19
19
from typing import Dict , Sequence , Tuple , Type , Union
20
20
import pkg_resources
21
21
22
- import google .api_core .client_options as ClientOptions # type: ignore
22
+ from google .api_core .client_options import ClientOptions # type: ignore
23
23
from google .api_core import exceptions as core_exceptions # type: ignore
24
24
from google .api_core import gapic_v1 # type: ignore
25
25
from google .api_core import retry as retries # type: ignore
26
26
from google .auth import credentials as ga_credentials # type: ignore
27
27
from google .oauth2 import service_account # type: ignore
28
28
29
+ OptionalRetry = Union [retries .Retry , object ]
30
+
29
31
from google .cloud .orgpolicy_v2 .services .org_policy import pagers
30
32
from google .cloud .orgpolicy_v2 .types import constraint
31
33
from google .cloud .orgpolicy_v2 .types import orgpolicy
@@ -182,18 +184,18 @@ def __init__(
182
184
183
185
async def list_constraints (
184
186
self ,
185
- request : orgpolicy .ListConstraintsRequest = None ,
187
+ request : Union [ orgpolicy .ListConstraintsRequest , dict ] = None ,
186
188
* ,
187
189
parent : str = None ,
188
- retry : retries . Retry = gapic_v1 .method .DEFAULT ,
190
+ retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
189
191
timeout : float = None ,
190
192
metadata : Sequence [Tuple [str , str ]] = (),
191
193
) -> pagers .ListConstraintsAsyncPager :
192
194
r"""Lists ``Constraints`` that could be applied on the specified
193
195
resource.
194
196
195
197
Args:
196
- request (:class:` google.cloud.orgpolicy_v2.types.ListConstraintsRequest` ):
198
+ request (Union[ google.cloud.orgpolicy_v2.types.ListConstraintsRequest, dict] ):
197
199
The request object. The request sent to the
198
200
[ListConstraints]
199
201
[google.cloud.orgpolicy.v2.OrgPolicy.ListConstraints]
@@ -281,18 +283,18 @@ async def list_constraints(
281
283
282
284
async def list_policies (
283
285
self ,
284
- request : orgpolicy .ListPoliciesRequest = None ,
286
+ request : Union [ orgpolicy .ListPoliciesRequest , dict ] = None ,
285
287
* ,
286
288
parent : str = None ,
287
- retry : retries . Retry = gapic_v1 .method .DEFAULT ,
289
+ retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
288
290
timeout : float = None ,
289
291
metadata : Sequence [Tuple [str , str ]] = (),
290
292
) -> pagers .ListPoliciesAsyncPager :
291
293
r"""Retrieves all of the ``Policies`` that exist on a particular
292
294
resource.
293
295
294
296
Args:
295
- request (:class:` google.cloud.orgpolicy_v2.types.ListPoliciesRequest` ):
297
+ request (Union[ google.cloud.orgpolicy_v2.types.ListPoliciesRequest, dict] ):
296
298
The request object. The request sent to the
297
299
[ListPolicies]
298
300
[google.cloud.orgpolicy.v2.OrgPolicy.ListPolicies]
@@ -382,10 +384,10 @@ async def list_policies(
382
384
383
385
async def get_policy (
384
386
self ,
385
- request : orgpolicy .GetPolicyRequest = None ,
387
+ request : Union [ orgpolicy .GetPolicyRequest , dict ] = None ,
386
388
* ,
387
389
name : str = None ,
388
- retry : retries . Retry = gapic_v1 .method .DEFAULT ,
390
+ retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
389
391
timeout : float = None ,
390
392
metadata : Sequence [Tuple [str , str ]] = (),
391
393
) -> orgpolicy .Policy :
@@ -396,7 +398,7 @@ async def get_policy(
396
398
a ``Policy`` during read-modify-write.
397
399
398
400
Args:
399
- request (:class:` google.cloud.orgpolicy_v2.types.GetPolicyRequest` ):
401
+ request (Union[ google.cloud.orgpolicy_v2.types.GetPolicyRequest, dict] ):
400
402
The request object. The request sent to the [GetPolicy]
401
403
[google.cloud.orgpolicy.v2.OrgPolicy.GetPolicy] method.
402
404
name (:class:`str`):
@@ -467,10 +469,10 @@ async def get_policy(
467
469
468
470
async def get_effective_policy (
469
471
self ,
470
- request : orgpolicy .GetEffectivePolicyRequest = None ,
472
+ request : Union [ orgpolicy .GetEffectivePolicyRequest , dict ] = None ,
471
473
* ,
472
474
name : str = None ,
473
- retry : retries . Retry = gapic_v1 .method .DEFAULT ,
475
+ retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
474
476
timeout : float = None ,
475
477
metadata : Sequence [Tuple [str , str ]] = (),
476
478
) -> orgpolicy .Policy :
@@ -482,7 +484,7 @@ async def get_effective_policy(
482
484
hierarchy with 'under:' prefix will not be expanded.
483
485
484
486
Args:
485
- request (:class:` google.cloud.orgpolicy_v2.types.GetEffectivePolicyRequest` ):
487
+ request (Union[ google.cloud.orgpolicy_v2.types.GetEffectivePolicyRequest, dict] ):
486
488
The request object. The request sent to the
487
489
[GetEffectivePolicy]
488
490
[google.cloud.orgpolicy.v2.OrgPolicy.GetEffectivePolicy]
@@ -555,11 +557,11 @@ async def get_effective_policy(
555
557
556
558
async def create_policy (
557
559
self ,
558
- request : orgpolicy .CreatePolicyRequest = None ,
560
+ request : Union [ orgpolicy .CreatePolicyRequest , dict ] = None ,
559
561
* ,
560
562
parent : str = None ,
561
563
policy : orgpolicy .Policy = None ,
562
- retry : retries . Retry = gapic_v1 .method .DEFAULT ,
564
+ retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
563
565
timeout : float = None ,
564
566
metadata : Sequence [Tuple [str , str ]] = (),
565
567
) -> orgpolicy .Policy :
@@ -572,7 +574,7 @@ async def create_policy(
572
574
on the given Cloud resource.
573
575
574
576
Args:
575
- request (:class:` google.cloud.orgpolicy_v2.types.CreatePolicyRequest` ):
577
+ request (Union[ google.cloud.orgpolicy_v2.types.CreatePolicyRequest, dict] ):
576
578
The request object. The request sent to the
577
579
[CreatePolicyRequest]
578
580
[google.cloud.orgpolicy.v2.OrgPolicy.CreatePolicy]
@@ -657,10 +659,10 @@ async def create_policy(
657
659
658
660
async def update_policy (
659
661
self ,
660
- request : orgpolicy .UpdatePolicyRequest = None ,
662
+ request : Union [ orgpolicy .UpdatePolicyRequest , dict ] = None ,
661
663
* ,
662
664
policy : orgpolicy .Policy = None ,
663
- retry : retries . Retry = gapic_v1 .method .DEFAULT ,
665
+ retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
664
666
timeout : float = None ,
665
667
metadata : Sequence [Tuple [str , str ]] = (),
666
668
) -> orgpolicy .Policy :
@@ -676,7 +678,7 @@ async def update_policy(
676
678
fields.
677
679
678
680
Args:
679
- request (:class:` google.cloud.orgpolicy_v2.types.UpdatePolicyRequest` ):
681
+ request (Union[ google.cloud.orgpolicy_v2.types.UpdatePolicyRequest, dict] ):
680
682
The request object. The request sent to the
681
683
[UpdatePolicyRequest]
682
684
[google.cloud.orgpolicy.v2.OrgPolicy.UpdatePolicy]
@@ -749,10 +751,10 @@ async def update_policy(
749
751
750
752
async def delete_policy (
751
753
self ,
752
- request : orgpolicy .DeletePolicyRequest = None ,
754
+ request : Union [ orgpolicy .DeletePolicyRequest , dict ] = None ,
753
755
* ,
754
756
name : str = None ,
755
- retry : retries . Retry = gapic_v1 .method .DEFAULT ,
757
+ retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
756
758
timeout : float = None ,
757
759
metadata : Sequence [Tuple [str , str ]] = (),
758
760
) -> None :
@@ -763,7 +765,7 @@ async def delete_policy(
763
765
does not exist.
764
766
765
767
Args:
766
- request (:class:` google.cloud.orgpolicy_v2.types.DeletePolicyRequest` ):
768
+ request (Union[ google.cloud.orgpolicy_v2.types.DeletePolicyRequest, dict] ):
767
769
The request object. The request sent to the
768
770
[DeletePolicy]
769
771
[google.cloud.orgpolicy.v2.OrgPolicy.DeletePolicy]
0 commit comments