@@ -63,6 +63,14 @@ class CloudBillingAsyncClient:
6363 DEFAULT_ENDPOINT = CloudBillingClient .DEFAULT_ENDPOINT
6464 DEFAULT_MTLS_ENDPOINT = CloudBillingClient .DEFAULT_MTLS_ENDPOINT
6565
66+ billing_account_path = staticmethod (CloudBillingClient .billing_account_path )
67+ parse_billing_account_path = staticmethod (
68+ CloudBillingClient .parse_billing_account_path
69+ )
70+ organization_path = staticmethod (CloudBillingClient .organization_path )
71+ parse_organization_path = staticmethod (CloudBillingClient .parse_organization_path )
72+ project_path = staticmethod (CloudBillingClient .project_path )
73+ parse_project_path = staticmethod (CloudBillingClient .parse_project_path )
6674 project_billing_info_path = staticmethod (
6775 CloudBillingClient .project_billing_info_path
6876 )
@@ -339,6 +347,7 @@ async def list_billing_accounts(
339347 self ,
340348 request : Optional [Union [cloud_billing .ListBillingAccountsRequest , dict ]] = None ,
341349 * ,
350+ parent : Optional [str ] = None ,
342351 retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
343352 timeout : Union [float , object ] = gapic_v1 .method .DEFAULT ,
344353 metadata : Sequence [Tuple [str , str ]] = (),
@@ -376,6 +385,18 @@ async def sample_list_billing_accounts():
376385 Args:
377386 request (Optional[Union[google.cloud.billing_v1.types.ListBillingAccountsRequest, dict]]):
378387 The request object. Request message for ``ListBillingAccounts``.
388+ parent (:class:`str`):
389+ Optional. The parent resource to list billing accounts
390+ from. Format:
391+
392+ - ``organizations/{organization_id}``, for example,
393+ ``organizations/12345678``
394+ - ``billingAccounts/{billing_account_id}``, for
395+ example, ``billingAccounts/012345-567890-ABCDEF``
396+
397+ This corresponds to the ``parent`` field
398+ on the ``request`` instance; if ``request`` is provided, this
399+ should not be set.
379400 retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
380401 should be retried.
381402 timeout (float): The timeout for this request.
@@ -391,8 +412,22 @@ async def sample_list_billing_accounts():
391412
392413 """
393414 # Create or coerce a protobuf request object.
415+ # Quick check: If we got a request object, we should *not* have
416+ # gotten any keyword arguments that map to the request.
417+ has_flattened_params = any ([parent ])
418+ if request is not None and has_flattened_params :
419+ raise ValueError (
420+ "If the `request` argument is set, then none of "
421+ "the individual field arguments should be set."
422+ )
423+
394424 request = cloud_billing .ListBillingAccountsRequest (request )
395425
426+ # If we have keyword arguments corresponding to fields on the
427+ # request, apply these.
428+ if parent is not None :
429+ request .parent = parent
430+
396431 # Wrap the RPC method; this adds retry and timeout information,
397432 # and friendly error handling.
398433 rpc = gapic_v1 .method_async .wrap_method (
@@ -569,6 +604,7 @@ async def create_billing_account(
569604 ] = None ,
570605 * ,
571606 billing_account : Optional [cloud_billing .BillingAccount ] = None ,
607+ parent : Optional [str ] = None ,
572608 retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
573609 timeout : Union [float , object ] = gapic_v1 .method .DEFAULT ,
574610 metadata : Sequence [Tuple [str , str ]] = (),
@@ -627,6 +663,18 @@ async def sample_create_billing_account():
627663 This corresponds to the ``billing_account`` field
628664 on the ``request`` instance; if ``request`` is provided, this
629665 should not be set.
666+ parent (:class:`str`):
667+ Optional. The parent to create a billing account from.
668+ Format:
669+
670+ - ``organizations/{organization_id}``, for example,
671+ ``organizations/12345678``
672+ - ``billingAccounts/{billing_account_id}``, for
673+ example, ``billingAccounts/012345-567890-ABCDEF``
674+
675+ This corresponds to the ``parent`` field
676+ on the ``request`` instance; if ``request`` is provided, this
677+ should not be set.
630678 retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
631679 should be retried.
632680 timeout (float): The timeout for this request.
@@ -644,7 +692,7 @@ async def sample_create_billing_account():
644692 # Create or coerce a protobuf request object.
645693 # Quick check: If we got a request object, we should *not* have
646694 # gotten any keyword arguments that map to the request.
647- has_flattened_params = any ([billing_account ])
695+ has_flattened_params = any ([billing_account , parent ])
648696 if request is not None and has_flattened_params :
649697 raise ValueError (
650698 "If the `request` argument is set, then none of "
@@ -657,6 +705,8 @@ async def sample_create_billing_account():
657705 # request, apply these.
658706 if billing_account is not None :
659707 request .billing_account = billing_account
708+ if parent is not None :
709+ request .parent = parent
660710
661711 # Wrap the RPC method; this adds retry and timeout information,
662712 # and friendly error handling.
@@ -1519,6 +1569,89 @@ async def sample_test_iam_permissions():
15191569 # Done; return the response.
15201570 return response
15211571
1572+ async def move_billing_account (
1573+ self ,
1574+ request : Optional [Union [cloud_billing .MoveBillingAccountRequest , dict ]] = None ,
1575+ * ,
1576+ retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
1577+ timeout : Union [float , object ] = gapic_v1 .method .DEFAULT ,
1578+ metadata : Sequence [Tuple [str , str ]] = (),
1579+ ) -> cloud_billing .BillingAccount :
1580+ r"""Changes which parent organization a billing account
1581+ belongs to.
1582+
1583+ .. code-block:: python
1584+
1585+ # This snippet has been automatically generated and should be regarded as a
1586+ # code template only.
1587+ # It will require modifications to work:
1588+ # - It may require correct/in-range values for request initialization.
1589+ # - It may require specifying regional endpoints when creating the service
1590+ # client as shown in:
1591+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
1592+ from google.cloud import billing_v1
1593+
1594+ async def sample_move_billing_account():
1595+ # Create a client
1596+ client = billing_v1.CloudBillingAsyncClient()
1597+
1598+ # Initialize request argument(s)
1599+ request = billing_v1.MoveBillingAccountRequest(
1600+ name="name_value",
1601+ destination_parent="destination_parent_value",
1602+ )
1603+
1604+ # Make the request
1605+ response = await client.move_billing_account(request=request)
1606+
1607+ # Handle the response
1608+ print(response)
1609+
1610+ Args:
1611+ request (Optional[Union[google.cloud.billing_v1.types.MoveBillingAccountRequest, dict]]):
1612+ The request object. Request message for ``MoveBillingAccount`` RPC.
1613+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
1614+ should be retried.
1615+ timeout (float): The timeout for this request.
1616+ metadata (Sequence[Tuple[str, str]]): Strings which should be
1617+ sent along with the request as metadata.
1618+
1619+ Returns:
1620+ google.cloud.billing_v1.types.BillingAccount:
1621+ A billing account in the
1622+ [Google Cloud
1623+ Console](\ https://console.cloud.google.com/). You
1624+ can assign a billing account to one or more projects.
1625+
1626+ """
1627+ # Create or coerce a protobuf request object.
1628+ request = cloud_billing .MoveBillingAccountRequest (request )
1629+
1630+ # Wrap the RPC method; this adds retry and timeout information,
1631+ # and friendly error handling.
1632+ rpc = gapic_v1 .method_async .wrap_method (
1633+ self ._client ._transport .move_billing_account ,
1634+ default_timeout = None ,
1635+ client_info = DEFAULT_CLIENT_INFO ,
1636+ )
1637+
1638+ # Certain fields should be provided within the metadata header;
1639+ # add these here.
1640+ metadata = tuple (metadata ) + (
1641+ gapic_v1 .routing_header .to_grpc_metadata ((("name" , request .name ),)),
1642+ )
1643+
1644+ # Send the request.
1645+ response = await rpc (
1646+ request ,
1647+ retry = retry ,
1648+ timeout = timeout ,
1649+ metadata = metadata ,
1650+ )
1651+
1652+ # Done; return the response.
1653+ return response
1654+
15221655 async def __aenter__ (self ) -> "CloudBillingAsyncClient" :
15231656 return self
15241657
0 commit comments