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

feat: added resource_reference for name in GetProjectBillingInfoRequest message #11409

Merged
merged 3 commits into from
Jun 19, 2023
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 @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "1.10.1" # {x-release-please-version}
__version__ = "0.1.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "1.10.1" # {x-release-please-version}
__version__ = "0.1.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ class CloudBillingAsyncClient:
DEFAULT_ENDPOINT = CloudBillingClient.DEFAULT_ENDPOINT
DEFAULT_MTLS_ENDPOINT = CloudBillingClient.DEFAULT_MTLS_ENDPOINT

project_billing_info_path = staticmethod(
CloudBillingClient.project_billing_info_path
)
parse_project_billing_info_path = staticmethod(
CloudBillingClient.parse_project_billing_info_path
)
common_billing_account_path = staticmethod(
CloudBillingClient.common_billing_account_path
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,21 @@ def transport(self) -> CloudBillingTransport:
"""
return self._transport

@staticmethod
def project_billing_info_path(
project: str,
) -> str:
"""Returns a fully-qualified project_billing_info string."""
return "projects/{project}/billingInfo".format(
project=project,
)

@staticmethod
def parse_project_billing_info_path(path: str) -> Dict[str, str]:
"""Parses a project_billing_info path into its component segments."""
m = re.match(r"^projects/(?P<project>.+?)/billingInfo$", path)
return m.groupdict() if m else {}

@staticmethod
def common_billing_account_path(
billing_account: str,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,29 +95,31 @@ class ProjectBillingInfo(proto.Message):

Attributes:
name (str):
The resource name for the ``ProjectBillingInfo``; has the
form ``projects/{project_id}/billingInfo``. For example, the
Output only. The resource name for the
``ProjectBillingInfo``; has the form
``projects/{project_id}/billingInfo``. For example, the
resource name for the billing information for project
``tokyo-rain-123`` would be
``projects/tokyo-rain-123/billingInfo``. This field is
read-only.
project_id (str):
The ID of the project that this ``ProjectBillingInfo``
represents, such as ``tokyo-rain-123``. This is a
convenience field so that you don't need to parse the
``name`` field to obtain a project ID. This field is
read-only.
Output only. The ID of the project that this
``ProjectBillingInfo`` represents, such as
``tokyo-rain-123``. This is a convenience field so that you
don't need to parse the ``name`` field to obtain a project
ID. This field is read-only.
billing_account_name (str):
The resource name of the billing account associated with the
project, if any. For example,
``billingAccounts/012345-567890-ABCDEF``.
billing_enabled (bool):
True if the project is associated with an
open billing account, to which usage on the
project is charged. False if the project is
associated with a closed billing account, or no
billing account at all, and therefore cannot use
paid services. This field is read-only.
Output only. True if the project is
associated with an open billing account, to
which usage on the project is charged. False if
the project is associated with a closed billing
account, or no billing account at all, and
therefore cannot use paid services. This field
is read-only.
"""

name: str = proto.Field(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Generated code. DO NOT EDIT!
#
# Snippet for CreateBillingAccount
# NOTE: This snippet has been automatically generated for illustrative purposes only.
# It may require modifications to work in your environment.

# To install the latest published package dependency, execute the following:
# python3 -m pip install google-cloud-billing


# [START cloudbilling_v1_generated_CloudBilling_CreateBillingAccount_async]
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import billing_v1


async def sample_create_billing_account():
# Create a client
client = billing_v1.CloudBillingAsyncClient()

# Initialize request argument(s)
request = billing_v1.CreateBillingAccountRequest(
)

# Make the request
response = await client.create_billing_account(request=request)

# Handle the response
print(response)

# [END cloudbilling_v1_generated_CloudBilling_CreateBillingAccount_async]
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Generated code. DO NOT EDIT!
#
# Snippet for CreateBillingAccount
# NOTE: This snippet has been automatically generated for illustrative purposes only.
# It may require modifications to work in your environment.

# To install the latest published package dependency, execute the following:
# python3 -m pip install google-cloud-billing


# [START cloudbilling_v1_generated_CloudBilling_CreateBillingAccount_sync]
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import billing_v1


def sample_create_billing_account():
# Create a client
client = billing_v1.CloudBillingClient()

# Initialize request argument(s)
request = billing_v1.CreateBillingAccountRequest(
)

# Make the request
response = client.create_billing_account(request=request)

# Handle the response
print(response)

# [END cloudbilling_v1_generated_CloudBilling_CreateBillingAccount_sync]
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Generated code. DO NOT EDIT!
#
# Snippet for GetBillingAccount
# NOTE: This snippet has been automatically generated for illustrative purposes only.
# It may require modifications to work in your environment.

# To install the latest published package dependency, execute the following:
# python3 -m pip install google-cloud-billing


# [START cloudbilling_v1_generated_CloudBilling_GetBillingAccount_async]
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import billing_v1


async def sample_get_billing_account():
# Create a client
client = billing_v1.CloudBillingAsyncClient()

# Initialize request argument(s)
request = billing_v1.GetBillingAccountRequest(
name="name_value",
)

# Make the request
response = await client.get_billing_account(request=request)

# Handle the response
print(response)

# [END cloudbilling_v1_generated_CloudBilling_GetBillingAccount_async]
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Generated code. DO NOT EDIT!
#
# Snippet for GetBillingAccount
# NOTE: This snippet has been automatically generated for illustrative purposes only.
# It may require modifications to work in your environment.

# To install the latest published package dependency, execute the following:
# python3 -m pip install google-cloud-billing


# [START cloudbilling_v1_generated_CloudBilling_GetBillingAccount_sync]
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import billing_v1


def sample_get_billing_account():
# Create a client
client = billing_v1.CloudBillingClient()

# Initialize request argument(s)
request = billing_v1.GetBillingAccountRequest(
name="name_value",
)

# Make the request
response = client.get_billing_account(request=request)

# Handle the response
print(response)

# [END cloudbilling_v1_generated_CloudBilling_GetBillingAccount_sync]
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Generated code. DO NOT EDIT!
#
# Snippet for GetIamPolicy
# NOTE: This snippet has been automatically generated for illustrative purposes only.
# It may require modifications to work in your environment.

# To install the latest published package dependency, execute the following:
# python3 -m pip install google-cloud-billing


# [START cloudbilling_v1_generated_CloudBilling_GetIamPolicy_async]
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import billing_v1
from google.iam.v1 import iam_policy_pb2 # type: ignore


async def sample_get_iam_policy():
# Create a client
client = billing_v1.CloudBillingAsyncClient()

# Initialize request argument(s)
request = iam_policy_pb2.GetIamPolicyRequest(
resource="resource_value",
)

# Make the request
response = await client.get_iam_policy(request=request)

# Handle the response
print(response)

# [END cloudbilling_v1_generated_CloudBilling_GetIamPolicy_async]
Loading