Skip to content

Commit

Permalink
feat(pubsub): update the API
Browse files Browse the repository at this point in the history
#### pubsub:v1
The following keys were added:
- resources.projects.resources.subscriptions.methods.detach.description
- resources.projects.resources.subscriptions.methods.detach.flatPath
- resources.projects.resources.subscriptions.methods.detach.httpMethod
- resources.projects.resources.subscriptions.methods.detach.id
- resources.projects.resources.subscriptions.methods.detach.parameterOrder
- resources.projects.resources.subscriptions.methods.detach.parameters.subscription.description
- resources.projects.resources.subscriptions.methods.detach.parameters.subscription.location
- resources.projects.resources.subscriptions.methods.detach.parameters.subscription.pattern
- resources.projects.resources.subscriptions.methods.detach.parameters.subscription.required
- resources.projects.resources.subscriptions.methods.detach.parameters.subscription.type
- resources.projects.resources.subscriptions.methods.detach.path
- resources.projects.resources.subscriptions.methods.detach.response.$ref
- resources.projects.resources.subscriptions.methods.detach.scopes
- schemas.DetachSubscriptionResponse.description
- schemas.DetachSubscriptionResponse.id
- schemas.DetachSubscriptionResponse.type

The following keys were changed:
- resources.projects.resources.topics.resources.subscriptions.methods.list.description
- schemas.ListTopicSubscriptionsResponse.properties.subscriptions.description
  • Loading branch information
