Skip to content

Commit

Permalink
feat: [google-analytics-data] add GetPropertyQuotasSnapshot method …
Browse files Browse the repository at this point in the history
…to the Data API v1alpha (#13095)

BEGIN_COMMIT_OVERRIDE
feat: add `GetPropertyQuotasSnapshot` method to the Data API v1alpha
feat: add `PropertyQuotasSnapshot` type to the Data API v1alpha
docs: update the documentation for the `CreateReportTask` method
END_COMMIT_OVERRIDE

- [ ] Regenerate this pull request now.

feat: add `PropertyQuotasSnapshot` type to the Data API v1alpha
docs: update the documentation for the `CreateReportTask` method

PiperOrigin-RevId: 676527881

Source-Link:
googleapis/googleapis@923b6f3

Source-Link:
googleapis/googleapis-gen@8729c5b
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLWFuYWx5dGljcy1kYXRhLy5Pd2xCb3QueWFtbCIsImgiOiI4NzI5YzViNGNkYWNjYTk2NzNjZWFiNDNmOTBiZmZkYzk3YWE1MTQ3In0=

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: ohmayr <omairnaveed@ymail.com>
  • Loading branch information
3 people authored Sep 20, 2024
1 parent 1f8b564 commit 65f098a
Show file tree
Hide file tree
Showing 16 changed files with 2,887 additions and 1,331 deletions.
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

0 comments on commit 65f098a

Please sign in to comment.