Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pub/Sub: Add 'options_' argument to clients' 'get_iam_policy'; pin black version (via synth). #8657

Merged
merged 1 commit into from
Jul 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion pubsub/google/cloud/pubsub_v1/gapic/publisher_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
from google.cloud.pubsub_v1.proto import pubsub_pb2
from google.cloud.pubsub_v1.proto import pubsub_pb2_grpc
from google.iam.v1 import iam_policy_pb2
from google.iam.v1 import options_pb2
from google.iam.v1 import policy_pb2
from google.protobuf import empty_pb2
from google.protobuf import field_mask_pb2
Expand Down Expand Up @@ -935,6 +936,7 @@ def set_iam_policy(
def get_iam_policy(
self,
resource,
options_=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
Expand All @@ -956,6 +958,11 @@ def get_iam_policy(
Args:
resource (str): REQUIRED: The resource for which the policy is being requested.
See the operation documentation for the appropriate value for this field.
options_ (Union[dict, ~google.cloud.pubsub_v1.types.GetPolicyOptions]): OPTIONAL: A ``GetPolicyOptions`` object for specifying options to
``GetIamPolicy``. This field is only used by Cloud IAM.

If a dict is provided, it must be of the same form as the protobuf
message :class:`~google.cloud.pubsub_v1.types.GetPolicyOptions`
retry (Optional[google.api_core.retry.Retry]): A retry object used
to retry requests. If ``None`` is specified, requests will not
be retried.
Expand Down Expand Up @@ -986,7 +993,9 @@ def get_iam_policy(
client_info=self._client_info,
)

request = iam_policy_pb2.GetIamPolicyRequest(resource=resource)
request = iam_policy_pb2.GetIamPolicyRequest(
resource=resource, options=options_
)
if metadata is None:
metadata = []
metadata = list(metadata)
Expand Down
11 changes: 10 additions & 1 deletion pubsub/google/cloud/pubsub_v1/gapic/subscriber_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
from google.cloud.pubsub_v1.proto import pubsub_pb2
from google.cloud.pubsub_v1.proto import pubsub_pb2_grpc
from google.iam.v1 import iam_policy_pb2
from google.iam.v1 import options_pb2
from google.iam.v1 import policy_pb2
from google.protobuf import duration_pb2
from google.protobuf import empty_pb2
Expand Down Expand Up @@ -1702,6 +1703,7 @@ def set_iam_policy(
def get_iam_policy(
self,
resource,
options_=None,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
Expand All @@ -1723,6 +1725,11 @@ def get_iam_policy(
Args:
resource (str): REQUIRED: The resource for which the policy is being requested.
See the operation documentation for the appropriate value for this field.
options_ (Union[dict, ~google.cloud.pubsub_v1.types.GetPolicyOptions]): OPTIONAL: A ``GetPolicyOptions`` object for specifying options to
``GetIamPolicy``. This field is only used by Cloud IAM.

If a dict is provided, it must be of the same form as the protobuf
message :class:`~google.cloud.pubsub_v1.types.GetPolicyOptions`
retry (Optional[google.api_core.retry.Retry]): A retry object used
to retry requests. If ``None`` is specified, requests will not
be retried.
Expand Down Expand Up @@ -1753,7 +1760,9 @@ def get_iam_policy(
client_info=self._client_info,
)

request = iam_policy_pb2.GetIamPolicyRequest(resource=resource)
request = iam_policy_pb2.GetIamPolicyRequest(
resource=resource, options=options_
)
if metadata is None:
metadata = []
metadata = list(metadata)
Expand Down
6 changes: 3 additions & 3 deletions pubsub/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@


LOCAL_DEPS = (os.path.join("..", "api_core"), os.path.join("..", "core"))

BLACK_VERSION = "black==19.3b0"
BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"]

if os.path.exists("samples"):
Expand All @@ -38,7 +38,7 @@ def lint(session):
Returns a failure if the linters find linting errors or sufficiently
serious code quality issues.
"""
session.install("flake8", "black", *LOCAL_DEPS)
session.install("flake8", BLACK_VERSION, *LOCAL_DEPS)
session.run("black", "--check", *BLACK_PATHS)
session.run("flake8", "google", "tests")

Expand All @@ -53,7 +53,7 @@ def blacken(session):
That run uses an image that doesn't have 3.6 installed. Before updating this
check the state of the `gcp_ubuntu_config` we use for that Kokoro run.
"""
session.install("black")
session.install(BLACK_VERSION)
session.run("black", *BLACK_PATHS)


Expand Down
10 changes: 5 additions & 5 deletions pubsub/synth.metadata
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"updateTime": "2019-06-28T12:30:21.076185Z",
"updateTime": "2019-07-12T12:30:16.225921Z",
"sources": [
{
"generator": {
"name": "artman",
"version": "0.29.2",
"dockerImage": "googleapis/artman@sha256:45263333b058a4b3c26a8b7680a2710f43eae3d250f791a6cb66423991dcb2df"
"version": "0.29.4",
"dockerImage": "googleapis/artman@sha256:63f21e83cb92680b7001dc381069e962c9e6dee314fd8365ac554c07c89221fb"
}
},
{
"git": {
"name": "googleapis",
"remote": "https://github.com/googleapis/googleapis.git",
"sha": "84c8ad4e52f8eec8f08a60636cfa597b86969b5c",
"internalRef": "255474859"
"sha": "47bd0c2ba33c28dd624a65dad382e02bb61d1618",
"internalRef": "257690259"
}
},
{
Expand Down