Skip to content
This repository was archived by the owner on Dec 31, 2023. It is now read-only.

Commit dfb21df

Browse files
chore: use gapic-generator-python 0.65.1 (#277)
- [ ] Regenerate this pull request now. PiperOrigin-RevId: 441524537 Source-Link: googleapis/googleapis@2a27391 Source-Link: https://github.com/googleapis/googleapis-gen/commit/ab6756a48c89b5bcb9fb73443cb8e55d574f4643 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWI2NzU2YTQ4Yzg5YjViY2I5ZmI3MzQ0M2NiOGU1NWQ1NzRmNDY0MyJ9 feat: AuditConfig for IAM v1 fix(deps): require grpc-google-iam-v1 >=0.12.4
1 parent 9a80259 commit dfb21df

15 files changed

+592
-194
lines changed

google/cloud/devtools/containeranalysis_v1/services/container_analysis/async_client.py

Lines changed: 57 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from collections import OrderedDict
1717
import functools
1818
import re
19-
from typing import Dict, Optional, Sequence, Tuple, Type, Union
19+
from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union
2020
import pkg_resources
2121

2222
from google.api_core.client_options import ClientOptions
@@ -253,17 +253,17 @@ async def set_iam_policy(
253253
``projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`` for
254254
occurrences.
255255
256-
257256
.. code-block:: python
258257
259258
from google.cloud.devtools import containeranalysis_v1
259+
from google.iam.v1 import iam_policy_pb2 # type: ignore
260260
261261
def sample_set_iam_policy():
262262
# Create a client
263263
client = containeranalysis_v1.ContainerAnalysisClient()
264264
265265
# Initialize request argument(s)
266-
request = containeranalysis_v1.SetIamPolicyRequest(
266+
request = iam_policy_pb2.SetIamPolicyRequest(
267267
resource="resource_value",
268268
)
269269
@@ -294,21 +294,26 @@ def sample_set_iam_policy():
294294
295295
Returns:
296296
google.iam.v1.policy_pb2.Policy:
297-
Defines an Identity and Access Management (IAM) policy. It is used to
298-
specify access control policies for Cloud Platform
299-
resources.
297+
An Identity and Access Management (IAM) policy, which specifies access
298+
controls for Google Cloud resources.
300299
301300
A Policy is a collection of bindings. A binding binds
302-
one or more members to a single role. Members can be
303-
user accounts, service accounts, Google groups, and
304-
domains (such as G Suite). A role is a named list of
305-
permissions (defined by IAM or configured by users).
306-
A binding can optionally specify a condition, which
307-
is a logic expression that further constrains the
308-
role binding based on attributes about the request
309-
and/or target resource.
310-
311-
**JSON Example**
301+
one or more members, or principals, to a single role.
302+
Principals can be user accounts, service accounts,
303+
Google groups, and domains (such as G Suite). A role
304+
is a named list of permissions; each role can be an
305+
IAM predefined role or a user-created custom role.
306+
307+
For some types of Google Cloud resources, a binding
308+
can also specify a condition, which is a logical
309+
expression that allows access to a resource only if
310+
the expression evaluates to true. A condition can add
311+
constraints based on attributes of the request, the
312+
resource, or both. To learn which resources support
313+
conditions in their IAM policies, see the [IAM
314+
documentation](\ https://cloud.google.com/iam/help/conditions/resource-policies).
315+
316+
**JSON example:**
312317
313318
{
314319
"bindings": [
@@ -323,17 +328,17 @@ def sample_set_iam_policy():
323328
324329
}, { "role":
325330
"roles/resourcemanager.organizationViewer",
326-
"members": ["user:[email protected]"],
331+
"members": [ "user:[email protected]" ],
327332
"condition": { "title": "expirable access",
328333
"description": "Does not grant access after
329334
Sep 2020", "expression": "request.time <
330335
timestamp('2020-10-01T00:00:00.000Z')", } }
331336
332-
]
337+
], "etag": "BwWWja0YfJA=", "version": 3
333338
334339
}
335340
336-
**YAML Example**
341+
**YAML example:**
337342
338343
bindings: - members: - user:\ [email protected] -
339344
group:\ [email protected] - domain:google.com -
@@ -344,11 +349,12 @@ def sample_set_iam_policy():
344349
condition: title: expirable access description:
345350
Does not grant access after Sep 2020 expression:
346351
request.time <
347-
timestamp('2020-10-01T00:00:00.000Z')
352+
timestamp('2020-10-01T00:00:00.000Z') etag:
353+
BwWWja0YfJA= version: 3
348354
349355
For a description of IAM and its features, see the
350-
[IAM developer's
351-
guide](\ https://cloud.google.com/iam/docs).
356+
[IAM
357+
documentation](\ https://cloud.google.com/iam/docs/).
352358
353359
"""
354360
# Create or coerce a protobuf request object.
@@ -414,17 +420,17 @@ async def get_iam_policy(
414420
``projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`` for
415421
occurrences.
416422
417-
418423
.. code-block:: python
419424
420425
from google.cloud.devtools import containeranalysis_v1
426+
from google.iam.v1 import iam_policy_pb2 # type: ignore
421427
422428
def sample_get_iam_policy():
423429
# Create a client
424430
client = containeranalysis_v1.ContainerAnalysisClient()
425431
426432
# Initialize request argument(s)
427-
request = containeranalysis_v1.GetIamPolicyRequest(
433+
request = iam_policy_pb2.GetIamPolicyRequest(
428434
resource="resource_value",
429435
)
430436
@@ -455,21 +461,26 @@ def sample_get_iam_policy():
455461
456462
Returns:
457463
google.iam.v1.policy_pb2.Policy:
458-
Defines an Identity and Access Management (IAM) policy. It is used to
459-
specify access control policies for Cloud Platform
460-
resources.
464+
An Identity and Access Management (IAM) policy, which specifies access
465+
controls for Google Cloud resources.
461466
462467
A Policy is a collection of bindings. A binding binds
463-
one or more members to a single role. Members can be
464-
user accounts, service accounts, Google groups, and
465-
domains (such as G Suite). A role is a named list of
466-
permissions (defined by IAM or configured by users).
467-
A binding can optionally specify a condition, which
468-
is a logic expression that further constrains the
469-
role binding based on attributes about the request
470-
and/or target resource.
471-
472-
**JSON Example**
468+
one or more members, or principals, to a single role.
469+
Principals can be user accounts, service accounts,
470+
Google groups, and domains (such as G Suite). A role
471+
is a named list of permissions; each role can be an
472+
IAM predefined role or a user-created custom role.
473+
474+
For some types of Google Cloud resources, a binding
475+
can also specify a condition, which is a logical
476+
expression that allows access to a resource only if
477+
the expression evaluates to true. A condition can add
478+
constraints based on attributes of the request, the
479+
resource, or both. To learn which resources support
480+
conditions in their IAM policies, see the [IAM
481+
documentation](\ https://cloud.google.com/iam/help/conditions/resource-policies).
482+
483+
**JSON example:**
473484
474485
{
475486
"bindings": [
@@ -484,17 +495,17 @@ def sample_get_iam_policy():
484495
485496
}, { "role":
486497
"roles/resourcemanager.organizationViewer",
487-
"members": ["user:[email protected]"],
498+
"members": [ "user:[email protected]" ],
488499
"condition": { "title": "expirable access",
489500
"description": "Does not grant access after
490501
Sep 2020", "expression": "request.time <
491502
timestamp('2020-10-01T00:00:00.000Z')", } }
492503
493-
]
504+
], "etag": "BwWWja0YfJA=", "version": 3
494505
495506
}
496507
497-
**YAML Example**
508+
**YAML example:**
498509
499510
bindings: - members: - user:\ [email protected] -
500511
group:\ [email protected] - domain:google.com -
@@ -505,11 +516,12 @@ def sample_get_iam_policy():
505516
condition: title: expirable access description:
506517
Does not grant access after Sep 2020 expression:
507518
request.time <
508-
timestamp('2020-10-01T00:00:00.000Z')
519+
timestamp('2020-10-01T00:00:00.000Z') etag:
520+
BwWWja0YfJA= version: 3
509521
510522
For a description of IAM and its features, see the
511-
[IAM developer's
512-
guide](\ https://cloud.google.com/iam/docs).
523+
[IAM
524+
documentation](\ https://cloud.google.com/iam/docs/).
513525
514526
"""
515527
# Create or coerce a protobuf request object.
@@ -575,17 +587,17 @@ async def test_iam_permissions(
575587
``projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`` for
576588
occurrences.
577589
578-
579590
.. code-block:: python
580591
581592
from google.cloud.devtools import containeranalysis_v1
593+
from google.iam.v1 import iam_policy_pb2 # type: ignore
582594
583595
def sample_test_iam_permissions():
584596
# Create a client
585597
client = containeranalysis_v1.ContainerAnalysisClient()
586598
587599
# Initialize request argument(s)
588-
request = containeranalysis_v1.TestIamPermissionsRequest(
600+
request = iam_policy_pb2.TestIamPermissionsRequest(
589601
resource="resource_value",
590602
permissions=['permissions_value_1', 'permissions_value_2'],
591603
)
@@ -688,7 +700,6 @@ async def get_vulnerability_occurrences_summary(
688700
r"""Gets a summary of the number and severity of
689701
occurrences.
690702
691-
692703
.. code-block:: python
693704
694705
from google.cloud.devtools import containeranalysis_v1

0 commit comments

Comments
 (0)