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: [google-analytics-data] add GetPropertyQuotasSnapshot method to the Data API v1alpha #13095

Merged
merged 3 commits into from
Sep 20, 2024
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 @@ -32,6 +32,7 @@
CreateRecurringAudienceListRequest,
CreateReportTaskRequest,
GetAudienceListRequest,
GetPropertyQuotasSnapshotRequest,
GetRecurringAudienceListRequest,
GetReportTaskRequest,
ListAudienceListsRequest,
Expand All @@ -40,6 +41,7 @@
ListRecurringAudienceListsResponse,
ListReportTasksRequest,
ListReportTasksResponse,
PropertyQuotasSnapshot,
QueryAudienceListRequest,
QueryAudienceListResponse,
QueryReportTaskRequest,
Expand Down Expand Up @@ -172,6 +174,7 @@
"FunnelStep",
"FunnelSubReport",
"GetAudienceListRequest",
"GetPropertyQuotasSnapshotRequest",
"GetRecurringAudienceListRequest",
"GetReportTaskRequest",
"InListFilter",
Expand All @@ -190,6 +193,7 @@
"NumericValue",
"OrderBy",
"PropertyQuota",
"PropertyQuotasSnapshot",
"QueryAudienceListRequest",
"QueryAudienceListResponse",
"QueryReportTaskRequest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
"get_audience_list"
]
},
"GetPropertyQuotasSnapshot": {
"methods": [
"get_property_quotas_snapshot"
]
},
"GetRecurringAudienceList": {
"methods": [
"get_recurring_audience_list"
Expand Down Expand Up @@ -100,6 +105,11 @@
"get_audience_list"
]
},
"GetPropertyQuotasSnapshot": {
"methods": [
"get_property_quotas_snapshot"
]
},
"GetRecurringAudienceList": {
"methods": [
"get_recurring_audience_list"
Expand Down Expand Up @@ -170,6 +180,11 @@
"get_audience_list"
]
},
"GetPropertyQuotasSnapshot": {
"methods": [
"get_property_quotas_snapshot"
]
},
"GetRecurringAudienceList": {
"methods": [
"get_recurring_audience_list"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ class AlphaAnalyticsDataAsyncClient:
parse_audience_list_path = staticmethod(
AlphaAnalyticsDataClient.parse_audience_list_path
)
property_quotas_snapshot_path = staticmethod(
AlphaAnalyticsDataClient.property_quotas_snapshot_path
)
parse_property_quotas_snapshot_path = staticmethod(
AlphaAnalyticsDataClient.parse_property_quotas_snapshot_path
)
recurring_audience_list_path = staticmethod(
AlphaAnalyticsDataClient.recurring_audience_list_path
)
Expand Down Expand Up @@ -1468,6 +1474,118 @@ async def sample_list_recurring_audience_lists():
# Done; return the response.
return response

async def get_property_quotas_snapshot(
self,
request: Optional[
Union[analytics_data_api.GetPropertyQuotasSnapshotRequest, dict]
] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> analytics_data_api.PropertyQuotasSnapshot:
r"""Get all property quotas organized by quota category
for a given property. This will charge 1 property quota
from the category with the most quota.

.. code-block:: python

# 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.analytics import data_v1alpha

async def sample_get_property_quotas_snapshot():
# Create a client
client = data_v1alpha.AlphaAnalyticsDataAsyncClient()

# Initialize request argument(s)
request = data_v1alpha.GetPropertyQuotasSnapshotRequest(
name="name_value",
)

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

# Handle the response
print(response)

Args:
request (Optional[Union[google.analytics.data_v1alpha.types.GetPropertyQuotasSnapshotRequest, dict]]):
The request object. A request to return the
PropertyQuotasSnapshot for a given
category.
name (:class:`str`):
Required. Quotas from this property will be listed in
the response. Format:
``properties/{property}/propertyQuotasSnapshot``

This corresponds to the ``name`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
sent along with the request as metadata.

Returns:
google.analytics.data_v1alpha.types.PropertyQuotasSnapshot:
Current state of all Property Quotas
organized by quota category.

"""
# Create or coerce a protobuf request object.
# - Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([name])
if request is not None and has_flattened_params:
raise ValueError(
"If the `request` argument is set, then none of "
"the individual field arguments should be set."
)

# - Use the request object if provided (there's no risk of modifying the input as
# there are no flattened fields), or create one.
if not isinstance(request, analytics_data_api.GetPropertyQuotasSnapshotRequest):
request = analytics_data_api.GetPropertyQuotasSnapshotRequest(request)

# If we have keyword arguments corresponding to fields on the
# request, apply these.
if name is not None:
request.name = name

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.get_property_quotas_snapshot
]

# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
)

# Validate the universe domain.
self._client._validate_universe_domain()

# Send the request.
response = await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)

