Skip to content

Commit

Permalink
feat: add StreamingPullRequest.client_id field (via synth)
Browse files Browse the repository at this point in the history
Additionally, the copyright year is bumped to 2020 in some of the files.
  • Loading branch information
yoshi-automation committed Feb 5, 2020
1 parent b4ffb3f commit 199d56a
Show file tree
Hide file tree
Showing 14 changed files with 139 additions and 97 deletions.
2 changes: 1 addition & 1 deletion google/__init__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright 2019 Google LLC
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/__init__.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright 2019 Google LLC
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/pubsub.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright 2019 Google LLC
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
8 changes: 4 additions & 4 deletions google/cloud/pubsub_v1/gapic/publisher_client.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright 2019 Google LLC
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -51,10 +51,10 @@


# TODO: remove conditional import after Python 2 support is dropped
if six.PY3:
from collections.abc import Mapping
else:
if six.PY2:
from collections import Mapping
else:
from collections.abc import Mapping


def _merge_dict(d1, d2):
Expand Down
12 changes: 6 additions & 6 deletions google/cloud/pubsub_v1/gapic/subscriber_client.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright 2019 Google LLC
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -1307,11 +1307,11 @@ def create_snapshot(
>>> response = client.create_snapshot(name, subscription)
Args:
name (str): Optional user-provided name for this snapshot. If the name is not
provided in the request, the server will assign a random name for this
snapshot on the same project as the subscription. Note that for REST API
requests, you must specify a name. See the resource name rules. Format
is ``projects/{project}/snapshots/{snap}``.
name (str): User-provided name for this snapshot. If the name is not provided in the
request, the server will assign a random name for this snapshot on the
same project as the subscription. Note that for REST API requests, you
must specify a name. See the resource name rules. Format is
``projects/{project}/snapshots/{snap}``.
subscription (str): The subscription whose backlog the snapshot retains. Specifically, the
created snapshot is guaranteed to retain: (a) The existing backlog on
the subscription. More precisely, this is defined as the messages in the
Expand Down
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright 2019 Google LLC
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright 2019 Google LLC
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
34 changes: 22 additions & 12 deletions google/cloud/pubsub_v1/proto/pubsub.proto
Expand Up @@ -164,7 +164,8 @@ message PubsubMessage {
// at least one attribute.
bytes data = 1;

// Optional attributes for this message.
// Attributes for this message. If this field is empty, the message must
// contain non-empty data.
map<string, string> attributes = 2;

// ID of this message, assigned by the server when the message is published.
Expand All @@ -178,10 +179,12 @@ message PubsubMessage {
// publisher in a `Publish` call.
google.protobuf.Timestamp publish_time = 4;

// Identifies related messages for which publish order should be respected.
// If a `Subscription` has `enable_message_ordering` set to `true`, messages
// published with the same `ordering_key` value will be delivered to
// subscribers in the order in which they are received by the Pub/Sub system.
// If non-empty, identifies related messages for which publish order should be
// respected. If a `Subscription` has `enable_message_ordering` set to `true`,
// messages published with the same non-empty `ordering_key` value will be
// delivered to subscribers in the order in which they are received by the
// Pub/Sub system. All `PubsubMessage`s published in a given `PublishRequest`
// must specify the same `ordering_key` value.
// <b>EXPERIMENTAL:</b> This feature is part of a closed alpha release. This
// API might be changed in backward-incompatible ways and is not recommended
// for production use. It is not subject to any SLA or deprecation policy.
Expand Down Expand Up @@ -922,6 +925,14 @@ message StreamingPullRequest {
// requests from client to server. The minimum deadline you can specify is 10
// seconds. The maximum deadline you can specify is 600 seconds (10 minutes).
int32 stream_ack_deadline_seconds = 5;

// A unique identifier that is used to distinguish client instances from each
// other. Only needs to be provided on the initial request. When a stream
// disconnects and reconnects for the same stream, the client_id should be set
// to the same value so that state associated with the old stream can be
// transferred to the new stream. The same client_id should not be used for
// different client instances.
string client_id = 6;
}

// Response for the `StreamingPull` method. This response is used to stream
Expand All @@ -933,13 +944,12 @@ message StreamingPullResponse {

// Request for the `CreateSnapshot` method.
message CreateSnapshotRequest {
// Optional user-provided name for this snapshot.
// If the name is not provided in the request, the server will assign a random
// name for this snapshot on the same project as the subscription.
// Note that for REST API requests, you must specify a name. See the
// <a href="https://cloud.google.com/pubsub/docs/admin#resource_names">
// resource name rules</a>.
// Format is `projects/{project}/snapshots/{snap}`.
// User-provided name for this snapshot. If the name is not provided in the
// request, the server will assign a random name for this snapshot on the same
// project as the subscription. Note that for REST API requests, you must
// specify a name. See the <a
// href="https://cloud.google.com/pubsub/docs/admin#resource_names"> resource
// name rules</a>. Format is `projects/{project}/snapshots/{snap}`.
string name = 1;

// The subscription whose backlog the snapshot retains.
Expand Down
156 changes: 93 additions & 63 deletions google/cloud/pubsub_v1/proto/pubsub_pb2.py

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion noxfile.py
Expand Up @@ -72,6 +72,7 @@ def default(session):
session.run(
"py.test",
"--quiet",
"--cov=google.cloud.pubsub",
"--cov=google.cloud",
"--cov=tests.unit",
"--cov-append",
Expand Down Expand Up @@ -110,7 +111,7 @@ def system(session):
# Install all test dependencies, then install this package into the
# virtualenv's dist-packages.
session.install("mock", "pytest")
# session.install("-e", "../test_utils/")

session.install("-e", "test_utils")
session.install("-e", ".")

Expand Down
7 changes: 4 additions & 3 deletions synth.metadata
@@ -1,5 +1,5 @@
{
"updateTime": "2020-01-31T14:49:10.048857Z",
"updateTime": "2020-02-04T13:19:45.479344Z",
"sources": [
{
"generator": {
Expand All @@ -12,8 +12,9 @@
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
"sha": "7ac66d9be8a7d7de4f13566d8663978c9ee9dcd7",
"internalRef": "292450564"
"sha": "69d9945330a5721cd679f17331a78850e2618226",
"internalRef": "293080182",
"log": "69d9945330a5721cd679f17331a78850e2618226\nAdd file-level `Session` resource definition\n\nPiperOrigin-RevId: 293080182\n\nf6a1a6b417f39694275ca286110bc3c1ca4db0dc\nAdd file-level `Session` resource definition\n\nPiperOrigin-RevId: 293080178\n\n29d40b78e3dc1579b0b209463fbcb76e5767f72a\nExpose managedidentities/v1beta1/ API for client library usage.\n\nPiperOrigin-RevId: 292979741\n\na22129a1fb6e18056d576dfb7717aef74b63734a\nExpose managedidentities/v1/ API for client library usage.\n\nPiperOrigin-RevId: 292968186\n\nb5cbe4a4ba64ab19e6627573ff52057a1657773d\nSecurityCenter v1p1beta1: move file-level option on top to workaround protobuf.js bug.\n\nPiperOrigin-RevId: 292647187\n\nb224b317bf20c6a4fbc5030b4a969c3147f27ad3\nAdds API definitions for bigqueryreservation v1beta1.\n\nPiperOrigin-RevId: 292634722\n\nc1468702f9b17e20dd59007c0804a089b83197d2\nSynchronize new proto/yaml changes.\n\nPiperOrigin-RevId: 292626173\n\nffdfa4f55ab2f0afc11d0eb68f125ccbd5e404bd\nvision: v1p3beta1 publish annotations and retry config\n\nPiperOrigin-RevId: 292605599\n\n78f61482cd028fc1d9892aa5d89d768666a954cd\nvision: v1p1beta1 publish annotations and retry config\n\nPiperOrigin-RevId: 292605125\n\n60bb5a294a604fd1778c7ec87b265d13a7106171\nvision: v1p2beta1 publish annotations and retry config\n\nPiperOrigin-RevId: 292604980\n\n3bcf7aa79d45eb9ec29ab9036e9359ea325a7fc3\nvision: v1p4beta1 publish annotations and retry config\n\nPiperOrigin-RevId: 292604656\n\n2717b8a1c762b26911b45ecc2e4ee01d98401b28\nFix dataproc artman client library generation.\n\nPiperOrigin-RevId: 292555664\n\n"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion tests/system/gapic/v1/test_system_publisher_v1.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright 2019 Google LLC
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/gapic/v1/test_publisher_client_v1.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright 2019 Google LLC
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/gapic/v1/test_subscriber_client_v1.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
# Copyright 2019 Google LLC
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down

0 comments on commit 199d56a

Please sign in to comment.