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

Containeranalysis: Add 'options_' argument to clients' 'get_iam_policy'; pin black version (via synth). #8653

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
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
)
from google.cloud.devtools.containeranalysis_v1.proto import containeranalysis_pb2_grpc
from google.iam.v1 import iam_policy_pb2
from google.iam.v1 import options_pb2
from google.iam.v1 import policy_pb2


Expand Down Expand Up @@ -100,6 +101,15 @@ def note_path(cls, project, note):
"projects/{project}/notes/{note}", project=project, note=note
)

@classmethod
def occurrence_path(cls, project, occurrence):
"""Return a fully-qualified occurrence string."""
return google.api_core.path_template.expand(
"projects/{project}/occurrences/{occurrence}",
project=project,
occurrence=occurrence,
)

def __init__(
self,
transport=None,
Expand Down Expand Up @@ -316,6 +326,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 @@ -342,6 +353,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.devtools.containeranalysis_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.devtools.containeranalysis_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 @@ -372,7 +388,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
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@
from google.api_core.protobuf_helpers import get_messages

from google.iam.v1 import iam_policy_pb2
from google.iam.v1 import options_pb2
from google.iam.v1 import policy_pb2
from google.type import expr_pb2


_shared_modules = [iam_policy_pb2, policy_pb2, expr_pb2]
_shared_modules = [iam_policy_pb2, options_pb2, policy_pb2, expr_pb2]

_local_modules = []

Expand Down
6 changes: 3 additions & 3 deletions containeranalysis/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 containeranalysis/synth.metadata
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"updateTime": "2019-06-28T12:16:38.580811Z",
"updateTime": "2019-07-12T12:16:31.577436Z",
"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