yoshi-automation authored and JustinBeckwith committed Jun 5, 2020
1 parent 8a3fbc3 commit 42a8ee5
Show file tree
Hide file tree
Showing 2 changed files with 188 additions and 5 deletions.
38 changes: 35 additions & 3 deletions discovery/pubsub-v1.json
Expand Up @@ -436,6 +436,32 @@
"https://www.googleapis.com/auth/pubsub"
]
},
"detach": {
"description": "Detaches a subscription from this topic. All messages retained in the\nsubscription are dropped. Subsequent `Pull` and `StreamingPull` requests\nwill return FAILED_PRECONDITION. If the subscription is a push\nsubscription, pushes to the endpoint will stop.",
"flatPath": "v1/projects/{projectsId}/subscriptions/{subscriptionsId}:detach",
"httpMethod": "POST",
"id": "pubsub.projects.subscriptions.detach",
"parameterOrder": [
"subscription"
],
"parameters": {
"subscription": {
"description": "Required. The subscription to detach.\nFormat is `projects/{project}/subscriptions/{subscription}`.",
"location": "path",
"pattern": "^projects/[^/]+/subscriptions/[^/]+$",
"required": true,
"type": "string"
}
},
"path": "v1/{+subscription}:detach",
"response": {
"$ref": "DetachSubscriptionResponse"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform",
"https://www.googleapis.com/auth/pubsub"
]
},
"get": {
"description": "Gets the configuration details of a subscription.",
"flatPath": "v1/projects/{projectsId}/subscriptions/{subscriptionsId}",
Expand Down Expand Up @@ -1050,7 +1076,7 @@
"subscriptions": {
"methods": {
"list": {
"description": "Lists the names of the subscriptions on this topic.",
"description": "Lists the names of the attached subscriptions on this topic.",
"flatPath": "v1/projects/{projectsId}/topics/{topicsId}/subscriptions",
"httpMethod": "GET",
"id": "pubsub.projects.topics.subscriptions.list",
Expand Down Expand Up @@ -1093,7 +1119,7 @@
}
}
},
"revision": "20200505",
"revision": "20200525",
"rootUrl": "https://pubsub.googleapis.com/",
"schemas": {
"AcknowledgeRequest": {
Expand Down Expand Up @@ -1166,6 +1192,12 @@
},
"type": "object"
},
"DetachSubscriptionResponse": {
"description": "Response for the DetachSubscription method.\nReserved for future use.",
"id": "DetachSubscriptionResponse",
"properties": {},
"type": "object"
},
"Empty": {
"description": "A generic empty message that you can re-use to avoid defining duplicated\nempty messages in your APIs. A typical example is to use it as the request\nor the response type of an API method. For instance:\n\n service Foo {\n rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);\n }\n\nThe JSON representation for `Empty` is empty JSON object `{}`.",
"id": "Empty",
Expand Down Expand Up @@ -1270,7 +1302,7 @@
"type": "string"
},
"subscriptions": {
"description": "The names of the subscriptions that match the request.",
"description": "The names of subscriptions attached to the topic specified in the request.",
"items": {
"type": "string"
},
Expand Down
155 changes: 153 additions & 2 deletions src/apis/pubsub/v1.ts
Expand Up @@ -179,6 +179,10 @@ export namespace pubsub_v1 {
*/
maxDeliveryAttempts?: number | null;
}
/**
* Response for the DetachSubscription method. Reserved for future use.
*/
export interface Schema$DetachSubscriptionResponse {}
/**
* 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 `{}`.
*/
Expand Down Expand Up @@ -274,7 +278,7 @@ export namespace pubsub_v1 {
*/
nextPageToken?: string | null;
/**
* The names of the subscriptions that match the request.
* The names of subscriptions attached to the topic specified in the request.
*/
subscriptions?: string[] | null;
}
Expand Down Expand Up @@ -2310,6 +2314,146 @@ export namespace pubsub_v1 {
}
}

/**
* pubsub.projects.subscriptions.detach
* @desc Detaches a subscription from this topic. All messages retained in the subscription are dropped. Subsequent `Pull` and `StreamingPull` requests will return FAILED_PRECONDITION. If the subscription is a push subscription, pushes to the endpoint will stop.
* @example
* // Before running the sample:
* // - Enable the API at:
* // https://console.developers.google.com/apis/api/pubsub.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 pubsub = google.pubsub('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',
* 'https://www.googleapis.com/auth/pubsub',
* ],
* });
*
* // 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 pubsub.projects.subscriptions.detach({
* // Required. The subscription to detach.
* // Format is `projects/{project}/subscriptions/{subscription}`.
* subscription: 'projects/my-project/subscriptions/my-subscription',
* });
* console.log(res.data);
*
* // Example response
* // {}
* }
*
* main().catch(e => {
* console.error(e);
* throw e;
* });
*
* @alias pubsub.projects.subscriptions.detach
* @memberOf! ()
*
* @param {object} params Parameters for request
* @param {string} params.subscription Required. The subscription to detach. Format is `projects/{project}/subscriptions/{subscription}`.
* @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
*/
detach(
params: Params$Resource$Projects$Subscriptions$Detach,
options: StreamMethodOptions
): GaxiosPromise<Readable>;
detach(
params?: Params$Resource$Projects$Subscriptions$Detach,
options?: MethodOptions
): GaxiosPromise<Schema$DetachSubscriptionResponse>;
detach(
params: Params$Resource$Projects$Subscriptions$Detach,
options: StreamMethodOptions | BodyResponseCallback<Readable>,
callback: BodyResponseCallback<Readable>
): void;
detach(
params: Params$Resource$Projects$Subscriptions$Detach,
options:
| MethodOptions
| BodyResponseCallback<Schema$DetachSubscriptionResponse>,
callback: BodyResponseCallback<Schema$DetachSubscriptionResponse>
): void;
detach(
params: Params$Resource$Projects$Subscriptions$Detach,
callback: BodyResponseCallback<Schema$DetachSubscriptionResponse>
): void;
detach(
callback: BodyResponseCallback<Schema$DetachSubscriptionResponse>
): void;
detach(
paramsOrCallback?:
| Params$Resource$Projects$Subscriptions$Detach
| BodyResponseCallback<Schema$DetachSubscriptionResponse>
| BodyResponseCallback<Readable>,
optionsOrCallback?:
| MethodOptions
| StreamMethodOptions
| BodyResponseCallback<Schema$DetachSubscriptionResponse>
| BodyResponseCallback<Readable>,
callback?:
| BodyResponseCallback<Schema$DetachSubscriptionResponse>
| BodyResponseCallback<Readable>
):
| void
| GaxiosPromise<Schema$DetachSubscriptionResponse>
| GaxiosPromise<Readable> {
let params = (paramsOrCallback ||
{}) as Params$Resource$Projects$Subscriptions$Detach;
let options = (optionsOrCallback || {}) as MethodOptions;

if (typeof paramsOrCallback === 'function') {
callback = paramsOrCallback;
params = {} as Params$Resource$Projects$Subscriptions$Detach;
options = {};
}

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

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

/**
* pubsub.projects.subscriptions.get
* @desc Gets the configuration details of a subscription.
Expand Down Expand Up @@ -3812,6 +3956,13 @@ export namespace pubsub_v1 {
*/
subscription?: string;
}
export interface Params$Resource$Projects$Subscriptions$Detach
extends StandardParameters {
/**
* Required. The subscription to detach. Format is `projects/{project}/subscriptions/{subscription}`.
*/
subscription?: string;
}
export interface Params$Resource$Projects$Subscriptions$Get
extends StandardParameters {
/**
Expand Down Expand Up @@ -5530,7 +5681,7 @@ export namespace pubsub_v1 {

/**
* pubsub.projects.topics.subscriptions.list
* @desc Lists the names of the subscriptions on this topic.
* @desc Lists the names of the attached subscriptions on this topic.
* @example
* // Before running the sample:
* // - Enable the API at:
Expand Down

0 comments on commit 42a8ee5

Please sign in to comment.