As of January 1, 2020 this library no longer supports Python 2 on the latest released version.
Library versions released prior to that date will continue to be available. For more information please
visit Python 2 support on Google Cloud.
Source code for google.analytics.admin_v1alpha.services.analytics_admin_service.async_client
# -*- coding: utf-8 -*-
# Copyright 2024 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.
#
from collections import OrderedDict
import logging as std_logging
import re
from typing import (
Callable,
Dict,
Mapping,
MutableMapping,
MutableSequence,
Optional,
Sequence,
Tuple,
Type,
Union,
)
import warnings
from google.api_core import exceptions as core_exceptions
from google.api_core import gapic_v1
from google.api_core import retry_async as retries
from google.api_core.client_options import ClientOptions
from google.auth import credentials as ga_credentials # type: ignore
from google.oauth2 import service_account # type: ignore
from google.analytics.admin_v1alpha import gapic_version as package_version
try:
OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None]
except AttributeError: # pragma: NO COVER
OptionalRetry = Union[retries.AsyncRetry, object, None] # type: ignore
from google.protobuf import field_mask_pb2 # type: ignore
from google.protobuf import timestamp_pb2 # type: ignore
from google.protobuf import wrappers_pb2 # type: ignore
from google.analytics.admin_v1alpha.services.analytics_admin_service import pagers
from google.analytics.admin_v1alpha.types import channel_group as gaa_channel_group
from google.analytics.admin_v1alpha.types import (
expanded_data_set as gaa_expanded_data_set,
)
from google.analytics.admin_v1alpha.types import (
subproperty_event_filter as gaa_subproperty_event_filter,
)
from google.analytics.admin_v1alpha.types import access_report, analytics_admin
from google.analytics.admin_v1alpha.types import audience
from google.analytics.admin_v1alpha.types import audience as gaa_audience
from google.analytics.admin_v1alpha.types import channel_group
from google.analytics.admin_v1alpha.types import event_create_and_edit
from google.analytics.admin_v1alpha.types import expanded_data_set
from google.analytics.admin_v1alpha.types import resources
from google.analytics.admin_v1alpha.types import subproperty_event_filter
from .client import AnalyticsAdminServiceClient
from .transports.base import DEFAULT_CLIENT_INFO, AnalyticsAdminServiceTransport
from .transports.grpc_asyncio import AnalyticsAdminServiceGrpcAsyncIOTransport
try:
from google.api_core import client_logging # type: ignore
CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
except ImportError: # pragma: NO COVER
CLIENT_LOGGING_SUPPORTED = False
_LOGGER = std_logging.getLogger(__name__)
[docs]class AnalyticsAdminServiceAsyncClient:
"""Service Interface for the Google Analytics Admin API."""
_client: AnalyticsAdminServiceClient
# Copy defaults from the synchronous client for use here.
# Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead.
DEFAULT_ENDPOINT = AnalyticsAdminServiceClient.DEFAULT_ENDPOINT
DEFAULT_MTLS_ENDPOINT = AnalyticsAdminServiceClient.DEFAULT_MTLS_ENDPOINT
_DEFAULT_ENDPOINT_TEMPLATE = AnalyticsAdminServiceClient._DEFAULT_ENDPOINT_TEMPLATE
_DEFAULT_UNIVERSE = AnalyticsAdminServiceClient._DEFAULT_UNIVERSE
access_binding_path = staticmethod(AnalyticsAdminServiceClient.access_binding_path)
parse_access_binding_path = staticmethod(
AnalyticsAdminServiceClient.parse_access_binding_path
)
account_path = staticmethod(AnalyticsAdminServiceClient.account_path)
parse_account_path = staticmethod(AnalyticsAdminServiceClient.parse_account_path)
account_summary_path = staticmethod(
AnalyticsAdminServiceClient.account_summary_path
)
parse_account_summary_path = staticmethod(
AnalyticsAdminServiceClient.parse_account_summary_path
)
ad_sense_link_path = staticmethod(AnalyticsAdminServiceClient.ad_sense_link_path)
parse_ad_sense_link_path = staticmethod(
AnalyticsAdminServiceClient.parse_ad_sense_link_path
)
attribution_settings_path = staticmethod(
AnalyticsAdminServiceClient.attribution_settings_path
)
parse_attribution_settings_path = staticmethod(
AnalyticsAdminServiceClient.parse_attribution_settings_path
)
audience_path = staticmethod(AnalyticsAdminServiceClient.audience_path)
parse_audience_path = staticmethod(AnalyticsAdminServiceClient.parse_audience_path)
big_query_link_path = staticmethod(AnalyticsAdminServiceClient.big_query_link_path)
parse_big_query_link_path = staticmethod(
AnalyticsAdminServiceClient.parse_big_query_link_path
)
calculated_metric_path = staticmethod(
AnalyticsAdminServiceClient.calculated_metric_path
)
parse_calculated_metric_path = staticmethod(
AnalyticsAdminServiceClient.parse_calculated_metric_path
)
channel_group_path = staticmethod(AnalyticsAdminServiceClient.channel_group_path)
parse_channel_group_path = staticmethod(
AnalyticsAdminServiceClient.parse_channel_group_path
)
conversion_event_path = staticmethod(
AnalyticsAdminServiceClient.conversion_event_path
)
parse_conversion_event_path = staticmethod(
AnalyticsAdminServiceClient.parse_conversion_event_path
)
custom_dimension_path = staticmethod(
AnalyticsAdminServiceClient.custom_dimension_path
)
parse_custom_dimension_path = staticmethod(
AnalyticsAdminServiceClient.parse_custom_dimension_path
)
custom_metric_path = staticmethod(AnalyticsAdminServiceClient.custom_metric_path)
parse_custom_metric_path = staticmethod(
AnalyticsAdminServiceClient.parse_custom_metric_path
)
data_redaction_settings_path = staticmethod(
AnalyticsAdminServiceClient.data_redaction_settings_path
)
parse_data_redaction_settings_path = staticmethod(
AnalyticsAdminServiceClient.parse_data_redaction_settings_path
)
data_retention_settings_path = staticmethod(
AnalyticsAdminServiceClient.data_retention_settings_path
)
parse_data_retention_settings_path = staticmethod(
AnalyticsAdminServiceClient.parse_data_retention_settings_path
)
data_sharing_settings_path = staticmethod(
AnalyticsAdminServiceClient.data_sharing_settings_path
)
parse_data_sharing_settings_path = staticmethod(
AnalyticsAdminServiceClient.parse_data_sharing_settings_path
)
data_stream_path = staticmethod(AnalyticsAdminServiceClient.data_stream_path)
parse_data_stream_path = staticmethod(
AnalyticsAdminServiceClient.parse_data_stream_path
)
display_video360_advertiser_link_path = staticmethod(
AnalyticsAdminServiceClient.display_video360_advertiser_link_path
)
parse_display_video360_advertiser_link_path = staticmethod(
AnalyticsAdminServiceClient.parse_display_video360_advertiser_link_path
)
display_video360_advertiser_link_proposal_path = staticmethod(
AnalyticsAdminServiceClient.display_video360_advertiser_link_proposal_path
)
parse_display_video360_advertiser_link_proposal_path = staticmethod(
AnalyticsAdminServiceClient.parse_display_video360_advertiser_link_proposal_path
)
enhanced_measurement_settings_path = staticmethod(
AnalyticsAdminServiceClient.enhanced_measurement_settings_path
)
parse_enhanced_measurement_settings_path = staticmethod(
AnalyticsAdminServiceClient.parse_enhanced_measurement_settings_path
)
event_create_rule_path = staticmethod(
AnalyticsAdminServiceClient.event_create_rule_path
)
parse_event_create_rule_path = staticmethod(
AnalyticsAdminServiceClient.parse_event_create_rule_path
)
event_edit_rule_path = staticmethod(
AnalyticsAdminServiceClient.event_edit_rule_path
)
parse_event_edit_rule_path = staticmethod(
AnalyticsAdminServiceClient.parse_event_edit_rule_path
)
expanded_data_set_path = staticmethod(
AnalyticsAdminServiceClient.expanded_data_set_path
)
parse_expanded_data_set_path = staticmethod(
AnalyticsAdminServiceClient.parse_expanded_data_set_path
)
firebase_link_path = staticmethod(AnalyticsAdminServiceClient.firebase_link_path)
parse_firebase_link_path = staticmethod(
AnalyticsAdminServiceClient.parse_firebase_link_path
)
global_site_tag_path = staticmethod(
AnalyticsAdminServiceClient.global_site_tag_path
)
parse_global_site_tag_path = staticmethod(
AnalyticsAdminServiceClient.parse_global_site_tag_path
)
google_ads_link_path = staticmethod(
AnalyticsAdminServiceClient.google_ads_link_path
)
parse_google_ads_link_path = staticmethod(
AnalyticsAdminServiceClient.parse_google_ads_link_path
)
google_signals_settings_path = staticmethod(
AnalyticsAdminServiceClient.google_signals_settings_path
)
parse_google_signals_settings_path = staticmethod(
AnalyticsAdminServiceClient.parse_google_signals_settings_path
)
key_event_path = staticmethod(AnalyticsAdminServiceClient.key_event_path)
parse_key_event_path = staticmethod(
AnalyticsAdminServiceClient.parse_key_event_path
)
measurement_protocol_secret_path = staticmethod(
AnalyticsAdminServiceClient.measurement_protocol_secret_path
)
parse_measurement_protocol_secret_path = staticmethod(
AnalyticsAdminServiceClient.parse_measurement_protocol_secret_path
)
organization_path = staticmethod(AnalyticsAdminServiceClient.organization_path)
parse_organization_path = staticmethod(
AnalyticsAdminServiceClient.parse_organization_path
)
property_path = staticmethod(AnalyticsAdminServiceClient.property_path)
parse_property_path = staticmethod(AnalyticsAdminServiceClient.parse_property_path)
rollup_property_source_link_path = staticmethod(
AnalyticsAdminServiceClient.rollup_property_source_link_path
)
parse_rollup_property_source_link_path = staticmethod(
AnalyticsAdminServiceClient.parse_rollup_property_source_link_path
)
search_ads360_link_path = staticmethod(
AnalyticsAdminServiceClient.search_ads360_link_path
)
parse_search_ads360_link_path = staticmethod(
AnalyticsAdminServiceClient.parse_search_ads360_link_path
)
sk_ad_network_conversion_value_schema_path = staticmethod(
AnalyticsAdminServiceClient.sk_ad_network_conversion_value_schema_path
)
parse_sk_ad_network_conversion_value_schema_path = staticmethod(
AnalyticsAdminServiceClient.parse_sk_ad_network_conversion_value_schema_path
)
subproperty_event_filter_path = staticmethod(
AnalyticsAdminServiceClient.subproperty_event_filter_path
)
parse_subproperty_event_filter_path = staticmethod(
AnalyticsAdminServiceClient.parse_subproperty_event_filter_path
)
common_billing_account_path = staticmethod(
AnalyticsAdminServiceClient.common_billing_account_path
)
parse_common_billing_account_path = staticmethod(
AnalyticsAdminServiceClient.parse_common_billing_account_path
)
common_folder_path = staticmethod(AnalyticsAdminServiceClient.common_folder_path)
parse_common_folder_path = staticmethod(
AnalyticsAdminServiceClient.parse_common_folder_path
)
common_organization_path = staticmethod(
AnalyticsAdminServiceClient.common_organization_path
)
parse_common_organization_path = staticmethod(
AnalyticsAdminServiceClient.parse_common_organization_path
)
common_project_path = staticmethod(AnalyticsAdminServiceClient.common_project_path)
parse_common_project_path = staticmethod(
AnalyticsAdminServiceClient.parse_common_project_path
)
common_location_path = staticmethod(
AnalyticsAdminServiceClient.common_location_path
)
parse_common_location_path = staticmethod(
AnalyticsAdminServiceClient.parse_common_location_path
)
[docs] @classmethod
def from_service_account_info(cls, info: dict, *args, **kwargs):
"""Creates an instance of this client using the provided credentials
info.
Args:
info (dict): The service account private key info.
args: Additional arguments to pass to the constructor.
kwargs: Additional arguments to pass to the constructor.
Returns:
AnalyticsAdminServiceAsyncClient: The constructed client.
"""
return AnalyticsAdminServiceClient.from_service_account_info.__func__(AnalyticsAdminServiceAsyncClient, info, *args, **kwargs) # type: ignore
[docs] @classmethod
def from_service_account_file(cls, filename: str, *args, **kwargs):
"""Creates an instance of this client using the provided credentials
file.
Args:
filename (str): The path to the service account private key json
file.
args: Additional arguments to pass to the constructor.
kwargs: Additional arguments to pass to the constructor.
Returns:
AnalyticsAdminServiceAsyncClient: The constructed client.
"""
return AnalyticsAdminServiceClient.from_service_account_file.__func__(AnalyticsAdminServiceAsyncClient, filename, *args, **kwargs) # type: ignore
from_service_account_json = from_service_account_file
[docs] @classmethod
def get_mtls_endpoint_and_cert_source(
cls, client_options: Optional[ClientOptions] = None
):
"""Return the API endpoint and client cert source for mutual TLS.
The client cert source is determined in the following order:
(1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the
client cert source is None.
(2) if `client_options.client_cert_source` is provided, use the provided one; if the
default client cert source exists, use the default one; otherwise the client cert
source is None.
The API endpoint is determined in the following order:
(1) if `client_options.api_endpoint` if provided, use the provided one.
(2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the
default mTLS endpoint; if the environment variable is "never", use the default API
endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise
use the default API endpoint.
More details can be found at https://google.aip.dev/auth/4114.
Args:
client_options (google.api_core.client_options.ClientOptions): Custom options for the
client. Only the `api_endpoint` and `client_cert_source` properties may be used
in this method.
Returns:
Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the
client cert source to use.
Raises:
google.auth.exceptions.MutualTLSChannelError: If any errors happen.
"""
return AnalyticsAdminServiceClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore
@property
def transport(self) -> AnalyticsAdminServiceTransport:
"""Returns the transport used by the client instance.
Returns:
AnalyticsAdminServiceTransport: The transport used by the client instance.
"""
return self._client.transport
@property
def api_endpoint(self):
"""Return the API endpoint used by the client instance.
Returns:
str: The API endpoint used by the client instance.
"""
return self._client._api_endpoint
@property
def universe_domain(self) -> str:
"""Return the universe domain used by the client instance.
Returns:
str: The universe domain used
by the client instance.
"""
return self._client._universe_domain
get_transport_class = AnalyticsAdminServiceClient.get_transport_class
def __init__(
self,
*,
credentials: Optional[ga_credentials.Credentials] = None,
transport: Optional[
Union[
str,
AnalyticsAdminServiceTransport,
Callable[..., AnalyticsAdminServiceTransport],
]
] = "grpc_asyncio",
client_options: Optional[ClientOptions] = None,
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
) -> None:
"""Instantiates the analytics admin service async client.
Args:
credentials (Optional[google.auth.credentials.Credentials]): The
authorization credentials to attach to requests. These
credentials identify the application to the service; if none
are specified, the client will attempt to ascertain the
credentials from the environment.
transport (Optional[Union[str,AnalyticsAdminServiceTransport,Callable[..., AnalyticsAdminServiceTransport]]]):
The transport to use, or a Callable that constructs and returns a new transport to use.
If a Callable is given, it will be called with the same set of initialization
arguments as used in the AnalyticsAdminServiceTransport constructor.
If set to None, a transport is chosen automatically.
client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]):
Custom options for the client.
1. The ``api_endpoint`` property can be used to override the
default endpoint provided by the client when ``transport`` is
not explicitly provided. Only if this property is not set and
``transport`` was not explicitly provided, the endpoint is
determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment
variable, which have one of the following values:
"always" (always use the default mTLS endpoint), "never" (always
use the default regular endpoint) and "auto" (auto-switch to the
default mTLS endpoint if client certificate is present; this is
the default value).
2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable
is "true", then the ``client_cert_source`` property can be used
to provide a client certificate for mTLS transport. If
not provided, the default SSL client certificate will be used if
present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not
set, no client certificate will be used.
3. The ``universe_domain`` property can be used to override the
default "googleapis.com" universe. Note that ``api_endpoint``
property still takes precedence; and ``universe_domain`` is
currently not supported for mTLS.
client_info (google.api_core.gapic_v1.client_info.ClientInfo):
The client info used to send a user-agent string along with
API requests. If ``None``, then default info will be used.
Generally, you only need to set this if you're developing
your own client library.
Raises:
google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
creation failed for any reason.
"""
self._client = AnalyticsAdminServiceClient(
credentials=credentials,
transport=transport,
client_options=client_options,
client_info=client_info,
)
if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
std_logging.DEBUG
): # pragma: NO COVER
_LOGGER.debug(
"Created client `google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient`.",
extra={
"serviceName": "google.analytics.admin.v1alpha.AnalyticsAdminService",
"universeDomain": getattr(
self._client._transport._credentials, "universe_domain", ""
),
"credentialsType": f"{type(self._client._transport._credentials).__module__}.{type(self._client._transport._credentials).__qualname__}",
"credentialsInfo": getattr(
self.transport._credentials, "get_cred_info", lambda: None
)(),
}
if hasattr(self._client._transport, "_credentials")
else {
"serviceName": "google.analytics.admin.v1alpha.AnalyticsAdminService",
"credentialsType": None,
},
)
[docs] async def get_account(
self,
request: Optional[Union[analytics_admin.GetAccountRequest, dict]] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.Account:
r"""Lookup for a single Account.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.GetAccountRequest, dict]]):
The request object. Request message for GetAccount RPC.
name (:class:`str`):
Required. The name of the account to
lookup. Format: accounts/{account}
Example: "accounts/100"
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.Account:
A resource message representing a
Google Analytics account.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.GetAccountRequest):
request = analytics_admin.GetAccountRequest(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_account
]
# 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
[docs] async def list_accounts(
self,
request: Optional[Union[analytics_admin.ListAccountsRequest, dict]] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> pagers.ListAccountsAsyncPager:
r"""Returns all accounts accessible by the caller.
Note that these accounts might not currently have GA
properties. Soft-deleted (ie: "trashed") accounts are
excluded by default. Returns an empty list if no
relevant accounts are found.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.ListAccountsRequest, dict]]):
The request object. Request message for ListAccounts RPC.
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListAccountsAsyncPager:
Request message for ListAccounts RPC.
Iterating over this object will yield
results and resolve additional pages
automatically.
"""
# Create or coerce a protobuf request object.
# - 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_admin.ListAccountsRequest):
request = analytics_admin.ListAccountsRequest(request)
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.list_accounts
]
# Validate the universe domain.
self._client._validate_universe_domain()
# Send the request.
response = await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# This method is paged; wrap the response in a pager, which provides
# an `__aiter__` convenience method.
response = pagers.ListAccountsAsyncPager(
method=rpc,
request=request,
response=response,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# Done; return the response.
return response
[docs] async def delete_account(
self,
request: Optional[Union[analytics_admin.DeleteAccountRequest, dict]] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> None:
r"""Marks target Account as soft-deleted (ie: "trashed")
and returns it.
This API does not have a method to restore soft-deleted
accounts. However, they can be restored using the Trash
Can UI.
If the accounts are not restored before the expiration
time, the account and all child resources (eg:
Properties, GoogleAdsLinks, Streams, AccessBindings)
will be permanently purged.
https://support.google.com/analytics/answer/6154772
Returns an error if the target is not found.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteAccountRequest, dict]]):
The request object. Request message for DeleteAccount
RPC.
name (:class:`str`):
Required. The name of the Account to
soft-delete. Format: accounts/{account}
Example: "accounts/100"
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.DeleteAccountRequest):
request = analytics_admin.DeleteAccountRequest(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.delete_account
]
# 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.
await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
[docs] async def update_account(
self,
request: Optional[Union[analytics_admin.UpdateAccountRequest, dict]] = None,
*,
account: Optional[resources.Account] = None,
update_mask: Optional[field_mask_pb2.FieldMask] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.Account:
r"""Updates an account.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateAccountRequest, dict]]):
The request object. Request message for UpdateAccount
RPC.
account (:class:`google.analytics.admin_v1alpha.types.Account`):
Required. The account to update. The account's ``name``
field is used to identify the account.
This corresponds to the ``account`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
Required. The list of fields to be updated. Field names
must be in snake case (for example, "field_to_update").
Omitted fields will not be updated. To replace the
entire entity, use one path with the string "*" to match
all fields.
This corresponds to the ``update_mask`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.Account:
A resource message representing a
Google Analytics account.
"""
# 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.
flattened_params = [account, update_mask]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.UpdateAccountRequest):
request = analytics_admin.UpdateAccountRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if account is not None:
request.account = account
if update_mask is not None:
request.update_mask = update_mask
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.update_account
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(
(("account.name", request.account.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
[docs] async def provision_account_ticket(
self,
request: Optional[
Union[analytics_admin.ProvisionAccountTicketRequest, dict]
] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> analytics_admin.ProvisionAccountTicketResponse:
r"""Requests a ticket for creating an account.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.ProvisionAccountTicketRequest, dict]]):
The request object. Request message for
ProvisionAccountTicket RPC.
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.ProvisionAccountTicketResponse:
Response message for
ProvisionAccountTicket RPC.
"""
# Create or coerce a protobuf request object.
# - 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_admin.ProvisionAccountTicketRequest):
request = analytics_admin.ProvisionAccountTicketRequest(request)
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.provision_account_ticket
]
# 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
[docs] async def list_account_summaries(
self,
request: Optional[
Union[analytics_admin.ListAccountSummariesRequest, dict]
] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> pagers.ListAccountSummariesAsyncPager:
r"""Returns summaries of all accounts accessible by the
caller.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.ListAccountSummariesRequest, dict]]):
The request object. Request message for
ListAccountSummaries RPC.
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListAccountSummariesAsyncPager:
Response message for
ListAccountSummaries RPC.
Iterating over this object will yield
results and resolve additional pages
automatically.
"""
# Create or coerce a protobuf request object.
# - 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_admin.ListAccountSummariesRequest):
request = analytics_admin.ListAccountSummariesRequest(request)
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.list_account_summaries
]
# Validate the universe domain.
self._client._validate_universe_domain()
# Send the request.
response = await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# This method is paged; wrap the response in a pager, which provides
# an `__aiter__` convenience method.
response = pagers.ListAccountSummariesAsyncPager(
method=rpc,
request=request,
response=response,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# Done; return the response.
return response
[docs] async def get_property(
self,
request: Optional[Union[analytics_admin.GetPropertyRequest, dict]] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.Property:
r"""Lookup for a single GA Property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.GetPropertyRequest, dict]]):
The request object. Request message for GetProperty RPC.
name (:class:`str`):
Required. The name of the property to lookup. Format:
properties/{property_id} Example: "properties/1000"
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.Property:
A resource message representing a
Google Analytics property.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.GetPropertyRequest):
request = analytics_admin.GetPropertyRequest(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
]
# 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
[docs] async def list_properties(
self,
request: Optional[Union[analytics_admin.ListPropertiesRequest, dict]] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> pagers.ListPropertiesAsyncPager:
r"""Returns child Properties under the specified parent
Account.
Properties will be excluded if the caller does not have
access. Soft-deleted (ie: "trashed") properties are
excluded by default. Returns an empty list if no
relevant properties are found.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.ListPropertiesRequest, dict]]):
The request object. Request message for ListProperties
RPC.
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListPropertiesAsyncPager:
Response message for ListProperties
RPC.
Iterating over this object will yield
results and resolve additional pages
automatically.
"""
# Create or coerce a protobuf request object.
# - 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_admin.ListPropertiesRequest):
request = analytics_admin.ListPropertiesRequest(request)
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.list_properties
]
# Validate the universe domain.
self._client._validate_universe_domain()
# Send the request.
response = await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# This method is paged; wrap the response in a pager, which provides
# an `__aiter__` convenience method.
response = pagers.ListPropertiesAsyncPager(
method=rpc,
request=request,
response=response,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# Done; return the response.
return response
[docs] async def create_property(
self,
request: Optional[Union[analytics_admin.CreatePropertyRequest, dict]] = None,
*,
property: Optional[resources.Property] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.Property:
r"""Creates a Google Analytics property with the
specified location and attributes.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.CreatePropertyRequest, dict]]):
The request object. Request message for CreateProperty
RPC.
property (:class:`google.analytics.admin_v1alpha.types.Property`):
Required. The property to create.
Note: the supplied property must specify
its parent.
This corresponds to the ``property`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.Property:
A resource message representing a
Google Analytics property.
"""
# 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.
flattened_params = [property]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.CreatePropertyRequest):
request = analytics_admin.CreatePropertyRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if property is not None:
request.property = property
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.create_property
]
# 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
[docs] async def delete_property(
self,
request: Optional[Union[analytics_admin.DeletePropertyRequest, dict]] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.Property:
r"""Marks target Property as soft-deleted (ie: "trashed")
and returns it.
This API does not have a method to restore soft-deleted
properties. However, they can be restored using the
Trash Can UI.
If the properties are not restored before the expiration
time, the Property and all child resources (eg:
GoogleAdsLinks, Streams, AccessBindings) will be
permanently purged.
https://support.google.com/analytics/answer/6154772
Returns an error if the target is not found.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.DeletePropertyRequest, dict]]):
The request object. Request message for DeleteProperty
RPC.
name (:class:`str`):
Required. The name of the Property to soft-delete.
Format: properties/{property_id} Example:
"properties/1000"
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.Property:
A resource message representing a
Google Analytics property.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.DeletePropertyRequest):
request = analytics_admin.DeletePropertyRequest(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.delete_property
]
# 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
[docs] async def update_property(
self,
request: Optional[Union[analytics_admin.UpdatePropertyRequest, dict]] = None,
*,
property: Optional[resources.Property] = None,
update_mask: Optional[field_mask_pb2.FieldMask] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.Property:
r"""Updates a property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.UpdatePropertyRequest, dict]]):
The request object. Request message for UpdateProperty
RPC.
property (:class:`google.analytics.admin_v1alpha.types.Property`):
Required. The property to update. The property's
``name`` field is used to identify the property to be
updated.
This corresponds to the ``property`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
Required. The list of fields to be updated. Field names
must be in snake case (e.g., "field_to_update"). Omitted
fields will not be updated. To replace the entire
entity, use one path with the string "*" to match all
fields.
This corresponds to the ``update_mask`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.Property:
A resource message representing a
Google Analytics property.
"""
# 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.
flattened_params = [property, update_mask]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.UpdatePropertyRequest):
request = analytics_admin.UpdatePropertyRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if property is not None:
request.property = property
if update_mask is not None:
request.update_mask = update_mask
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.update_property
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(
(("property.name", request.property.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
[docs] async def create_firebase_link(
self,
request: Optional[
Union[analytics_admin.CreateFirebaseLinkRequest, dict]
] = None,
*,
parent: Optional[str] = None,
firebase_link: Optional[resources.FirebaseLink] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.FirebaseLink:
r"""Creates a FirebaseLink.
Properties can have at most one FirebaseLink.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.CreateFirebaseLinkRequest, dict]]):
The request object. Request message for
CreateFirebaseLink RPC
parent (:class:`str`):
Required. Format: properties/{property_id}
Example: ``properties/1234``
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
firebase_link (:class:`google.analytics.admin_v1alpha.types.FirebaseLink`):
Required. The Firebase link to
create.
This corresponds to the ``firebase_link`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.FirebaseLink:
A link between a Google Analytics
property and a Firebase project.
"""
# 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.
flattened_params = [parent, firebase_link]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.CreateFirebaseLinkRequest):
request = analytics_admin.CreateFirebaseLinkRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
if firebase_link is not None:
request.firebase_link = firebase_link
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.create_firebase_link
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# 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
[docs] async def delete_firebase_link(
self,
request: Optional[
Union[analytics_admin.DeleteFirebaseLinkRequest, dict]
] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> None:
r"""Deletes a FirebaseLink on a property
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteFirebaseLinkRequest, dict]]):
The request object. Request message for
DeleteFirebaseLink RPC
name (:class:`str`):
Required. Format:
properties/{property_id}/firebaseLinks/{firebase_link_id}
Example: ``properties/1234/firebaseLinks/5678``
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.DeleteFirebaseLinkRequest):
request = analytics_admin.DeleteFirebaseLinkRequest(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.delete_firebase_link
]
# 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.
await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
[docs] async def list_firebase_links(
self,
request: Optional[Union[analytics_admin.ListFirebaseLinksRequest, dict]] = None,
*,
parent: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> pagers.ListFirebaseLinksAsyncPager:
r"""Lists FirebaseLinks on a property.
Properties can have at most one FirebaseLink.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.ListFirebaseLinksRequest, dict]]):
The request object. Request message for ListFirebaseLinks
RPC
parent (:class:`str`):
Required. Format: properties/{property_id}
Example: ``properties/1234``
This corresponds to the ``parent`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListFirebaseLinksAsyncPager:
Response message for
ListFirebaseLinks RPC
Iterating over this object will yield
results and resolve additional pages
automatically.
"""
# 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.
flattened_params = [parent]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.ListFirebaseLinksRequest):
request = analytics_admin.ListFirebaseLinksRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.list_firebase_links
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# Validate the universe domain.
self._client._validate_universe_domain()
# Send the request.
response = await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# This method is paged; wrap the response in a pager, which provides
# an `__aiter__` convenience method.
response = pagers.ListFirebaseLinksAsyncPager(
method=rpc,
request=request,
response=response,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# Done; return the response.
return response
[docs] async def get_global_site_tag(
self,
request: Optional[Union[analytics_admin.GetGlobalSiteTagRequest, dict]] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.GlobalSiteTag:
r"""Returns the Site Tag for the specified web stream.
Site Tags are immutable singletons.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.GetGlobalSiteTagRequest, dict]]):
The request object. Request message for GetGlobalSiteTag
RPC.
name (:class:`str`):
Required. The name of the site tag to lookup. Note that
site tags are singletons and do not have unique IDs.
Format:
properties/{property_id}/dataStreams/{stream_id}/globalSiteTag
Example:
``properties/123/dataStreams/456/globalSiteTag``
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.GlobalSiteTag:
Read-only resource with the tag for
sending data from a website to a
DataStream. Only present for web
DataStream resources.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.GetGlobalSiteTagRequest):
request = analytics_admin.GetGlobalSiteTagRequest(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_global_site_tag
]
# 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
[docs] async def create_google_ads_link(
self,
request: Optional[
Union[analytics_admin.CreateGoogleAdsLinkRequest, dict]
] = None,
*,
parent: Optional[str] = None,
google_ads_link: Optional[resources.GoogleAdsLink] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.GoogleAdsLink:
r"""Creates a GoogleAdsLink.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.CreateGoogleAdsLinkRequest, dict]]):
The request object. Request message for
CreateGoogleAdsLink RPC
parent (:class:`str`):
Required. Example format:
properties/1234
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
google_ads_link (:class:`google.analytics.admin_v1alpha.types.GoogleAdsLink`):
Required. The GoogleAdsLink to
create.
This corresponds to the ``google_ads_link`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.GoogleAdsLink:
A link between a Google Analytics
property and a Google Ads account.
"""
# 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.
flattened_params = [parent, google_ads_link]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.CreateGoogleAdsLinkRequest):
request = analytics_admin.CreateGoogleAdsLinkRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
if google_ads_link is not None:
request.google_ads_link = google_ads_link
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.create_google_ads_link
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# 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
[docs] async def update_google_ads_link(
self,
request: Optional[
Union[analytics_admin.UpdateGoogleAdsLinkRequest, dict]
] = None,
*,
google_ads_link: Optional[resources.GoogleAdsLink] = None,
update_mask: Optional[field_mask_pb2.FieldMask] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.GoogleAdsLink:
r"""Updates a GoogleAdsLink on a property
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateGoogleAdsLinkRequest, dict]]):
The request object. Request message for
UpdateGoogleAdsLink RPC
google_ads_link (:class:`google.analytics.admin_v1alpha.types.GoogleAdsLink`):
The GoogleAdsLink to update
This corresponds to the ``google_ads_link`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
Required. The list of fields to be updated. Field names
must be in snake case (e.g., "field_to_update"). Omitted
fields will not be updated. To replace the entire
entity, use one path with the string "*" to match all
fields.
This corresponds to the ``update_mask`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.GoogleAdsLink:
A link between a Google Analytics
property and a Google Ads account.
"""
# 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.
flattened_params = [google_ads_link, update_mask]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.UpdateGoogleAdsLinkRequest):
request = analytics_admin.UpdateGoogleAdsLinkRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if google_ads_link is not None:
request.google_ads_link = google_ads_link
if update_mask is not None:
request.update_mask = update_mask
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.update_google_ads_link
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(
(("google_ads_link.name", request.google_ads_link.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
[docs] async def delete_google_ads_link(
self,
request: Optional[
Union[analytics_admin.DeleteGoogleAdsLinkRequest, dict]
] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> None:
r"""Deletes a GoogleAdsLink on a property
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteGoogleAdsLinkRequest, dict]]):
The request object. Request message for
DeleteGoogleAdsLink RPC.
name (:class:`str`):
Required. Example format:
properties/1234/googleAdsLinks/5678
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.DeleteGoogleAdsLinkRequest):
request = analytics_admin.DeleteGoogleAdsLinkRequest(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.delete_google_ads_link
]
# 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.
await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
[docs] async def list_google_ads_links(
self,
request: Optional[
Union[analytics_admin.ListGoogleAdsLinksRequest, dict]
] = None,
*,
parent: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> pagers.ListGoogleAdsLinksAsyncPager:
r"""Lists GoogleAdsLinks on a property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.ListGoogleAdsLinksRequest, dict]]):
The request object. Request message for
ListGoogleAdsLinks RPC.
parent (:class:`str`):
Required. Example format:
properties/1234
This corresponds to the ``parent`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListGoogleAdsLinksAsyncPager:
Response message for
ListGoogleAdsLinks RPC.
Iterating over this object will yield
results and resolve additional pages
automatically.
"""
# 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.
flattened_params = [parent]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.ListGoogleAdsLinksRequest):
request = analytics_admin.ListGoogleAdsLinksRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.list_google_ads_links
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# Validate the universe domain.
self._client._validate_universe_domain()
# Send the request.
response = await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# This method is paged; wrap the response in a pager, which provides
# an `__aiter__` convenience method.
response = pagers.ListGoogleAdsLinksAsyncPager(
method=rpc,
request=request,
response=response,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# Done; return the response.
return response
[docs] async def get_data_sharing_settings(
self,
request: Optional[
Union[analytics_admin.GetDataSharingSettingsRequest, dict]
] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.DataSharingSettings:
r"""Get data sharing settings on an account.
Data sharing settings are singletons.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.GetDataSharingSettingsRequest, dict]]):
The request object. Request message for
GetDataSharingSettings RPC.
name (:class:`str`):
Required. The name of the settings to lookup. Format:
accounts/{account}/dataSharingSettings
Example: ``accounts/1000/dataSharingSettings``
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.DataSharingSettings:
A resource message representing data
sharing settings of a Google Analytics
account.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.GetDataSharingSettingsRequest):
request = analytics_admin.GetDataSharingSettingsRequest(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_data_sharing_settings
]
# 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
[docs] async def get_measurement_protocol_secret(
self,
request: Optional[
Union[analytics_admin.GetMeasurementProtocolSecretRequest, dict]
] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.MeasurementProtocolSecret:
r"""Lookup for a single MeasurementProtocolSecret.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.GetMeasurementProtocolSecretRequest, dict]]):
The request object. Request message for
GetMeasurementProtocolSecret RPC.
name (:class:`str`):
Required. The name of the measurement
protocol secret to lookup. Format:
properties/{property}/dataStreams/{dataStream}/measurementProtocolSecrets/{measurementProtocolSecret}
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.MeasurementProtocolSecret:
A secret value used for sending hits
to Measurement Protocol.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.GetMeasurementProtocolSecretRequest):
request = analytics_admin.GetMeasurementProtocolSecretRequest(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_measurement_protocol_secret
]
# 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
[docs] async def list_measurement_protocol_secrets(
self,
request: Optional[
Union[analytics_admin.ListMeasurementProtocolSecretsRequest, dict]
] = None,
*,
parent: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> pagers.ListMeasurementProtocolSecretsAsyncPager:
r"""Returns child MeasurementProtocolSecrets under the
specified parent Property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.ListMeasurementProtocolSecretsRequest, dict]]):
The request object. Request message for
ListMeasurementProtocolSecret RPC
parent (:class:`str`):
Required. The resource name of the
parent stream. Format:
properties/{property}/dataStreams/{dataStream}/measurementProtocolSecrets
This corresponds to the ``parent`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListMeasurementProtocolSecretsAsyncPager:
Response message for
ListMeasurementProtocolSecret RPC
Iterating over this object will yield
results and resolve additional pages
automatically.
"""
# 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.
flattened_params = [parent]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.ListMeasurementProtocolSecretsRequest
):
request = analytics_admin.ListMeasurementProtocolSecretsRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.list_measurement_protocol_secrets
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# Validate the universe domain.
self._client._validate_universe_domain()
# Send the request.
response = await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# This method is paged; wrap the response in a pager, which provides
# an `__aiter__` convenience method.
response = pagers.ListMeasurementProtocolSecretsAsyncPager(
method=rpc,
request=request,
response=response,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# Done; return the response.
return response
[docs] async def create_measurement_protocol_secret(
self,
request: Optional[
Union[analytics_admin.CreateMeasurementProtocolSecretRequest, dict]
] = None,
*,
parent: Optional[str] = None,
measurement_protocol_secret: Optional[
resources.MeasurementProtocolSecret
] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.MeasurementProtocolSecret:
r"""Creates a measurement protocol secret.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.CreateMeasurementProtocolSecretRequest, dict]]):
The request object. Request message for
CreateMeasurementProtocolSecret RPC
parent (:class:`str`):
Required. The parent resource where
this secret will be created. Format:
properties/{property}/dataStreams/{dataStream}
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
measurement_protocol_secret (:class:`google.analytics.admin_v1alpha.types.MeasurementProtocolSecret`):
Required. The measurement protocol
secret to create.
This corresponds to the ``measurement_protocol_secret`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.MeasurementProtocolSecret:
A secret value used for sending hits
to Measurement Protocol.
"""
# 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.
flattened_params = [parent, measurement_protocol_secret]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.CreateMeasurementProtocolSecretRequest
):
request = analytics_admin.CreateMeasurementProtocolSecretRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
if measurement_protocol_secret is not None:
request.measurement_protocol_secret = measurement_protocol_secret
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.create_measurement_protocol_secret
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# 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
[docs] async def delete_measurement_protocol_secret(
self,
request: Optional[
Union[analytics_admin.DeleteMeasurementProtocolSecretRequest, dict]
] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> None:
r"""Deletes target MeasurementProtocolSecret.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteMeasurementProtocolSecretRequest, dict]]):
The request object. Request message for
DeleteMeasurementProtocolSecret RPC
name (:class:`str`):
Required. The name of the
MeasurementProtocolSecret to delete.
Format:
properties/{property}/dataStreams/{dataStream}/measurementProtocolSecrets/{measurementProtocolSecret}
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.DeleteMeasurementProtocolSecretRequest
):
request = analytics_admin.DeleteMeasurementProtocolSecretRequest(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.delete_measurement_protocol_secret
]
# 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.
await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
[docs] async def update_measurement_protocol_secret(
self,
request: Optional[
Union[analytics_admin.UpdateMeasurementProtocolSecretRequest, dict]
] = None,
*,
measurement_protocol_secret: Optional[
resources.MeasurementProtocolSecret
] = None,
update_mask: Optional[field_mask_pb2.FieldMask] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.MeasurementProtocolSecret:
r"""Updates a measurement protocol secret.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateMeasurementProtocolSecretRequest, dict]]):
The request object. Request message for
UpdateMeasurementProtocolSecret RPC
measurement_protocol_secret (:class:`google.analytics.admin_v1alpha.types.MeasurementProtocolSecret`):
Required. The measurement protocol
secret to update.
This corresponds to the ``measurement_protocol_secret`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
Required. The list of fields to be
updated. Omitted fields will not be
updated.
This corresponds to the ``update_mask`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.MeasurementProtocolSecret:
A secret value used for sending hits
to Measurement Protocol.
"""
# 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.
flattened_params = [measurement_protocol_secret, update_mask]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.UpdateMeasurementProtocolSecretRequest
):
request = analytics_admin.UpdateMeasurementProtocolSecretRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if measurement_protocol_secret is not None:
request.measurement_protocol_secret = measurement_protocol_secret
if update_mask is not None:
request.update_mask = update_mask
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.update_measurement_protocol_secret
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(
(
(
"measurement_protocol_secret.name",
request.measurement_protocol_secret.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
[docs] async def acknowledge_user_data_collection(
self,
request: Optional[
Union[analytics_admin.AcknowledgeUserDataCollectionRequest, dict]
] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> analytics_admin.AcknowledgeUserDataCollectionResponse:
r"""Acknowledges the terms of user data collection for
the specified property.
This acknowledgement must be completed (either in the
Google Analytics UI or through this API) before
MeasurementProtocolSecret resources may be created.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.AcknowledgeUserDataCollectionRequest, dict]]):
The request object. Request message for
AcknowledgeUserDataCollection RPC.
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.AcknowledgeUserDataCollectionResponse:
Response message for
AcknowledgeUserDataCollection RPC.
"""
# Create or coerce a protobuf request object.
# - 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_admin.AcknowledgeUserDataCollectionRequest
):
request = analytics_admin.AcknowledgeUserDataCollectionRequest(request)
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.acknowledge_user_data_collection
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("property", request.property),)),
)
# 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
[docs] async def get_sk_ad_network_conversion_value_schema(
self,
request: Optional[
Union[analytics_admin.GetSKAdNetworkConversionValueSchemaRequest, dict]
] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.SKAdNetworkConversionValueSchema:
r"""Looks up a single SKAdNetworkConversionValueSchema.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.GetSKAdNetworkConversionValueSchemaRequest, dict]]):
The request object. Request message for
GetSKAdNetworkConversionValueSchema RPC.
name (:class:`str`):
Required. The resource name of SKAdNetwork conversion
value schema to look up. Format:
properties/{property}/dataStreams/{dataStream}/sKAdNetworkConversionValueSchema/{skadnetwork_conversion_value_schema}
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.SKAdNetworkConversionValueSchema:
SKAdNetwork conversion value schema
of an iOS stream.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.GetSKAdNetworkConversionValueSchemaRequest
):
request = analytics_admin.GetSKAdNetworkConversionValueSchemaRequest(
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_sk_ad_network_conversion_value_schema
]
# 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
[docs] async def create_sk_ad_network_conversion_value_schema(
self,
request: Optional[
Union[analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest, dict]
] = None,
*,
parent: Optional[str] = None,
skadnetwork_conversion_value_schema: Optional[
resources.SKAdNetworkConversionValueSchema
] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.SKAdNetworkConversionValueSchema:
r"""Creates a SKAdNetworkConversionValueSchema.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.CreateSKAdNetworkConversionValueSchemaRequest, dict]]):
The request object. Request message for
CreateSKAdNetworkConversionValueSchema
RPC.
parent (:class:`str`):
Required. The parent resource where
this schema will be created. Format:
properties/{property}/dataStreams/{dataStream}
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
skadnetwork_conversion_value_schema (:class:`google.analytics.admin_v1alpha.types.SKAdNetworkConversionValueSchema`):
Required. SKAdNetwork conversion
value schema to create.
This corresponds to the ``skadnetwork_conversion_value_schema`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.SKAdNetworkConversionValueSchema:
SKAdNetwork conversion value schema
of an iOS stream.
"""
# 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.
flattened_params = [parent, skadnetwork_conversion_value_schema]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.CreateSKAdNetworkConversionValueSchemaRequest
):
request = analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest(
request
)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
if skadnetwork_conversion_value_schema is not None:
request.skadnetwork_conversion_value_schema = (
skadnetwork_conversion_value_schema
)
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.create_sk_ad_network_conversion_value_schema
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# 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
[docs] async def delete_sk_ad_network_conversion_value_schema(
self,
request: Optional[
Union[analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest, dict]
] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> None:
r"""Deletes target SKAdNetworkConversionValueSchema.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteSKAdNetworkConversionValueSchemaRequest, dict]]):
The request object. Request message for
DeleteSKAdNetworkConversionValueSchema
RPC.
name (:class:`str`):
Required. The name of the
SKAdNetworkConversionValueSchema to delete. Format:
properties/{property}/dataStreams/{dataStream}/sKAdNetworkConversionValueSchema/{skadnetwork_conversion_value_schema}
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.DeleteSKAdNetworkConversionValueSchemaRequest
):
request = analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest(
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.delete_sk_ad_network_conversion_value_schema
]
# 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.
await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
[docs] async def update_sk_ad_network_conversion_value_schema(
self,
request: Optional[
Union[analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest, dict]
] = None,
*,
skadnetwork_conversion_value_schema: Optional[
resources.SKAdNetworkConversionValueSchema
] = None,
update_mask: Optional[field_mask_pb2.FieldMask] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.SKAdNetworkConversionValueSchema:
r"""Updates a SKAdNetworkConversionValueSchema.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateSKAdNetworkConversionValueSchemaRequest, dict]]):
The request object. Request message for
UpdateSKAdNetworkConversionValueSchema
RPC.
skadnetwork_conversion_value_schema (:class:`google.analytics.admin_v1alpha.types.SKAdNetworkConversionValueSchema`):
Required. SKAdNetwork conversion
value schema to update.
This corresponds to the ``skadnetwork_conversion_value_schema`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
Required. The list of fields to be
updated. Omitted fields will not be
updated.
This corresponds to the ``update_mask`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.SKAdNetworkConversionValueSchema:
SKAdNetwork conversion value schema
of an iOS stream.
"""
# 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.
flattened_params = [skadnetwork_conversion_value_schema, update_mask]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.UpdateSKAdNetworkConversionValueSchemaRequest
):
request = analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest(
request
)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if skadnetwork_conversion_value_schema is not None:
request.skadnetwork_conversion_value_schema = (
skadnetwork_conversion_value_schema
)
if update_mask is not None:
request.update_mask = update_mask
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.update_sk_ad_network_conversion_value_schema
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(
(
(
"skadnetwork_conversion_value_schema.name",
request.skadnetwork_conversion_value_schema.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
[docs] async def list_sk_ad_network_conversion_value_schemas(
self,
request: Optional[
Union[analytics_admin.ListSKAdNetworkConversionValueSchemasRequest, dict]
] = None,
*,
parent: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> pagers.ListSKAdNetworkConversionValueSchemasAsyncPager:
r"""Lists SKAdNetworkConversionValueSchema on a stream.
Properties can have at most one
SKAdNetworkConversionValueSchema.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.ListSKAdNetworkConversionValueSchemasRequest, dict]]):
The request object. Request message for
ListSKAdNetworkConversionValueSchemas
RPC
parent (:class:`str`):
Required. The DataStream resource to list schemas for.
Format:
properties/{property_id}/dataStreams/{dataStream}
Example: properties/1234/dataStreams/5678
This corresponds to the ``parent`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListSKAdNetworkConversionValueSchemasAsyncPager:
Response message for
ListSKAdNetworkConversionValueSchemas
RPC Iterating over this object will
yield results and resolve additional
pages automatically.
"""
# 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.
flattened_params = [parent]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.ListSKAdNetworkConversionValueSchemasRequest
):
request = analytics_admin.ListSKAdNetworkConversionValueSchemasRequest(
request
)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.list_sk_ad_network_conversion_value_schemas
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# Validate the universe domain.
self._client._validate_universe_domain()
# Send the request.
response = await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# This method is paged; wrap the response in a pager, which provides
# an `__aiter__` convenience method.
response = pagers.ListSKAdNetworkConversionValueSchemasAsyncPager(
method=rpc,
request=request,
response=response,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# Done; return the response.
return response
[docs] async def search_change_history_events(
self,
request: Optional[
Union[analytics_admin.SearchChangeHistoryEventsRequest, dict]
] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> pagers.SearchChangeHistoryEventsAsyncPager:
r"""Searches through all changes to an account or its
children given the specified set of filters.
Only returns the subset of changes supported by the API.
The UI may return additional changes.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.SearchChangeHistoryEventsRequest, dict]]):
The request object. Request message for
SearchChangeHistoryEvents RPC.
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.SearchChangeHistoryEventsAsyncPager:
Response message for SearchAccounts
RPC.
Iterating over this object will yield
results and resolve additional pages
automatically.
"""
# Create or coerce a protobuf request object.
# - 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_admin.SearchChangeHistoryEventsRequest):
request = analytics_admin.SearchChangeHistoryEventsRequest(request)
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.search_change_history_events
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("account", request.account),)),
)
# Validate the universe domain.
self._client._validate_universe_domain()
# Send the request.
response = await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# This method is paged; wrap the response in a pager, which provides
# an `__aiter__` convenience method.
response = pagers.SearchChangeHistoryEventsAsyncPager(
method=rpc,
request=request,
response=response,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# Done; return the response.
return response
[docs] async def get_google_signals_settings(
self,
request: Optional[
Union[analytics_admin.GetGoogleSignalsSettingsRequest, dict]
] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.GoogleSignalsSettings:
r"""Lookup for Google Signals settings for a property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.GetGoogleSignalsSettingsRequest, dict]]):
The request object. Request message for
GetGoogleSignalsSettings RPC
name (:class:`str`):
Required. The name of the google
signals settings to retrieve. Format:
properties/{property}/googleSignalsSettings
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.GoogleSignalsSettings:
Settings values for Google Signals.
This is a singleton resource.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.GetGoogleSignalsSettingsRequest):
request = analytics_admin.GetGoogleSignalsSettingsRequest(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_google_signals_settings
]
# 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
[docs] async def update_google_signals_settings(
self,
request: Optional[
Union[analytics_admin.UpdateGoogleSignalsSettingsRequest, dict]
] = None,
*,
google_signals_settings: Optional[resources.GoogleSignalsSettings] = None,
update_mask: Optional[field_mask_pb2.FieldMask] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.GoogleSignalsSettings:
r"""Updates Google Signals settings for a property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateGoogleSignalsSettingsRequest, dict]]):
The request object. Request message for
UpdateGoogleSignalsSettings RPC
google_signals_settings (:class:`google.analytics.admin_v1alpha.types.GoogleSignalsSettings`):
Required. The settings to update. The ``name`` field is
used to identify the settings to be updated.
This corresponds to the ``google_signals_settings`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
Required. The list of fields to be updated. Field names
must be in snake case (e.g., "field_to_update"). Omitted
fields will not be updated. To replace the entire
entity, use one path with the string "*" to match all
fields.
This corresponds to the ``update_mask`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.GoogleSignalsSettings:
Settings values for Google Signals.
This is a singleton resource.
"""
# 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.
flattened_params = [google_signals_settings, update_mask]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.UpdateGoogleSignalsSettingsRequest):
request = analytics_admin.UpdateGoogleSignalsSettingsRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if google_signals_settings is not None:
request.google_signals_settings = google_signals_settings
if update_mask is not None:
request.update_mask = update_mask
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.update_google_signals_settings
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(
(
(
"google_signals_settings.name",
request.google_signals_settings.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
[docs] async def create_conversion_event(
self,
request: Optional[
Union[analytics_admin.CreateConversionEventRequest, dict]
] = None,
*,
parent: Optional[str] = None,
conversion_event: Optional[resources.ConversionEvent] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.ConversionEvent:
r"""Deprecated: Use ``CreateKeyEvent`` instead. Creates a conversion
event with the specified attributes.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.CreateConversionEventRequest, dict]]):
The request object. Request message for
CreateConversionEvent RPC
parent (:class:`str`):
Required. The resource name of the
parent property where this conversion
event will be created. Format:
properties/123
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
conversion_event (:class:`google.analytics.admin_v1alpha.types.ConversionEvent`):
Required. The conversion event to
create.
This corresponds to the ``conversion_event`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.ConversionEvent:
A conversion event in a Google
Analytics property.
"""
warnings.warn(
"AnalyticsAdminServiceAsyncClient.create_conversion_event is deprecated",
DeprecationWarning,
)
# 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.
flattened_params = [parent, conversion_event]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.CreateConversionEventRequest):
request = analytics_admin.CreateConversionEventRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
if conversion_event is not None:
request.conversion_event = conversion_event
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.create_conversion_event
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# 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
[docs] async def update_conversion_event(
self,
request: Optional[
Union[analytics_admin.UpdateConversionEventRequest, dict]
] = None,
*,
conversion_event: Optional[resources.ConversionEvent] = None,
update_mask: Optional[field_mask_pb2.FieldMask] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.ConversionEvent:
r"""Deprecated: Use ``UpdateKeyEvent`` instead. Updates a conversion
event with the specified attributes.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateConversionEventRequest, dict]]):
The request object. Request message for
UpdateConversionEvent RPC
conversion_event (:class:`google.analytics.admin_v1alpha.types.ConversionEvent`):
Required. The conversion event to update. The ``name``
field is used to identify the settings to be updated.
This corresponds to the ``conversion_event`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
Required. The list of fields to be updated. Field names
must be in snake case (e.g., "field_to_update"). Omitted
fields will not be updated. To replace the entire
entity, use one path with the string "*" to match all
fields.
This corresponds to the ``update_mask`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.ConversionEvent:
A conversion event in a Google
Analytics property.
"""
warnings.warn(
"AnalyticsAdminServiceAsyncClient.update_conversion_event is deprecated",
DeprecationWarning,
)
# 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.
flattened_params = [conversion_event, update_mask]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.UpdateConversionEventRequest):
request = analytics_admin.UpdateConversionEventRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if conversion_event is not None:
request.conversion_event = conversion_event
if update_mask is not None:
request.update_mask = update_mask
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.update_conversion_event
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(
(("conversion_event.name", request.conversion_event.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
[docs] async def get_conversion_event(
self,
request: Optional[
Union[analytics_admin.GetConversionEventRequest, dict]
] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.ConversionEvent:
r"""Deprecated: Use ``GetKeyEvent`` instead. Retrieve a single
conversion event.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.GetConversionEventRequest, dict]]):
The request object. Request message for
GetConversionEvent RPC
name (:class:`str`):
Required. The resource name of the conversion event to
retrieve. Format:
properties/{property}/conversionEvents/{conversion_event}
Example: "properties/123/conversionEvents/456"
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.ConversionEvent:
A conversion event in a Google
Analytics property.
"""
warnings.warn(
"AnalyticsAdminServiceAsyncClient.get_conversion_event is deprecated",
DeprecationWarning,
)
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.GetConversionEventRequest):
request = analytics_admin.GetConversionEventRequest(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_conversion_event
]
# 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
[docs] async def delete_conversion_event(
self,
request: Optional[
Union[analytics_admin.DeleteConversionEventRequest, dict]
] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> None:
r"""Deprecated: Use ``DeleteKeyEvent`` instead. Deletes a conversion
event in a property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteConversionEventRequest, dict]]):
The request object. Request message for
DeleteConversionEvent RPC
name (:class:`str`):
Required. The resource name of the conversion event to
delete. Format:
properties/{property}/conversionEvents/{conversion_event}
Example: "properties/123/conversionEvents/456"
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
"""
warnings.warn(
"AnalyticsAdminServiceAsyncClient.delete_conversion_event is deprecated",
DeprecationWarning,
)
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.DeleteConversionEventRequest):
request = analytics_admin.DeleteConversionEventRequest(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.delete_conversion_event
]
# 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.
await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
[docs] async def list_conversion_events(
self,
request: Optional[
Union[analytics_admin.ListConversionEventsRequest, dict]
] = None,
*,
parent: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> pagers.ListConversionEventsAsyncPager:
r"""Deprecated: Use ``ListKeyEvents`` instead. Returns a list of
conversion events in the specified parent property.
Returns an empty list if no conversion events are found.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.ListConversionEventsRequest, dict]]):
The request object. Request message for
ListConversionEvents RPC
parent (:class:`str`):
Required. The resource name of the
parent property. Example:
'properties/123'
This corresponds to the ``parent`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListConversionEventsAsyncPager:
Response message for
ListConversionEvents RPC.
Iterating over this object will yield
results and resolve additional pages
automatically.
"""
warnings.warn(
"AnalyticsAdminServiceAsyncClient.list_conversion_events is deprecated",
DeprecationWarning,
)
# 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.
flattened_params = [parent]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.ListConversionEventsRequest):
request = analytics_admin.ListConversionEventsRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.list_conversion_events
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# Validate the universe domain.
self._client._validate_universe_domain()
# Send the request.
response = await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# This method is paged; wrap the response in a pager, which provides
# an `__aiter__` convenience method.
response = pagers.ListConversionEventsAsyncPager(
method=rpc,
request=request,
response=response,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# Done; return the response.
return response
[docs] async def create_key_event(
self,
request: Optional[Union[analytics_admin.CreateKeyEventRequest, dict]] = None,
*,
parent: Optional[str] = None,
key_event: Optional[resources.KeyEvent] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.KeyEvent:
r"""Creates a Key Event.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.CreateKeyEventRequest, dict]]):
The request object. Request message for CreateKeyEvent
RPC
parent (:class:`str`):
Required. The resource name of the
parent property where this Key Event
will be created. Format: properties/123
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
key_event (:class:`google.analytics.admin_v1alpha.types.KeyEvent`):
Required. The Key Event to create.
This corresponds to the ``key_event`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.KeyEvent:
A key event in a Google Analytics
property.
"""
# 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.
flattened_params = [parent, key_event]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.CreateKeyEventRequest):
request = analytics_admin.CreateKeyEventRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
if key_event is not None:
request.key_event = key_event
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.create_key_event
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# 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
[docs] async def update_key_event(
self,
request: Optional[Union[analytics_admin.UpdateKeyEventRequest, dict]] = None,
*,
key_event: Optional[resources.KeyEvent] = None,
update_mask: Optional[field_mask_pb2.FieldMask] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.KeyEvent:
r"""Updates a Key Event.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateKeyEventRequest, dict]]):
The request object. Request message for UpdateKeyEvent
RPC
key_event (:class:`google.analytics.admin_v1alpha.types.KeyEvent`):
Required. The Key Event to update. The ``name`` field is
used to identify the settings to be updated.
This corresponds to the ``key_event`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
Required. The list of fields to be updated. Field names
must be in snake case (e.g., "field_to_update"). Omitted
fields will not be updated. To replace the entire
entity, use one path with the string "*" to match all
fields.
This corresponds to the ``update_mask`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.KeyEvent:
A key event in a Google Analytics
property.
"""
# 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.
flattened_params = [key_event, update_mask]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.UpdateKeyEventRequest):
request = analytics_admin.UpdateKeyEventRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if key_event is not None:
request.key_event = key_event
if update_mask is not None:
request.update_mask = update_mask
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.update_key_event
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(
(("key_event.name", request.key_event.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
[docs] async def get_key_event(
self,
request: Optional[Union[analytics_admin.GetKeyEventRequest, dict]] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.KeyEvent:
r"""Retrieve a single Key Event.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.GetKeyEventRequest, dict]]):
The request object. Request message for GetKeyEvent RPC
name (:class:`str`):
Required. The resource name of the Key Event to
retrieve. Format:
properties/{property}/keyEvents/{key_event} Example:
"properties/123/keyEvents/456"
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.KeyEvent:
A key event in a Google Analytics
property.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.GetKeyEventRequest):
request = analytics_admin.GetKeyEventRequest(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_key_event
]
# 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
[docs] async def delete_key_event(
self,
request: Optional[Union[analytics_admin.DeleteKeyEventRequest, dict]] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> None:
r"""Deletes a Key Event.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteKeyEventRequest, dict]]):
The request object. Request message for DeleteKeyEvent
RPC
name (:class:`str`):
Required. The resource name of the Key Event to delete.
Format: properties/{property}/keyEvents/{key_event}
Example: "properties/123/keyEvents/456"
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.DeleteKeyEventRequest):
request = analytics_admin.DeleteKeyEventRequest(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.delete_key_event
]
# 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.
await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
[docs] async def list_key_events(
self,
request: Optional[Union[analytics_admin.ListKeyEventsRequest, dict]] = None,
*,
parent: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> pagers.ListKeyEventsAsyncPager:
r"""Returns a list of Key Events in the specified parent
property. Returns an empty list if no Key Events are
found.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.ListKeyEventsRequest, dict]]):
The request object. Request message for ListKeyEvents RPC
parent (:class:`str`):
Required. The resource name of the
parent property. Example:
'properties/123'
This corresponds to the ``parent`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListKeyEventsAsyncPager:
Response message for ListKeyEvents
RPC.
Iterating over this object will yield
results and resolve additional pages
automatically.
"""
# 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.
flattened_params = [parent]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.ListKeyEventsRequest):
request = analytics_admin.ListKeyEventsRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.list_key_events
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# Validate the universe domain.
self._client._validate_universe_domain()
# Send the request.
response = await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# This method is paged; wrap the response in a pager, which provides
# an `__aiter__` convenience method.
response = pagers.ListKeyEventsAsyncPager(
method=rpc,
request=request,
response=response,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# Done; return the response.
return response
[docs] async def get_display_video360_advertiser_link(
self,
request: Optional[
Union[analytics_admin.GetDisplayVideo360AdvertiserLinkRequest, dict]
] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.DisplayVideo360AdvertiserLink:
r"""Look up a single DisplayVideo360AdvertiserLink
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.GetDisplayVideo360AdvertiserLinkRequest, dict]]):
The request object. Request message for
GetDisplayVideo360AdvertiserLink RPC.
name (:class:`str`):
Required. The name of the
DisplayVideo360AdvertiserLink to get.
Example format:
properties/1234/displayVideo360AdvertiserLink/5678
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink:
A link between a Google Analytics
property and a Display & Video 360
advertiser.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.GetDisplayVideo360AdvertiserLinkRequest
):
request = analytics_admin.GetDisplayVideo360AdvertiserLinkRequest(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_display_video360_advertiser_link
]
# 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
[docs] async def list_display_video360_advertiser_links(
self,
request: Optional[
Union[analytics_admin.ListDisplayVideo360AdvertiserLinksRequest, dict]
] = None,
*,
parent: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> pagers.ListDisplayVideo360AdvertiserLinksAsyncPager:
r"""Lists all DisplayVideo360AdvertiserLinks on a
property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.ListDisplayVideo360AdvertiserLinksRequest, dict]]):
The request object. Request message for
ListDisplayVideo360AdvertiserLinks RPC.
parent (:class:`str`):
Required. Example format:
properties/1234
This corresponds to the ``parent`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListDisplayVideo360AdvertiserLinksAsyncPager:
Response message for
ListDisplayVideo360AdvertiserLinks RPC.
Iterating over this object will yield
results and resolve additional pages
automatically.
"""
# 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.
flattened_params = [parent]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.ListDisplayVideo360AdvertiserLinksRequest
):
request = analytics_admin.ListDisplayVideo360AdvertiserLinksRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.list_display_video360_advertiser_links
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# Validate the universe domain.
self._client._validate_universe_domain()
# Send the request.
response = await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# This method is paged; wrap the response in a pager, which provides
# an `__aiter__` convenience method.
response = pagers.ListDisplayVideo360AdvertiserLinksAsyncPager(
method=rpc,
request=request,
response=response,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# Done; return the response.
return response
[docs] async def create_display_video360_advertiser_link(
self,
request: Optional[
Union[analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest, dict]
] = None,
*,
parent: Optional[str] = None,
display_video_360_advertiser_link: Optional[
resources.DisplayVideo360AdvertiserLink
] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.DisplayVideo360AdvertiserLink:
r"""Creates a DisplayVideo360AdvertiserLink.
This can only be utilized by users who have proper
authorization both on the Google Analytics property and
on the Display & Video 360 advertiser. Users who do not
have access to the Display & Video 360 advertiser should
instead seek to create a DisplayVideo360LinkProposal.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.CreateDisplayVideo360AdvertiserLinkRequest, dict]]):
The request object. Request message for
CreateDisplayVideo360AdvertiserLink RPC.
parent (:class:`str`):
Required. Example format:
properties/1234
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
display_video_360_advertiser_link (:class:`google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink`):
Required. The
DisplayVideo360AdvertiserLink to create.
This corresponds to the ``display_video_360_advertiser_link`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink:
A link between a Google Analytics
property and a Display & Video 360
advertiser.
"""
# 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.
flattened_params = [parent, display_video_360_advertiser_link]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.CreateDisplayVideo360AdvertiserLinkRequest
):
request = analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest(
request
)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
if display_video_360_advertiser_link is not None:
request.display_video_360_advertiser_link = (
display_video_360_advertiser_link
)
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.create_display_video360_advertiser_link
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# 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
[docs] async def delete_display_video360_advertiser_link(
self,
request: Optional[
Union[analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest, dict]
] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> None:
r"""Deletes a DisplayVideo360AdvertiserLink on a
property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteDisplayVideo360AdvertiserLinkRequest, dict]]):
The request object. Request message for
DeleteDisplayVideo360AdvertiserLink RPC.
name (:class:`str`):
Required. The name of the
DisplayVideo360AdvertiserLink to delete.
Example format:
properties/1234/displayVideo360AdvertiserLinks/5678
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.DeleteDisplayVideo360AdvertiserLinkRequest
):
request = analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest(
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.delete_display_video360_advertiser_link
]
# 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.
await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
[docs] async def update_display_video360_advertiser_link(
self,
request: Optional[
Union[analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest, dict]
] = None,
*,
display_video_360_advertiser_link: Optional[
resources.DisplayVideo360AdvertiserLink
] = None,
update_mask: Optional[field_mask_pb2.FieldMask] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.DisplayVideo360AdvertiserLink:
r"""Updates a DisplayVideo360AdvertiserLink on a
property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateDisplayVideo360AdvertiserLinkRequest, dict]]):
The request object. Request message for
UpdateDisplayVideo360AdvertiserLink RPC.
display_video_360_advertiser_link (:class:`google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink`):
The DisplayVideo360AdvertiserLink to
update
This corresponds to the ``display_video_360_advertiser_link`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
Required. The list of fields to be updated. Omitted
fields will not be updated. To replace the entire
entity, use one path with the string "*" to match all
fields.
This corresponds to the ``update_mask`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink:
A link between a Google Analytics
property and a Display & Video 360
advertiser.
"""
# 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.
flattened_params = [display_video_360_advertiser_link, update_mask]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.UpdateDisplayVideo360AdvertiserLinkRequest
):
request = analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest(
request
)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if display_video_360_advertiser_link is not None:
request.display_video_360_advertiser_link = (
display_video_360_advertiser_link
)
if update_mask is not None:
request.update_mask = update_mask
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.update_display_video360_advertiser_link
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(
(
(
"display_video_360_advertiser_link.name",
request.display_video_360_advertiser_link.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
[docs] async def get_display_video360_advertiser_link_proposal(
self,
request: Optional[
Union[analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest, dict]
] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.DisplayVideo360AdvertiserLinkProposal:
r"""Lookup for a single
DisplayVideo360AdvertiserLinkProposal.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.GetDisplayVideo360AdvertiserLinkProposalRequest, dict]]):
The request object. Request message for
GetDisplayVideo360AdvertiserLinkProposal
RPC.
name (:class:`str`):
Required. The name of the
DisplayVideo360AdvertiserLinkProposal to
get. Example format:
properties/1234/displayVideo360AdvertiserLinkProposals/5678
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLinkProposal:
A proposal for a link between a
Google Analytics property and a Display
& Video 360 advertiser.
A proposal is converted to a
DisplayVideo360AdvertiserLink once
approved. Google Analytics admins
approve inbound proposals while Display
& Video 360 admins approve outbound
proposals.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.GetDisplayVideo360AdvertiserLinkProposalRequest
):
request = analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest(
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_display_video360_advertiser_link_proposal
]
# 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
[docs] async def list_display_video360_advertiser_link_proposals(
self,
request: Optional[
Union[
analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest, dict
]
] = None,
*,
parent: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> pagers.ListDisplayVideo360AdvertiserLinkProposalsAsyncPager:
r"""Lists DisplayVideo360AdvertiserLinkProposals on a
property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.ListDisplayVideo360AdvertiserLinkProposalsRequest, dict]]):
The request object. Request message for
ListDisplayVideo360AdvertiserLinkProposals
RPC.
parent (:class:`str`):
Required. Example format:
properties/1234
This corresponds to the ``parent`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListDisplayVideo360AdvertiserLinkProposalsAsyncPager:
Response message for
ListDisplayVideo360AdvertiserLinkProposals
RPC. Iterating over this object will
yield results and resolve additional
pages automatically.
"""
# 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.
flattened_params = [parent]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest
):
request = analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest(
request
)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.list_display_video360_advertiser_link_proposals
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# Validate the universe domain.
self._client._validate_universe_domain()
# Send the request.
response = await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# This method is paged; wrap the response in a pager, which provides
# an `__aiter__` convenience method.
response = pagers.ListDisplayVideo360AdvertiserLinkProposalsAsyncPager(
method=rpc,
request=request,
response=response,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# Done; return the response.
return response
[docs] async def create_display_video360_advertiser_link_proposal(
self,
request: Optional[
Union[
analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest, dict
]
] = None,
*,
parent: Optional[str] = None,
display_video_360_advertiser_link_proposal: Optional[
resources.DisplayVideo360AdvertiserLinkProposal
] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.DisplayVideo360AdvertiserLinkProposal:
r"""Creates a DisplayVideo360AdvertiserLinkProposal.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.CreateDisplayVideo360AdvertiserLinkProposalRequest, dict]]):
The request object. Request message for
CreateDisplayVideo360AdvertiserLinkProposal
RPC.
parent (:class:`str`):
Required. Example format:
properties/1234
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
display_video_360_advertiser_link_proposal (:class:`google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLinkProposal`):
Required. The
DisplayVideo360AdvertiserLinkProposal to
create.
This corresponds to the ``display_video_360_advertiser_link_proposal`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLinkProposal:
A proposal for a link between a
Google Analytics property and a Display
& Video 360 advertiser.
A proposal is converted to a
DisplayVideo360AdvertiserLink once
approved. Google Analytics admins
approve inbound proposals while Display
& Video 360 admins approve outbound
proposals.
"""
# 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.
flattened_params = [parent, display_video_360_advertiser_link_proposal]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest
):
request = (
analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest(
request
)
)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
if display_video_360_advertiser_link_proposal is not None:
request.display_video_360_advertiser_link_proposal = (
display_video_360_advertiser_link_proposal
)
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.create_display_video360_advertiser_link_proposal
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# 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
[docs] async def delete_display_video360_advertiser_link_proposal(
self,
request: Optional[
Union[
analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest, dict
]
] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> None:
r"""Deletes a DisplayVideo360AdvertiserLinkProposal on a
property. This can only be used on cancelled proposals.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteDisplayVideo360AdvertiserLinkProposalRequest, dict]]):
The request object. Request message for
DeleteDisplayVideo360AdvertiserLinkProposal
RPC.
name (:class:`str`):
Required. The name of the
DisplayVideo360AdvertiserLinkProposal to
delete. Example format:
properties/1234/displayVideo360AdvertiserLinkProposals/5678
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest
):
request = (
analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest(
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.delete_display_video360_advertiser_link_proposal
]
# 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.
await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
[docs] async def approve_display_video360_advertiser_link_proposal(
self,
request: Optional[
Union[
analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest,
dict,
]
] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalResponse:
r"""Approves a DisplayVideo360AdvertiserLinkProposal.
The DisplayVideo360AdvertiserLinkProposal will be
deleted and a new DisplayVideo360AdvertiserLink will be
created.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.ApproveDisplayVideo360AdvertiserLinkProposalRequest, dict]]):
The request object. Request message for
ApproveDisplayVideo360AdvertiserLinkProposal
RPC.
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.ApproveDisplayVideo360AdvertiserLinkProposalResponse:
Response message for
ApproveDisplayVideo360AdvertiserLinkProposal
RPC.
"""
# Create or coerce a protobuf request object.
# - 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_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest
):
request = (
analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest(
request
)
)
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.approve_display_video360_advertiser_link_proposal
]
# 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
[docs] async def cancel_display_video360_advertiser_link_proposal(
self,
request: Optional[
Union[
analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest, dict
]
] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.DisplayVideo360AdvertiserLinkProposal:
r"""Cancels a DisplayVideo360AdvertiserLinkProposal.
Cancelling can mean either:
- Declining a proposal initiated from Display & Video
360
- Withdrawing a proposal initiated from Google Analytics
After being cancelled, a proposal will eventually be
deleted automatically.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.CancelDisplayVideo360AdvertiserLinkProposalRequest, dict]]):
The request object. Request message for
CancelDisplayVideo360AdvertiserLinkProposal
RPC.
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLinkProposal:
A proposal for a link between a
Google Analytics property and a Display
& Video 360 advertiser.
A proposal is converted to a
DisplayVideo360AdvertiserLink once
approved. Google Analytics admins
approve inbound proposals while Display
& Video 360 admins approve outbound
proposals.
"""
# Create or coerce a protobuf request object.
# - 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_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest
):
request = (
analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest(
request
)
)
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.cancel_display_video360_advertiser_link_proposal
]
# 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
[docs] async def create_custom_dimension(
self,
request: Optional[
Union[analytics_admin.CreateCustomDimensionRequest, dict]
] = None,
*,
parent: Optional[str] = None,
custom_dimension: Optional[resources.CustomDimension] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.CustomDimension:
r"""Creates a CustomDimension.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.CreateCustomDimensionRequest, dict]]):
The request object. Request message for
CreateCustomDimension RPC.
parent (:class:`str`):
Required. Example format:
properties/1234
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
custom_dimension (:class:`google.analytics.admin_v1alpha.types.CustomDimension`):
Required. The CustomDimension to
create.
This corresponds to the ``custom_dimension`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.CustomDimension:
A definition for a CustomDimension.
"""
# 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.
flattened_params = [parent, custom_dimension]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.CreateCustomDimensionRequest):
request = analytics_admin.CreateCustomDimensionRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
if custom_dimension is not None:
request.custom_dimension = custom_dimension
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.create_custom_dimension
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# 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
[docs] async def update_custom_dimension(
self,
request: Optional[
Union[analytics_admin.UpdateCustomDimensionRequest, dict]
] = None,
*,
custom_dimension: Optional[resources.CustomDimension] = None,
update_mask: Optional[field_mask_pb2.FieldMask] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.CustomDimension:
r"""Updates a CustomDimension on a property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateCustomDimensionRequest, dict]]):
The request object. Request message for
UpdateCustomDimension RPC.
custom_dimension (:class:`google.analytics.admin_v1alpha.types.CustomDimension`):
The CustomDimension to update
This corresponds to the ``custom_dimension`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
Required. The list of fields to be updated. Omitted
fields will not be updated. To replace the entire
entity, use one path with the string "*" to match all
fields.
This corresponds to the ``update_mask`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.CustomDimension:
A definition for a CustomDimension.
"""
# 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.
flattened_params = [custom_dimension, update_mask]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.UpdateCustomDimensionRequest):
request = analytics_admin.UpdateCustomDimensionRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if custom_dimension is not None:
request.custom_dimension = custom_dimension
if update_mask is not None:
request.update_mask = update_mask
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.update_custom_dimension
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(
(("custom_dimension.name", request.custom_dimension.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
[docs] async def list_custom_dimensions(
self,
request: Optional[
Union[analytics_admin.ListCustomDimensionsRequest, dict]
] = None,
*,
parent: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> pagers.ListCustomDimensionsAsyncPager:
r"""Lists CustomDimensions on a property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.ListCustomDimensionsRequest, dict]]):
The request object. Request message for
ListCustomDimensions RPC.
parent (:class:`str`):
Required. Example format:
properties/1234
This corresponds to the ``parent`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListCustomDimensionsAsyncPager:
Response message for
ListCustomDimensions RPC.
Iterating over this object will yield
results and resolve additional pages
automatically.
"""
# 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.
flattened_params = [parent]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.ListCustomDimensionsRequest):
request = analytics_admin.ListCustomDimensionsRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.list_custom_dimensions
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# Validate the universe domain.
self._client._validate_universe_domain()
# Send the request.
response = await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# This method is paged; wrap the response in a pager, which provides
# an `__aiter__` convenience method.
response = pagers.ListCustomDimensionsAsyncPager(
method=rpc,
request=request,
response=response,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# Done; return the response.
return response
[docs] async def archive_custom_dimension(
self,
request: Optional[
Union[analytics_admin.ArchiveCustomDimensionRequest, dict]
] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> None:
r"""Archives a CustomDimension on a property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.ArchiveCustomDimensionRequest, dict]]):
The request object. Request message for
ArchiveCustomDimension RPC.
name (:class:`str`):
Required. The name of the
CustomDimension to archive. Example
format:
properties/1234/customDimensions/5678
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.ArchiveCustomDimensionRequest):
request = analytics_admin.ArchiveCustomDimensionRequest(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.archive_custom_dimension
]
# 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.
await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
[docs] async def get_custom_dimension(
self,
request: Optional[
Union[analytics_admin.GetCustomDimensionRequest, dict]
] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.CustomDimension:
r"""Lookup for a single CustomDimension.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.GetCustomDimensionRequest, dict]]):
The request object. Request message for
GetCustomDimension RPC.
name (:class:`str`):
Required. The name of the
CustomDimension to get. Example format:
properties/1234/customDimensions/5678
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.CustomDimension:
A definition for a CustomDimension.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.GetCustomDimensionRequest):
request = analytics_admin.GetCustomDimensionRequest(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_custom_dimension
]
# 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
[docs] async def create_custom_metric(
self,
request: Optional[
Union[analytics_admin.CreateCustomMetricRequest, dict]
] = None,
*,
parent: Optional[str] = None,
custom_metric: Optional[resources.CustomMetric] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.CustomMetric:
r"""Creates a CustomMetric.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.CreateCustomMetricRequest, dict]]):
The request object. Request message for
CreateCustomMetric RPC.
parent (:class:`str`):
Required. Example format:
properties/1234
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
custom_metric (:class:`google.analytics.admin_v1alpha.types.CustomMetric`):
Required. The CustomMetric to create.
This corresponds to the ``custom_metric`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.CustomMetric:
A definition for a custom metric.
"""
# 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.
flattened_params = [parent, custom_metric]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.CreateCustomMetricRequest):
request = analytics_admin.CreateCustomMetricRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
if custom_metric is not None:
request.custom_metric = custom_metric
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.create_custom_metric
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# 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
[docs] async def update_custom_metric(
self,
request: Optional[
Union[analytics_admin.UpdateCustomMetricRequest, dict]
] = None,
*,
custom_metric: Optional[resources.CustomMetric] = None,
update_mask: Optional[field_mask_pb2.FieldMask] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.CustomMetric:
r"""Updates a CustomMetric on a property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateCustomMetricRequest, dict]]):
The request object. Request message for
UpdateCustomMetric RPC.
custom_metric (:class:`google.analytics.admin_v1alpha.types.CustomMetric`):
The CustomMetric to update
This corresponds to the ``custom_metric`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
Required. The list of fields to be updated. Omitted
fields will not be updated. To replace the entire
entity, use one path with the string "*" to match all
fields.
This corresponds to the ``update_mask`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.CustomMetric:
A definition for a custom metric.
"""
# 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.
flattened_params = [custom_metric, update_mask]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.UpdateCustomMetricRequest):
request = analytics_admin.UpdateCustomMetricRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if custom_metric is not None:
request.custom_metric = custom_metric
if update_mask is not None:
request.update_mask = update_mask
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.update_custom_metric
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(
(("custom_metric.name", request.custom_metric.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
[docs] async def list_custom_metrics(
self,
request: Optional[Union[analytics_admin.ListCustomMetricsRequest, dict]] = None,
*,
parent: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> pagers.ListCustomMetricsAsyncPager:
r"""Lists CustomMetrics on a property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.ListCustomMetricsRequest, dict]]):
The request object. Request message for ListCustomMetrics
RPC.
parent (:class:`str`):
Required. Example format:
properties/1234
This corresponds to the ``parent`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListCustomMetricsAsyncPager:
Response message for
ListCustomMetrics RPC.
Iterating over this object will yield
results and resolve additional pages
automatically.
"""
# 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.
flattened_params = [parent]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.ListCustomMetricsRequest):
request = analytics_admin.ListCustomMetricsRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.list_custom_metrics
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# Validate the universe domain.
self._client._validate_universe_domain()
# Send the request.
response = await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# This method is paged; wrap the response in a pager, which provides
# an `__aiter__` convenience method.
response = pagers.ListCustomMetricsAsyncPager(
method=rpc,
request=request,
response=response,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# Done; return the response.
return response
[docs] async def archive_custom_metric(
self,
request: Optional[
Union[analytics_admin.ArchiveCustomMetricRequest, dict]
] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> None:
r"""Archives a CustomMetric on a property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.ArchiveCustomMetricRequest, dict]]):
The request object. Request message for
ArchiveCustomMetric RPC.
name (:class:`str`):
Required. The name of the
CustomMetric to archive. Example format:
properties/1234/customMetrics/5678
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.ArchiveCustomMetricRequest):
request = analytics_admin.ArchiveCustomMetricRequest(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.archive_custom_metric
]
# 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.
await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
[docs] async def get_custom_metric(
self,
request: Optional[Union[analytics_admin.GetCustomMetricRequest, dict]] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.CustomMetric:
r"""Lookup for a single CustomMetric.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.GetCustomMetricRequest, dict]]):
The request object. Request message for GetCustomMetric
RPC.
name (:class:`str`):
Required. The name of the
CustomMetric to get. Example format:
properties/1234/customMetrics/5678
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.CustomMetric:
A definition for a custom metric.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.GetCustomMetricRequest):
request = analytics_admin.GetCustomMetricRequest(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_custom_metric
]
# 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
[docs] async def get_data_retention_settings(
self,
request: Optional[
Union[analytics_admin.GetDataRetentionSettingsRequest, dict]
] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.DataRetentionSettings:
r"""Returns the singleton data retention settings for
this property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.GetDataRetentionSettingsRequest, dict]]):
The request object. Request message for
GetDataRetentionSettings RPC.
name (:class:`str`):
Required. The name of the settings to
lookup. Format:
properties/{property}/dataRetentionSettings
Example:
"properties/1000/dataRetentionSettings"
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.DataRetentionSettings:
Settings values for data retention.
This is a singleton resource.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.GetDataRetentionSettingsRequest):
request = analytics_admin.GetDataRetentionSettingsRequest(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_data_retention_settings
]
# 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
[docs] async def update_data_retention_settings(
self,
request: Optional[
Union[analytics_admin.UpdateDataRetentionSettingsRequest, dict]
] = None,
*,
data_retention_settings: Optional[resources.DataRetentionSettings] = None,
update_mask: Optional[field_mask_pb2.FieldMask] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.DataRetentionSettings:
r"""Updates the singleton data retention settings for
this property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateDataRetentionSettingsRequest, dict]]):
The request object. Request message for
UpdateDataRetentionSettings RPC.
data_retention_settings (:class:`google.analytics.admin_v1alpha.types.DataRetentionSettings`):
Required. The settings to update. The ``name`` field is
used to identify the settings to be updated.
This corresponds to the ``data_retention_settings`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
Required. The list of fields to be updated. Field names
must be in snake case (e.g., "field_to_update"). Omitted
fields will not be updated. To replace the entire
entity, use one path with the string "*" to match all
fields.
This corresponds to the ``update_mask`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.DataRetentionSettings:
Settings values for data retention.
This is a singleton resource.
"""
# 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.
flattened_params = [data_retention_settings, update_mask]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.UpdateDataRetentionSettingsRequest):
request = analytics_admin.UpdateDataRetentionSettingsRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if data_retention_settings is not None:
request.data_retention_settings = data_retention_settings
if update_mask is not None:
request.update_mask = update_mask
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.update_data_retention_settings
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(
(
(
"data_retention_settings.name",
request.data_retention_settings.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
[docs] async def create_data_stream(
self,
request: Optional[Union[analytics_admin.CreateDataStreamRequest, dict]] = None,
*,
parent: Optional[str] = None,
data_stream: Optional[resources.DataStream] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.DataStream:
r"""Creates a DataStream.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.CreateDataStreamRequest, dict]]):
The request object. Request message for CreateDataStream
RPC.
parent (:class:`str`):
Required. Example format:
properties/1234
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
data_stream (:class:`google.analytics.admin_v1alpha.types.DataStream`):
Required. The DataStream to create.
This corresponds to the ``data_stream`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.DataStream:
A resource message representing a
data stream.
"""
# 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.
flattened_params = [parent, data_stream]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.CreateDataStreamRequest):
request = analytics_admin.CreateDataStreamRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
if data_stream is not None:
request.data_stream = data_stream
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.create_data_stream
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# 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
[docs] async def delete_data_stream(
self,
request: Optional[Union[analytics_admin.DeleteDataStreamRequest, dict]] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> None:
r"""Deletes a DataStream on a property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteDataStreamRequest, dict]]):
The request object. Request message for DeleteDataStream
RPC.
name (:class:`str`):
Required. The name of the DataStream
to delete. Example format:
properties/1234/dataStreams/5678
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.DeleteDataStreamRequest):
request = analytics_admin.DeleteDataStreamRequest(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.delete_data_stream
]
# 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.
await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
[docs] async def update_data_stream(
self,
request: Optional[Union[analytics_admin.UpdateDataStreamRequest, dict]] = None,
*,
data_stream: Optional[resources.DataStream] = None,
update_mask: Optional[field_mask_pb2.FieldMask] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.DataStream:
r"""Updates a DataStream on a property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateDataStreamRequest, dict]]):
The request object. Request message for UpdateDataStream
RPC.
data_stream (:class:`google.analytics.admin_v1alpha.types.DataStream`):
The DataStream to update
This corresponds to the ``data_stream`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
Required. The list of fields to be updated. Omitted
fields will not be updated. To replace the entire
entity, use one path with the string "*" to match all
fields.
This corresponds to the ``update_mask`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.DataStream:
A resource message representing a
data stream.
"""
# 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.
flattened_params = [data_stream, update_mask]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.UpdateDataStreamRequest):
request = analytics_admin.UpdateDataStreamRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if data_stream is not None:
request.data_stream = data_stream
if update_mask is not None:
request.update_mask = update_mask
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.update_data_stream
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(
(("data_stream.name", request.data_stream.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
[docs] async def list_data_streams(
self,
request: Optional[Union[analytics_admin.ListDataStreamsRequest, dict]] = None,
*,
parent: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> pagers.ListDataStreamsAsyncPager:
r"""Lists DataStreams on a property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.ListDataStreamsRequest, dict]]):
The request object. Request message for ListDataStreams
RPC.
parent (:class:`str`):
Required. Example format:
properties/1234
This corresponds to the ``parent`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListDataStreamsAsyncPager:
Response message for ListDataStreams
RPC.
Iterating over this object will yield
results and resolve additional pages
automatically.
"""
# 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.
flattened_params = [parent]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.ListDataStreamsRequest):
request = analytics_admin.ListDataStreamsRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.list_data_streams
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# Validate the universe domain.
self._client._validate_universe_domain()
# Send the request.
response = await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# This method is paged; wrap the response in a pager, which provides
# an `__aiter__` convenience method.
response = pagers.ListDataStreamsAsyncPager(
method=rpc,
request=request,
response=response,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# Done; return the response.
return response
[docs] async def get_data_stream(
self,
request: Optional[Union[analytics_admin.GetDataStreamRequest, dict]] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.DataStream:
r"""Lookup for a single DataStream.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.GetDataStreamRequest, dict]]):
The request object. Request message for GetDataStream
RPC.
name (:class:`str`):
Required. The name of the DataStream
to get. Example format:
properties/1234/dataStreams/5678
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.DataStream:
A resource message representing a
data stream.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.GetDataStreamRequest):
request = analytics_admin.GetDataStreamRequest(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_data_stream
]
# 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
[docs] async def get_audience(
self,
request: Optional[Union[analytics_admin.GetAudienceRequest, dict]] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> audience.Audience:
r"""Lookup for a single Audience.
Audiences created before 2020 may not be supported.
Default audiences will not show filter definitions.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.GetAudienceRequest, dict]]):
The request object. Request message for GetAudience RPC.
name (:class:`str`):
Required. The name of the Audience to
get. Example format:
properties/1234/audiences/5678
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.Audience:
A resource message representing an
Audience.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.GetAudienceRequest):
request = analytics_admin.GetAudienceRequest(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_audience
]
# 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
[docs] async def list_audiences(
self,
request: Optional[Union[analytics_admin.ListAudiencesRequest, dict]] = None,
*,
parent: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> pagers.ListAudiencesAsyncPager:
r"""Lists Audiences on a property.
Audiences created before 2020 may not be supported.
Default audiences will not show filter definitions.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.ListAudiencesRequest, dict]]):
The request object. Request message for ListAudiences
RPC.
parent (:class:`str`):
Required. Example format:
properties/1234
This corresponds to the ``parent`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListAudiencesAsyncPager:
Response message for ListAudiences
RPC.
Iterating over this object will yield
results and resolve additional pages
automatically.
"""
# 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.
flattened_params = [parent]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.ListAudiencesRequest):
request = analytics_admin.ListAudiencesRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.list_audiences
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# Validate the universe domain.
self._client._validate_universe_domain()
# Send the request.
response = await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# This method is paged; wrap the response in a pager, which provides
# an `__aiter__` convenience method.
response = pagers.ListAudiencesAsyncPager(
method=rpc,
request=request,
response=response,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# Done; return the response.
return response
[docs] async def create_audience(
self,
request: Optional[Union[analytics_admin.CreateAudienceRequest, dict]] = None,
*,
parent: Optional[str] = None,
audience: Optional[gaa_audience.Audience] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> gaa_audience.Audience:
r"""Creates an Audience.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.CreateAudienceRequest, dict]]):
The request object. Request message for CreateAudience
RPC.
parent (:class:`str`):
Required. Example format:
properties/1234
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
audience (:class:`google.analytics.admin_v1alpha.types.Audience`):
Required. The audience to create.
This corresponds to the ``audience`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.Audience:
A resource message representing an
Audience.
"""
# 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.
flattened_params = [parent, audience]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.CreateAudienceRequest):
request = analytics_admin.CreateAudienceRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
if audience is not None:
request.audience = audience
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.create_audience
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# 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
[docs] async def update_audience(
self,
request: Optional[Union[analytics_admin.UpdateAudienceRequest, dict]] = None,
*,
audience: Optional[gaa_audience.Audience] = None,
update_mask: Optional[field_mask_pb2.FieldMask] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> gaa_audience.Audience:
r"""Updates an Audience on a property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateAudienceRequest, dict]]):
The request object. Request message for UpdateAudience
RPC.
audience (:class:`google.analytics.admin_v1alpha.types.Audience`):
Required. The audience to update. The audience's
``name`` field is used to identify the audience to be
updated.
This corresponds to the ``audience`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
Required. The list of fields to be updated. Field names
must be in snake case (e.g., "field_to_update"). Omitted
fields will not be updated. To replace the entire
entity, use one path with the string "*" to match all
fields.
This corresponds to the ``update_mask`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.Audience:
A resource message representing an
Audience.
"""
# 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.
flattened_params = [audience, update_mask]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.UpdateAudienceRequest):
request = analytics_admin.UpdateAudienceRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if audience is not None:
request.audience = audience
if update_mask is not None:
request.update_mask = update_mask
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.update_audience
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(
(("audience.name", request.audience.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
[docs] async def archive_audience(
self,
request: Optional[Union[analytics_admin.ArchiveAudienceRequest, dict]] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> None:
r"""Archives an Audience on a property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.ArchiveAudienceRequest, dict]]):
The request object. Request message for ArchiveAudience
RPC.
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
"""
# Create or coerce a protobuf request object.
# - 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_admin.ArchiveAudienceRequest):
request = analytics_admin.ArchiveAudienceRequest(request)
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.archive_audience
]
# 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.
await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
[docs] async def get_search_ads360_link(
self,
request: Optional[
Union[analytics_admin.GetSearchAds360LinkRequest, dict]
] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.SearchAds360Link:
r"""Look up a single SearchAds360Link
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.GetSearchAds360LinkRequest, dict]]):
The request object. Request message for
GetSearchAds360Link RPC.
name (:class:`str`):
Required. The name of the
SearchAds360Link to get. Example format:
properties/1234/SearchAds360Link/5678
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.SearchAds360Link:
A link between a Google Analytics
property and a Search Ads 360 entity.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.GetSearchAds360LinkRequest):
request = analytics_admin.GetSearchAds360LinkRequest(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_search_ads360_link
]
# 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
[docs] async def list_search_ads360_links(
self,
request: Optional[
Union[analytics_admin.ListSearchAds360LinksRequest, dict]
] = None,
*,
parent: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> pagers.ListSearchAds360LinksAsyncPager:
r"""Lists all SearchAds360Links on a property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.ListSearchAds360LinksRequest, dict]]):
The request object. Request message for
ListSearchAds360Links RPC.
parent (:class:`str`):
Required. Example format:
properties/1234
This corresponds to the ``parent`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListSearchAds360LinksAsyncPager:
Response message for
ListSearchAds360Links RPC.
Iterating over this object will yield
results and resolve additional pages
automatically.
"""
# 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.
flattened_params = [parent]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.ListSearchAds360LinksRequest):
request = analytics_admin.ListSearchAds360LinksRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.list_search_ads360_links
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# Validate the universe domain.
self._client._validate_universe_domain()
# Send the request.
response = await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# This method is paged; wrap the response in a pager, which provides
# an `__aiter__` convenience method.
response = pagers.ListSearchAds360LinksAsyncPager(
method=rpc,
request=request,
response=response,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# Done; return the response.
return response
[docs] async def create_search_ads360_link(
self,
request: Optional[
Union[analytics_admin.CreateSearchAds360LinkRequest, dict]
] = None,
*,
parent: Optional[str] = None,
search_ads_360_link: Optional[resources.SearchAds360Link] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.SearchAds360Link:
r"""Creates a SearchAds360Link.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.CreateSearchAds360LinkRequest, dict]]):
The request object. Request message for
CreateSearchAds360Link RPC.
parent (:class:`str`):
Required. Example format:
properties/1234
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
search_ads_360_link (:class:`google.analytics.admin_v1alpha.types.SearchAds360Link`):
Required. The SearchAds360Link to
create.
This corresponds to the ``search_ads_360_link`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.SearchAds360Link:
A link between a Google Analytics
property and a Search Ads 360 entity.
"""
# 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.
flattened_params = [parent, search_ads_360_link]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.CreateSearchAds360LinkRequest):
request = analytics_admin.CreateSearchAds360LinkRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
if search_ads_360_link is not None:
request.search_ads_360_link = search_ads_360_link
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.create_search_ads360_link
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# 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
[docs] async def delete_search_ads360_link(
self,
request: Optional[
Union[analytics_admin.DeleteSearchAds360LinkRequest, dict]
] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> None:
r"""Deletes a SearchAds360Link on a property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteSearchAds360LinkRequest, dict]]):
The request object. Request message for
DeleteSearchAds360Link RPC.
name (:class:`str`):
Required. The name of the
SearchAds360Link to delete. Example
format:
properties/1234/SearchAds360Links/5678
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.DeleteSearchAds360LinkRequest):
request = analytics_admin.DeleteSearchAds360LinkRequest(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.delete_search_ads360_link
]
# 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.
await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
[docs] async def update_search_ads360_link(
self,
request: Optional[
Union[analytics_admin.UpdateSearchAds360LinkRequest, dict]
] = None,
*,
search_ads_360_link: Optional[resources.SearchAds360Link] = None,
update_mask: Optional[field_mask_pb2.FieldMask] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.SearchAds360Link:
r"""Updates a SearchAds360Link on a property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateSearchAds360LinkRequest, dict]]):
The request object. Request message for
UpdateSearchAds360Link RPC.
search_ads_360_link (:class:`google.analytics.admin_v1alpha.types.SearchAds360Link`):
The SearchAds360Link to update
This corresponds to the ``search_ads_360_link`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
Required. The list of fields to be updated. Omitted
fields will not be updated. To replace the entire
entity, use one path with the string "*" to match all
fields.
This corresponds to the ``update_mask`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.SearchAds360Link:
A link between a Google Analytics
property and a Search Ads 360 entity.
"""
# 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.
flattened_params = [search_ads_360_link, update_mask]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.UpdateSearchAds360LinkRequest):
request = analytics_admin.UpdateSearchAds360LinkRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if search_ads_360_link is not None:
request.search_ads_360_link = search_ads_360_link
if update_mask is not None:
request.update_mask = update_mask
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.update_search_ads360_link
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(
(("search_ads_360_link.name", request.search_ads_360_link.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
[docs] async def get_attribution_settings(
self,
request: Optional[
Union[analytics_admin.GetAttributionSettingsRequest, dict]
] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.AttributionSettings:
r"""Lookup for a AttributionSettings singleton.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.GetAttributionSettingsRequest, dict]]):
The request object. Request message for
GetAttributionSettings RPC.
name (:class:`str`):
Required. The name of the attribution
settings to retrieve. Format:
properties/{property}/attributionSettings
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.AttributionSettings:
The attribution settings used for a
given property. This is a singleton
resource.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.GetAttributionSettingsRequest):
request = analytics_admin.GetAttributionSettingsRequest(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_attribution_settings
]
# 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
[docs] async def update_attribution_settings(
self,
request: Optional[
Union[analytics_admin.UpdateAttributionSettingsRequest, dict]
] = None,
*,
attribution_settings: Optional[resources.AttributionSettings] = None,
update_mask: Optional[field_mask_pb2.FieldMask] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.AttributionSettings:
r"""Updates attribution settings on a property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateAttributionSettingsRequest, dict]]):
The request object. Request message for
UpdateAttributionSettings RPC
attribution_settings (:class:`google.analytics.admin_v1alpha.types.AttributionSettings`):
Required. The attribution settings to update. The
``name`` field is used to identify the settings to be
updated.
This corresponds to the ``attribution_settings`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
Required. The list of fields to be updated. Field names
must be in snake case (e.g., "field_to_update"). Omitted
fields will not be updated. To replace the entire
entity, use one path with the string "*" to match all
fields.
This corresponds to the ``update_mask`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.AttributionSettings:
The attribution settings used for a
given property. This is a singleton
resource.
"""
# 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.
flattened_params = [attribution_settings, update_mask]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.UpdateAttributionSettingsRequest):
request = analytics_admin.UpdateAttributionSettingsRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if attribution_settings is not None:
request.attribution_settings = attribution_settings
if update_mask is not None:
request.update_mask = update_mask
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.update_attribution_settings
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(
(("attribution_settings.name", request.attribution_settings.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
[docs] async def run_access_report(
self,
request: Optional[Union[analytics_admin.RunAccessReportRequest, dict]] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> analytics_admin.RunAccessReportResponse:
r"""Returns a customized report of data access records. The report
provides records of each time a user reads Google Analytics
reporting data. Access records are retained for up to 2 years.
Data Access Reports can be requested for a property. Reports may
be requested for any property, but dimensions that aren't
related to quota can only be requested on Google Analytics 360
properties. This method is only available to Administrators.
These data access records include GA UI Reporting, GA UI
Explorations, GA Data API, and other products like Firebase &
Admob that can retrieve data from Google Analytics through a
linkage. These records don't include property configuration
changes like adding a stream or changing a property's time zone.
For configuration change history, see
`searchChangeHistoryEvents <https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts/searchChangeHistoryEvents>`__.
To give your feedback on this API, complete the `Google
Analytics Access Reports
feedback <https://docs.google.com/forms/d/e/1FAIpQLSdmEBUrMzAEdiEKk5TV5dEHvDUZDRlgWYdQdAeSdtR4hVjEhw/viewform>`__
form.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.RunAccessReportRequest, dict]]):
The request object. The request for a Data Access Record
Report.
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.RunAccessReportResponse:
The customized Data Access Record
Report response.
"""
# Create or coerce a protobuf request object.
# - 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_admin.RunAccessReportRequest):
request = analytics_admin.RunAccessReportRequest(request)
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.run_access_report
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("entity", request.entity),)),
)
# 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
[docs] async def create_access_binding(
self,
request: Optional[
Union[analytics_admin.CreateAccessBindingRequest, dict]
] = None,
*,
parent: Optional[str] = None,
access_binding: Optional[resources.AccessBinding] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.AccessBinding:
r"""Creates an access binding on an account or property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.CreateAccessBindingRequest, dict]]):
The request object. Request message for
CreateAccessBinding RPC.
parent (:class:`str`):
Required. Formats:
- accounts/{account}
- properties/{property}
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
access_binding (:class:`google.analytics.admin_v1alpha.types.AccessBinding`):
Required. The access binding to
create.
This corresponds to the ``access_binding`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.AccessBinding:
A binding of a user to a set of
roles.
"""
# 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.
flattened_params = [parent, access_binding]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.CreateAccessBindingRequest):
request = analytics_admin.CreateAccessBindingRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
if access_binding is not None:
request.access_binding = access_binding
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.create_access_binding
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# 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
[docs] async def get_access_binding(
self,
request: Optional[Union[analytics_admin.GetAccessBindingRequest, dict]] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.AccessBinding:
r"""Gets information about an access binding.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.GetAccessBindingRequest, dict]]):
The request object. Request message for GetAccessBinding
RPC.
name (:class:`str`):
Required. The name of the access
binding to retrieve. Formats:
-
accounts/{account}/accessBindings/{accessBinding}
-
properties/{property}/accessBindings/{accessBinding}
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.AccessBinding:
A binding of a user to a set of
roles.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.GetAccessBindingRequest):
request = analytics_admin.GetAccessBindingRequest(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_access_binding
]
# 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
[docs] async def update_access_binding(
self,
request: Optional[
Union[analytics_admin.UpdateAccessBindingRequest, dict]
] = None,
*,
access_binding: Optional[resources.AccessBinding] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.AccessBinding:
r"""Updates an access binding on an account or property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateAccessBindingRequest, dict]]):
The request object. Request message for
UpdateAccessBinding RPC.
access_binding (:class:`google.analytics.admin_v1alpha.types.AccessBinding`):
Required. The access binding to
update.
This corresponds to the ``access_binding`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.AccessBinding:
A binding of a user to a set of
roles.
"""
# 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.
flattened_params = [access_binding]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.UpdateAccessBindingRequest):
request = analytics_admin.UpdateAccessBindingRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if access_binding is not None:
request.access_binding = access_binding
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.update_access_binding
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(
(("access_binding.name", request.access_binding.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
[docs] async def delete_access_binding(
self,
request: Optional[
Union[analytics_admin.DeleteAccessBindingRequest, dict]
] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> None:
r"""Deletes an access binding on an account or property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteAccessBindingRequest, dict]]):
The request object. Request message for
DeleteAccessBinding RPC.
name (:class:`str`):
Required. Formats:
-
accounts/{account}/accessBindings/{accessBinding}
-
properties/{property}/accessBindings/{accessBinding}
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.DeleteAccessBindingRequest):
request = analytics_admin.DeleteAccessBindingRequest(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.delete_access_binding
]
# 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.
await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
[docs] async def list_access_bindings(
self,
request: Optional[
Union[analytics_admin.ListAccessBindingsRequest, dict]
] = None,
*,
parent: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> pagers.ListAccessBindingsAsyncPager:
r"""Lists all access bindings on an account or property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.ListAccessBindingsRequest, dict]]):
The request object. Request message for
ListAccessBindings RPC.
parent (:class:`str`):
Required. Formats:
- accounts/{account}
- properties/{property}
This corresponds to the ``parent`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListAccessBindingsAsyncPager:
Response message for
ListAccessBindings RPC.
Iterating over this object will yield
results and resolve additional pages
automatically.
"""
# 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.
flattened_params = [parent]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.ListAccessBindingsRequest):
request = analytics_admin.ListAccessBindingsRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.list_access_bindings
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# Validate the universe domain.
self._client._validate_universe_domain()
# Send the request.
response = await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# This method is paged; wrap the response in a pager, which provides
# an `__aiter__` convenience method.
response = pagers.ListAccessBindingsAsyncPager(
method=rpc,
request=request,
response=response,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# Done; return the response.
return response
[docs] async def batch_create_access_bindings(
self,
request: Optional[
Union[analytics_admin.BatchCreateAccessBindingsRequest, dict]
] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> analytics_admin.BatchCreateAccessBindingsResponse:
r"""Creates information about multiple access bindings to
an account or property.
This method is transactional. If any AccessBinding
cannot be created, none of the AccessBindings will be
created.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.BatchCreateAccessBindingsRequest, dict]]):
The request object. Request message for
BatchCreateAccessBindings RPC.
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.BatchCreateAccessBindingsResponse:
Response message for
BatchCreateAccessBindings RPC.
"""
# Create or coerce a protobuf request object.
# - 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_admin.BatchCreateAccessBindingsRequest):
request = analytics_admin.BatchCreateAccessBindingsRequest(request)
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.batch_create_access_bindings
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# 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
[docs] async def batch_get_access_bindings(
self,
request: Optional[
Union[analytics_admin.BatchGetAccessBindingsRequest, dict]
] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> analytics_admin.BatchGetAccessBindingsResponse:
r"""Gets information about multiple access bindings to an
account or property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.BatchGetAccessBindingsRequest, dict]]):
The request object. Request message for
BatchGetAccessBindings RPC.
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.BatchGetAccessBindingsResponse:
Response message for
BatchGetAccessBindings RPC.
"""
# Create or coerce a protobuf request object.
# - 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_admin.BatchGetAccessBindingsRequest):
request = analytics_admin.BatchGetAccessBindingsRequest(request)
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.batch_get_access_bindings
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# 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
[docs] async def batch_update_access_bindings(
self,
request: Optional[
Union[analytics_admin.BatchUpdateAccessBindingsRequest, dict]
] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> analytics_admin.BatchUpdateAccessBindingsResponse:
r"""Updates information about multiple access bindings to
an account or property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.BatchUpdateAccessBindingsRequest, dict]]):
The request object. Request message for
BatchUpdateAccessBindings RPC.
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.BatchUpdateAccessBindingsResponse:
Response message for
BatchUpdateAccessBindings RPC.
"""
# Create or coerce a protobuf request object.
# - 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_admin.BatchUpdateAccessBindingsRequest):
request = analytics_admin.BatchUpdateAccessBindingsRequest(request)
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.batch_update_access_bindings
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# 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
[docs] async def batch_delete_access_bindings(
self,
request: Optional[
Union[analytics_admin.BatchDeleteAccessBindingsRequest, dict]
] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> None:
r"""Deletes information about multiple users' links to an
account or property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.BatchDeleteAccessBindingsRequest, dict]]):
The request object. Request message for
BatchDeleteAccessBindings RPC.
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
"""
# Create or coerce a protobuf request object.
# - 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_admin.BatchDeleteAccessBindingsRequest):
request = analytics_admin.BatchDeleteAccessBindingsRequest(request)
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.batch_delete_access_bindings
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# Validate the universe domain.
self._client._validate_universe_domain()
# Send the request.
await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
[docs] async def get_expanded_data_set(
self,
request: Optional[
Union[analytics_admin.GetExpandedDataSetRequest, dict]
] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> expanded_data_set.ExpandedDataSet:
r"""Lookup for a single ExpandedDataSet.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.GetExpandedDataSetRequest, dict]]):
The request object. Request message for
GetExpandedDataSet RPC.
name (:class:`str`):
Required. The name of the
ExpandedDataSet to get. Example format:
properties/1234/expandedDataSets/5678
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.ExpandedDataSet:
A resource message representing an ExpandedDataSet.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.GetExpandedDataSetRequest):
request = analytics_admin.GetExpandedDataSetRequest(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_expanded_data_set
]
# 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
[docs] async def list_expanded_data_sets(
self,
request: Optional[
Union[analytics_admin.ListExpandedDataSetsRequest, dict]
] = None,
*,
parent: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> pagers.ListExpandedDataSetsAsyncPager:
r"""Lists ExpandedDataSets on a property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.ListExpandedDataSetsRequest, dict]]):
The request object. Request message for
ListExpandedDataSets RPC.
parent (:class:`str`):
Required. Example format:
properties/1234
This corresponds to the ``parent`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListExpandedDataSetsAsyncPager:
Response message for
ListExpandedDataSets RPC.
Iterating over this object will yield
results and resolve additional pages
automatically.
"""
# 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.
flattened_params = [parent]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.ListExpandedDataSetsRequest):
request = analytics_admin.ListExpandedDataSetsRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.list_expanded_data_sets
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# Validate the universe domain.
self._client._validate_universe_domain()
# Send the request.
response = await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# This method is paged; wrap the response in a pager, which provides
# an `__aiter__` convenience method.
response = pagers.ListExpandedDataSetsAsyncPager(
method=rpc,
request=request,
response=response,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# Done; return the response.
return response
[docs] async def create_expanded_data_set(
self,
request: Optional[
Union[analytics_admin.CreateExpandedDataSetRequest, dict]
] = None,
*,
parent: Optional[str] = None,
expanded_data_set: Optional[gaa_expanded_data_set.ExpandedDataSet] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> gaa_expanded_data_set.ExpandedDataSet:
r"""Creates a ExpandedDataSet.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.CreateExpandedDataSetRequest, dict]]):
The request object. Request message for
CreateExpandedDataSet RPC.
parent (:class:`str`):
Required. Example format:
properties/1234
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
expanded_data_set (:class:`google.analytics.admin_v1alpha.types.ExpandedDataSet`):
Required. The ExpandedDataSet to
create.
This corresponds to the ``expanded_data_set`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.ExpandedDataSet:
A resource message representing an ExpandedDataSet.
"""
# 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.
flattened_params = [parent, expanded_data_set]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.CreateExpandedDataSetRequest):
request = analytics_admin.CreateExpandedDataSetRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
if expanded_data_set is not None:
request.expanded_data_set = expanded_data_set
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.create_expanded_data_set
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# 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
[docs] async def update_expanded_data_set(
self,
request: Optional[
Union[analytics_admin.UpdateExpandedDataSetRequest, dict]
] = None,
*,
expanded_data_set: Optional[gaa_expanded_data_set.ExpandedDataSet] = None,
update_mask: Optional[field_mask_pb2.FieldMask] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> gaa_expanded_data_set.ExpandedDataSet:
r"""Updates a ExpandedDataSet on a property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateExpandedDataSetRequest, dict]]):
The request object. Request message for
UpdateExpandedDataSet RPC.
expanded_data_set (:class:`google.analytics.admin_v1alpha.types.ExpandedDataSet`):
Required. The ExpandedDataSet to update. The resource's
``name`` field is used to identify the ExpandedDataSet
to be updated.
This corresponds to the ``expanded_data_set`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
Required. The list of fields to be updated. Field names
must be in snake case (e.g., "field_to_update"). Omitted
fields will not be updated. To replace the entire
entity, use one path with the string "*" to match all
fields.
This corresponds to the ``update_mask`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.ExpandedDataSet:
A resource message representing an ExpandedDataSet.
"""
# 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.
flattened_params = [expanded_data_set, update_mask]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.UpdateExpandedDataSetRequest):
request = analytics_admin.UpdateExpandedDataSetRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if expanded_data_set is not None:
request.expanded_data_set = expanded_data_set
if update_mask is not None:
request.update_mask = update_mask
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.update_expanded_data_set
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(
(("expanded_data_set.name", request.expanded_data_set.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
[docs] async def delete_expanded_data_set(
self,
request: Optional[
Union[analytics_admin.DeleteExpandedDataSetRequest, dict]
] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> None:
r"""Deletes a ExpandedDataSet on a property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteExpandedDataSetRequest, dict]]):
The request object. Request message for
DeleteExpandedDataSet RPC.
name (:class:`str`):
Required. Example format:
properties/1234/expandedDataSets/5678
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.DeleteExpandedDataSetRequest):
request = analytics_admin.DeleteExpandedDataSetRequest(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.delete_expanded_data_set
]
# 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.
await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
[docs] async def get_channel_group(
self,
request: Optional[Union[analytics_admin.GetChannelGroupRequest, dict]] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> channel_group.ChannelGroup:
r"""Lookup for a single ChannelGroup.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.GetChannelGroupRequest, dict]]):
The request object. Request message for GetChannelGroup
RPC.
name (:class:`str`):
Required. The ChannelGroup to get.
Example format:
properties/1234/channelGroups/5678
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.ChannelGroup:
A resource message representing a
Channel Group.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.GetChannelGroupRequest):
request = analytics_admin.GetChannelGroupRequest(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_channel_group
]
# 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
[docs] async def list_channel_groups(
self,
request: Optional[Union[analytics_admin.ListChannelGroupsRequest, dict]] = None,
*,
parent: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> pagers.ListChannelGroupsAsyncPager:
r"""Lists ChannelGroups on a property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.ListChannelGroupsRequest, dict]]):
The request object. Request message for ListChannelGroups
RPC.
parent (:class:`str`):
Required. The property for which to
list ChannelGroups. Example format:
properties/1234
This corresponds to the ``parent`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListChannelGroupsAsyncPager:
Response message for
ListChannelGroups RPC.
Iterating over this object will yield
results and resolve additional pages
automatically.
"""
# 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.
flattened_params = [parent]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.ListChannelGroupsRequest):
request = analytics_admin.ListChannelGroupsRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.list_channel_groups
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# Validate the universe domain.
self._client._validate_universe_domain()
# Send the request.
response = await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# This method is paged; wrap the response in a pager, which provides
# an `__aiter__` convenience method.
response = pagers.ListChannelGroupsAsyncPager(
method=rpc,
request=request,
response=response,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# Done; return the response.
return response
[docs] async def create_channel_group(
self,
request: Optional[
Union[analytics_admin.CreateChannelGroupRequest, dict]
] = None,
*,
parent: Optional[str] = None,
channel_group: Optional[gaa_channel_group.ChannelGroup] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> gaa_channel_group.ChannelGroup:
r"""Creates a ChannelGroup.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.CreateChannelGroupRequest, dict]]):
The request object. Request message for
CreateChannelGroup RPC.
parent (:class:`str`):
Required. The property for which to
create a ChannelGroup. Example format:
properties/1234
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
channel_group (:class:`google.analytics.admin_v1alpha.types.ChannelGroup`):
Required. The ChannelGroup to create.
This corresponds to the ``channel_group`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.ChannelGroup:
A resource message representing a
Channel Group.
"""
# 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.
flattened_params = [parent, channel_group]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.CreateChannelGroupRequest):
request = analytics_admin.CreateChannelGroupRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
if channel_group is not None:
request.channel_group = channel_group
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.create_channel_group
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# 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
[docs] async def update_channel_group(
self,
request: Optional[
Union[analytics_admin.UpdateChannelGroupRequest, dict]
] = None,
*,
channel_group: Optional[gaa_channel_group.ChannelGroup] = None,
update_mask: Optional[field_mask_pb2.FieldMask] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> gaa_channel_group.ChannelGroup:
r"""Updates a ChannelGroup.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateChannelGroupRequest, dict]]):
The request object. Request message for
UpdateChannelGroup RPC.
channel_group (:class:`google.analytics.admin_v1alpha.types.ChannelGroup`):
Required. The ChannelGroup to update. The resource's
``name`` field is used to identify the ChannelGroup to
be updated.
This corresponds to the ``channel_group`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
Required. The list of fields to be updated. Field names
must be in snake case (e.g., "field_to_update"). Omitted
fields will not be updated. To replace the entire
entity, use one path with the string "*" to match all
fields.
This corresponds to the ``update_mask`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.ChannelGroup:
A resource message representing a
Channel Group.
"""
# 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.
flattened_params = [channel_group, update_mask]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.UpdateChannelGroupRequest):
request = analytics_admin.UpdateChannelGroupRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if channel_group is not None:
request.channel_group = channel_group
if update_mask is not None:
request.update_mask = update_mask
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.update_channel_group
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(
(("channel_group.name", request.channel_group.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
[docs] async def delete_channel_group(
self,
request: Optional[
Union[analytics_admin.DeleteChannelGroupRequest, dict]
] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> None:
r"""Deletes a ChannelGroup on a property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteChannelGroupRequest, dict]]):
The request object. Request message for
DeleteChannelGroup RPC.
name (:class:`str`):
Required. The ChannelGroup to delete.
Example format:
properties/1234/channelGroups/5678
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.DeleteChannelGroupRequest):
request = analytics_admin.DeleteChannelGroupRequest(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.delete_channel_group
]
# 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.
await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
[docs] async def set_automated_ga4_configuration_opt_out(
self,
request: Optional[
Union[analytics_admin.SetAutomatedGa4ConfigurationOptOutRequest, dict]
] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> analytics_admin.SetAutomatedGa4ConfigurationOptOutResponse:
r"""Sets the opt out status for the automated GA4 setup
process for a UA property.
Note: this has no effect on GA4 property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.SetAutomatedGa4ConfigurationOptOutRequest, dict]]):
The request object. Request for setting the opt out
status for the automated GA4 setup
process.
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.SetAutomatedGa4ConfigurationOptOutResponse:
Response message for setting the opt
out status for the automated GA4 setup
process.
"""
# Create or coerce a protobuf request object.
# - 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_admin.SetAutomatedGa4ConfigurationOptOutRequest
):
request = analytics_admin.SetAutomatedGa4ConfigurationOptOutRequest(request)
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.set_automated_ga4_configuration_opt_out
]
# 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
[docs] async def fetch_automated_ga4_configuration_opt_out(
self,
request: Optional[
Union[analytics_admin.FetchAutomatedGa4ConfigurationOptOutRequest, dict]
] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> analytics_admin.FetchAutomatedGa4ConfigurationOptOutResponse:
r"""Fetches the opt out status for the automated GA4
setup process for a UA property.
Note: this has no effect on GA4 property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.FetchAutomatedGa4ConfigurationOptOutRequest, dict]]):
The request object. Request for fetching the opt out
status for the automated GA4 setup
process.
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.FetchAutomatedGa4ConfigurationOptOutResponse:
Response message for fetching the opt
out status for the automated GA4 setup
process.
"""
# Create or coerce a protobuf request object.
# - 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_admin.FetchAutomatedGa4ConfigurationOptOutRequest
):
request = analytics_admin.FetchAutomatedGa4ConfigurationOptOutRequest(
request
)
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.fetch_automated_ga4_configuration_opt_out
]
# 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
[docs] async def create_big_query_link(
self,
request: Optional[
Union[analytics_admin.CreateBigQueryLinkRequest, dict]
] = None,
*,
parent: Optional[str] = None,
bigquery_link: Optional[resources.BigQueryLink] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.BigQueryLink:
r"""Creates a BigQueryLink.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.CreateBigQueryLinkRequest, dict]]):
The request object. Request message for
CreateBigQueryLink RPC.
parent (:class:`str`):
Required. Example format:
properties/1234
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
bigquery_link (:class:`google.analytics.admin_v1alpha.types.BigQueryLink`):
Required. The BigQueryLink to create.
This corresponds to the ``bigquery_link`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.BigQueryLink:
A link between a Google Analytics
property and BigQuery project.
"""
# 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.
flattened_params = [parent, bigquery_link]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.CreateBigQueryLinkRequest):
request = analytics_admin.CreateBigQueryLinkRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
if bigquery_link is not None:
request.bigquery_link = bigquery_link
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.create_big_query_link
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# 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
[docs] async def get_big_query_link(
self,
request: Optional[Union[analytics_admin.GetBigQueryLinkRequest, dict]] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.BigQueryLink:
r"""Lookup for a single BigQuery Link.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.GetBigQueryLinkRequest, dict]]):
The request object. Request message for GetBigQueryLink
RPC.
name (:class:`str`):
Required. The name of the BigQuery link to lookup.
Format:
properties/{property_id}/bigQueryLinks/{bigquery_link_id}
Example: properties/123/bigQueryLinks/456
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.BigQueryLink:
A link between a Google Analytics
property and BigQuery project.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.GetBigQueryLinkRequest):
request = analytics_admin.GetBigQueryLinkRequest(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_big_query_link
]
# 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
[docs] async def list_big_query_links(
self,
request: Optional[Union[analytics_admin.ListBigQueryLinksRequest, dict]] = None,
*,
parent: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> pagers.ListBigQueryLinksAsyncPager:
r"""Lists BigQuery Links on a property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.ListBigQueryLinksRequest, dict]]):
The request object. Request message for ListBigQueryLinks
RPC.
parent (:class:`str`):
Required. The name of the property to list BigQuery
links under. Format: properties/{property_id} Example:
properties/1234
This corresponds to the ``parent`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListBigQueryLinksAsyncPager:
Response message for
ListBigQueryLinks RPC
Iterating over this object will yield
results and resolve additional pages
automatically.
"""
# 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.
flattened_params = [parent]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.ListBigQueryLinksRequest):
request = analytics_admin.ListBigQueryLinksRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.list_big_query_links
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# Validate the universe domain.
self._client._validate_universe_domain()
# Send the request.
response = await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# This method is paged; wrap the response in a pager, which provides
# an `__aiter__` convenience method.
response = pagers.ListBigQueryLinksAsyncPager(
method=rpc,
request=request,
response=response,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# Done; return the response.
return response
[docs] async def delete_big_query_link(
self,
request: Optional[
Union[analytics_admin.DeleteBigQueryLinkRequest, dict]
] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> None:
r"""Deletes a BigQueryLink on a property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteBigQueryLinkRequest, dict]]):
The request object. Request message for
DeleteBigQueryLink RPC.
name (:class:`str`):
Required. The BigQueryLink to delete.
Example format:
properties/1234/bigQueryLinks/5678
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.DeleteBigQueryLinkRequest):
request = analytics_admin.DeleteBigQueryLinkRequest(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.delete_big_query_link
]
# 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.
await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
[docs] async def update_big_query_link(
self,
request: Optional[
Union[analytics_admin.UpdateBigQueryLinkRequest, dict]
] = None,
*,
bigquery_link: Optional[resources.BigQueryLink] = None,
update_mask: Optional[field_mask_pb2.FieldMask] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.BigQueryLink:
r"""Updates a BigQueryLink.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateBigQueryLinkRequest, dict]]):
The request object. Request message for
UpdateBigQueryLink RPC.
bigquery_link (:class:`google.analytics.admin_v1alpha.types.BigQueryLink`):
Required. The settings to update. The ``name`` field is
used to identify the settings to be updated.
This corresponds to the ``bigquery_link`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
Required. The list of fields to be updated. Field names
must be in snake case (e.g., "field_to_update"). Omitted
fields will not be updated. To replace the entire
entity, use one path with the string "*" to match all
fields.
This corresponds to the ``update_mask`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.BigQueryLink:
A link between a Google Analytics
property and BigQuery project.
"""
# 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.
flattened_params = [bigquery_link, update_mask]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.UpdateBigQueryLinkRequest):
request = analytics_admin.UpdateBigQueryLinkRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if bigquery_link is not None:
request.bigquery_link = bigquery_link
if update_mask is not None:
request.update_mask = update_mask
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.update_big_query_link
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(
(("bigquery_link.name", request.bigquery_link.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
[docs] async def get_enhanced_measurement_settings(
self,
request: Optional[
Union[analytics_admin.GetEnhancedMeasurementSettingsRequest, dict]
] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.EnhancedMeasurementSettings:
r"""Returns the enhanced measurement settings for this
data stream. Note that the stream must enable enhanced
measurement for these settings to take effect.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.GetEnhancedMeasurementSettingsRequest, dict]]):
The request object. Request message for
GetEnhancedMeasurementSettings RPC.
name (:class:`str`):
Required. The name of the settings to lookup. Format:
properties/{property}/dataStreams/{data_stream}/enhancedMeasurementSettings
Example:
"properties/1000/dataStreams/2000/enhancedMeasurementSettings"
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.EnhancedMeasurementSettings:
Singleton resource under a web
DataStream, configuring measurement of
additional site interactions and
content.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.GetEnhancedMeasurementSettingsRequest
):
request = analytics_admin.GetEnhancedMeasurementSettingsRequest(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_enhanced_measurement_settings
]
# 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
[docs] async def update_enhanced_measurement_settings(
self,
request: Optional[
Union[analytics_admin.UpdateEnhancedMeasurementSettingsRequest, dict]
] = None,
*,
enhanced_measurement_settings: Optional[
resources.EnhancedMeasurementSettings
] = None,
update_mask: Optional[field_mask_pb2.FieldMask] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.EnhancedMeasurementSettings:
r"""Updates the enhanced measurement settings for this
data stream. Note that the stream must enable enhanced
measurement for these settings to take effect.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateEnhancedMeasurementSettingsRequest, dict]]):
The request object. Request message for
UpdateEnhancedMeasurementSettings RPC.
enhanced_measurement_settings (:class:`google.analytics.admin_v1alpha.types.EnhancedMeasurementSettings`):
Required. The settings to update. The ``name`` field is
used to identify the settings to be updated.
This corresponds to the ``enhanced_measurement_settings`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
Required. The list of fields to be updated. Field names
must be in snake case (e.g., "field_to_update"). Omitted
fields will not be updated. To replace the entire
entity, use one path with the string "*" to match all
fields.
This corresponds to the ``update_mask`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.EnhancedMeasurementSettings:
Singleton resource under a web
DataStream, configuring measurement of
additional site interactions and
content.
"""
# 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.
flattened_params = [enhanced_measurement_settings, update_mask]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.UpdateEnhancedMeasurementSettingsRequest
):
request = analytics_admin.UpdateEnhancedMeasurementSettingsRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if enhanced_measurement_settings is not None:
request.enhanced_measurement_settings = enhanced_measurement_settings
if update_mask is not None:
request.update_mask = update_mask
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.update_enhanced_measurement_settings
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(
(
(
"enhanced_measurement_settings.name",
request.enhanced_measurement_settings.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
[docs] async def create_connected_site_tag(
self,
request: Optional[
Union[analytics_admin.CreateConnectedSiteTagRequest, dict]
] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> analytics_admin.CreateConnectedSiteTagResponse:
r"""Creates a connected site tag for a Universal
Analytics property. You can create a maximum of 20
connected site tags per property. Note: This API cannot
be used on GA4 properties.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.CreateConnectedSiteTagRequest, dict]]):
The request object. Request message for
CreateConnectedSiteTag RPC.
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.CreateConnectedSiteTagResponse:
Response message for
CreateConnectedSiteTag RPC.
"""
# Create or coerce a protobuf request object.
# - 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_admin.CreateConnectedSiteTagRequest):
request = analytics_admin.CreateConnectedSiteTagRequest(request)
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.create_connected_site_tag
]
# 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
[docs] async def delete_connected_site_tag(
self,
request: Optional[
Union[analytics_admin.DeleteConnectedSiteTagRequest, dict]
] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> None:
r"""Deletes a connected site tag for a Universal
Analytics property. Note: this has no effect on GA4
properties.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteConnectedSiteTagRequest, dict]]):
The request object. Request message for
DeleteConnectedSiteTag RPC.
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
"""
# Create or coerce a protobuf request object.
# - 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_admin.DeleteConnectedSiteTagRequest):
request = analytics_admin.DeleteConnectedSiteTagRequest(request)
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.delete_connected_site_tag
]
# Validate the universe domain.
self._client._validate_universe_domain()
# Send the request.
await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
[docs] async def list_connected_site_tags(
self,
request: Optional[
Union[analytics_admin.ListConnectedSiteTagsRequest, dict]
] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> analytics_admin.ListConnectedSiteTagsResponse:
r"""Lists the connected site tags for a Universal
Analytics property. A maximum of 20 connected site tags
will be returned. Note: this has no effect on GA4
property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.ListConnectedSiteTagsRequest, dict]]):
The request object. Request message for
ListConnectedSiteTags RPC.
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.ListConnectedSiteTagsResponse:
Response message for
ListConnectedSiteTags RPC.
"""
# Create or coerce a protobuf request object.
# - 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_admin.ListConnectedSiteTagsRequest):
request = analytics_admin.ListConnectedSiteTagsRequest(request)
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.list_connected_site_tags
]
# 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
[docs] async def fetch_connected_ga4_property(
self,
request: Optional[
Union[analytics_admin.FetchConnectedGa4PropertyRequest, dict]
] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> analytics_admin.FetchConnectedGa4PropertyResponse:
r"""Given a specified UA property, looks up the GA4
property connected to it. Note: this cannot be used with
GA4 properties.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.FetchConnectedGa4PropertyRequest, dict]]):
The request object. Request for looking up GA4 property
connected to a UA property.
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.FetchConnectedGa4PropertyResponse:
Response for looking up GA4 property
connected to a UA property.
"""
# Create or coerce a protobuf request object.
# - 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_admin.FetchConnectedGa4PropertyRequest):
request = analytics_admin.FetchConnectedGa4PropertyRequest(request)
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.fetch_connected_ga4_property
]
# 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
[docs] async def get_ad_sense_link(
self,
request: Optional[Union[analytics_admin.GetAdSenseLinkRequest, dict]] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.AdSenseLink:
r"""Looks up a single AdSenseLink.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.GetAdSenseLinkRequest, dict]]):
The request object. Request message to be passed to
GetAdSenseLink method.
name (:class:`str`):
Required. Unique identifier for the
AdSense Link requested. Format:
properties/{propertyId}/adSenseLinks/{linkId}
Example:
properties/1234/adSenseLinks/5678
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.AdSenseLink:
A link between a Google Analytics
property and an AdSense for Content ad
client.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.GetAdSenseLinkRequest):
request = analytics_admin.GetAdSenseLinkRequest(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_ad_sense_link
]
# 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
[docs] async def create_ad_sense_link(
self,
request: Optional[Union[analytics_admin.CreateAdSenseLinkRequest, dict]] = None,
*,
parent: Optional[str] = None,
adsense_link: Optional[resources.AdSenseLink] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.AdSenseLink:
r"""Creates an AdSenseLink.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.CreateAdSenseLinkRequest, dict]]):
The request object. Request message to be passed to
CreateAdSenseLink method.
parent (:class:`str`):
Required. The property for which to
create an AdSense Link. Format:
properties/{propertyId} Example:
properties/1234
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
adsense_link (:class:`google.analytics.admin_v1alpha.types.AdSenseLink`):
Required. The AdSense Link to create
This corresponds to the ``adsense_link`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.AdSenseLink:
A link between a Google Analytics
property and an AdSense for Content ad
client.
"""
# 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.
flattened_params = [parent, adsense_link]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.CreateAdSenseLinkRequest):
request = analytics_admin.CreateAdSenseLinkRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
if adsense_link is not None:
request.adsense_link = adsense_link
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.create_ad_sense_link
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# 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
[docs] async def delete_ad_sense_link(
self,
request: Optional[Union[analytics_admin.DeleteAdSenseLinkRequest, dict]] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> None:
r"""Deletes an AdSenseLink.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteAdSenseLinkRequest, dict]]):
The request object. Request message to be passed to
DeleteAdSenseLink method.
name (:class:`str`):
Required. Unique identifier for the
AdSense Link to be deleted. Format:
properties/{propertyId}/adSenseLinks/{linkId}
Example:
properties/1234/adSenseLinks/5678
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.DeleteAdSenseLinkRequest):
request = analytics_admin.DeleteAdSenseLinkRequest(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.delete_ad_sense_link
]
# 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.
await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
[docs] async def list_ad_sense_links(
self,
request: Optional[Union[analytics_admin.ListAdSenseLinksRequest, dict]] = None,
*,
parent: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> pagers.ListAdSenseLinksAsyncPager:
r"""Lists AdSenseLinks on a property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.ListAdSenseLinksRequest, dict]]):
The request object. Request message to be passed to
ListAdSenseLinks method.
parent (:class:`str`):
Required. Resource name of the parent
property. Format:
properties/{propertyId}
Example: properties/1234
This corresponds to the ``parent`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListAdSenseLinksAsyncPager:
Response message for ListAdSenseLinks
method.
Iterating over this object will yield
results and resolve additional pages
automatically.
"""
# 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.
flattened_params = [parent]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.ListAdSenseLinksRequest):
request = analytics_admin.ListAdSenseLinksRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.list_ad_sense_links
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# Validate the universe domain.
self._client._validate_universe_domain()
# Send the request.
response = await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# This method is paged; wrap the response in a pager, which provides
# an `__aiter__` convenience method.
response = pagers.ListAdSenseLinksAsyncPager(
method=rpc,
request=request,
response=response,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# Done; return the response.
return response
[docs] async def get_event_create_rule(
self,
request: Optional[
Union[analytics_admin.GetEventCreateRuleRequest, dict]
] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> event_create_and_edit.EventCreateRule:
r"""Lookup for a single EventCreateRule.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.GetEventCreateRuleRequest, dict]]):
The request object. Request message for
GetEventCreateRule RPC.
name (:class:`str`):
Required. The name of the
EventCreateRule to get. Example format:
properties/123/dataStreams/456/eventCreateRules/789
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.EventCreateRule:
An Event Create Rule defines
conditions that will trigger the
creation of an entirely new event based
upon matched criteria of a source event.
Additional mutations of the parameters
from the source event can be defined.
Unlike Event Edit rules, Event Creation
Rules have no defined order. They will
all be run independently.
Event Edit and Event Create rules can't
be used to modify an event created from
an Event Create rule.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.GetEventCreateRuleRequest):
request = analytics_admin.GetEventCreateRuleRequest(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_event_create_rule
]
# 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
[docs] async def list_event_create_rules(
self,
request: Optional[
Union[analytics_admin.ListEventCreateRulesRequest, dict]
] = None,
*,
parent: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> pagers.ListEventCreateRulesAsyncPager:
r"""Lists EventCreateRules on a web data stream.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.ListEventCreateRulesRequest, dict]]):
The request object. Request message for
ListEventCreateRules RPC.
parent (:class:`str`):
Required. Example format:
properties/123/dataStreams/456
This corresponds to the ``parent`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListEventCreateRulesAsyncPager:
Response message for
ListEventCreateRules RPC.
Iterating over this object will yield
results and resolve additional pages
automatically.
"""
# 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.
flattened_params = [parent]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.ListEventCreateRulesRequest):
request = analytics_admin.ListEventCreateRulesRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.list_event_create_rules
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# Validate the universe domain.
self._client._validate_universe_domain()
# Send the request.
response = await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# This method is paged; wrap the response in a pager, which provides
# an `__aiter__` convenience method.
response = pagers.ListEventCreateRulesAsyncPager(
method=rpc,
request=request,
response=response,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# Done; return the response.
return response
[docs] async def create_event_create_rule(
self,
request: Optional[
Union[analytics_admin.CreateEventCreateRuleRequest, dict]
] = None,
*,
parent: Optional[str] = None,
event_create_rule: Optional[event_create_and_edit.EventCreateRule] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> event_create_and_edit.EventCreateRule:
r"""Creates an EventCreateRule.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.CreateEventCreateRuleRequest, dict]]):
The request object. Request message for
CreateEventCreateRule RPC.
parent (:class:`str`):
Required. Example format:
properties/123/dataStreams/456
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
event_create_rule (:class:`google.analytics.admin_v1alpha.types.EventCreateRule`):
Required. The EventCreateRule to
create.
This corresponds to the ``event_create_rule`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.EventCreateRule:
An Event Create Rule defines
conditions that will trigger the
creation of an entirely new event based
upon matched criteria of a source event.
Additional mutations of the parameters
from the source event can be defined.
Unlike Event Edit rules, Event Creation
Rules have no defined order. They will
all be run independently.
Event Edit and Event Create rules can't
be used to modify an event created from
an Event Create rule.
"""
# 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.
flattened_params = [parent, event_create_rule]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.CreateEventCreateRuleRequest):
request = analytics_admin.CreateEventCreateRuleRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
if event_create_rule is not None:
request.event_create_rule = event_create_rule
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.create_event_create_rule
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# 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
[docs] async def update_event_create_rule(
self,
request: Optional[
Union[analytics_admin.UpdateEventCreateRuleRequest, dict]
] = None,
*,
event_create_rule: Optional[event_create_and_edit.EventCreateRule] = None,
update_mask: Optional[field_mask_pb2.FieldMask] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> event_create_and_edit.EventCreateRule:
r"""Updates an EventCreateRule.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateEventCreateRuleRequest, dict]]):
The request object. Request message for
UpdateEventCreateRule RPC.
event_create_rule (:class:`google.analytics.admin_v1alpha.types.EventCreateRule`):
Required. The EventCreateRule to update. The resource's
``name`` field is used to identify the EventCreateRule
to be updated.
This corresponds to the ``event_create_rule`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
Required. The list of fields to be updated. Field names
must be in snake case (e.g., "field_to_update"). Omitted
fields will not be updated. To replace the entire
entity, use one path with the string "*" to match all
fields.
This corresponds to the ``update_mask`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.EventCreateRule:
An Event Create Rule defines
conditions that will trigger the
creation of an entirely new event based
upon matched criteria of a source event.
Additional mutations of the parameters
from the source event can be defined.
Unlike Event Edit rules, Event Creation
Rules have no defined order. They will
all be run independently.
Event Edit and Event Create rules can't
be used to modify an event created from
an Event Create rule.
"""
# 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.
flattened_params = [event_create_rule, update_mask]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.UpdateEventCreateRuleRequest):
request = analytics_admin.UpdateEventCreateRuleRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if event_create_rule is not None:
request.event_create_rule = event_create_rule
if update_mask is not None:
request.update_mask = update_mask
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.update_event_create_rule
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(
(("event_create_rule.name", request.event_create_rule.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
[docs] async def delete_event_create_rule(
self,
request: Optional[
Union[analytics_admin.DeleteEventCreateRuleRequest, dict]
] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> None:
r"""Deletes an EventCreateRule.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteEventCreateRuleRequest, dict]]):
The request object. Request message for
DeleteEventCreateRule RPC.
name (:class:`str`):
Required. Example format:
properties/123/dataStreams/456/eventCreateRules/789
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.DeleteEventCreateRuleRequest):
request = analytics_admin.DeleteEventCreateRuleRequest(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.delete_event_create_rule
]
# 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.
await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
[docs] async def get_event_edit_rule(
self,
request: Optional[Union[analytics_admin.GetEventEditRuleRequest, dict]] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> event_create_and_edit.EventEditRule:
r"""Lookup for a single EventEditRule.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.GetEventEditRuleRequest, dict]]):
The request object. Request message for GetEventEditRule
RPC.
name (:class:`str`):
Required. The name of the
EventEditRule to get. Example format:
properties/123/dataStreams/456/eventEditRules/789
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.EventEditRule:
An Event Edit Rule defines conditions
that will trigger the creation of an
entirely new event based upon matched
criteria of a source event. Additional
mutations of the parameters from the
source event can be defined.
Unlike Event Create rules, Event Edit
Rules are applied in their defined
order.
Event Edit rules can't be used to modify
an event created from an Event Create
rule.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.GetEventEditRuleRequest):
request = analytics_admin.GetEventEditRuleRequest(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_event_edit_rule
]
# 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
[docs] async def list_event_edit_rules(
self,
request: Optional[
Union[analytics_admin.ListEventEditRulesRequest, dict]
] = None,
*,
parent: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> pagers.ListEventEditRulesAsyncPager:
r"""Lists EventEditRules on a web data stream.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.ListEventEditRulesRequest, dict]]):
The request object. Request message for
ListEventEditRules RPC.
parent (:class:`str`):
Required. Example format:
properties/123/dataStreams/456
This corresponds to the ``parent`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListEventEditRulesAsyncPager:
Response message for
ListEventEditRules RPC.
Iterating over this object will yield
results and resolve additional pages
automatically.
"""
# 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.
flattened_params = [parent]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.ListEventEditRulesRequest):
request = analytics_admin.ListEventEditRulesRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.list_event_edit_rules
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# Validate the universe domain.
self._client._validate_universe_domain()
# Send the request.
response = await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# This method is paged; wrap the response in a pager, which provides
# an `__aiter__` convenience method.
response = pagers.ListEventEditRulesAsyncPager(
method=rpc,
request=request,
response=response,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# Done; return the response.
return response
[docs] async def create_event_edit_rule(
self,
request: Optional[
Union[analytics_admin.CreateEventEditRuleRequest, dict]
] = None,
*,
parent: Optional[str] = None,
event_edit_rule: Optional[event_create_and_edit.EventEditRule] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> event_create_and_edit.EventEditRule:
r"""Creates an EventEditRule.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.CreateEventEditRuleRequest, dict]]):
The request object. Request message for
CreateEventEditRule RPC.
parent (:class:`str`):
Required. Example format:
properties/123/dataStreams/456
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
event_edit_rule (:class:`google.analytics.admin_v1alpha.types.EventEditRule`):
Required. The EventEditRule to
create.
This corresponds to the ``event_edit_rule`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.EventEditRule:
An Event Edit Rule defines conditions
that will trigger the creation of an
entirely new event based upon matched
criteria of a source event. Additional
mutations of the parameters from the
source event can be defined.
Unlike Event Create rules, Event Edit
Rules are applied in their defined
order.
Event Edit rules can't be used to modify
an event created from an Event Create
rule.
"""
# 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.
flattened_params = [parent, event_edit_rule]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.CreateEventEditRuleRequest):
request = analytics_admin.CreateEventEditRuleRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
if event_edit_rule is not None:
request.event_edit_rule = event_edit_rule
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.create_event_edit_rule
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# 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
[docs] async def update_event_edit_rule(
self,
request: Optional[
Union[analytics_admin.UpdateEventEditRuleRequest, dict]
] = None,
*,
event_edit_rule: Optional[event_create_and_edit.EventEditRule] = None,
update_mask: Optional[field_mask_pb2.FieldMask] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> event_create_and_edit.EventEditRule:
r"""Updates an EventEditRule.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateEventEditRuleRequest, dict]]):
The request object. Request message for
UpdateEventEditRule RPC.
event_edit_rule (:class:`google.analytics.admin_v1alpha.types.EventEditRule`):
Required. The EventEditRule to update. The resource's
``name`` field is used to identify the EventEditRule to
be updated.
This corresponds to the ``event_edit_rule`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
Required. The list of fields to be updated. Field names
must be in snake case (e.g., "field_to_update"). Omitted
fields will not be updated. To replace the entire
entity, use one path with the string "*" to match all
fields.
This corresponds to the ``update_mask`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.EventEditRule:
An Event Edit Rule defines conditions
that will trigger the creation of an
entirely new event based upon matched
criteria of a source event. Additional
mutations of the parameters from the
source event can be defined.
Unlike Event Create rules, Event Edit
Rules are applied in their defined
order.
Event Edit rules can't be used to modify
an event created from an Event Create
rule.
"""
# 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.
flattened_params = [event_edit_rule, update_mask]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.UpdateEventEditRuleRequest):
request = analytics_admin.UpdateEventEditRuleRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if event_edit_rule is not None:
request.event_edit_rule = event_edit_rule
if update_mask is not None:
request.update_mask = update_mask
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.update_event_edit_rule
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(
(("event_edit_rule.name", request.event_edit_rule.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
[docs] async def delete_event_edit_rule(
self,
request: Optional[
Union[analytics_admin.DeleteEventEditRuleRequest, dict]
] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> None:
r"""Deletes an EventEditRule.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteEventEditRuleRequest, dict]]):
The request object. Request message for
DeleteEventEditRule RPC.
name (:class:`str`):
Required. Example format:
properties/123/dataStreams/456/eventEditRules/789
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.DeleteEventEditRuleRequest):
request = analytics_admin.DeleteEventEditRuleRequest(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.delete_event_edit_rule
]
# 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.
await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
[docs] async def reorder_event_edit_rules(
self,
request: Optional[
Union[analytics_admin.ReorderEventEditRulesRequest, dict]
] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> None:
r"""Changes the processing order of event edit rules on
the specified stream.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.ReorderEventEditRulesRequest, dict]]):
The request object. Request message for
ReorderEventEditRules RPC.
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
"""
# Create or coerce a protobuf request object.
# - 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_admin.ReorderEventEditRulesRequest):
request = analytics_admin.ReorderEventEditRulesRequest(request)
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.reorder_event_edit_rules
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# Validate the universe domain.
self._client._validate_universe_domain()
# Send the request.
await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
[docs] async def update_data_redaction_settings(
self,
request: Optional[
Union[analytics_admin.UpdateDataRedactionSettingsRequest, dict]
] = None,
*,
data_redaction_settings: Optional[resources.DataRedactionSettings] = None,
update_mask: Optional[field_mask_pb2.FieldMask] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.DataRedactionSettings:
r"""Updates a DataRedactionSettings on a property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateDataRedactionSettingsRequest, dict]]):
The request object. Request message for
UpdateDataRedactionSettings RPC.
data_redaction_settings (:class:`google.analytics.admin_v1alpha.types.DataRedactionSettings`):
Required. The settings to update. The ``name`` field is
used to identify the settings to be updated.
This corresponds to the ``data_redaction_settings`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
Required. The list of fields to be updated. Field names
must be in snake case (e.g., "field_to_update"). Omitted
fields will not be updated. To replace the entire
entity, use one path with the string "*" to match all
fields.
This corresponds to the ``update_mask`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.DataRedactionSettings:
Settings for client-side data
redaction. Singleton resource under a
Web Stream.
"""
# 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.
flattened_params = [data_redaction_settings, update_mask]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.UpdateDataRedactionSettingsRequest):
request = analytics_admin.UpdateDataRedactionSettingsRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if data_redaction_settings is not None:
request.data_redaction_settings = data_redaction_settings
if update_mask is not None:
request.update_mask = update_mask
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.update_data_redaction_settings
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(
(
(
"data_redaction_settings.name",
request.data_redaction_settings.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
[docs] async def get_data_redaction_settings(
self,
request: Optional[
Union[analytics_admin.GetDataRedactionSettingsRequest, dict]
] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.DataRedactionSettings:
r"""Lookup for a single DataRedactionSettings.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.GetDataRedactionSettingsRequest, dict]]):
The request object. Request message for
GetDataRedactionSettings RPC.
name (:class:`str`):
Required. The name of the settings to lookup. Format:
properties/{property}/dataStreams/{data_stream}/dataRedactionSettings
Example:
"properties/1000/dataStreams/2000/dataRedactionSettings"
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.DataRedactionSettings:
Settings for client-side data
redaction. Singleton resource under a
Web Stream.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.GetDataRedactionSettingsRequest):
request = analytics_admin.GetDataRedactionSettingsRequest(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_data_redaction_settings
]
# 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
[docs] async def get_calculated_metric(
self,
request: Optional[
Union[analytics_admin.GetCalculatedMetricRequest, dict]
] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.CalculatedMetric:
r"""Lookup for a single CalculatedMetric.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.GetCalculatedMetricRequest, dict]]):
The request object. Request message for
GetCalculatedMetric RPC.
name (:class:`str`):
Required. The name of the CalculatedMetric to get.
Format:
properties/{property_id}/calculatedMetrics/{calculated_metric_id}
Example: properties/1234/calculatedMetrics/Metric01
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.CalculatedMetric:
A definition for a calculated metric.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.GetCalculatedMetricRequest):
request = analytics_admin.GetCalculatedMetricRequest(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_calculated_metric
]
# 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
[docs] async def create_calculated_metric(
self,
request: Optional[
Union[analytics_admin.CreateCalculatedMetricRequest, dict]
] = None,
*,
parent: Optional[str] = None,
calculated_metric: Optional[resources.CalculatedMetric] = None,
calculated_metric_id: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.CalculatedMetric:
r"""Creates a CalculatedMetric.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.CreateCalculatedMetricRequest, dict]]):
The request object. Request message for
CreateCalculatedMetric RPC.
parent (:class:`str`):
Required. Format: properties/{property_id} Example:
properties/1234
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
calculated_metric (:class:`google.analytics.admin_v1alpha.types.CalculatedMetric`):
Required. The CalculatedMetric to
create.
This corresponds to the ``calculated_metric`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
calculated_metric_id (:class:`str`):
Required. The ID to use for the calculated metric which
will become the final component of the calculated
metric's resource name.
This value should be 1-80 characters and valid
characters are `[a-zA-Z0-9_]`, no spaces allowed.
calculated_metric_id must be unique between all
calculated metrics under a property. The
calculated_metric_id is used when referencing this
calculated metric from external APIs, for example,
"calcMetric:{calculated_metric_id}".
This corresponds to the ``calculated_metric_id`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.CalculatedMetric:
A definition for a calculated metric.
"""
# 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.
flattened_params = [parent, calculated_metric, calculated_metric_id]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.CreateCalculatedMetricRequest):
request = analytics_admin.CreateCalculatedMetricRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
if calculated_metric is not None:
request.calculated_metric = calculated_metric
if calculated_metric_id is not None:
request.calculated_metric_id = calculated_metric_id
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.create_calculated_metric
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# 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
[docs] async def list_calculated_metrics(
self,
request: Optional[
Union[analytics_admin.ListCalculatedMetricsRequest, dict]
] = None,
*,
parent: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> pagers.ListCalculatedMetricsAsyncPager:
r"""Lists CalculatedMetrics on a property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.ListCalculatedMetricsRequest, dict]]):
The request object. Request message for
ListCalculatedMetrics RPC.
parent (:class:`str`):
Required. Example format:
properties/1234
This corresponds to the ``parent`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListCalculatedMetricsAsyncPager:
Response message for
ListCalculatedMetrics RPC.
Iterating over this object will yield
results and resolve additional pages
automatically.
"""
# 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.
flattened_params = [parent]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.ListCalculatedMetricsRequest):
request = analytics_admin.ListCalculatedMetricsRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.list_calculated_metrics
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# Validate the universe domain.
self._client._validate_universe_domain()
# Send the request.
response = await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# This method is paged; wrap the response in a pager, which provides
# an `__aiter__` convenience method.
response = pagers.ListCalculatedMetricsAsyncPager(
method=rpc,
request=request,
response=response,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# Done; return the response.
return response
[docs] async def update_calculated_metric(
self,
request: Optional[
Union[analytics_admin.UpdateCalculatedMetricRequest, dict]
] = None,
*,
calculated_metric: Optional[resources.CalculatedMetric] = None,
update_mask: Optional[field_mask_pb2.FieldMask] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.CalculatedMetric:
r"""Updates a CalculatedMetric on a property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateCalculatedMetricRequest, dict]]):
The request object. Request message for
UpdateCalculatedMetric RPC.
calculated_metric (:class:`google.analytics.admin_v1alpha.types.CalculatedMetric`):
Required. The CalculatedMetric to
update
This corresponds to the ``calculated_metric`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
Required. The list of fields to be updated. Omitted
fields will not be updated. To replace the entire
entity, use one path with the string "*" to match all
fields.
This corresponds to the ``update_mask`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.CalculatedMetric:
A definition for a calculated metric.
"""
# 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.
flattened_params = [calculated_metric, update_mask]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.UpdateCalculatedMetricRequest):
request = analytics_admin.UpdateCalculatedMetricRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if calculated_metric is not None:
request.calculated_metric = calculated_metric
if update_mask is not None:
request.update_mask = update_mask
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.update_calculated_metric
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(
(("calculated_metric.name", request.calculated_metric.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
[docs] async def delete_calculated_metric(
self,
request: Optional[
Union[analytics_admin.DeleteCalculatedMetricRequest, dict]
] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> None:
r"""Deletes a CalculatedMetric on a property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteCalculatedMetricRequest, dict]]):
The request object. Request message for
DeleteCalculatedMetric RPC.
name (:class:`str`):
Required. The name of the CalculatedMetric to delete.
Format:
properties/{property_id}/calculatedMetrics/{calculated_metric_id}
Example: properties/1234/calculatedMetrics/Metric01
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.DeleteCalculatedMetricRequest):
request = analytics_admin.DeleteCalculatedMetricRequest(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.delete_calculated_metric
]
# 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.
await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
[docs] async def create_rollup_property(
self,
request: Optional[
Union[analytics_admin.CreateRollupPropertyRequest, dict]
] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> analytics_admin.CreateRollupPropertyResponse:
r"""Create a roll-up property and all roll-up property
source links.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.CreateRollupPropertyRequest, dict]]):
The request object. Request message for
CreateRollupProperty RPC.
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.CreateRollupPropertyResponse:
Response message for
CreateRollupProperty RPC.
"""
# Create or coerce a protobuf request object.
# - 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_admin.CreateRollupPropertyRequest):
request = analytics_admin.CreateRollupPropertyRequest(request)
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.create_rollup_property
]
# 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
[docs] async def get_rollup_property_source_link(
self,
request: Optional[
Union[analytics_admin.GetRollupPropertySourceLinkRequest, dict]
] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.RollupPropertySourceLink:
r"""Lookup for a single roll-up property source Link.
Only roll-up properties can have source links, so this
method will throw an error if used on other types of
properties.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.GetRollupPropertySourceLinkRequest, dict]]):
The request object. Request message for
GetRollupPropertySourceLink RPC.
name (:class:`str`):
Required. The name of the roll-up property source link
to lookup. Format:
properties/{property_id}/rollupPropertySourceLinks/{rollup_property_source_link_id}
Example: properties/123/rollupPropertySourceLinks/456
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.RollupPropertySourceLink:
A link that references a source
property under the parent rollup
property.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.GetRollupPropertySourceLinkRequest):
request = analytics_admin.GetRollupPropertySourceLinkRequest(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_rollup_property_source_link
]
# 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
[docs] async def list_rollup_property_source_links(
self,
request: Optional[
Union[analytics_admin.ListRollupPropertySourceLinksRequest, dict]
] = None,
*,
parent: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> pagers.ListRollupPropertySourceLinksAsyncPager:
r"""Lists roll-up property source Links on a property.
Only roll-up properties can have source links, so this
method will throw an error if used on other types of
properties.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.ListRollupPropertySourceLinksRequest, dict]]):
The request object. Request message for
ListRollupPropertySourceLinks RPC.
parent (:class:`str`):
Required. The name of the roll-up property to list
roll-up property source links under. Format:
properties/{property_id} Example: properties/1234
This corresponds to the ``parent`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListRollupPropertySourceLinksAsyncPager:
Response message for
ListRollupPropertySourceLinks RPC.
Iterating over this object will yield
results and resolve additional pages
automatically.
"""
# 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.
flattened_params = [parent]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.ListRollupPropertySourceLinksRequest
):
request = analytics_admin.ListRollupPropertySourceLinksRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.list_rollup_property_source_links
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# Validate the universe domain.
self._client._validate_universe_domain()
# Send the request.
response = await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# This method is paged; wrap the response in a pager, which provides
# an `__aiter__` convenience method.
response = pagers.ListRollupPropertySourceLinksAsyncPager(
method=rpc,
request=request,
response=response,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# Done; return the response.
return response
[docs] async def create_rollup_property_source_link(
self,
request: Optional[
Union[analytics_admin.CreateRollupPropertySourceLinkRequest, dict]
] = None,
*,
parent: Optional[str] = None,
rollup_property_source_link: Optional[
resources.RollupPropertySourceLink
] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> resources.RollupPropertySourceLink:
r"""Creates a roll-up property source link.
Only roll-up properties can have source links, so this
method will throw an error if used on other types of
properties.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.CreateRollupPropertySourceLinkRequest, dict]]):
The request object. Request message for
CreateRollupPropertySourceLink RPC.
parent (:class:`str`):
Required. Format: properties/{property_id} Example:
properties/1234
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
rollup_property_source_link (:class:`google.analytics.admin_v1alpha.types.RollupPropertySourceLink`):
Required. The roll-up property source
link to create.
This corresponds to the ``rollup_property_source_link`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.RollupPropertySourceLink:
A link that references a source
property under the parent rollup
property.
"""
# 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.
flattened_params = [parent, rollup_property_source_link]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.CreateRollupPropertySourceLinkRequest
):
request = analytics_admin.CreateRollupPropertySourceLinkRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
if rollup_property_source_link is not None:
request.rollup_property_source_link = rollup_property_source_link
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.create_rollup_property_source_link
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# 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
[docs] async def delete_rollup_property_source_link(
self,
request: Optional[
Union[analytics_admin.DeleteRollupPropertySourceLinkRequest, dict]
] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> None:
r"""Deletes a roll-up property source link.
Only roll-up properties can have source links, so this
method will throw an error if used on other types of
properties.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteRollupPropertySourceLinkRequest, dict]]):
The request object. Request message for
DeleteRollupPropertySourceLink RPC.
name (:class:`str`):
Required. Format:
properties/{property_id}/rollupPropertySourceLinks/{rollup_property_source_link_id}
Example: properties/1234/rollupPropertySourceLinks/5678
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.DeleteRollupPropertySourceLinkRequest
):
request = analytics_admin.DeleteRollupPropertySourceLinkRequest(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.delete_rollup_property_source_link
]
# 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.
await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
[docs] async def provision_subproperty(
self,
request: Optional[
Union[analytics_admin.ProvisionSubpropertyRequest, dict]
] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> analytics_admin.ProvisionSubpropertyResponse:
r"""Create a subproperty and a subproperty event filter
that applies to the created subproperty.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.ProvisionSubpropertyRequest, dict]]):
The request object. Request message for CreateSubproperty
RPC.
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.ProvisionSubpropertyResponse:
Response message for
ProvisionSubproperty RPC.
"""
# Create or coerce a protobuf request object.
# - 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_admin.ProvisionSubpropertyRequest):
request = analytics_admin.ProvisionSubpropertyRequest(request)
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.provision_subproperty
]
# 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
[docs] async def create_subproperty_event_filter(
self,
request: Optional[
Union[analytics_admin.CreateSubpropertyEventFilterRequest, dict]
] = None,
*,
parent: Optional[str] = None,
subproperty_event_filter: Optional[
gaa_subproperty_event_filter.SubpropertyEventFilter
] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> gaa_subproperty_event_filter.SubpropertyEventFilter:
r"""Creates a subproperty Event Filter.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.CreateSubpropertyEventFilterRequest, dict]]):
The request object. Request message for
CreateSubpropertyEventFilter RPC.
parent (:class:`str`):
Required. The ordinary property for which to create a
subproperty event filter. Format: properties/property_id
Example: properties/123
This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
subproperty_event_filter (:class:`google.analytics.admin_v1alpha.types.SubpropertyEventFilter`):
Required. The subproperty event
filter to create.
This corresponds to the ``subproperty_event_filter`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.SubpropertyEventFilter:
A resource message representing a
Google Analytics subproperty event
filter.
"""
# 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.
flattened_params = [parent, subproperty_event_filter]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.CreateSubpropertyEventFilterRequest):
request = analytics_admin.CreateSubpropertyEventFilterRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
if subproperty_event_filter is not None:
request.subproperty_event_filter = subproperty_event_filter
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.create_subproperty_event_filter
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# 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
[docs] async def get_subproperty_event_filter(
self,
request: Optional[
Union[analytics_admin.GetSubpropertyEventFilterRequest, dict]
] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> subproperty_event_filter.SubpropertyEventFilter:
r"""Lookup for a single subproperty Event Filter.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.GetSubpropertyEventFilterRequest, dict]]):
The request object. Request message for
GetSubpropertyEventFilter RPC.
name (:class:`str`):
Required. Resource name of the subproperty event filter
to lookup. Format:
properties/property_id/subpropertyEventFilters/subproperty_event_filter
Example: properties/123/subpropertyEventFilters/456
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.SubpropertyEventFilter:
A resource message representing a
Google Analytics subproperty event
filter.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.GetSubpropertyEventFilterRequest):
request = analytics_admin.GetSubpropertyEventFilterRequest(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_subproperty_event_filter
]
# 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
[docs] async def list_subproperty_event_filters(
self,
request: Optional[
Union[analytics_admin.ListSubpropertyEventFiltersRequest, dict]
] = None,
*,
parent: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> pagers.ListSubpropertyEventFiltersAsyncPager:
r"""List all subproperty Event Filters on a property.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.ListSubpropertyEventFiltersRequest, dict]]):
The request object. Request message for
ListSubpropertyEventFilters RPC.
parent (:class:`str`):
Required. Resource name of the ordinary property.
Format: properties/property_id Example: properties/123
This corresponds to the ``parent`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListSubpropertyEventFiltersAsyncPager:
Response message for
ListSubpropertyEventFilter RPC.
Iterating over this object will yield
results and resolve additional pages
automatically.
"""
# 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.
flattened_params = [parent]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.ListSubpropertyEventFiltersRequest):
request = analytics_admin.ListSubpropertyEventFiltersRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if parent is not None:
request.parent = parent
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.list_subproperty_event_filters
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
)
# Validate the universe domain.
self._client._validate_universe_domain()
# Send the request.
response = await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# This method is paged; wrap the response in a pager, which provides
# an `__aiter__` convenience method.
response = pagers.ListSubpropertyEventFiltersAsyncPager(
method=rpc,
request=request,
response=response,
retry=retry,
timeout=timeout,
metadata=metadata,
)
# Done; return the response.
return response
[docs] async def update_subproperty_event_filter(
self,
request: Optional[
Union[analytics_admin.UpdateSubpropertyEventFilterRequest, dict]
] = None,
*,
subproperty_event_filter: Optional[
gaa_subproperty_event_filter.SubpropertyEventFilter
] = None,
update_mask: Optional[field_mask_pb2.FieldMask] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> gaa_subproperty_event_filter.SubpropertyEventFilter:
r"""Updates a subproperty Event Filter.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateSubpropertyEventFilterRequest, dict]]):
The request object. Request message for
UpdateSubpropertyEventFilter RPC.
subproperty_event_filter (:class:`google.analytics.admin_v1alpha.types.SubpropertyEventFilter`):
Required. The subproperty event
filter to update.
This corresponds to the ``subproperty_event_filter`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
Required. The list of fields to update. Field names must
be in snake case (for example, "field_to_update").
Omitted fields will not be updated. To replace the
entire entity, use one path with the string "*" to match
all fields.
This corresponds to the ``update_mask`` 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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.analytics.admin_v1alpha.types.SubpropertyEventFilter:
A resource message representing a
Google Analytics subproperty event
filter.
"""
# 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.
flattened_params = [subproperty_event_filter, update_mask]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.UpdateSubpropertyEventFilterRequest):
request = analytics_admin.UpdateSubpropertyEventFilterRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if subproperty_event_filter is not None:
request.subproperty_event_filter = subproperty_event_filter
if update_mask is not None:
request.update_mask = update_mask
# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.update_subproperty_event_filter
]
# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata(
(
(
"subproperty_event_filter.name",
request.subproperty_event_filter.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
[docs] async def delete_subproperty_event_filter(
self,
request: Optional[
Union[analytics_admin.DeleteSubpropertyEventFilterRequest, dict]
] = None,
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> None:
r"""Deletes a subproperty event filter.
Args:
request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteSubpropertyEventFilterRequest, dict]]):
The request object. Request message for
DeleteSubpropertyEventFilter RPC.
name (:class:`str`):
Required. Resource name of the subproperty event filter
to delete. Format:
properties/property_id/subpropertyEventFilters/subproperty_event_filter
Example: properties/123/subpropertyEventFilters/456
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, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
"""
# 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.
flattened_params = [name]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
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_admin.DeleteSubpropertyEventFilterRequest):
request = analytics_admin.DeleteSubpropertyEventFilterRequest(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.delete_subproperty_event_filter
]
# 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.
await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)
async def __aenter__(self) -> "AnalyticsAdminServiceAsyncClient":
return self
async def __aexit__(self, exc_type, exc, tb):
await self.transport.close()
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=package_version.__version__
)
__all__ = ("AnalyticsAdminServiceAsyncClient",)