Skip to content

Commit

Permalink
feat(run): update the API
Browse files Browse the repository at this point in the history
#### run:v1

The following keys were added:
- resources.operations.methods.cancel.description
- resources.operations.methods.cancel.flatPath
- resources.operations.methods.cancel.httpMethod
- resources.operations.methods.cancel.id
- resources.operations.methods.cancel.parameterOrder
- resources.operations.methods.cancel.parameters.name.description
- resources.operations.methods.cancel.parameters.name.location
- resources.operations.methods.cancel.parameters.name.pattern
- resources.operations.methods.cancel.parameters.name.required
- resources.operations.methods.cancel.parameters.name.type
- resources.operations.methods.cancel.path
- resources.operations.methods.cancel.request.$ref
- resources.operations.methods.cancel.response.$ref
- resources.operations.methods.cancel.scopes
- schemas.Empty.description
- schemas.Empty.id
- schemas.Empty.type
- schemas.GoogleLongrunningCancelOperationRequest.description
- schemas.GoogleLongrunningCancelOperationRequest.id
- schemas.GoogleLongrunningCancelOperationRequest.type
  • Loading branch information
yoshi-automation authored and bcoe committed Nov 8, 2021
1 parent 5f7627c commit 5c103ff
Show file tree
Hide file tree
Showing 2 changed files with 205 additions and 1 deletion.
46 changes: 45 additions & 1 deletion discovery/run-v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,38 @@
}
}
},
"operations": {
"methods": {
"cancel": {
"description": "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`.",
"flatPath": "v1/operations/{operationsId}:cancel",
"httpMethod": "POST",
"id": "run.operations.cancel",
"parameterOrder": [
"name"
],
"parameters": {
"name": {
"description": "The name of the operation resource to be cancelled.",
"location": "path",
"pattern": "^operations/.*$",
"required": true,
"type": "string"
}
},
"path": "v1/{+name}:cancel",
"request": {
"$ref": "GoogleLongrunningCancelOperationRequest"
},
"response": {
"$ref": "Empty"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform"
]
}
}
},
"projects": {
"resources": {
"authorizeddomains": {
Expand Down Expand Up @@ -1736,7 +1768,7 @@
}
}
},
"revision": "20211015",
"revision": "20211029",
"rootUrl": "https://run.googleapis.com/",
"schemas": {
"Addressable": {
Expand Down Expand Up @@ -2170,6 +2202,12 @@
},
"type": "object"
},
"Empty": {
"description": "A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } The JSON representation for `Empty` is empty JSON object `{}`.",
"id": "Empty",
"properties": {},
"type": "object"
},
"EnvFromSource": {
"description": "Not supported by Cloud Run EnvFromSource represents the source of a set of ConfigMaps",
"id": "EnvFromSource",
Expand Down Expand Up @@ -2292,6 +2330,12 @@
},
"type": "object"
},
"GoogleLongrunningCancelOperationRequest": {
"description": "The request message for Operations.CancelOperation.",
"id": "GoogleLongrunningCancelOperationRequest",
"properties": {},
"type": "object"
},
"HTTPGetAction": {
"description": "Not supported by Cloud Run HTTPGetAction describes an action based on HTTP Get requests.",
"id": "HTTPGetAction",
Expand Down
160 changes: 160 additions & 0 deletions src/apis/run/v1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ export namespace run_v1 {
export class Run {
context: APIRequestContext;
namespaces: Resource$Namespaces;
operations: Resource$Operations;
projects: Resource$Projects;

constructor(options: GlobalOptions, google?: GoogleConfigurable) {
Expand All @@ -123,6 +124,7 @@ export namespace run_v1 {
};

this.namespaces = new Resource$Namespaces(this.context);
this.operations = new Resource$Operations(this.context);
this.projects = new Resource$Projects(this.context);
}
}
Expand Down Expand Up @@ -457,6 +459,10 @@ export namespace run_v1 {
*/
url?: string | null;
}
/**
* A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); \} The JSON representation for `Empty` is empty JSON object `{\}`.
*/
export interface Schema$Empty {}
/**
* Not supported by Cloud Run EnvFromSource represents the source of a set of ConfigMaps
*/
Expand Down Expand Up @@ -563,6 +569,10 @@ export namespace run_v1 {
*/
type?: string | null;
}
/**
* The request message for Operations.CancelOperation.
*/
export interface Schema$GoogleLongrunningCancelOperationRequest {}
/**
* Not supported by Cloud Run HTTPGetAction describes an action based on HTTP Get requests.
*/
Expand Down Expand Up @@ -4307,6 +4317,156 @@ export namespace run_v1 {
requestBody?: Schema$Service;
}

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

/**
* 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
* ```js
* // Before running the sample:
* // - Enable the API at:
* // https://console.developers.google.com/apis/api/run.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 run = google.run('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 run.operations.cancel({
* // The name of the operation resource to be cancelled.
* name: 'operations/.*',
*
* // Request body metadata
* requestBody: {
* // request body parameters
* // {}
* },
* });
* console.log(res.data);
*
* // Example response
* // {}
* }
*
* main().catch(e => {
* console.error(e);
* throw e;
* });
*
* ```
*
* @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.
*/
cancel(
params: Params$Resource$Operations$Cancel,
options: StreamMethodOptions
): GaxiosPromise<Readable>;
cancel(
params?: Params$Resource$Operations$Cancel,
options?: MethodOptions
): GaxiosPromise<Schema$Empty>;
cancel(
params: Params$Resource$Operations$Cancel,
options: StreamMethodOptions | BodyResponseCallback<Readable>,
callback: BodyResponseCallback<Readable>
): void;
cancel(
params: Params$Resource$Operations$Cancel,
options: MethodOptions | BodyResponseCallback<Schema$Empty>,
callback: BodyResponseCallback<Schema$Empty>
): void;
cancel(
params: Params$Resource$Operations$Cancel,
callback: BodyResponseCallback<Schema$Empty>
): void;
cancel(callback: BodyResponseCallback<Schema$Empty>): void;
cancel(
paramsOrCallback?:
| Params$Resource$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$Operations$Cancel;
let options = (optionsOrCallback || {}) as MethodOptions;

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

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

const rootUrl = options.rootUrl || 'https://run.googleapis.com/';
const parameters = {
options: Object.assign(
{
url: (rootUrl + '/v1/{+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<unknown>
);
} else {
return createAPIRequest<Schema$Empty>(parameters);
}
}
}

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

/**
* Request body metadata
*/
requestBody?: Schema$GoogleLongrunningCancelOperationRequest;
}

export class Resource$Projects {
context: APIRequestContext;
authorizeddomains: Resource$Projects$Authorizeddomains;
Expand Down

0 comments on commit 5c103ff

Please sign in to comment.