# Done; return the response.
return response

async def create_report_task(
self,
request: Optional[
Expand All @@ -1485,6 +1603,12 @@ async def create_report_task(
running asynchronous request to form a customized report
of your Google Analytics event data.

A report task will be retained and available for
querying for 72 hours after it has been created.

A report task created by one user can be listed and
queried by all users who have access to the property.

.. code-block:: python

# This snippet has been automatically generated and should be regarded as a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,21 @@ def parse_audience_list_path(path: str) -> Dict[str, str]:
)
return m.groupdict() if m else {}

@staticmethod
def property_quotas_snapshot_path(
property: str,
) -> str:
"""Returns a fully-qualified property_quotas_snapshot string."""
return "properties/{property}/propertyQuotasSnapshot".format(
property=property,
)

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

@staticmethod
def recurring_audience_list_path(
property: str,
Expand Down Expand Up @@ -1898,6 +1913,117 @@ def sample_list_recurring_audience_lists():
# Done; return the response.
return response

def get_property_quotas_snapshot(
self,
request: Optional[
Union[analytics_data_api.GetPropertyQuotasSnapshotRequest, dict]
] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> analytics_data_api.PropertyQuotasSnapshot:
r"""Get all property quotas organized by quota category
for a given property. This will charge 1 property quota
from the category with the most quota.

.. code-block:: python

# 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.analytics import data_v1alpha

def sample_get_property_quotas_snapshot():
# Create a client
client = data_v1alpha.AlphaAnalyticsDataClient()

# Initialize request argument(s)
request = data_v1alpha.GetPropertyQuotasSnapshotRequest(
name="name_value",
)

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

# Handle the response
print(response)

Args:
request (Union[google.analytics.data_v1alpha.types.GetPropertyQuotasSnapshotRequest, dict]):
The request object. A request to return the
PropertyQuotasSnapshot for a given
category.
name (str):
Required. Quotas from this property will be listed in
the response. Format:
``properties/{property}/propertyQuotasSnapshot``

This corresponds to the ``name`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
sent along with the request as metadata.

Returns:
google.analytics.data_v1alpha.types.PropertyQuotasSnapshot:
Current state of all Property Quotas
organized by quota category.

"""
# Create or coerce a protobuf request object.
# - Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([name])
if request is not None and has_flattened_params:
raise ValueError(
"If the `request` argument is set, then none of "
"the individual field arguments should be set."
)

# - Use the request object if provided (there's no risk of modifying the input as
# there are no flattened fields), or create one.
if not isinstance(request, analytics_data_api.GetPropertyQuotasSnapshotRequest):
request = analytics_data_api.GetPropertyQuotasSnapshotRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if name is not None:
request.name = name

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._transport._wrapped_methods[
self._transport.get_property_quotas_snapshot
]

# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
)

# Validate the universe domain.
self._validate_universe_domain()

# Send the request.
response = rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)

# Done; return the response.
return response

def create_report_task(
self,
request: Optional[
Expand All @@ -1915,6 +2041,12 @@ def create_report_task(
running asynchronous request to form a customized report
of your Google Analytics event data.

A report task will be retained and available for
querying for 72 hours after it has been created.

A report task created by one user can be listed and
queried by all users who have access to the property.

.. code-block:: python

# This snippet has been automatically generated and should be regarded as a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,11 @@ def _prep_wrapped_messages(self, client_info):
default_timeout=None,
client_info=client_info,
),
self.get_property_quotas_snapshot: gapic_v1.method.wrap_method(
self.get_property_quotas_snapshot,
default_timeout=None,
client_info=client_info,
),
self.create_report_task: gapic_v1.method.wrap_method(
self.create_report_task,
default_timeout=None,
Expand Down Expand Up @@ -320,6 +325,18 @@ def list_recurring_audience_lists(
]:
raise NotImplementedError()

@property
def get_property_quotas_snapshot(
self,
) -> Callable[
[analytics_data_api.GetPropertyQuotasSnapshotRequest],
Union[
analytics_data_api.PropertyQuotasSnapshot,
Awaitable[analytics_data_api.PropertyQuotasSnapshot],
],
]:
raise NotImplementedError()

@property
def create_report_task(
self,
Expand Down
Loading
Loading