From 03be41aa6890a2e186f96196ba89a65dc7a838c7 Mon Sep 17 00:00:00 2001
From: ikuleshov <ikuleshov@google.com>
Date: Mon, 3 Aug 2020 22:04:55 -0700
Subject: [PATCH 001/213] docs: added a sample (#9)

* feat: added a sample

* docs: added a sample
---
 google-analytics-admin/quickstart.py | 68 ++++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)
 create mode 100644 google-analytics-admin/quickstart.py

diff --git a/google-analytics-admin/quickstart.py b/google-analytics-admin/quickstart.py
new file mode 100644
index 0000000..5653af4
--- /dev/null
+++ b/google-analytics-admin/quickstart.py
@@ -0,0 +1,68 @@
+#!/usr/bin/env python
+
+# Copyright 2020 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample quickstart application.
+Example usage:
+    python quickstart.py
+
+This application demonstrates the usage of the Analytics Admin API using
+service account credentials. For more information on service accounts, see
+
+https://cloud.google.com/iam/docs/understanding-service-accounts
+
+The following document provides instructions on setting service account
+credentials for your application:
+
+  https://cloud.google.com/docs/authentication/production
+
+In a nutshell, you need to:
+1. Create a service account and download the key JSON file.
+
+https://cloud.google.com/docs/authentication/production#creating_a_service_account
+
+2. Provide service account credentials using one of the following options:
+- set the GOOGLE_APPLICATION_CREDENTIALS environment variable, the API
+client will use the value of this variable to find the service account key
+JSON file.
+
+https://cloud.google.com/docs/authentication/production#setting_the_environment_variable
+
+OR
+- manually pass the path to the service account key JSON file to the API client
+by specifying the keyFilename parameter in the constructor:
+https://cloud.google.com/docs/authentication/production#passing_the_path_to_the_service_account_key_in_code
+
+To install the latest published package dependency, execute the following:
+  pip install google-analytics-admin
+"""
+
+# [START ga_admin_list_accounts]
+def list_accounts():
+  """Lists the available Google Analytics accounts."""
+  from google.analytics.admin import AnalyticsAdminServiceClient
+  # Using a default constructor instructs the client to use the credentials
+  # specified in GOOGLE_APPLICATION_CREDENTIALS environment variable.
+  client = AnalyticsAdminServiceClient()
+
+  # Displays the configuration information for all Google Analytics accounts
+  # available to the authenticated user.
+  for account in client.list_accounts():
+    print(account)
+# [END ga_admin_list_accounts]
+
+
+if __name__ == "__main__":
+  list_accounts()

From 44a589ee2f0edd216135a3e494307c94b62408eb Mon Sep 17 00:00:00 2001
From: Dina Graves Portman <dinagraves@google.com>
Date: Tue, 6 Oct 2020 15:41:14 -0700
Subject: [PATCH 002/213] test: Adding samples directory and requirements (#9)

* test: Adding samples directory and requirements

* test: Adding noxfile
---
 google-analytics-data/noxfile.py            | 237 ++++++++++++++++++++
 google-analytics-data/requirements-test.txt |   1 +
 google-analytics-data/requirements.txt      |   1 +
 3 files changed, 239 insertions(+)
 create mode 100644 google-analytics-data/noxfile.py
 create mode 100644 google-analytics-data/requirements-test.txt
 create mode 100644 google-analytics-data/requirements.txt

diff --git a/google-analytics-data/noxfile.py b/google-analytics-data/noxfile.py
new file mode 100644
index 0000000..0bf9dba
--- /dev/null
+++ b/google-analytics-data/noxfile.py
@@ -0,0 +1,237 @@
+# Copyright 2020 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 __future__ import print_function
+
+import os
+from pathlib import Path
+import sys
+
+import nox
+
+
+# WARNING - WARNING - WARNING - WARNING - WARNING
+# WARNING - WARNING - WARNING - WARNING - WARNING
+#           DO NOT EDIT THIS FILE EVER!
+# WARNING - WARNING - WARNING - WARNING - WARNING
+# WARNING - WARNING - WARNING - WARNING - WARNING
+
+# Copy `noxfile_config.py` to your directory and modify it instead.
+
+
+# `TEST_CONFIG` dict is a configuration hook that allows users to
+# modify the test configurations. The values here should be in sync
+# with `noxfile_config.py`. Users will copy `noxfile_config.py` into
+# their directory and modify it.
+
+TEST_CONFIG = {
+    # You can opt out from the test for specific Python versions.
+    'ignored_versions': ["2.7"],
+
+    # An envvar key for determining the project id to use. Change it
+    # to 'BUILD_SPECIFIC_GCLOUD_PROJECT' if you want to opt in using a
+    # build specific Cloud project. You can also use your own string
+    # to use your own Cloud project.
+    'gcloud_project_env': 'GOOGLE_CLOUD_PROJECT',
+    # 'gcloud_project_env': 'BUILD_SPECIFIC_GCLOUD_PROJECT',
+
+    # A dictionary you want to inject into your test. Don't put any
+    # secrets here. These values will override predefined values.
+    'envs': {},
+}
+
+
+try:
+    # Ensure we can import noxfile_config in the project's directory.
+    sys.path.append('.')
+    from noxfile_config import TEST_CONFIG_OVERRIDE
+except ImportError as e:
+    print("No user noxfile_config found: detail: {}".format(e))
+    TEST_CONFIG_OVERRIDE = {}
+
+# Update the TEST_CONFIG with the user supplied values.
+TEST_CONFIG.update(TEST_CONFIG_OVERRIDE)
+
+
+def get_pytest_env_vars():
+    """Returns a dict for pytest invocation."""
+    ret = {}
+
+    # Override the GCLOUD_PROJECT and the alias.
+    env_key = TEST_CONFIG['gcloud_project_env']
+    # This should error out if not set.
+    ret['GOOGLE_CLOUD_PROJECT'] = os.environ[env_key]
+    ret['GCLOUD_PROJECT'] = os.environ[env_key]  # deprecated
+
+    # Apply user supplied envs.
+    ret.update(TEST_CONFIG['envs'])
+    return ret
+
+
+# DO NOT EDIT - automatically generated.
+# All versions used to tested samples.
+ALL_VERSIONS = ["2.7", "3.6", "3.7", "3.8"]
+
+# Any default versions that should be ignored.
+IGNORED_VERSIONS = TEST_CONFIG['ignored_versions']
+
+TESTED_VERSIONS = sorted([v for v in ALL_VERSIONS if v not in IGNORED_VERSIONS])
+
+INSTALL_LIBRARY_FROM_SOURCE = bool(os.environ.get("INSTALL_LIBRARY_FROM_SOURCE", False))
+#
+# Style Checks
+#
+
+
+def _determine_local_import_names(start_dir):
+    """Determines all import names that should be considered "local".
+
+    This is used when running the linter to insure that import order is
+    properly checked.
+    """
+    file_ext_pairs = [os.path.splitext(path) for path in os.listdir(start_dir)]
+    return [
+        basename
+        for basename, extension in file_ext_pairs
+        if extension == ".py"
+        or os.path.isdir(os.path.join(start_dir, basename))
+        and basename not in ("__pycache__")
+    ]
+
+
+# Linting with flake8.
+#
+# We ignore the following rules:
+#   E203: whitespace before ‘:’
+#   E266: too many leading ‘#’ for block comment
+#   E501: line too long
+#   I202: Additional newline in a section of imports
+#
+# We also need to specify the rules which are ignored by default:
+# ['E226', 'W504', 'E126', 'E123', 'W503', 'E24', 'E704', 'E121']
+FLAKE8_COMMON_ARGS = [
+    "--show-source",
+    "--builtin=gettext",
+    "--max-complexity=20",
+    "--import-order-style=google",
+    "--exclude=.nox,.cache,env,lib,generated_pb2,*_pb2.py,*_pb2_grpc.py",
+    "--ignore=E121,E123,E126,E203,E226,E24,E266,E501,E704,W503,W504,I202",
+    "--max-line-length=88",
+]
+
+
+@nox.session
+def lint(session):
+    session.install("flake8", "flake8-import-order")
+
+    local_names = _determine_local_import_names(".")
+    args = FLAKE8_COMMON_ARGS + [
+        "--application-import-names",
+        ",".join(local_names),
+        "."
+    ]
+    session.run("flake8", *args)
+
+
+#
+# Black
+#
+
+@nox.session
+def blacken(session):
+    session.install("black")
+    python_files = [path for path in os.listdir(".") if path.endswith(".py")]
+
+    session.run("black", *python_files)
+
+
+#
+# Sample Tests
+#
+
+
+PYTEST_COMMON_ARGS = ["--junitxml=sponge_log.xml"]
+
+
+def _session_tests(session, post_install=None):
+    """Runs py.test for a particular project."""
+    if os.path.exists("requirements.txt"):
+        session.install("-r", "requirements.txt")
+
+    if os.path.exists("requirements-test.txt"):
+        session.install("-r", "requirements-test.txt")
+
+    if INSTALL_LIBRARY_FROM_SOURCE:
+        session.install("-e", _get_repo_root())
+
+    if post_install:
+        post_install(session)
+
+    session.run(
+        "pytest",
+        *(PYTEST_COMMON_ARGS + session.posargs),
+        # Pytest will return 5 when no tests are collected. This can happen
+        # on travis where slow and flaky tests are excluded.
+        # See http://doc.pytest.org/en/latest/_modules/_pytest/main.html
+        success_codes=[0, 5],
+        env=get_pytest_env_vars()
+    )
+
+
+@nox.session(python=ALL_VERSIONS)
+def py(session):
+    """Runs py.test for a sample using the specified version of Python."""
+    if session.python in TESTED_VERSIONS:
+        _session_tests(session)
+    else:
+        session.skip("SKIPPED: {} tests are disabled for this sample.".format(
+            session.python
+        ))
+
+
+#
+# Readmegen
+#
+
+
+def _get_repo_root():
+    """ Returns the root folder of the project. """
+    # Get root of this repository. Assume we don't have directories nested deeper than 10 items.
+    p = Path(os.getcwd())
+    for i in range(10):
+        if p is None:
+            break
+        if Path(p / ".git").exists():
+            return str(p)
+        p = p.parent
+    raise Exception("Unable to detect repository root.")
+
+
+GENERATED_READMES = sorted([x for x in Path(".").rglob("*.rst.in")])
+
+
+@nox.session
+@nox.parametrize("path", GENERATED_READMES)
+def readmegen(session, path):
+    """(Re-)generates the readme for a sample."""
+    session.install("jinja2", "pyyaml")
+    dir_ = os.path.dirname(path)
+
+    if os.path.exists(os.path.join(dir_, "requirements.txt")):
+        session.install("-r", os.path.join(dir_, "requirements.txt"))
+
+    in_file = os.path.join(dir_, "README.rst.in")
+    session.run(
+        "python", _get_repo_root() + "/scripts/readme-gen/readme_gen.py", in_file
+    )
diff --git a/google-analytics-data/requirements-test.txt b/google-analytics-data/requirements-test.txt
new file mode 100644
index 0000000..be53bec
--- /dev/null
+++ b/google-analytics-data/requirements-test.txt
@@ -0,0 +1 @@
+pytest==6.1.1
diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
new file mode 100644
index 0000000..7c41f24
--- /dev/null
+++ b/google-analytics-data/requirements.txt
@@ -0,0 +1 @@
+google-analytics-data==0.1.0

From a44c949f34b5aeb096897bb9cf26d71666a37407 Mon Sep 17 00:00:00 2001
From: ikuleshov <ikuleshov@google.com>
Date: Wed, 7 Oct 2020 13:57:13 -0700
Subject: [PATCH 003/213] docs: added a sample (#7)

---
 google-analytics-data/quickstart.py      | 101 +++++++++++++++++++++++
 google-analytics-data/quickstart_test.py |  22 +++++
 2 files changed, 123 insertions(+)
 create mode 100644 google-analytics-data/quickstart.py
 create mode 100644 google-analytics-data/quickstart_test.py

diff --git a/google-analytics-data/quickstart.py b/google-analytics-data/quickstart.py
new file mode 100644
index 0000000..1525dd2
--- /dev/null
+++ b/google-analytics-data/quickstart.py
@@ -0,0 +1,101 @@
+#!/usr/bin/env python
+
+# Copyright 2020 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Data API sample quickstart application.
+Example usage:
+    python quickstart.py --property_id <PROPERTY_ID>
+
+    where <PROPERTY_ID> is the Google Analytics property id to use for a query.
+
+Note: you need to have the Google Analytics Data API enabled in your project
+prior to running this sample. Please visit the following URL and make sure the
+API is enabled:
+
+https://console.developers.google.com/apis/library/analyticsdata.googleapis.com
+
+This application demonstrates the usage of the Analytics Data API using
+service account credentials. For more information on service accounts, see
+
+https://cloud.google.com/iam/docs/understanding-service-accounts
+
+The following document provides instructions on setting service account
+credentials for your application:
+
+  https://cloud.google.com/docs/authentication/production
+
+In a nutshell, you need to:
+1. Create a service account and download the key JSON file.
+
+https://cloud.google.com/docs/authentication/production#creating_a_service_account
+
+2. Provide service account credentials using one of the following options:
+- set the GOOGLE_APPLICATION_CREDENTIALS environment variable, the API
+client will use the value of this variable to find the service account key
+JSON file.
+
+https://cloud.google.com/docs/authentication/production#setting_the_environment_variable
+
+OR
+- manually pass the path to the service account key JSON file to the API client
+by specifying the keyFilename parameter in the constructor:
+https://cloud.google.com/docs/authentication/production#passing_the_path_to_the_service_account_key_in_code
+
+To install the latest published package dependency, execute the following:
+  pip install google-analytics-data
+"""
+import argparse
+
+# [START ga_data_run_report]
+from google.analytics.data import AlphaAnalyticsDataClient
+from google.analytics.data_v1alpha.types import DateRange
+from google.analytics.data_v1alpha.types import Dimension
+from google.analytics.data_v1alpha.types import Entity
+from google.analytics.data_v1alpha.types import Metric
+from google.analytics.data_v1alpha.types import RunReportRequest
+
+
+def sample_run_report(property_id):
+    """Runs a simple report on a Google Analytics App+Web property."""
+
+    # Using a default constructor instructs the client to use the credentials
+    # specified in GOOGLE_APPLICATION_CREDENTIALS environment variable.
+    client = AlphaAnalyticsDataClient()
+    request = RunReportRequest(entity=Entity(property_id=property_id),
+                               dimensions=[Dimension(name='city')],
+                               metrics=[Metric(name='activeUsers')],
+                               date_ranges=[DateRange(start_date='2020-03-31',
+                                                      end_date='today')])
+    response = client.run_report(request)
+
+    print("Report result:")
+    for row in response.rows:
+        print(row.dimension_values[0].value, row.metric_values[0].value)
+
+
+# [END ga_data_run_report]
+
+if __name__ == "__main__":
+    parser = argparse.ArgumentParser(
+        description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter,
+    )
+    parser.add_argument(
+        "--property_id",
+        type=str,
+        required=True,
+        help="Google Analytics property ID to use for a query.",
+    )
+    args = parser.parse_args()
+    sample_run_report(args.property_id)
diff --git a/google-analytics-data/quickstart_test.py b/google-analytics-data/quickstart_test.py
new file mode 100644
index 0000000..7e1d307
--- /dev/null
+++ b/google-analytics-data/quickstart_test.py
@@ -0,0 +1,22 @@
+# Copyright 2020 Google Inc. All Rights Reserved.
+#
+# 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.
+
+import quickstart
+
+
+def test_quickstart(capsys):
+    TEST_PROPERTY_ID = '222596558'
+    quickstart.sample_run_report(TEST_PROPERTY_ID)
+    out, _ = capsys.readouterr()
+    assert "Report result" in out

From 9e0fa30d708f5bad36fd8486038c0b2148e8ef54 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <renovate@whitesourcesoftware.com>
Date: Wed, 25 Nov 2020 20:32:22 +0100
Subject: [PATCH 004/213] chore(deps): update dependency google-analytics-data
 to v0.2.0 (#14)

---
 google-analytics-data/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index 7c41f24..7d0b1a8 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1 +1 @@
-google-analytics-data==0.1.0
+google-analytics-data==0.2.0

From 9623202302db0ea0b45dccb0806c2578251fad85 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Wed, 27 Jan 2021 18:21:10 +0100
Subject: [PATCH 005/213] chore(deps): update dependency google-analytics-data
 to v0.3.0 (#28)

---
 google-analytics-data/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index 7d0b1a8..44013c1 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1 +1 @@
-google-analytics-data==0.2.0
+google-analytics-data==0.3.0

From 9922833391379b52370cfe3c5703f2f949e7c125 Mon Sep 17 00:00:00 2001
From: Yoshi Automation Bot <yoshi-automation@google.com>
Date: Wed, 24 Feb 2021 16:51:06 -0800
Subject: [PATCH 006/213] feat: add v1beta (#35)

---
 google-analytics-data/quickstart.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/quickstart.py b/google-analytics-data/quickstart.py
index 1525dd2..5c6657d 100644
--- a/google-analytics-data/quickstart.py
+++ b/google-analytics-data/quickstart.py
@@ -59,7 +59,7 @@
 import argparse
 
 # [START ga_data_run_report]
-from google.analytics.data import AlphaAnalyticsDataClient
+from google.analytics.data_v1alpha import AlphaAnalyticsDataClient
 from google.analytics.data_v1alpha.types import DateRange
 from google.analytics.data_v1alpha.types import Dimension
 from google.analytics.data_v1alpha.types import Entity

From cdcdd8b806612612f2d0319cda0ab1eae78a926d Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Mon, 1 Mar 2021 17:34:26 +0100
Subject: [PATCH 007/213] chore(deps): update dependency google-analytics-data
 to v0.4.0 (#41)

---
 google-analytics-data/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index 44013c1..fcb2cda 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1 +1 @@
-google-analytics-data==0.3.0
+google-analytics-data==0.4.0

From ffdb9ff5385b65193c4e027db1f6d710610aa02d Mon Sep 17 00:00:00 2001
From: ikuleshov <ikuleshov@google.com>
Date: Fri, 19 Mar 2021 13:44:18 -0700
Subject: [PATCH 008/213] docs: update quickstart samples to support the Data
 API v1 beta (#50)

* docs: added a sample

* docs: usage instructions updated to use Python3

* docs: updated sample to include main() method

* docs: update the sample to support the Google Analytics Data API v1 beta

* docs: update quickstart samples to support the Data API v1 beta

* docs: update quickstart samples to support the Data API v1 beta

* separate the sample into separate methods to facilitate testing

* separate the sample into separate methods to facilitate testing

* fix: update formatting

* fix: update formatting

* add noxfile_config with a test property id value

* add noxfile_config with a test property id value

* fix: use the credentials json file provided during the test

* fix: use the credentials json file provided during the test
---
 google-analytics-data/noxfile_config.py       |  16 +++
 google-analytics-data/quickstart.py           | 101 ++++++------------
 .../quickstart_json_credentials.py            |  72 +++++++++++++
 .../quickstart_json_credentials_test.py       |  29 +++++
 google-analytics-data/quickstart_oauth2.py    |  89 +++++++++++++++
 .../quickstart_oauth2_test.py                 |  24 +++++
 google-analytics-data/quickstart_test.py      |   4 +-
 google-analytics-data/requirements.txt        |   1 +
 8 files changed, 269 insertions(+), 67 deletions(-)
 create mode 100644 google-analytics-data/noxfile_config.py
 create mode 100644 google-analytics-data/quickstart_json_credentials.py
 create mode 100644 google-analytics-data/quickstart_json_credentials_test.py
 create mode 100644 google-analytics-data/quickstart_oauth2.py
 create mode 100644 google-analytics-data/quickstart_oauth2_test.py

diff --git a/google-analytics-data/noxfile_config.py b/google-analytics-data/noxfile_config.py
new file mode 100644
index 0000000..20c30ee
--- /dev/null
+++ b/google-analytics-data/noxfile_config.py
@@ -0,0 +1,16 @@
+TEST_CONFIG_OVERRIDE = {
+    # You can opt out from the test for specific Python versions.
+    "ignored_versions": ["2.7"],
+    # Old samples are opted out of enforcing Python type hints
+    # All new samples should feature them
+    "enforce_type_hints": True,
+    # An envvar key for determining the project id to use. Change it
+    # to 'BUILD_SPECIFIC_GCLOUD_PROJECT' if you want to opt in using a
+    # build specific Cloud project. You can also use your own string
+    # to use your own Cloud project.
+    "gcloud_project_env": "GOOGLE_CLOUD_PROJECT",
+    # 'gcloud_project_env': 'BUILD_SPECIFIC_GCLOUD_PROJECT',
+    # A dictionary you want to inject into your test. Don't put any
+    # secrets here. These values will override predefined values.
+    "envs": {"GA_TEST_PROPERTY_ID": "222596558"},
+}
diff --git a/google-analytics-data/quickstart.py b/google-analytics-data/quickstart.py
index 5c6657d..c3fe192 100644
--- a/google-analytics-data/quickstart.py
+++ b/google-analytics-data/quickstart.py
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 
-# Copyright 2020 Google Inc. All Rights Reserved.
+# Copyright 2021 Google Inc. All Rights Reserved.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -15,87 +15,56 @@
 # limitations under the License.
 
 """Google Analytics Data API sample quickstart application.
-Example usage:
-    python quickstart.py --property_id <PROPERTY_ID>
-
-    where <PROPERTY_ID> is the Google Analytics property id to use for a query.
-
-Note: you need to have the Google Analytics Data API enabled in your project
-prior to running this sample. Please visit the following URL and make sure the
-API is enabled:
-
-https://console.developers.google.com/apis/library/analyticsdata.googleapis.com
 
 This application demonstrates the usage of the Analytics Data API using
-service account credentials. For more information on service accounts, see
-
-https://cloud.google.com/iam/docs/understanding-service-accounts
-
-The following document provides instructions on setting service account
-credentials for your application:
-
-  https://cloud.google.com/docs/authentication/production
-
-In a nutshell, you need to:
-1. Create a service account and download the key JSON file.
-
-https://cloud.google.com/docs/authentication/production#creating_a_service_account
+service account credentials.
 
-2. Provide service account credentials using one of the following options:
-- set the GOOGLE_APPLICATION_CREDENTIALS environment variable, the API
-client will use the value of this variable to find the service account key
-JSON file.
+Before you start the application, please review the comments starting with
+"TODO(developer)" and update the code to use correct values.
 
-https://cloud.google.com/docs/authentication/production#setting_the_environment_variable
-
-OR
-- manually pass the path to the service account key JSON file to the API client
-by specifying the keyFilename parameter in the constructor:
-https://cloud.google.com/docs/authentication/production#passing_the_path_to_the_service_account_key_in_code
-
-To install the latest published package dependency, execute the following:
-  pip install google-analytics-data
+Usage:
+  pip3 install --upgrade google-analytics-data
+  python3 quickstart.py
 """
-import argparse
+# [START google_analytics_data_quickstart]
+from google.analytics.data_v1beta import BetaAnalyticsDataClient
+from google.analytics.data_v1beta.types import DateRange
+from google.analytics.data_v1beta.types import Dimension
+from google.analytics.data_v1beta.types import Metric
+from google.analytics.data_v1beta.types import RunReportRequest
 
-# [START ga_data_run_report]
-from google.analytics.data_v1alpha import AlphaAnalyticsDataClient
-from google.analytics.data_v1alpha.types import DateRange
-from google.analytics.data_v1alpha.types import Dimension
-from google.analytics.data_v1alpha.types import Entity
-from google.analytics.data_v1alpha.types import Metric
-from google.analytics.data_v1alpha.types import RunReportRequest
 
+def sample_run_report(property_id="YOUR-GA4-PROPERTY-ID"):
+    """Runs a simple report on a Google Analytics 4 property."""
+    # TODO(developer): Uncomment this variable and replace with your
+    #  Google Analytics 4 property ID before running the sample.
+    # property_id = "YOUR-GA4-PROPERTY-ID"
 
-def sample_run_report(property_id):
-    """Runs a simple report on a Google Analytics App+Web property."""
-
+    # [START google_analytics_data_initialize]
     # Using a default constructor instructs the client to use the credentials
     # specified in GOOGLE_APPLICATION_CREDENTIALS environment variable.
-    client = AlphaAnalyticsDataClient()
-    request = RunReportRequest(entity=Entity(property_id=property_id),
-                               dimensions=[Dimension(name='city')],
-                               metrics=[Metric(name='activeUsers')],
-                               date_ranges=[DateRange(start_date='2020-03-31',
-                                                      end_date='today')])
+    client = BetaAnalyticsDataClient()
+    # [END google_analytics_data_initialize]
+
+    # [START google_analytics_data_run_report]
+    request = RunReportRequest(
+        property="properties/" + str(property_id),
+        dimensions=[Dimension(name="city")],
+        metrics=[Metric(name="activeUsers")],
+        date_ranges=[DateRange(start_date="2020-03-31", end_date="today")],
+    )
     response = client.run_report(request)
+    # [END google_analytics_data_run_report]
 
+    # [START google_analytics_data_run_report_response]
     print("Report result:")
     for row in response.rows:
         print(row.dimension_values[0].value, row.metric_values[0].value)
+    # [END google_analytics_data_run_report_response]
 
 
-# [END ga_data_run_report]
+# [END google_analytics_data_quickstart]
+
 
 if __name__ == "__main__":
-    parser = argparse.ArgumentParser(
-        description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter,
-    )
-    parser.add_argument(
-        "--property_id",
-        type=str,
-        required=True,
-        help="Google Analytics property ID to use for a query.",
-    )
-    args = parser.parse_args()
-    sample_run_report(args.property_id)
+    sample_run_report()
diff --git a/google-analytics-data/quickstart_json_credentials.py b/google-analytics-data/quickstart_json_credentials.py
new file mode 100644
index 0000000..97b9b4f
--- /dev/null
+++ b/google-analytics-data/quickstart_json_credentials.py
@@ -0,0 +1,72 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Data API sample quickstart application.
+
+This application demonstrates the usage of the Analytics Data API using
+service account credentials from a JSON file downloaded from
+the Google Cloud Console.
+
+Before you start the application, please review the comments starting with
+"TODO(developer)" and update the code to use correct values.
+
+Usage:
+  pip3 install --upgrade google-analytics-data
+  python3 quickstart_json_credentials.py
+"""
+# [START google_analytics_data_quickstart]
+from google.analytics.data_v1beta import BetaAnalyticsDataClient
+from google.analytics.data_v1beta.types import DateRange
+from google.analytics.data_v1beta.types import Dimension
+from google.analytics.data_v1beta.types import Metric
+from google.analytics.data_v1beta.types import RunReportRequest
+
+
+def sample_run_report(property_id="YOUR-GA4-PROPERTY-ID", credentials_json_path=""):
+    """Runs a simple report on a Google Analytics 4 property."""
+    # TODO(developer): Uncomment this variable and replace with your
+    #  Google Analytics 4 property ID before running the sample.
+    # property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # [START google_analytics_data_initialize]
+    # TODO(developer): Uncomment this variable and replace with a valid path to
+    #  the credentials.json file for your service account downloaded from the
+    #  Cloud Console.
+    # credentials_json_path = "/path/to/credentials.json"
+
+    # Explicitly use service account credentials by specifying
+    # the private key file.
+    client = BetaAnalyticsDataClient().from_service_account_json(credentials_json_path)
+    # [END google_analytics_data_initialize]
+
+    # [START google_analytics_data_run_report]
+    request = RunReportRequest(
+        property="properties/" + str(property_id),
+        dimensions=[Dimension(name="city")],
+        metrics=[Metric(name="activeUsers")],
+        date_ranges=[DateRange(start_date="2020-03-31", end_date="today")],
+    )
+    response = client.run_report(request)
+    # [END google_analytics_data_run_report]
+
+    print("Report result:")
+    for row in response.rows:
+        print(row.dimension_values[0].value, row.metric_values[0].value)
+# [END google_analytics_data_quickstart]
+
+
+if __name__ == "__main__":
+    sample_run_report()
diff --git a/google-analytics-data/quickstart_json_credentials_test.py b/google-analytics-data/quickstart_json_credentials_test.py
new file mode 100644
index 0000000..06d7d1e
--- /dev/null
+++ b/google-analytics-data/quickstart_json_credentials_test.py
@@ -0,0 +1,29 @@
+# Copyright 2020 Google Inc. All Rights Reserved.
+#
+# 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.
+
+import os
+
+import quickstart_json_credentials
+
+
+def test_quickstart(capsys):
+    # Create a temporary service account credentials JSON file to be used by
+    # the test.
+    TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+    CREDENTIALS_JSON_PATH = os.getenv("GOOGLE_APPLICATION_CREDENTIALS")
+    quickstart_json_credentials.sample_run_report(
+        TEST_PROPERTY_ID, CREDENTIALS_JSON_PATH
+    )
+    out, _ = capsys.readouterr()
+    assert "Report result" in out
diff --git a/google-analytics-data/quickstart_oauth2.py b/google-analytics-data/quickstart_oauth2.py
new file mode 100644
index 0000000..4ef3228
--- /dev/null
+++ b/google-analytics-data/quickstart_oauth2.py
@@ -0,0 +1,89 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Data API sample quickstart application.
+
+This application demonstrates the usage of the Analytics Data API using
+OAuth2 credentials.
+
+Before you start the application, please review the comments starting with
+"TODO(developer)" and update the code to use correct values.
+
+Usage:
+  pip3 install --upgrade google-auth-oauthlib
+  pip3 install --upgrade google-analytics-data
+  python3 quickstart_oauth2.py
+"""
+# [START google_analytics_data_quickstart]
+from google.analytics.data import BetaAnalyticsDataClient
+from google.analytics.data_v1beta.types import DateRange
+from google.analytics.data_v1beta.types import Dimension
+from google.analytics.data_v1beta.types import Metric
+from google.analytics.data_v1beta.types import RunReportRequest
+from google_auth_oauthlib import flow
+
+
+def sample_run_report(credentials=None, property_id="YOUR-GA4-PROPERTY-ID"):
+    """Runs a simple report on a Google Analytics 4 property."""
+    # TODO(developer): Uncomment this variable and replace with your
+    #  Google Analytics 4 property ID before running the sample.
+    # property_id = "YOUR-GA4-PROPERTY-ID"
+
+    client = BetaAnalyticsDataClient(credentials=credentials)
+    request = RunReportRequest(
+        property="properties/" + str(property_id),
+        dimensions=[Dimension(name="city")],
+        metrics=[Metric(name="activeUsers")],
+        date_ranges=[DateRange(start_date="2020-03-31", end_date="today")],
+    )
+
+    response = client.run_report(request)
+
+    print("Report result:")
+    for row in response.rows:
+        print(row.dimension_values[0].value, row.metric_values[0].value)
+
+
+def get_credentials():
+    """Creates an OAuth2 credentials instance."""
+    # [START google_analytics_data_initialize]
+    appflow = flow.InstalledAppFlow.from_client_secrets_file(
+        "client_secrets.json",
+        scopes=["https://www.googleapis.com/auth/analytics.readonly"],
+    )
+    # TODO(developer): Update the line below to set the `launch_browser` variable.
+    # The `launch_browser` boolean variable indicates if a local server is used
+    # as the callback URL in the auth flow. A value of `True` is recommended,
+    # but a local server does not work if accessing the application remotely,
+    # such as over SSH or from a remote Jupyter notebook.
+    launch_browser = True
+    if launch_browser:
+        appflow.run_local_server()
+    else:
+        appflow.run_console()
+    return appflow.credentials
+    # [END google_analytics_data_initialize]
+
+
+def main():
+    credentials = get_credentials()
+    sample_run_report(credentials)
+
+
+# [END google_analytics_data_quickstart]
+
+if __name__ == "__main__":
+    main()
diff --git a/google-analytics-data/quickstart_oauth2_test.py b/google-analytics-data/quickstart_oauth2_test.py
new file mode 100644
index 0000000..dcbdc19
--- /dev/null
+++ b/google-analytics-data/quickstart_oauth2_test.py
@@ -0,0 +1,24 @@
+# Copyright 2020 Google Inc. All Rights Reserved.
+#
+# 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.
+
+import os
+
+import quickstart_oauth2
+
+
+def test_quickstart(capsys):
+    TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+    quickstart_oauth2.sample_run_report(None, TEST_PROPERTY_ID)
+    out, _ = capsys.readouterr()
+    assert "Report result" in out
diff --git a/google-analytics-data/quickstart_test.py b/google-analytics-data/quickstart_test.py
index 7e1d307..14c639d 100644
--- a/google-analytics-data/quickstart_test.py
+++ b/google-analytics-data/quickstart_test.py
@@ -12,11 +12,13 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+import os
+
 import quickstart
 
 
 def test_quickstart(capsys):
-    TEST_PROPERTY_ID = '222596558'
+    TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
     quickstart.sample_run_report(TEST_PROPERTY_ID)
     out, _ = capsys.readouterr()
     assert "Report result" in out
diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index fcb2cda..e3b1250 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1 +1,2 @@
 google-analytics-data==0.4.0
+google-auth-oauthlib==0.4.3
\ No newline at end of file

From 8e6f104911faa981589541be02fcfec123e476cc Mon Sep 17 00:00:00 2001
From: ikuleshov <ikuleshov@google.com>
Date: Thu, 25 Mar 2021 12:23:10 -0700
Subject: [PATCH 009/213] docs: update region tag names to match the convention
 (#55)

* docs: update region tag names to match the convention

* lint
---
 google-analytics-data/quickstart.py              | 16 ++++++++--------
 .../quickstart_json_credentials.py               | 14 ++++++++------
 google-analytics-data/quickstart_oauth2.py       |  8 ++++----
 3 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/google-analytics-data/quickstart.py b/google-analytics-data/quickstart.py
index c3fe192..7572097 100644
--- a/google-analytics-data/quickstart.py
+++ b/google-analytics-data/quickstart.py
@@ -26,7 +26,7 @@
   pip3 install --upgrade google-analytics-data
   python3 quickstart.py
 """
-# [START google_analytics_data_quickstart]
+# [START analyticsdata_quickstart]
 from google.analytics.data_v1beta import BetaAnalyticsDataClient
 from google.analytics.data_v1beta.types import DateRange
 from google.analytics.data_v1beta.types import Dimension
@@ -40,13 +40,13 @@ def sample_run_report(property_id="YOUR-GA4-PROPERTY-ID"):
     #  Google Analytics 4 property ID before running the sample.
     # property_id = "YOUR-GA4-PROPERTY-ID"
 
-    # [START google_analytics_data_initialize]
+    # [START analyticsdata_run_report_initialize]
     # Using a default constructor instructs the client to use the credentials
     # specified in GOOGLE_APPLICATION_CREDENTIALS environment variable.
     client = BetaAnalyticsDataClient()
-    # [END google_analytics_data_initialize]
+    # [END analyticsdata_run_report_initialize]
 
-    # [START google_analytics_data_run_report]
+    # [START analyticsdata_run_report]
     request = RunReportRequest(
         property="properties/" + str(property_id),
         dimensions=[Dimension(name="city")],
@@ -54,16 +54,16 @@ def sample_run_report(property_id="YOUR-GA4-PROPERTY-ID"):
         date_ranges=[DateRange(start_date="2020-03-31", end_date="today")],
     )
     response = client.run_report(request)
-    # [END google_analytics_data_run_report]
+    # [END analyticsdata_run_report]
 
-    # [START google_analytics_data_run_report_response]
+    # [START analyticsdata_run_report_response]
     print("Report result:")
     for row in response.rows:
         print(row.dimension_values[0].value, row.metric_values[0].value)
-    # [END google_analytics_data_run_report_response]
+    # [END analyticsdata_run_report_response]
 
 
-# [END google_analytics_data_quickstart]
+# [END analyticsdata_quickstart]
 
 
 if __name__ == "__main__":
diff --git a/google-analytics-data/quickstart_json_credentials.py b/google-analytics-data/quickstart_json_credentials.py
index 97b9b4f..a30c8ea 100644
--- a/google-analytics-data/quickstart_json_credentials.py
+++ b/google-analytics-data/quickstart_json_credentials.py
@@ -27,7 +27,7 @@
   pip3 install --upgrade google-analytics-data
   python3 quickstart_json_credentials.py
 """
-# [START google_analytics_data_quickstart]
+# [START analyticsdata_json_credentials_quickstart]
 from google.analytics.data_v1beta import BetaAnalyticsDataClient
 from google.analytics.data_v1beta.types import DateRange
 from google.analytics.data_v1beta.types import Dimension
@@ -41,7 +41,7 @@ def sample_run_report(property_id="YOUR-GA4-PROPERTY-ID", credentials_json_path=
     #  Google Analytics 4 property ID before running the sample.
     # property_id = "YOUR-GA4-PROPERTY-ID"
 
-    # [START google_analytics_data_initialize]
+    # [START analyticsdata_json_credentials_initialize]
     # TODO(developer): Uncomment this variable and replace with a valid path to
     #  the credentials.json file for your service account downloaded from the
     #  Cloud Console.
@@ -50,9 +50,9 @@ def sample_run_report(property_id="YOUR-GA4-PROPERTY-ID", credentials_json_path=
     # Explicitly use service account credentials by specifying
     # the private key file.
     client = BetaAnalyticsDataClient().from_service_account_json(credentials_json_path)
-    # [END google_analytics_data_initialize]
+    # [END analyticsdata_json_credentials_initialize]
 
-    # [START google_analytics_data_run_report]
+    # [START analyticsdata_json_credentials_run_report]
     request = RunReportRequest(
         property="properties/" + str(property_id),
         dimensions=[Dimension(name="city")],
@@ -60,12 +60,14 @@ def sample_run_report(property_id="YOUR-GA4-PROPERTY-ID", credentials_json_path=
         date_ranges=[DateRange(start_date="2020-03-31", end_date="today")],
     )
     response = client.run_report(request)
-    # [END google_analytics_data_run_report]
+    # [END analyticsdata_json_credentials_run_report]
 
     print("Report result:")
     for row in response.rows:
         print(row.dimension_values[0].value, row.metric_values[0].value)
-# [END google_analytics_data_quickstart]
+
+
+# [END analyticsdata_json_credentials_quickstart]
 
 
 if __name__ == "__main__":
diff --git a/google-analytics-data/quickstart_oauth2.py b/google-analytics-data/quickstart_oauth2.py
index 4ef3228..83aae0b 100644
--- a/google-analytics-data/quickstart_oauth2.py
+++ b/google-analytics-data/quickstart_oauth2.py
@@ -27,7 +27,7 @@
   pip3 install --upgrade google-analytics-data
   python3 quickstart_oauth2.py
 """
-# [START google_analytics_data_quickstart]
+# [START analyticsdata_quickstart_oauth2]
 from google.analytics.data import BetaAnalyticsDataClient
 from google.analytics.data_v1beta.types import DateRange
 from google.analytics.data_v1beta.types import Dimension
@@ -59,7 +59,7 @@ def sample_run_report(credentials=None, property_id="YOUR-GA4-PROPERTY-ID"):
 
 def get_credentials():
     """Creates an OAuth2 credentials instance."""
-    # [START google_analytics_data_initialize]
+    # [START analyticsdata_initialize]
     appflow = flow.InstalledAppFlow.from_client_secrets_file(
         "client_secrets.json",
         scopes=["https://www.googleapis.com/auth/analytics.readonly"],
@@ -75,7 +75,7 @@ def get_credentials():
     else:
         appflow.run_console()
     return appflow.credentials
-    # [END google_analytics_data_initialize]
+    # [END analyticsdata_initialize]
 
 
 def main():
@@ -83,7 +83,7 @@ def main():
     sample_run_report(credentials)
 
 
-# [END google_analytics_data_quickstart]
+# [END analyticsdata_quickstart_oauth2]
 
 if __name__ == "__main__":
     main()

From 76f026bac6f221d7fbffe910a4aa853f6b6f204e Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Tue, 30 Mar 2021 17:41:46 +0200
Subject: [PATCH 010/213] chore(deps): update dependency google-auth-oauthlib
 to v0.4.4 (#58)

---
 google-analytics-data/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index e3b1250..4d222ea 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
 google-analytics-data==0.4.0
-google-auth-oauthlib==0.4.3
\ No newline at end of file
+google-auth-oauthlib==0.4.4
\ No newline at end of file

From c19885e83f2b2aa5d2630c234ba86968cae6c4a3 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Fri, 2 Apr 2021 21:38:41 +0200
Subject: [PATCH 011/213] chore(deps): update dependency google-analytics-data
 to v0.5.0 (#49)

---
 google-analytics-data/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index 4d222ea..2b2d2d6 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-data==0.4.0
+google-analytics-data==0.5.0
 google-auth-oauthlib==0.4.4
\ No newline at end of file

From fef8bc1f25314062e429c77286f5daf37f386b3d Mon Sep 17 00:00:00 2001
From: ikuleshov <ikuleshov@google.com>
Date: Tue, 6 Apr 2021 12:20:50 -0700
Subject: [PATCH 012/213] docs: add sample code for Data API v1 (#57)

* docs: added a sample

* docs: usage instructions updated to use Python3

* docs: updated sample to include main() method

* docs: update the sample to support the Google Analytics Data API v1 beta

* docs: add samples for the Data API v1 beta

* update region tag names to match the convention

* docs: add Data API v1 samples

* add tests for new samples

* add more samples

* fix the test

* fix tests

* fix tests

* fix tests

* lint

* lint

* add README.md

* fix time range in a query

* temporary disable the threashold quota display

* display pootentially thresholded requests per hour quota

* lint

* lint

* removed noxfile.py from PR

* removed generated configs from PR

* removed generated configs from PR

* remove generated configs from PR

* Use f-strings instead of fortmat(). Use run_sample() to start the sample..

* move each sample into an individual file

* move each sample into an individual file

* fix region tags

* fix tests
---
 google-analytics-data/README.md               | 33 +++++++
 google-analytics-data/get_common_metadata.py  | 81 +++++++++++++++
 .../get_common_metadata_test.py               | 21 ++++
 .../get_metadata_by_property_id.py            | 56 +++++++++++
 .../get_metadata_by_property_id_test.py       | 25 +++++
 google-analytics-data/quickstart.py           |  5 +-
 .../quickstart_json_credentials.py            |  2 +-
 google-analytics-data/quickstart_oauth2.py    | 14 ++-
 google-analytics-data/run_batch_report.py     | 78 +++++++++++++++
 .../run_batch_report_test.py                  | 25 +++++
 google-analytics-data/run_pivot_report.py     | 99 +++++++++++++++++++
 .../run_pivot_report_test.py                  | 25 +++++
 google-analytics-data/run_realtime_report.py  | 57 +++++++++++
 .../run_realtime_report_test.py               | 25 +++++
 ...ealtime_report_with_multiple_dimensions.py | 57 +++++++++++
 ...me_report_with_multiple_dimensions_test.py | 27 +++++
 ...n_realtime_report_with_multiple_metrics.py | 57 +++++++++++
 ...ltime_report_with_multiple_metrics_test.py | 25 +++++
 google-analytics-data/run_report.py           | 80 +++++++++++++++
 google-analytics-data/run_report_test.py      | 25 +++++
 .../run_report_with_aggregations.py           | 66 +++++++++++++
 .../run_report_with_aggregations_test.py      | 25 +++++
 .../run_report_with_cohorts.py                | 85 ++++++++++++++++
 .../run_report_with_cohorts_test.py           | 25 +++++
 .../run_report_with_custom_parameters.py      | 41 ++++++++
 .../run_report_with_date_ranges.py            | 62 ++++++++++++
 .../run_report_with_date_ranges_test.py       | 25 +++++
 ...eport_with_dimension_and_metric_filters.py | 99 +++++++++++++++++++
 ..._with_dimension_and_metric_filters_test.py | 27 +++++
 ...un_report_with_dimension_exclude_filter.py | 74 ++++++++++++++
 ...port_with_dimension_exclude_filter_test.py | 27 +++++
 .../run_report_with_dimension_filter.py       | 73 ++++++++++++++
 .../run_report_with_dimension_filter_test.py  | 25 +++++
 ...un_report_with_dimension_in_list_filter.py | 79 +++++++++++++++
 ...port_with_dimension_in_list_filter_test.py | 27 +++++
 ..._report_with_multiple_dimension_filters.py | 86 ++++++++++++++++
 ...rt_with_multiple_dimension_filters_test.py | 27 +++++
 .../run_report_with_multiple_dimensions.py    | 62 ++++++++++++
 ...un_report_with_multiple_dimensions_test.py | 27 +++++
 .../run_report_with_multiple_metrics.py       | 64 ++++++++++++
 .../run_report_with_multiple_metrics_test.py  | 25 +++++
 .../run_report_with_named_date_ranges.py      | 64 ++++++++++++
 .../run_report_with_named_date_ranges_test.py | 27 +++++
 .../run_report_with_ordering.py               | 68 +++++++++++++
 .../run_report_with_ordering_test.py          | 25 +++++
 .../run_report_with_pagination.py             | 95 ++++++++++++++++++
 .../run_report_with_pagination_test.py        | 25 +++++
 .../run_report_with_property_quota.py         | 86 ++++++++++++++++
 .../run_report_with_property_quota_test.py    | 25 +++++
 49 files changed, 2270 insertions(+), 13 deletions(-)
 create mode 100644 google-analytics-data/README.md
 create mode 100644 google-analytics-data/get_common_metadata.py
 create mode 100644 google-analytics-data/get_common_metadata_test.py
 create mode 100644 google-analytics-data/get_metadata_by_property_id.py
 create mode 100644 google-analytics-data/get_metadata_by_property_id_test.py
 create mode 100644 google-analytics-data/run_batch_report.py
 create mode 100644 google-analytics-data/run_batch_report_test.py
 create mode 100644 google-analytics-data/run_pivot_report.py
 create mode 100644 google-analytics-data/run_pivot_report_test.py
 create mode 100644 google-analytics-data/run_realtime_report.py
 create mode 100644 google-analytics-data/run_realtime_report_test.py
 create mode 100644 google-analytics-data/run_realtime_report_with_multiple_dimensions.py
 create mode 100644 google-analytics-data/run_realtime_report_with_multiple_dimensions_test.py
 create mode 100644 google-analytics-data/run_realtime_report_with_multiple_metrics.py
 create mode 100644 google-analytics-data/run_realtime_report_with_multiple_metrics_test.py
 create mode 100644 google-analytics-data/run_report.py
 create mode 100644 google-analytics-data/run_report_test.py
 create mode 100644 google-analytics-data/run_report_with_aggregations.py
 create mode 100644 google-analytics-data/run_report_with_aggregations_test.py
 create mode 100644 google-analytics-data/run_report_with_cohorts.py
 create mode 100644 google-analytics-data/run_report_with_cohorts_test.py
 create mode 100644 google-analytics-data/run_report_with_custom_parameters.py
 create mode 100644 google-analytics-data/run_report_with_date_ranges.py
 create mode 100644 google-analytics-data/run_report_with_date_ranges_test.py
 create mode 100644 google-analytics-data/run_report_with_dimension_and_metric_filters.py
 create mode 100644 google-analytics-data/run_report_with_dimension_and_metric_filters_test.py
 create mode 100644 google-analytics-data/run_report_with_dimension_exclude_filter.py
 create mode 100644 google-analytics-data/run_report_with_dimension_exclude_filter_test.py
 create mode 100644 google-analytics-data/run_report_with_dimension_filter.py
 create mode 100644 google-analytics-data/run_report_with_dimension_filter_test.py
 create mode 100644 google-analytics-data/run_report_with_dimension_in_list_filter.py
 create mode 100644 google-analytics-data/run_report_with_dimension_in_list_filter_test.py
 create mode 100644 google-analytics-data/run_report_with_multiple_dimension_filters.py
 create mode 100644 google-analytics-data/run_report_with_multiple_dimension_filters_test.py
 create mode 100644 google-analytics-data/run_report_with_multiple_dimensions.py
 create mode 100644 google-analytics-data/run_report_with_multiple_dimensions_test.py
 create mode 100644 google-analytics-data/run_report_with_multiple_metrics.py
 create mode 100644 google-analytics-data/run_report_with_multiple_metrics_test.py
 create mode 100644 google-analytics-data/run_report_with_named_date_ranges.py
 create mode 100644 google-analytics-data/run_report_with_named_date_ranges_test.py
 create mode 100644 google-analytics-data/run_report_with_ordering.py
 create mode 100644 google-analytics-data/run_report_with_ordering_test.py
 create mode 100644 google-analytics-data/run_report_with_pagination.py
 create mode 100644 google-analytics-data/run_report_with_pagination_test.py
 create mode 100644 google-analytics-data/run_report_with_property_quota.py
 create mode 100644 google-analytics-data/run_report_with_property_quota_test.py

diff --git a/google-analytics-data/README.md b/google-analytics-data/README.md
new file mode 100644
index 0000000..f390224
--- /dev/null
+++ b/google-analytics-data/README.md
@@ -0,0 +1,33 @@
+# Google Analytics Data API examples
+
+[![Open in Cloud Shell][shell_img]][shell_link]
+
+[shell_img]: http://gstatic.com/cloudssh/images/open-btn.png
+[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/python-analytics-data&page=editor&working_dir=samples/snippets
+
+These samples show how to use the
+[Google Analytics Data API](https://developers.google.com/analytics/devguides/reporting/data/v1) from Python.
+
+## Build and Run
+1.  **Enable APIs** - [Enable the Analytics Data API](https://console.cloud.google.com/flows/enableapi?apiid=analyticsdata.googleapis.com)
+    and create a new project or select an existing project.
+2.  **Download The Credentials** - Configure your project using [Application Default Credentials][adc].
+    Click "Go to credentials" after enabling the APIs. Click "Create Credentials"
+    and select "Service Account Credentials" and download the credentials file. Then set the path to
+    this file to the environment variable `GOOGLE_APPLICATION_CREDENTIALS`:
+```sh
+    $ export GOOGLE_APPLICATION_CREDENTIALS=/path/to/credentials.json
+```
+3.  **Clone the repo** and cd into this directory
+```sh
+    $ git clone https://github.com/googleapis/python-analytics-data
+    $ cd python-analytics-data/samples/snippets
+```
+4.  **Install dependencies** via [pip3](https://pip.pypa.io/en/stable).
+    Run `pip3 install --upgrade google-analytics-data`.
+5.  **Review the comments starting with `TODO(developer)` and update the code
+to use correct values.
+6.  **Run** with the command `python3 SNIPPET_NAME.py`. For example:
+```sh
+    $ python3 quickstart.py
+```
diff --git a/google-analytics-data/get_common_metadata.py b/google-analytics-data/get_common_metadata.py
new file mode 100644
index 0000000..731da0d
--- /dev/null
+++ b/google-analytics-data/get_common_metadata.py
@@ -0,0 +1,81 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Data API sample application retrieving dimension and metrics
+metadata.
+
+See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/getMetadata
+for more information.
+"""
+# [START analyticsdata_get_common_metadata]
+from google.analytics.data_v1beta import BetaAnalyticsDataClient
+from google.analytics.data_v1beta.types import GetMetadataRequest
+from google.analytics.data_v1beta.types import MetricType
+
+
+def run_sample():
+    """Runs the sample."""
+    get_common_metadata()
+
+
+def get_common_metadata():
+    """Retrieves dimensions and metrics available for all Google Analytics 4
+    properties."""
+    client = BetaAnalyticsDataClient()
+
+    # Set the Property ID to 0 for dimensions and metrics common
+    # to all properties. In this special mode, this method will
+    # not return custom dimensions and metrics.
+    property_id = 0
+    request = GetMetadataRequest(name=f"properties/{property_id}/metadata")
+    response = client.get_metadata(request)
+
+    print("Dimensions and metrics available for all Google Analytics 4 properties:")
+    print_get_metadata_response(response)
+
+
+def print_get_metadata_response(response):
+    """Prints results of the getMetadata call."""
+    # [START analyticsdata_print_get_metadata_response]
+    for dimension in response.dimensions:
+        print("DIMENSION")
+        print(f"{dimension.api_name} ({dimension.ui_name}): {dimension.description}")
+        print(f"custom_definition: {dimension.custom_definition}")
+        if dimension.deprecated_api_names:
+            print(f"Deprecated API names: {dimension.deprecated_api_names}")
+        print("")
+
+    for metric in response.metrics:
+        print("METRIC")
+        print(f"{metric.api_name} ({metric.ui_name}): {metric.description}")
+        print(f"custom_definition: {dimension.custom_definition}")
+        if metric.expression:
+            print(f"Expression: {metric.expression}")
+
+        metric_type = MetricType(metric.type_).name
+        print(f"Type: {metric_type}")
+
+        if metric.deprecated_api_names:
+            print(f"Deprecated API names: {metric.deprecated_api_names}")
+        print("")
+    # [END analyticsdata_print_get_metadata_response]
+
+
+# [END analyticsdata_get_common_metadata]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-data/get_common_metadata_test.py b/google-analytics-data/get_common_metadata_test.py
new file mode 100644
index 0000000..ae11969
--- /dev/null
+++ b/google-analytics-data/get_common_metadata_test.py
@@ -0,0 +1,21 @@
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+import get_common_metadata
+
+
+def test_get_common_metadata(capsys):
+    get_common_metadata.get_common_metadata()
+    out, _ = capsys.readouterr()
+    assert "Dimensions and metrics" in out
diff --git a/google-analytics-data/get_metadata_by_property_id.py b/google-analytics-data/get_metadata_by_property_id.py
new file mode 100644
index 0000000..6950ced
--- /dev/null
+++ b/google-analytics-data/get_metadata_by_property_id.py
@@ -0,0 +1,56 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Data API sample application retrieving dimension and metrics
+metadata.
+
+See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/getMetadata
+for more information.
+"""
+# [START analyticsdata_get_metadata_by_property_id]
+from google.analytics.data_v1beta import BetaAnalyticsDataClient
+from google.analytics.data_v1beta.types import GetMetadataRequest
+
+from get_common_metadata import print_get_metadata_response
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+    get_metadata_by_property_id(property_id)
+
+
+def get_metadata_by_property_id(property_id="YOUR-GA4-PROPERTY-ID"):
+    """Retrieves dimensions and metrics available for a Google Analytics 4
+    property, including custom fields."""
+    client = BetaAnalyticsDataClient()
+
+    request = GetMetadataRequest(name=f"properties/{property_id}/metadata")
+    response = client.get_metadata(request)
+
+    print(
+        f"Dimensions and metrics available for Google Analytics 4 "
+        f"property {property_id} (including custom fields):"
+    )
+    print_get_metadata_response(response)
+
+
+# [END analyticsdata_get_metadata_by_property_id]
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-data/get_metadata_by_property_id_test.py b/google-analytics-data/get_metadata_by_property_id_test.py
new file mode 100644
index 0000000..958f4b1
--- /dev/null
+++ b/google-analytics-data/get_metadata_by_property_id_test.py
@@ -0,0 +1,25 @@
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+import os
+
+import get_metadata_by_property_id
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+
+
+def test_get_metadata_by_property_id(capsys):
+    get_metadata_by_property_id.get_metadata_by_property_id(TEST_PROPERTY_ID)
+    out, _ = capsys.readouterr()
+    assert "Dimensions and metrics" in out
diff --git a/google-analytics-data/quickstart.py b/google-analytics-data/quickstart.py
index 7572097..ea1d771 100644
--- a/google-analytics-data/quickstart.py
+++ b/google-analytics-data/quickstart.py
@@ -15,13 +15,10 @@
 # limitations under the License.
 
 """Google Analytics Data API sample quickstart application.
-
 This application demonstrates the usage of the Analytics Data API using
 service account credentials.
-
 Before you start the application, please review the comments starting with
 "TODO(developer)" and update the code to use correct values.
-
 Usage:
   pip3 install --upgrade google-analytics-data
   python3 quickstart.py
@@ -48,7 +45,7 @@ def sample_run_report(property_id="YOUR-GA4-PROPERTY-ID"):
 
     # [START analyticsdata_run_report]
     request = RunReportRequest(
-        property="properties/" + str(property_id),
+        property=f"properties/{property_id}",
         dimensions=[Dimension(name="city")],
         metrics=[Metric(name="activeUsers")],
         date_ranges=[DateRange(start_date="2020-03-31", end_date="today")],
diff --git a/google-analytics-data/quickstart_json_credentials.py b/google-analytics-data/quickstart_json_credentials.py
index a30c8ea..97c2889 100644
--- a/google-analytics-data/quickstart_json_credentials.py
+++ b/google-analytics-data/quickstart_json_credentials.py
@@ -54,7 +54,7 @@ def sample_run_report(property_id="YOUR-GA4-PROPERTY-ID", credentials_json_path=
 
     # [START analyticsdata_json_credentials_run_report]
     request = RunReportRequest(
-        property="properties/" + str(property_id),
+        property=f"properties/{property_id}",
         dimensions=[Dimension(name="city")],
         metrics=[Metric(name="activeUsers")],
         date_ranges=[DateRange(start_date="2020-03-31", end_date="today")],
diff --git a/google-analytics-data/quickstart_oauth2.py b/google-analytics-data/quickstart_oauth2.py
index 83aae0b..aa488ee 100644
--- a/google-analytics-data/quickstart_oauth2.py
+++ b/google-analytics-data/quickstart_oauth2.py
@@ -15,19 +15,16 @@
 # limitations under the License.
 
 """Google Analytics Data API sample quickstart application.
-
 This application demonstrates the usage of the Analytics Data API using
 OAuth2 credentials.
-
 Before you start the application, please review the comments starting with
 "TODO(developer)" and update the code to use correct values.
-
 Usage:
   pip3 install --upgrade google-auth-oauthlib
   pip3 install --upgrade google-analytics-data
   python3 quickstart_oauth2.py
 """
-# [START analyticsdata_quickstart_oauth2]
+# [START analyticsdata_oauth2_quickstart]
 from google.analytics.data import BetaAnalyticsDataClient
 from google.analytics.data_v1beta.types import DateRange
 from google.analytics.data_v1beta.types import Dimension
@@ -44,7 +41,7 @@ def sample_run_report(credentials=None, property_id="YOUR-GA4-PROPERTY-ID"):
 
     client = BetaAnalyticsDataClient(credentials=credentials)
     request = RunReportRequest(
-        property="properties/" + str(property_id),
+        property=f"properties/{property_id}",
         dimensions=[Dimension(name="city")],
         metrics=[Metric(name="activeUsers")],
         date_ranges=[DateRange(start_date="2020-03-31", end_date="today")],
@@ -59,7 +56,7 @@ def sample_run_report(credentials=None, property_id="YOUR-GA4-PROPERTY-ID"):
 
 def get_credentials():
     """Creates an OAuth2 credentials instance."""
-    # [START analyticsdata_initialize]
+    # [START analyticsdata_oauth2_initialize]
     appflow = flow.InstalledAppFlow.from_client_secrets_file(
         "client_secrets.json",
         scopes=["https://www.googleapis.com/auth/analytics.readonly"],
@@ -75,7 +72,7 @@ def get_credentials():
     else:
         appflow.run_console()
     return appflow.credentials
-    # [END analyticsdata_initialize]
+    # [END analyticsdata_oauth2_initialize]
 
 
 def main():
@@ -83,7 +80,8 @@ def main():
     sample_run_report(credentials)
 
 
-# [END analyticsdata_quickstart_oauth2]
+# [END analyticsdata_oauth2_quickstart]
+
 
 if __name__ == "__main__":
     main()
diff --git a/google-analytics-data/run_batch_report.py b/google-analytics-data/run_batch_report.py
new file mode 100644
index 0000000..dfd155e
--- /dev/null
+++ b/google-analytics-data/run_batch_report.py
@@ -0,0 +1,78 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Data API sample application demonstrating the batch creation
+of multiple reports.
+
+See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/batchRunReports
+for more information.
+"""
+# [START analyticsdata_run_batch_report]
+from google.analytics.data_v1beta import BetaAnalyticsDataClient
+from google.analytics.data_v1beta.types import BatchRunReportsRequest
+from google.analytics.data_v1beta.types import DateRange
+from google.analytics.data_v1beta.types import Dimension
+from google.analytics.data_v1beta.types import Metric
+from google.analytics.data_v1beta.types import RunReportRequest
+
+from run_report import print_run_report_response
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+    run_batch_report(property_id)
+
+
+def run_batch_report(property_id="YOUR-GA4-PROPERTY-ID"):
+    """Runs a batch report on a Google Analytics 4 property."""
+    client = BetaAnalyticsDataClient()
+
+    request = BatchRunReportsRequest(
+        property=f"properties/{property_id}",
+        requests=[
+            RunReportRequest(
+                dimensions=[
+                    Dimension(name="country"),
+                    Dimension(name="region"),
+                    Dimension(name="city"),
+                ],
+                metrics=[Metric(name="activeUsers")],
+                date_ranges=[DateRange(start_date="2021-01-03", end_date="2021-01-09")],
+            ),
+            RunReportRequest(
+                dimensions=[
+                    Dimension(name="browser"),
+                ],
+                metrics=[Metric(name="activeUsers")],
+                date_ranges=[DateRange(start_date="2021-01-01", end_date="2021-01-31")],
+            ),
+        ],
+    )
+    response = client.batch_run_reports(request)
+
+    print("Batch report results:")
+    for report in response.reports:
+        print_run_report_response(report)
+
+
+# [END analyticsdata_run_batch_report]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-data/run_batch_report_test.py b/google-analytics-data/run_batch_report_test.py
new file mode 100644
index 0000000..880c10b
--- /dev/null
+++ b/google-analytics-data/run_batch_report_test.py
@@ -0,0 +1,25 @@
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+import os
+
+import run_batch_report
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+
+
+def test_run_batch_report(capsys):
+    run_batch_report.run_batch_report(TEST_PROPERTY_ID)
+    out, _ = capsys.readouterr()
+    assert "Batch report result" in out
diff --git a/google-analytics-data/run_pivot_report.py b/google-analytics-data/run_pivot_report.py
new file mode 100644
index 0000000..dc3ce91
--- /dev/null
+++ b/google-analytics-data/run_pivot_report.py
@@ -0,0 +1,99 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Data API sample application demonstrating the creation of
+a pivot report.
+
+See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/runPivotReport
+for more information.
+"""
+# [START analyticsdata_run_pivot_report]
+from google.analytics.data_v1beta import BetaAnalyticsDataClient
+from google.analytics.data_v1beta.types import DateRange
+from google.analytics.data_v1beta.types import Dimension
+from google.analytics.data_v1beta.types import Metric
+from google.analytics.data_v1beta.types import OrderBy
+from google.analytics.data_v1beta.types import Pivot
+from google.analytics.data_v1beta.types import RunPivotReportRequest
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+    run_pivot_report(property_id)
+
+
+def run_pivot_report(property_id="YOUR-GA4-PROPERTY-ID"):
+    """Runs a pivot query to build a report of session counts by country,
+    pivoted by the browser dimension.."""
+    client = BetaAnalyticsDataClient()
+
+    request = RunPivotReportRequest(
+        property=f"properties/{property_id}",
+        date_ranges=[
+            DateRange(start_date="2021-01-01", end_date="2021-01-30"),
+        ],
+        pivots=[
+            Pivot(
+                field_names=["country"],
+                limit=250,
+                order_bys=[
+                    OrderBy(
+                        dimension=OrderBy.DimensionOrderBy(dimension_name="country")
+                    )
+                ],
+            ),
+            Pivot(
+                field_names=["browser"],
+                offset=3,
+                limit=3,
+                order_bys=[
+                    OrderBy(
+                        metric=OrderBy.MetricOrderBy(metric_name="sessions"), desc=True
+                    )
+                ],
+            ),
+        ],
+        metrics=[Metric(name="sessions")],
+        dimensions=[
+            Dimension(name="country"),
+            Dimension(name="browser"),
+        ],
+    )
+    response = client.run_pivot_report(request)
+    print_run_pivot_report_response(response)
+
+
+def print_run_pivot_report_response(response):
+    """Prints results of a runPivotReport call."""
+    # [START analyticsdata_print_run_pivot_report_response]
+    print("Report result:")
+    for row in response.rows:
+        for dimension_value in row.dimension_values:
+            print(dimension_value.value)
+
+        for metric_value in row.metric_values:
+            print(metric_value.value)
+    # [END analyticsdata_print_run_pivot_report_response]
+
+
+# [END analyticsdata_run_pivot_report]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-data/run_pivot_report_test.py b/google-analytics-data/run_pivot_report_test.py
new file mode 100644
index 0000000..da010a1
--- /dev/null
+++ b/google-analytics-data/run_pivot_report_test.py
@@ -0,0 +1,25 @@
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+import os
+
+import run_pivot_report
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+
+
+def test_run_pivot_report(capsys):
+    run_pivot_report.run_pivot_report(TEST_PROPERTY_ID)
+    out, _ = capsys.readouterr()
+    assert "Report result" in out
diff --git a/google-analytics-data/run_realtime_report.py b/google-analytics-data/run_realtime_report.py
new file mode 100644
index 0000000..f106a16
--- /dev/null
+++ b/google-analytics-data/run_realtime_report.py
@@ -0,0 +1,57 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Data API sample application demonstrating the creation of
+a realtime report.
+
+See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/runRealtimeReport
+for more information.
+"""
+# [START analyticsdata_run_realtime_report]
+from google.analytics.data_v1beta import BetaAnalyticsDataClient
+from google.analytics.data_v1beta.types import Dimension
+from google.analytics.data_v1beta.types import Metric
+from google.analytics.data_v1beta.types import RunRealtimeReportRequest
+
+from run_report import print_run_report_response
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+    run_realtime_report(property_id)
+
+
+def run_realtime_report(property_id="YOUR-GA4-PROPERTY-ID"):
+    """Runs a realtime report on a Google Analytics 4 property."""
+    client = BetaAnalyticsDataClient()
+
+    request = RunRealtimeReportRequest(
+        property=f"properties/{property_id}",
+        dimensions=[Dimension(name="country")],
+        metrics=[Metric(name="activeUsers")],
+    )
+    response = client.run_realtime_report(request)
+    print_run_report_response(response)
+
+
+# [END analyticsdata_run_realtime_report]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-data/run_realtime_report_test.py b/google-analytics-data/run_realtime_report_test.py
new file mode 100644
index 0000000..b0a643e
--- /dev/null
+++ b/google-analytics-data/run_realtime_report_test.py
@@ -0,0 +1,25 @@
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+import os
+
+import run_realtime_report
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+
+
+def test_run_realtime_report(capsys):
+    run_realtime_report.run_realtime_report(TEST_PROPERTY_ID)
+    out, _ = capsys.readouterr()
+    assert "Report result" in out
diff --git a/google-analytics-data/run_realtime_report_with_multiple_dimensions.py b/google-analytics-data/run_realtime_report_with_multiple_dimensions.py
new file mode 100644
index 0000000..3726681
--- /dev/null
+++ b/google-analytics-data/run_realtime_report_with_multiple_dimensions.py
@@ -0,0 +1,57 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Data API sample application demonstrating the creation of
+a realtime report.
+
+See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/runReport
+for more information.
+"""
+# [START analyticsdata_run_realtime_report_with_multiple_dimensions]
+from google.analytics.data_v1beta import BetaAnalyticsDataClient
+from google.analytics.data_v1beta.types import Dimension
+from google.analytics.data_v1beta.types import Metric
+from google.analytics.data_v1beta.types import RunRealtimeReportRequest
+
+from run_report import print_run_report_response
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+    run_realtime_report_with_multiple_dimensions(property_id)
+
+
+def run_realtime_report_with_multiple_dimensions(property_id="YOUR-GA4-PROPERTY-ID"):
+    """Runs a realtime report on a Google Analytics 4 property."""
+    client = BetaAnalyticsDataClient()
+
+    request = RunRealtimeReportRequest(
+        property=f"properties/{property_id}",
+        dimensions=[Dimension(name="country"), Dimension(name="city")],
+        metrics=[Metric(name="activeUsers")],
+    )
+    response = client.run_realtime_report(request)
+    print_run_report_response(response)
+
+
+# [END analyticsdata_run_realtime_report_with_multiple_dimensions]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-data/run_realtime_report_with_multiple_dimensions_test.py b/google-analytics-data/run_realtime_report_with_multiple_dimensions_test.py
new file mode 100644
index 0000000..2f0f057
--- /dev/null
+++ b/google-analytics-data/run_realtime_report_with_multiple_dimensions_test.py
@@ -0,0 +1,27 @@
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+import os
+
+import run_report_with_multiple_dimensions
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+
+
+def test_run_report_with_multiple_dimensions(capsys):
+    run_report_with_multiple_dimensions.run_report_with_multiple_dimensions(
+        TEST_PROPERTY_ID
+    )
+    out, _ = capsys.readouterr()
+    assert "Report result" in out
diff --git a/google-analytics-data/run_realtime_report_with_multiple_metrics.py b/google-analytics-data/run_realtime_report_with_multiple_metrics.py
new file mode 100644
index 0000000..c87731d
--- /dev/null
+++ b/google-analytics-data/run_realtime_report_with_multiple_metrics.py
@@ -0,0 +1,57 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Data API sample application demonstrating the creation of
+a realtime report.
+
+See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/runReport
+for more information.
+"""
+# [START analyticsdata_run_realtime_report_with_multiple_metrics]
+from google.analytics.data_v1beta import BetaAnalyticsDataClient
+from google.analytics.data_v1beta.types import Dimension
+from google.analytics.data_v1beta.types import Metric
+from google.analytics.data_v1beta.types import RunRealtimeReportRequest
+
+from run_report import print_run_report_response
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+    run_realtime_report_with_multiple_metrics(property_id)
+
+
+def run_realtime_report_with_multiple_metrics(property_id="YOUR-GA4-PROPERTY-ID"):
+    """Runs a realtime report on a Google Analytics 4 property."""
+    client = BetaAnalyticsDataClient()
+
+    request = RunRealtimeReportRequest(
+        property=f"properties/{property_id}",
+        dimensions=[Dimension(name="unifiedScreenName")],
+        metrics=[Metric(name="screenPageViews"), Metric(name="conversions")],
+    )
+    response = client.run_realtime_report(request)
+    print_run_report_response(response)
+
+
+# [END analyticsdata_run_realtime_report_with_multiple_metrics]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-data/run_realtime_report_with_multiple_metrics_test.py b/google-analytics-data/run_realtime_report_with_multiple_metrics_test.py
new file mode 100644
index 0000000..92ab1eb
--- /dev/null
+++ b/google-analytics-data/run_realtime_report_with_multiple_metrics_test.py
@@ -0,0 +1,25 @@
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+import os
+
+import run_report_with_multiple_metrics
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+
+
+def test_run_report_with_multiple_metrics(capsys):
+    run_report_with_multiple_metrics.run_report_with_multiple_metrics(TEST_PROPERTY_ID)
+    out, _ = capsys.readouterr()
+    assert "Report result" in out
diff --git a/google-analytics-data/run_report.py b/google-analytics-data/run_report.py
new file mode 100644
index 0000000..c76f5ea
--- /dev/null
+++ b/google-analytics-data/run_report.py
@@ -0,0 +1,80 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Data API sample application demonstrating the creation
+of a basic report.
+
+See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/runReport
+for more information.
+"""
+# [START analyticsdata_run_report]
+from google.analytics.data_v1beta import BetaAnalyticsDataClient
+from google.analytics.data_v1beta.types import DateRange
+from google.analytics.data_v1beta.types import Dimension
+from google.analytics.data_v1beta.types import Metric
+from google.analytics.data_v1beta.types import MetricType
+from google.analytics.data_v1beta.types import RunReportRequest
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+    run_report(property_id)
+
+
+def run_report(property_id="YOUR-GA4-PROPERTY-ID"):
+    """Runs a report of active users grouped by country."""
+    client = BetaAnalyticsDataClient()
+
+    request = RunReportRequest(
+        property=f"properties/{property_id}",
+        dimensions=[Dimension(name="country")],
+        metrics=[Metric(name="activeUsers")],
+        date_ranges=[DateRange(start_date="2020-09-01", end_date="2020-09-15")],
+    )
+    response = client.run_report(request)
+    print_run_report_response(response)
+
+
+def print_run_report_response(response):
+    """Prints results of a runReport call."""
+    # [START analyticsdata_print_run_report_response_header]
+    print(f"{response.row_count} rows received")
+    for dimensionHeader in response.dimension_headers:
+        print(f"Dimension header name: {dimensionHeader.name}")
+    for metricHeader in response.metric_headers:
+        metric_type = MetricType(metricHeader.type_).name
+        print(f"Metric header name: {metricHeader.name} ({metric_type})")
+    # [END analyticsdata_print_run_report_response_header]
+
+    # [START analyticsdata_print_run_report_response_rows]
+    print("Report result:")
+    for row in response.rows:
+        for dimension_value in row.dimension_values:
+            print(dimension_value.value)
+
+        for metric_value in row.metric_values:
+            print(metric_value.value)
+    # [END analyticsdata_print_run_report_response_rows]
+
+
+# [END analyticsdata_run_report]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-data/run_report_test.py b/google-analytics-data/run_report_test.py
new file mode 100644
index 0000000..d6e6f2f
--- /dev/null
+++ b/google-analytics-data/run_report_test.py
@@ -0,0 +1,25 @@
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+import os
+
+import run_report
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+
+
+def test_run_report_basic(capsys):
+    run_report.run_report(TEST_PROPERTY_ID)
+    out, _ = capsys.readouterr()
+    assert "Report result" in out
diff --git a/google-analytics-data/run_report_with_aggregations.py b/google-analytics-data/run_report_with_aggregations.py
new file mode 100644
index 0000000..3b77fd8
--- /dev/null
+++ b/google-analytics-data/run_report_with_aggregations.py
@@ -0,0 +1,66 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Data API sample application demonstrating the usage of
+metric aggregations in a report.
+
+See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/runReport#body.request_body.FIELDS.metric_aggregations
+for more information.
+"""
+# [START analyticsdata_run_report_with_aggregations]
+from google.analytics.data_v1beta import BetaAnalyticsDataClient
+from google.analytics.data_v1beta.types import DateRange
+from google.analytics.data_v1beta.types import Dimension
+from google.analytics.data_v1beta.types import Metric
+from google.analytics.data_v1beta.types import MetricAggregation
+from google.analytics.data_v1beta.types import RunReportRequest
+
+from run_report import print_run_report_response
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+    run_report_with_aggregations(property_id)
+
+
+def run_report_with_aggregations(property_id="YOUR-GA4-PROPERTY-ID"):
+    """Runs a report which includes total, maximum and minimum values for
+    each metric."""
+    client = BetaAnalyticsDataClient()
+
+    request = RunReportRequest(
+        property=f"properties/{property_id}",
+        dimensions=[Dimension(name="country")],
+        metrics=[Metric(name="sessions")],
+        date_ranges=[DateRange(start_date="365daysAgo", end_date="today")],
+        metric_aggregations=[
+            MetricAggregation.TOTAL,
+            MetricAggregation.MAXIMUM,
+            MetricAggregation.MINIMUM,
+        ],
+    )
+    response = client.run_report(request)
+    print_run_report_response(response)
+
+
+# [END analyticsdata_run_report_with_aggregations]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-data/run_report_with_aggregations_test.py b/google-analytics-data/run_report_with_aggregations_test.py
new file mode 100644
index 0000000..420c412
--- /dev/null
+++ b/google-analytics-data/run_report_with_aggregations_test.py
@@ -0,0 +1,25 @@
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+import os
+
+import run_report_with_aggregations
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+
+
+def test_run_report_with_aggregations(capsys):
+    run_report_with_aggregations.run_report_with_aggregations(TEST_PROPERTY_ID)
+    out, _ = capsys.readouterr()
+    assert "Report result" in out
diff --git a/google-analytics-data/run_report_with_cohorts.py b/google-analytics-data/run_report_with_cohorts.py
new file mode 100644
index 0000000..4bf15a5
--- /dev/null
+++ b/google-analytics-data/run_report_with_cohorts.py
@@ -0,0 +1,85 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Data API sample application demonstratinf the usage of
+cohort specification in a report.
+
+See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/runReport#body.request_body.FIELDS.cohort_spec
+for more information.
+"""
+# [START analyticsdata_run_report_with_cohorts]
+from google.analytics.data_v1beta import BetaAnalyticsDataClient
+from google.analytics.data_v1beta.types import Cohort
+from google.analytics.data_v1beta.types import CohortSpec
+from google.analytics.data_v1beta.types import CohortsRange
+from google.analytics.data_v1beta.types import DateRange
+from google.analytics.data_v1beta.types import Dimension
+from google.analytics.data_v1beta.types import Metric
+from google.analytics.data_v1beta.types import RunReportRequest
+
+from run_report import print_run_report_response
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+    run_report_with_cohorts(property_id)
+
+
+def run_report_with_cohorts(property_id="YOUR-GA4-PROPERTY-ID"):
+    """Runs a report on a cohort of users whose first session happened on the
+    same week. The number of active users and user retention rate is calculated
+    for the cohort using WEEKLY granularity."""
+    client = BetaAnalyticsDataClient()
+
+    request = RunReportRequest(
+        property=f"properties/{property_id}",
+        dimensions=[Dimension(name="cohort"), Dimension(name="cohortNthWeek")],
+        metrics=[
+            Metric(name="cohortActiveUsers"),
+            Metric(
+                name="cohortRetentionRate",
+                expression="cohortActiveUsers/cohortTotalUsers",
+            ),
+        ],
+        cohort_spec=CohortSpec(
+            cohorts=[
+                Cohort(
+                    dimension="firstSessionDate",
+                    name="cohort",
+                    date_range=DateRange(
+                        start_date="2021-01-03", end_date="2021-01-09"
+                    ),
+                )
+            ],
+            cohorts_range=CohortsRange(
+                start_offset=0,
+                end_offset=4,
+                granularity=CohortsRange.Granularity.WEEKLY,
+            ),
+        ),
+    )
+    response = client.run_report(request)
+    print_run_report_response(response)
+
+
+# [END analyticsdata_run_report_with_cohorts]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-data/run_report_with_cohorts_test.py b/google-analytics-data/run_report_with_cohorts_test.py
new file mode 100644
index 0000000..06907e7
--- /dev/null
+++ b/google-analytics-data/run_report_with_cohorts_test.py
@@ -0,0 +1,25 @@
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+import os
+
+import run_report_with_cohorts
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+
+
+def test_run_report_with_cohorts(capsys):
+    run_report_with_cohorts.run_report_with_cohorts(TEST_PROPERTY_ID)
+    out, _ = capsys.readouterr()
+    assert "Report result" in out
diff --git a/google-analytics-data/run_report_with_custom_parameters.py b/google-analytics-data/run_report_with_custom_parameters.py
new file mode 100644
index 0000000..e0a3191
--- /dev/null
+++ b/google-analytics-data/run_report_with_custom_parameters.py
@@ -0,0 +1,41 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Data API sample application.
+"""
+from google.analytics.data_v1beta import BetaAnalyticsDataClient
+from google.analytics.data_v1beta.types import RunReportRequest
+
+
+def run_report_with_custom_parameters(property_id="YOUR-GA4-PROPERTY-ID"):
+    """Runs a simple report on a Google Analytics 4 property."""
+    client = BetaAnalyticsDataClient()
+
+    # [START run_report_with_custom_parameters]
+    request = RunReportRequest()
+    response = client.run_report(request)
+    # [END run_report_with_custom_parameters]
+
+    print("Report result:")
+    for row in response.rows:
+        print(row.dimension_values[0].value, row.metric_values[0].value)
+
+
+if __name__ == "__main__":
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+    run_report_with_custom_parameters(property_id)
diff --git a/google-analytics-data/run_report_with_date_ranges.py b/google-analytics-data/run_report_with_date_ranges.py
new file mode 100644
index 0000000..73fae80
--- /dev/null
+++ b/google-analytics-data/run_report_with_date_ranges.py
@@ -0,0 +1,62 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Data API sample application demonstrating the usage of
+date ranges in a report.
+
+See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/runReport#body.request_body.FIELDS.date_ranges
+for more information.
+"""
+# [START analyticsdata_run_report_with_date_ranges]
+from google.analytics.data_v1beta import BetaAnalyticsDataClient
+from google.analytics.data_v1beta.types import DateRange
+from google.analytics.data_v1beta.types import Dimension
+from google.analytics.data_v1beta.types import Metric
+from google.analytics.data_v1beta.types import RunReportRequest
+
+from run_report import print_run_report_response
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+    run_report_with_date_ranges(property_id)
+
+
+def run_report_with_date_ranges(property_id="YOUR-GA4-PROPERTY-ID"):
+    """Runs a report using two date ranges."""
+    client = BetaAnalyticsDataClient()
+
+    request = RunReportRequest(
+        property=f"properties/{property_id}",
+        date_ranges=[
+            DateRange(start_date="2019-08-01", end_date="2019-08-14"),
+            DateRange(start_date="2020-08-01", end_date="2020-08-14"),
+        ],
+        dimensions=[Dimension(name="platform")],
+        metrics=[Metric(name="activeUsers")],
+    )
+    response = client.run_report(request)
+    print_run_report_response(response)
+
+
+# [END analyticsdata_run_report_with_date_ranges]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-data/run_report_with_date_ranges_test.py b/google-analytics-data/run_report_with_date_ranges_test.py
new file mode 100644
index 0000000..552f969
--- /dev/null
+++ b/google-analytics-data/run_report_with_date_ranges_test.py
@@ -0,0 +1,25 @@
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+import os
+
+import run_report_with_date_ranges
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+
+
+def test_run_report_with_date_ranges(capsys):
+    run_report_with_date_ranges.run_report_with_date_ranges(TEST_PROPERTY_ID)
+    out, _ = capsys.readouterr()
+    assert "Report result" in out
diff --git a/google-analytics-data/run_report_with_dimension_and_metric_filters.py b/google-analytics-data/run_report_with_dimension_and_metric_filters.py
new file mode 100644
index 0000000..8935e32
--- /dev/null
+++ b/google-analytics-data/run_report_with_dimension_and_metric_filters.py
@@ -0,0 +1,99 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Data API sample application demonstrating the usage of
+dimension and metric filters in a report.
+
+See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/runReport#body.request_body.FIELDS.dimension_filter
+for more information.
+"""
+# [START analyticsdata_run_report_with_dimension_and_metric_filters]
+from google.analytics.data_v1beta import BetaAnalyticsDataClient
+from google.analytics.data_v1beta.types import DateRange
+from google.analytics.data_v1beta.types import Dimension
+from google.analytics.data_v1beta.types import Filter
+from google.analytics.data_v1beta.types import FilterExpression
+from google.analytics.data_v1beta.types import FilterExpressionList
+from google.analytics.data_v1beta.types import Metric
+from google.analytics.data_v1beta.types import NumericValue
+from google.analytics.data_v1beta.types import RunReportRequest
+
+from run_report import print_run_report_response
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+    run_report_with_dimension_and_metric_filters(property_id)
+
+
+def run_report_with_dimension_and_metric_filters(property_id="YOUR-GA4-PROPERTY-ID"):
+    """Runs a report using both metric and dimension filters. A dimension filter
+    limits the report to include only users who made an in-app purchase using
+    Android platform. A metric filter specifies that only users with session
+    counts larger than 1,000 should be included."""
+    client = BetaAnalyticsDataClient()
+
+    request = RunReportRequest(
+        property=f"properties/{property_id}",
+        dimensions=[Dimension(name="city")],
+        metrics=[Metric(name="activeUsers")],
+        date_ranges=[DateRange(start_date="2020-03-31", end_date="today")],
+        metric_filter=FilterExpression(
+            filter=Filter(
+                field_name="sessions",
+                numeric_filter=Filter.NumericFilter(
+                    operation=Filter.NumericFilter.Operation.GREATER_THAN,
+                    value=NumericValue(int64_value=1000),
+                ),
+            )
+        ),
+        dimension_filter=FilterExpression(
+            and_group=FilterExpressionList(
+                expressions=[
+                    FilterExpression(
+                        filter=Filter(
+                            field_name="platform",
+                            string_filter=Filter.StringFilter(
+                                match_type=Filter.StringFilter.MatchType.EXACT,
+                                value="Android",
+                            ),
+                        )
+                    ),
+                    FilterExpression(
+                        filter=Filter(
+                            field_name="eventName",
+                            string_filter=Filter.StringFilter(
+                                match_type=Filter.StringFilter.MatchType.EXACT,
+                                value="in_app_purchase",
+                            ),
+                        )
+                    ),
+                ]
+            )
+        ),
+    )
+    response = client.run_report(request)
+    print_run_report_response(response)
+
+
+# [END analyticsdata_run_report_with_dimension_and_metric_filters]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-data/run_report_with_dimension_and_metric_filters_test.py b/google-analytics-data/run_report_with_dimension_and_metric_filters_test.py
new file mode 100644
index 0000000..5499574
--- /dev/null
+++ b/google-analytics-data/run_report_with_dimension_and_metric_filters_test.py
@@ -0,0 +1,27 @@
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+import os
+
+import run_report_with_dimension_and_metric_filters
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+
+
+def test_run_report_with_dimension_and_metric_filters(capsys):
+    run_report_with_dimension_and_metric_filters.run_report_with_dimension_and_metric_filters(
+        TEST_PROPERTY_ID
+    )
+    out, _ = capsys.readouterr()
+    assert "Report result" in out
diff --git a/google-analytics-data/run_report_with_dimension_exclude_filter.py b/google-analytics-data/run_report_with_dimension_exclude_filter.py
new file mode 100644
index 0000000..938cee9
--- /dev/null
+++ b/google-analytics-data/run_report_with_dimension_exclude_filter.py
@@ -0,0 +1,74 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Data API sample application demonstrating the usage of
+dimension and metric filters in a report.
+
+See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/runReport#body.request_body.FIELDS.dimension_filter
+for more information.
+"""
+# [START analyticsdata_run_report_with_dimension_exclude_filter]
+from google.analytics.data_v1beta import BetaAnalyticsDataClient
+from google.analytics.data_v1beta.types import DateRange
+from google.analytics.data_v1beta.types import Dimension
+from google.analytics.data_v1beta.types import Filter
+from google.analytics.data_v1beta.types import FilterExpression
+from google.analytics.data_v1beta.types import Metric
+from google.analytics.data_v1beta.types import RunReportRequest
+
+from run_report import print_run_report_response
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+    run_report_with_dimension_exclude_filter(property_id)
+
+
+def run_report_with_dimension_exclude_filter(property_id="YOUR-GA4-PROPERTY-ID"):
+    """Runs a report using a filter with `not_expression`. The dimension filter
+    selects for when `pageTitle` is not `My Homepage`.
+
+    This sample uses relative date range values. See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/DateRange
+    for more information.
+    """
+    client = BetaAnalyticsDataClient()
+
+    request = RunReportRequest(
+        property=f"properties/{property_id}",
+        dimensions=[Dimension(name="pageTitle")],
+        metrics=[Metric(name="sessions")],
+        date_ranges=[DateRange(start_date="7daysAgo", end_date="yesterday")],
+        dimension_filter=FilterExpression(
+            not_expression=FilterExpression(
+                filter=Filter(
+                    field_name="pageTitle",
+                    string_filter=Filter.StringFilter(value="My Homepage"),
+                )
+            )
+        ),
+    )
+    response = client.run_report(request)
+    print_run_report_response(response)
+
+
+# [END analyticsdata_run_report_with_dimension_exclude_filter]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-data/run_report_with_dimension_exclude_filter_test.py b/google-analytics-data/run_report_with_dimension_exclude_filter_test.py
new file mode 100644
index 0000000..3cef3fb
--- /dev/null
+++ b/google-analytics-data/run_report_with_dimension_exclude_filter_test.py
@@ -0,0 +1,27 @@
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+import os
+
+import run_report_with_dimension_exclude_filter
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+
+
+def test_run_report_with_dimension_exclude_filter(capsys):
+    run_report_with_dimension_exclude_filter.run_report_with_dimension_exclude_filter(
+        TEST_PROPERTY_ID
+    )
+    out, _ = capsys.readouterr()
+    assert "Report result" in out
diff --git a/google-analytics-data/run_report_with_dimension_filter.py b/google-analytics-data/run_report_with_dimension_filter.py
new file mode 100644
index 0000000..d9568a7
--- /dev/null
+++ b/google-analytics-data/run_report_with_dimension_filter.py
@@ -0,0 +1,73 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Data API sample application demonstrating the usage of
+dimension and metric filters in a report.
+
+See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/runReport#body.request_body.FIELDS.dimension_filter
+for more information.
+"""
+# [START analyticsdata_run_report_with_dimension_filter]
+from google.analytics.data_v1beta import BetaAnalyticsDataClient
+from google.analytics.data_v1beta.types import DateRange
+from google.analytics.data_v1beta.types import Dimension
+from google.analytics.data_v1beta.types import Filter
+from google.analytics.data_v1beta.types import FilterExpression
+from google.analytics.data_v1beta.types import Metric
+from google.analytics.data_v1beta.types import RunReportRequest
+
+from run_report import print_run_report_response
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+    run_report_with_dimension_filter(property_id)
+
+
+def run_report_with_dimension_filter(property_id="YOUR-GA4-PROPERTY-ID"):
+    """Runs a report using a dimension filter. The call returns a time series
+    report of `eventCount` when `eventName` is `first_open` for each date.
+
+    This sample uses relative date range values. See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/DateRange
+    for more information.
+    """
+
+    client = BetaAnalyticsDataClient()
+
+    request = RunReportRequest(
+        property=f"properties/{property_id}",
+        dimensions=[Dimension(name="date")],
+        metrics=[Metric(name="eventCount")],
+        date_ranges=[DateRange(start_date="7daysAgo", end_date="yesterday")],
+        dimension_filter=FilterExpression(
+            filter=Filter(
+                field_name="eventName",
+                string_filter=Filter.StringFilter(value="first_open"),
+            )
+        ),
+    )
+    response = client.run_report(request)
+    print_run_report_response(response)
+
+
+# [END analyticsdata_run_report_with_dimension_filter]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-data/run_report_with_dimension_filter_test.py b/google-analytics-data/run_report_with_dimension_filter_test.py
new file mode 100644
index 0000000..b4e5791
--- /dev/null
+++ b/google-analytics-data/run_report_with_dimension_filter_test.py
@@ -0,0 +1,25 @@
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+import os
+
+import run_report_with_dimension_filter
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+
+
+def test_run_report_with_dimension_filter(capsys):
+    run_report_with_dimension_filter.run_report_with_dimension_filter(TEST_PROPERTY_ID)
+    out, _ = capsys.readouterr()
+    assert "Report result" in out
diff --git a/google-analytics-data/run_report_with_dimension_in_list_filter.py b/google-analytics-data/run_report_with_dimension_in_list_filter.py
new file mode 100644
index 0000000..e4bd7e3
--- /dev/null
+++ b/google-analytics-data/run_report_with_dimension_in_list_filter.py
@@ -0,0 +1,79 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Data API sample application demonstrating the usage of
+dimension and metric filters in a report.
+
+See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/runReport#body.request_body.FIELDS.dimension_filter
+for more information.
+"""
+# [START analyticsdata_run_report_with_dimension_in_list_filter]
+from google.analytics.data_v1beta import BetaAnalyticsDataClient
+from google.analytics.data_v1beta.types import DateRange
+from google.analytics.data_v1beta.types import Dimension
+from google.analytics.data_v1beta.types import Filter
+from google.analytics.data_v1beta.types import FilterExpression
+from google.analytics.data_v1beta.types import Metric
+from google.analytics.data_v1beta.types import RunReportRequest
+
+from run_report import print_run_report_response
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+    run_report_with_dimension_in_list_filter(property_id)
+
+
+def run_report_with_dimension_in_list_filter(property_id="YOUR-GA4-PROPERTY-ID"):
+    """Runs a report using a dimension filter with `in_list_filter` expression.
+    The filter selects for when `eventName` is set to one of three event names
+    specified in the query.
+
+    This sample uses relative date range values. See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/DateRange
+    for more information.
+    """
+    client = BetaAnalyticsDataClient()
+
+    request = RunReportRequest(
+        property=f"properties/{property_id}",
+        dimensions=[Dimension(name="eventName")],
+        metrics=[Metric(name="sessions")],
+        date_ranges=[DateRange(start_date="7daysAgo", end_date="yesterday")],
+        dimension_filter=FilterExpression(
+            filter=Filter(
+                field_name="eventName",
+                in_list_filter=Filter.InListFilter(
+                    values=[
+                        "purchase",
+                        "in_app_purchase",
+                        "app_store_subscription_renew",
+                    ]
+                ),
+            )
+        ),
+    )
+    response = client.run_report(request)
+    print_run_report_response(response)
+
+
+# [END analyticsdata_run_report_with_dimension_in_list_filter]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-data/run_report_with_dimension_in_list_filter_test.py b/google-analytics-data/run_report_with_dimension_in_list_filter_test.py
new file mode 100644
index 0000000..60f34a5
--- /dev/null
+++ b/google-analytics-data/run_report_with_dimension_in_list_filter_test.py
@@ -0,0 +1,27 @@
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+import os
+
+import run_report_with_dimension_in_list_filter
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+
+
+def test_run_report_with_dimension_in_list_filter(capsys):
+    run_report_with_dimension_in_list_filter.run_report_with_dimension_in_list_filter(
+        TEST_PROPERTY_ID
+    )
+    out, _ = capsys.readouterr()
+    assert "Report result" in out
diff --git a/google-analytics-data/run_report_with_multiple_dimension_filters.py b/google-analytics-data/run_report_with_multiple_dimension_filters.py
new file mode 100644
index 0000000..e1002af
--- /dev/null
+++ b/google-analytics-data/run_report_with_multiple_dimension_filters.py
@@ -0,0 +1,86 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Data API sample application demonstrating the usage of
+dimension and metric filters in a report.
+
+See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/runReport#body.request_body.FIELDS.dimension_filter
+for more information.
+"""
+# [START analyticsdata_run_report_with_multiple_dimension_filters]
+from google.analytics.data_v1beta import BetaAnalyticsDataClient
+from google.analytics.data_v1beta.types import DateRange
+from google.analytics.data_v1beta.types import Dimension
+from google.analytics.data_v1beta.types import Filter
+from google.analytics.data_v1beta.types import FilterExpression
+from google.analytics.data_v1beta.types import FilterExpressionList
+from google.analytics.data_v1beta.types import Metric
+from google.analytics.data_v1beta.types import RunReportRequest
+
+from run_report import print_run_report_response
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+    run_report_with_multiple_dimension_filters(property_id)
+
+
+def run_report_with_multiple_dimension_filters(property_id="YOUR-GA4-PROPERTY-ID"):
+    """Runs a report using multiple dimension filters joined as `and_group`
+    expression. The filter selects for when both `browser` is `Chrome` and
+    `countryId` is `US`.
+
+    This sample uses relative date range values. See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/DateRange
+    for more information.
+    """
+    client = BetaAnalyticsDataClient()
+
+    request = RunReportRequest(
+        property=f"properties/{property_id}",
+        dimensions=[Dimension(name="browser")],
+        metrics=[Metric(name="activeUsers")],
+        date_ranges=[DateRange(start_date="7daysAgo", end_date="yesterday")],
+        dimension_filter=FilterExpression(
+            and_group=FilterExpressionList(
+                expressions=[
+                    FilterExpression(
+                        filter=Filter(
+                            field_name="browser",
+                            string_filter=Filter.StringFilter(value="Chrome"),
+                        )
+                    ),
+                    FilterExpression(
+                        filter=Filter(
+                            field_name="countryId",
+                            string_filter=Filter.StringFilter(value="US"),
+                        )
+                    ),
+                ]
+            )
+        ),
+    )
+    response = client.run_report(request)
+    print_run_report_response(response)
+
+
+# [END analyticsdata_run_report_with_multiple_dimension_filters]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-data/run_report_with_multiple_dimension_filters_test.py b/google-analytics-data/run_report_with_multiple_dimension_filters_test.py
new file mode 100644
index 0000000..82f2160
--- /dev/null
+++ b/google-analytics-data/run_report_with_multiple_dimension_filters_test.py
@@ -0,0 +1,27 @@
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+import os
+
+import run_report_with_multiple_dimension_filters
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+
+
+def test_run_report_with_multiple_dimension_filters(capsys):
+    run_report_with_multiple_dimension_filters.run_report_with_multiple_dimension_filters(
+        TEST_PROPERTY_ID
+    )
+    out, _ = capsys.readouterr()
+    assert "Report result" in out
diff --git a/google-analytics-data/run_report_with_multiple_dimensions.py b/google-analytics-data/run_report_with_multiple_dimensions.py
new file mode 100644
index 0000000..78a4a1c
--- /dev/null
+++ b/google-analytics-data/run_report_with_multiple_dimensions.py
@@ -0,0 +1,62 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Data API sample application demonstrating the creation
+of a basic report.
+
+See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/runReport
+for more information.
+"""
+# [START analyticsdata_run_report_with_multiple_dimensions]
+from google.analytics.data_v1beta import BetaAnalyticsDataClient
+from google.analytics.data_v1beta.types import DateRange
+from google.analytics.data_v1beta.types import Dimension
+from google.analytics.data_v1beta.types import Metric
+from google.analytics.data_v1beta.types import RunReportRequest
+
+from run_report import print_run_report_response
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+    run_report_with_multiple_dimensions(property_id)
+
+
+def run_report_with_multiple_dimensions(property_id="YOUR-GA4-PROPERTY-ID"):
+    """Runs a report of active users grouped by three dimensions."""
+    client = BetaAnalyticsDataClient()
+
+    request = RunReportRequest(
+        property=f"properties/{property_id}",
+        dimensions=[
+            Dimension(name="country"),
+            Dimension(name="region"),
+            Dimension(name="city"),
+        ],
+        metrics=[Metric(name="activeUsers")],
+        date_ranges=[DateRange(start_date="7daysAgo", end_date="today")],
+    )
+    response = client.run_report(request)
+    print_run_report_response(response)
+
+
+# [END analyticsdata_run_report_with_multiple_dimensions]
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-data/run_report_with_multiple_dimensions_test.py b/google-analytics-data/run_report_with_multiple_dimensions_test.py
new file mode 100644
index 0000000..2f0f057
--- /dev/null
+++ b/google-analytics-data/run_report_with_multiple_dimensions_test.py
@@ -0,0 +1,27 @@
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+import os
+
+import run_report_with_multiple_dimensions
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+
+
+def test_run_report_with_multiple_dimensions(capsys):
+    run_report_with_multiple_dimensions.run_report_with_multiple_dimensions(
+        TEST_PROPERTY_ID
+    )
+    out, _ = capsys.readouterr()
+    assert "Report result" in out
diff --git a/google-analytics-data/run_report_with_multiple_metrics.py b/google-analytics-data/run_report_with_multiple_metrics.py
new file mode 100644
index 0000000..d3546df
--- /dev/null
+++ b/google-analytics-data/run_report_with_multiple_metrics.py
@@ -0,0 +1,64 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Data API sample application demonstrating the creation
+of a basic report.
+
+See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/runReport
+for more information.
+"""
+# [START analyticsdata_run_report_with_multiple_metrics]
+from google.analytics.data_v1beta import BetaAnalyticsDataClient
+from google.analytics.data_v1beta.types import DateRange
+from google.analytics.data_v1beta.types import Dimension
+from google.analytics.data_v1beta.types import Metric
+from google.analytics.data_v1beta.types import RunReportRequest
+
+from run_report import print_run_report_response
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+    run_report_with_multiple_metrics(property_id)
+
+
+def run_report_with_multiple_metrics(property_id="YOUR-GA4-PROPERTY-ID"):
+    """Runs a report of active users, new users and total revenue grouped by
+    date dimension."""
+    client = BetaAnalyticsDataClient()
+
+    # Runs a report of active users grouped by three dimensions.
+    request = RunReportRequest(
+        property=f"properties/{property_id}",
+        dimensions=[Dimension(name="date")],
+        metrics=[
+            Metric(name="activeUsers"),
+            Metric(name="newUsers"),
+            Metric(name="totalRevenue"),
+        ],
+        date_ranges=[DateRange(start_date="7daysAgo", end_date="today")],
+    )
+    response = client.run_report(request)
+    print_run_report_response(response)
+
+
+# [END analyticsdata_run_report_with_multiple_metrics]
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-data/run_report_with_multiple_metrics_test.py b/google-analytics-data/run_report_with_multiple_metrics_test.py
new file mode 100644
index 0000000..92ab1eb
--- /dev/null
+++ b/google-analytics-data/run_report_with_multiple_metrics_test.py
@@ -0,0 +1,25 @@
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+import os
+
+import run_report_with_multiple_metrics
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+
+
+def test_run_report_with_multiple_metrics(capsys):
+    run_report_with_multiple_metrics.run_report_with_multiple_metrics(TEST_PROPERTY_ID)
+    out, _ = capsys.readouterr()
+    assert "Report result" in out
diff --git a/google-analytics-data/run_report_with_named_date_ranges.py b/google-analytics-data/run_report_with_named_date_ranges.py
new file mode 100644
index 0000000..a4f0d17
--- /dev/null
+++ b/google-analytics-data/run_report_with_named_date_ranges.py
@@ -0,0 +1,64 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Data API sample application demonstrating the usage of
+date ranges in a report.
+
+See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/DateRange#FIELDS.name
+for more information.
+"""
+# [START analyticsdata_run_report_with_date_ranges]
+from google.analytics.data_v1beta import BetaAnalyticsDataClient
+from google.analytics.data_v1beta.types import DateRange
+from google.analytics.data_v1beta.types import Dimension
+from google.analytics.data_v1beta.types import Metric
+from google.analytics.data_v1beta.types import RunReportRequest
+
+from run_report import print_run_report_response
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+    run_report_with_named_date_ranges(property_id)
+
+
+def run_report_with_named_date_ranges(property_id="YOUR-GA4-PROPERTY-ID"):
+    """Runs a report using named date ranges."""
+    client = BetaAnalyticsDataClient()
+
+    request = RunReportRequest(
+        property=f"properties/{property_id}",
+        date_ranges=[
+            DateRange(start_date="2020-01-01", end_date="2020-01-31", name="year_ago"),
+            DateRange(
+                start_date="2021-01-01", end_date="2021-01-31", name="current_year"
+            ),
+        ],
+        dimensions=[Dimension(name="country")],
+        metrics=[Metric(name="sessions")],
+    )
+    response = client.run_report(request)
+    print_run_report_response(response)
+
+
+# [END analyticsdata_run_report_with_date_ranges]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-data/run_report_with_named_date_ranges_test.py b/google-analytics-data/run_report_with_named_date_ranges_test.py
new file mode 100644
index 0000000..0c0637f
--- /dev/null
+++ b/google-analytics-data/run_report_with_named_date_ranges_test.py
@@ -0,0 +1,27 @@
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+import os
+
+import run_report_with_named_date_ranges
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+
+
+def test_run_report_with_named_date_ranges(capsys):
+    run_report_with_named_date_ranges.run_report_with_named_date_ranges(
+        TEST_PROPERTY_ID
+    )
+    out, _ = capsys.readouterr()
+    assert "Report result" in out
diff --git a/google-analytics-data/run_report_with_ordering.py b/google-analytics-data/run_report_with_ordering.py
new file mode 100644
index 0000000..f55bf5c
--- /dev/null
+++ b/google-analytics-data/run_report_with_ordering.py
@@ -0,0 +1,68 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Data API sample application demonstrating the ordering of
+ report rows.
+
+See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/runReport#body.request_body.FIELDS.order_bys
+for more information.
+"""
+# [START analyticsdata_run_report_with_ordering]
+from google.analytics.data_v1beta import BetaAnalyticsDataClient
+from google.analytics.data_v1beta.types import DateRange
+from google.analytics.data_v1beta.types import Dimension
+from google.analytics.data_v1beta.types import Metric
+from google.analytics.data_v1beta.types import OrderBy
+from google.analytics.data_v1beta.types import RunReportRequest
+
+from run_report import print_run_report_response
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+    run_report_with_ordering(property_id)
+
+
+def run_report_with_ordering(property_id="YOUR-GA4-PROPERTY-ID"):
+    """Runs a report of active users grouped by three dimensions, ordered by
+    the total revenue in descending order."""
+    client = BetaAnalyticsDataClient()
+
+    request = RunReportRequest(
+        property=f"properties/{property_id}",
+        dimensions=[Dimension(name="date")],
+        metrics=[
+            Metric(name="activeUsers"),
+            Metric(name="newUsers"),
+            Metric(name="totalRevenue"),
+        ],
+        date_ranges=[DateRange(start_date="7daysAgo", end_date="today")],
+        order_bys=[
+            OrderBy(metric=OrderBy.MetricOrderBy(metric_name="totalRevenue"), desc=True)
+        ],
+    )
+    response = client.run_report(request)
+    print_run_report_response(response)
+
+
+# [END analyticsdata_run_report_with_ordering]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-data/run_report_with_ordering_test.py b/google-analytics-data/run_report_with_ordering_test.py
new file mode 100644
index 0000000..28c7297
--- /dev/null
+++ b/google-analytics-data/run_report_with_ordering_test.py
@@ -0,0 +1,25 @@
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+import os
+
+import run_report_with_ordering
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+
+
+def test_run_report_with_ordering(capsys):
+    run_report_with_ordering.run_report_with_ordering(TEST_PROPERTY_ID)
+    out, _ = capsys.readouterr()
+    assert "Report result" in out
diff --git a/google-analytics-data/run_report_with_pagination.py b/google-analytics-data/run_report_with_pagination.py
new file mode 100644
index 0000000..487f325
--- /dev/null
+++ b/google-analytics-data/run_report_with_pagination.py
@@ -0,0 +1,95 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Data API sample application demonstrating the use of
+pagination to retrieve large result sets.
+
+See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/runReport#body.request_body.FIELDS.offset
+for more information.
+"""
+# [START analyticsdata_run_report_with_pagination]
+from google.analytics.data_v1beta import BetaAnalyticsDataClient
+from google.analytics.data_v1beta.types import DateRange
+from google.analytics.data_v1beta.types import Dimension
+from google.analytics.data_v1beta.types import Metric
+from google.analytics.data_v1beta.types import RunReportRequest
+
+from run_report import print_run_report_response
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+    run_report_with_pagination(property_id)
+
+
+def run_report_with_pagination(property_id="YOUR-GA4-PROPERTY-ID"):
+    """Runs a report several times, each time retrieving a portion of result
+    using pagination."""
+    client = BetaAnalyticsDataClient()
+
+    # [START analyticsdata_run_report_with_pagination_page1]
+    request = RunReportRequest(
+        property=f"properties/{property_id}",
+        date_ranges=[DateRange(start_date="365daysAgo", end_date="yesterday")],
+        dimensions=[
+            Dimension(name="firstUserSource"),
+            Dimension(name="firstUserMedium"),
+            Dimension(name="firstUserCampaignName"),
+        ],
+        metrics=[
+            Metric(name="sessions"),
+            Metric(name="conversions"),
+            Metric(name="totalRevenue"),
+        ],
+        limit=100000,
+        offset=0,
+    )
+    response = client.run_report(request)
+    # [END analyticsdata_run_report_with_pagination_page1]
+    print_run_report_response(response)
+
+    # Run the same report with a different offset value to retrieve the second
+    # page of a response.
+    # [START analyticsdata_run_report_with_pagination_page2]
+    request = RunReportRequest(
+        property=f"properties/{property_id}",
+        date_ranges=[DateRange(start_date="365daysAgo", end_date="yesterday")],
+        dimensions=[
+            Dimension(name="firstUserSource"),
+            Dimension(name="firstUserMedium"),
+            Dimension(name="firstUserCampaignName"),
+        ],
+        metrics=[
+            Metric(name="sessions"),
+            Metric(name="conversions"),
+            Metric(name="totalRevenue"),
+        ],
+        limit=100000,
+        offset=100000,
+    )
+    response = client.run_report(request)
+    # [END analyticsdata_run_report_with_pagination_page2]
+    print_run_report_response(response)
+
+
+# [END analyticsdata_run_report_with_pagination]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-data/run_report_with_pagination_test.py b/google-analytics-data/run_report_with_pagination_test.py
new file mode 100644
index 0000000..b9b65e7
--- /dev/null
+++ b/google-analytics-data/run_report_with_pagination_test.py
@@ -0,0 +1,25 @@
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+import os
+
+import run_report_with_pagination
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+
+
+def test_run_report_with_pagination(capsys):
+    run_report_with_pagination.run_report_with_pagination(TEST_PROPERTY_ID)
+    out, _ = capsys.readouterr()
+    assert "Report result" in out
diff --git a/google-analytics-data/run_report_with_property_quota.py b/google-analytics-data/run_report_with_property_quota.py
new file mode 100644
index 0000000..f62414a
--- /dev/null
+++ b/google-analytics-data/run_report_with_property_quota.py
@@ -0,0 +1,86 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Data API sample application demonstrating the usage of
+property quota metadata.
+
+See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/runReport#body.request_body.FIELDS.return_property_quota
+for more information.
+"""
+# [START analyticsdata_run_report_with_property_quota]
+from google.analytics.data_v1beta import BetaAnalyticsDataClient
+from google.analytics.data_v1beta.types import DateRange
+from google.analytics.data_v1beta.types import Dimension
+from google.analytics.data_v1beta.types import Metric
+from google.analytics.data_v1beta.types import RunReportRequest
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+    run_report_with_property_quota(property_id)
+
+
+def run_report_with_property_quota(property_id="YOUR-GA4-PROPERTY-ID"):
+    """Runs a report and prints property quota information."""
+    client = BetaAnalyticsDataClient()
+
+    request = RunReportRequest(
+        property=f"properties/{property_id}",
+        return_property_quota=True,
+        dimensions=[Dimension(name="country")],
+        metrics=[
+            Metric(name="activeUsers"),
+        ],
+        date_ranges=[DateRange(start_date="7daysAgo", end_date="today")],
+    )
+    response = client.run_report(request)
+
+    # [START analyticsdata_run_report_with_property_quota_print_response]
+    if response.property_quota:
+        print(
+            f"Tokens per day quota consumed: {response.property_quota.tokens_per_day.consumed}, "
+            f"remaining: {response.property_quota.tokens_per_day.remaining}."
+        )
+
+        print(
+            f"Tokens per hour quota consumed: {response.property_quota.tokens_per_hour.consumed}, "
+            f"remaining: {response.property_quota.tokens_per_hour.remaining}."
+        )
+
+        print(
+            f"Concurrent requests quota consumed: {response.property_quota.concurrent_requests.consumed}, "
+            f"remaining: {response.property_quota.concurrent_requests.remaining}."
+        )
+
+        print(
+            f"Server errors per project per hour quota consumed: {response.property_quota.server_errors_per_project_per_hour.consumed}, "
+            f"remaining: {response.property_quota.server_errors_per_project_per_hour.remaining}."
+        )
+        print(
+            f"Potentially thresholded requests per hour quota consumed: {response.property_quota.potentially_thresholded_requests_per_hour.consumed}, "
+            f"remaining: {response.property_quota.potentially_thresholded_requests_per_hour.remaining}."
+        )
+    # [END analyticsdata_run_report_with_property_quota_print_response]
+
+
+# [END analyticsdata_run_report_with_property_quota]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-data/run_report_with_property_quota_test.py b/google-analytics-data/run_report_with_property_quota_test.py
new file mode 100644
index 0000000..1b17fb8
--- /dev/null
+++ b/google-analytics-data/run_report_with_property_quota_test.py
@@ -0,0 +1,25 @@
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+import os
+
+import run_report_with_property_quota
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+
+
+def test_run_report_with_property_quota(capsys):
+    run_report_with_property_quota.run_report_with_property_quota(TEST_PROPERTY_ID)
+    out, _ = capsys.readouterr()
+    assert "Tokens per day quota consumed" in out

From 2d5fe84f5cca9bf08ace9bda5c453a6225b33ced Mon Sep 17 00:00:00 2001
From: ikuleshov <ikuleshov@google.com>
Date: Fri, 14 May 2021 15:16:18 -0700
Subject: [PATCH 013/213] docs: add Admin API samples for account management
 methods (#58)

* docs: add Admin API samples for account management methods

* update copyright and remove redundant run_sample method

* update noxfile template and set enforce_type_hints=False

* add type annotations
---
 .../account_summaries_list.py                 |  50 ++++
 .../account_summaries_list_test.py            |  21 ++
 google-analytics-admin/accounts_delete.py     |  52 ++++
 .../accounts_delete_test.py                   |  28 ++
 google-analytics-admin/accounts_get.py        |  57 ++++
 .../accounts_get_data_sharing_settings.py     |  60 +++++
 ...accounts_get_data_sharing_settings_test.py |  25 ++
 google-analytics-admin/accounts_get_test.py   |  25 ++
 google-analytics-admin/accounts_list.py       |  43 +++
 google-analytics-admin/accounts_list_test.py  |  21 ++
 .../accounts_provision_account_ticket.py      |  89 +++++++
 .../accounts_provision_account_ticket_test.py |  24 ++
 google-analytics-admin/accounts_update.py     |  69 +++++
 .../accounts_update_test.py                   |  27 ++
 google-analytics-admin/noxfile.py             | 252 ++++++++++++++++++
 google-analytics-admin/noxfile_config.py      |  23 ++
 google-analytics-admin/noxfile_config_test.py |   0
 google-analytics-admin/requirements.txt       |   2 +
 18 files changed, 868 insertions(+)
 create mode 100644 google-analytics-admin/account_summaries_list.py
 create mode 100644 google-analytics-admin/account_summaries_list_test.py
 create mode 100644 google-analytics-admin/accounts_delete.py
 create mode 100644 google-analytics-admin/accounts_delete_test.py
 create mode 100644 google-analytics-admin/accounts_get.py
 create mode 100644 google-analytics-admin/accounts_get_data_sharing_settings.py
 create mode 100644 google-analytics-admin/accounts_get_data_sharing_settings_test.py
 create mode 100644 google-analytics-admin/accounts_get_test.py
 create mode 100644 google-analytics-admin/accounts_list.py
 create mode 100644 google-analytics-admin/accounts_list_test.py
 create mode 100644 google-analytics-admin/accounts_provision_account_ticket.py
 create mode 100644 google-analytics-admin/accounts_provision_account_ticket_test.py
 create mode 100644 google-analytics-admin/accounts_update.py
 create mode 100644 google-analytics-admin/accounts_update_test.py
 create mode 100644 google-analytics-admin/noxfile.py
 create mode 100644 google-analytics-admin/noxfile_config.py
 create mode 100644 google-analytics-admin/noxfile_config_test.py
 create mode 100644 google-analytics-admin/requirements.txt

diff --git a/google-analytics-admin/account_summaries_list.py b/google-analytics-admin/account_summaries_list.py
new file mode 100644
index 0000000..cb60816
--- /dev/null
+++ b/google-analytics-admin/account_summaries_list.py
@@ -0,0 +1,50 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which prints summaries of
+all accounts accessible by the caller.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accountSummaries/list
+for more information.
+"""
+# [START analyticsadmin_account_summaries_list]
+from google.analytics.admin import AnalyticsAdminServiceClient
+
+
+def list_account_summaries():
+    """Returns summaries of all accounts accessible by the caller."""
+    client = AnalyticsAdminServiceClient()
+    results = client.list_account_summaries()
+
+    print("Result:")
+    for account_summary in results:
+        print("-- Account --")
+        print(f"Resource name: {account_summary.name}")
+        print(f"Account name: {account_summary.account}")
+        print(f"Display name: {account_summary.display_name}")
+        print()
+        for property_summary in account_summary.property_summaries:
+            print("-- Property --")
+            print(f"Property resource name: {property_summary.property}")
+            print(f"Property display name: {property_summary.display_name}")
+            print()
+
+
+# [END analyticsadmin_account_summaries_list]
+
+
+if __name__ == "__main__":
+    list_account_summaries()
diff --git a/google-analytics-admin/account_summaries_list_test.py b/google-analytics-admin/account_summaries_list_test.py
new file mode 100644
index 0000000..d97ef6d
--- /dev/null
+++ b/google-analytics-admin/account_summaries_list_test.py
@@ -0,0 +1,21 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import account_summaries_list
+
+
+def test_account_summaries_list(capsys):
+    account_summaries_list.list_account_summaries()
+    out, _ = capsys.readouterr()
+    assert "Result" in out
diff --git a/google-analytics-admin/accounts_delete.py b/google-analytics-admin/accounts_delete.py
new file mode 100644
index 0000000..7c6f7af
--- /dev/null
+++ b/google-analytics-admin/accounts_delete.py
@@ -0,0 +1,52 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which deletes a Google
+Analytics account.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts/delete
+for more information.
+"""
+# [START analyticsadmin_accounts_delete]
+from google.analytics.admin import AnalyticsAdminServiceClient
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics account ID from
+    # your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account ID (e.g. "123456") before running the sample.
+    account_id = "YOUR-GA-ACCOUNT-ID"
+    delete_account(account_id)
+
+
+def delete_account(account_id: str):
+    """Deletes the Google Analytics account."""
+    client = AnalyticsAdminServiceClient()
+    client.delete_account(name=f"accounts/{account_id}")
+    print("Account deleted")
+
+
+# [END analyticsadmin_accounts_delete]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/accounts_delete_test.py b/google-analytics-admin/accounts_delete_test.py
new file mode 100644
index 0000000..0458fef
--- /dev/null
+++ b/google-analytics-admin/accounts_delete_test.py
@@ -0,0 +1,28 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import accounts_delete
+
+
+FAKE_ACCOUNT_ID = "1"
+
+
+def test_accounts_delete():
+    # This test ensures that the call is valid and reaches the server. No
+    # account is being deleted during the test as it is not trivial to
+    # provision a new account for testing.
+    with pytest.raises(Exception, match="403 The caller does not have permission"):
+        accounts_delete.delete_account(FAKE_ACCOUNT_ID)
diff --git a/google-analytics-admin/accounts_get.py b/google-analytics-admin/accounts_get.py
new file mode 100644
index 0000000..d7cbf92
--- /dev/null
+++ b/google-analytics-admin/accounts_get.py
@@ -0,0 +1,57 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which prints the Google
+Analytics account data.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts/get
+for more information.
+"""
+# [START analyticsadmin_accounts_get]
+from google.analytics.admin import AnalyticsAdminServiceClient
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account ID (e.g. "123456") before running the sample.
+    account_id = "YOUR-GA-ACCOUNT-ID"
+    get_account(account_id)
+
+
+def get_account(account_id: str):
+    """Retrieves the Google Analytics account data."""
+    client = AnalyticsAdminServiceClient()
+    account = client.get_account(name=f"accounts/{account_id}")
+
+    print("Result:")
+    print_account(account)
+
+
+def print_account(account: str):
+    """Prints account data."""
+    print(f"Resource name: {account.name}")
+    print(f"Display name: {account.display_name}")
+    print(f"Region code: {account.region_code}")
+    print(f"Create time: {account.create_time}")
+    print(f"Update time: {account.update_time}")
+
+
+# [END analyticsadmin_accounts_get]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/accounts_get_data_sharing_settings.py b/google-analytics-admin/accounts_get_data_sharing_settings.py
new file mode 100644
index 0000000..66a8ef2
--- /dev/null
+++ b/google-analytics-admin/accounts_get_data_sharing_settings.py
@@ -0,0 +1,60 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which prints the data sharing
+settings on an account.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts/getDataSharingSettings
+for more information.
+"""
+# [START analyticsadmin_accounts_get_data_sharing_settings]
+from google.analytics.admin import AnalyticsAdminServiceClient
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account ID (e.g. "123456") before running the sample.
+    account_id = "YOUR-GA-ACCOUNT-ID"
+    get_data_sharing_settings(account_id)
+
+
+def get_data_sharing_settings(account_id: str):
+    """Gets data sharing settings on an account."""
+    client = AnalyticsAdminServiceClient()
+    data_sharing_settings = client.get_data_sharing_settings(
+        name=f"accounts/{account_id}/dataSharingSettings"
+    )
+
+    print("Result:")
+    print(f"Resource name: {data_sharing_settings.name}")
+    print(
+        f"Sharing with Google support enabled: {data_sharing_settings.sharing_with_google_support_enabled}"
+    )
+    print(
+        f"Sharing with Google assigned sales enabled: {data_sharing_settings.sharing_with_google_assigned_sales_enabled}"
+    )
+    print(
+        f"Sharing with others enabled: {data_sharing_settings.sharing_with_others_enabled}"
+    )
+
+
+# [END analyticsadmin_accounts_get_data_sharing_settings]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/accounts_get_data_sharing_settings_test.py b/google-analytics-admin/accounts_get_data_sharing_settings_test.py
new file mode 100644
index 0000000..6232fc7
--- /dev/null
+++ b/google-analytics-admin/accounts_get_data_sharing_settings_test.py
@@ -0,0 +1,25 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import os
+
+import accounts_get_data_sharing_settings
+
+TEST_ACCOUNT_ID = os.getenv("GA_TEST_ACCOUNT_ID")
+
+
+def test_accounts_get_data_sharing_settings(capsys):
+    accounts_get_data_sharing_settings.get_data_sharing_settings(TEST_ACCOUNT_ID)
+    out, _ = capsys.readouterr()
+    assert "Result" in out
diff --git a/google-analytics-admin/accounts_get_test.py b/google-analytics-admin/accounts_get_test.py
new file mode 100644
index 0000000..5c0c131
--- /dev/null
+++ b/google-analytics-admin/accounts_get_test.py
@@ -0,0 +1,25 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import os
+
+import accounts_get
+
+TEST_ACCOUNT_ID = os.getenv("GA_TEST_ACCOUNT_ID")
+
+
+def test_accounts_get(capsys):
+    accounts_get.get_account(TEST_ACCOUNT_ID)
+    out, _ = capsys.readouterr()
+    assert "Result" in out
diff --git a/google-analytics-admin/accounts_list.py b/google-analytics-admin/accounts_list.py
new file mode 100644
index 0000000..f69869e
--- /dev/null
+++ b/google-analytics-admin/accounts_list.py
@@ -0,0 +1,43 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which prints the Google
+Analytics accounts available to the current user.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts/list
+for more information.
+"""
+# [START analyticsadmin_accounts_list]
+from google.analytics.admin import AnalyticsAdminServiceClient
+
+from accounts_get import print_account
+
+
+def list_accounts():
+    """Lists the Google Analytics accounts available to the current user."""
+    client = AnalyticsAdminServiceClient()
+    results = client.list_accounts()
+
+    print("Result:")
+    for account in results:
+        print_account(account)
+
+
+# [END analyticsadmin_accounts_list]
+
+
+if __name__ == "__main__":
+    list_accounts()
diff --git a/google-analytics-admin/accounts_list_test.py b/google-analytics-admin/accounts_list_test.py
new file mode 100644
index 0000000..379c73b
--- /dev/null
+++ b/google-analytics-admin/accounts_list_test.py
@@ -0,0 +1,21 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import accounts_list
+
+
+def test_accounts_list(capsys):
+    accounts_list.list_accounts()
+    out, _ = capsys.readouterr()
+    assert "Result" in out
diff --git a/google-analytics-admin/accounts_provision_account_ticket.py b/google-analytics-admin/accounts_provision_account_ticket.py
new file mode 100644
index 0000000..3a57422
--- /dev/null
+++ b/google-analytics-admin/accounts_provision_account_ticket.py
@@ -0,0 +1,89 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which provisions the Google
+Analytics account creation ticket and prints the Terms of Service link that
+can be used by an end user to complete the account creation flow.
+
+This sample invokes the provision_account_ticket() method of the Google
+Analytics Admin API to start the Google Analytics account creation
+process for a user. This method returns an account ticket which shall be used
+to generate the Terms Of Service url that an end user should visit in order
+to accept the Terms and complete the account creation flow.
+
+You have to authenticate as an end user in order to run this sample. Only
+the authenticated user will be able to use the Terms of Service url generated
+as part of the account provisioning flow.
+
+To authenticate as an end user prior to running this sample, use the
+gcloud tool:
+
+ gcloud auth application-default login --scopes=https://www.googleapis.com/auth/analytics.edit --client-id-file=PATH_TO_YOUR_CLIENT_SECRET_JSON
+
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts/provisionAccountTicket
+for more information.
+"""
+# [START analyticsadmin_accounts_provision_account_ticket]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha.types import Account
+from google.analytics.admin_v1alpha.types import ProvisionAccountTicketRequest
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics account ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with a redirect URI where the user
+    #  will be sent after accepting Terms of Service. Must be configured in
+    #  Developers Console as a Redirect URI
+    redirect_uri = "YOUR-REDIRECT-URI"
+
+    provision_account_ticket(redirect_uri)
+
+
+def provision_account_ticket(redirect_uri: str):
+    """Provisions the Google Analytics account creation ticket."""
+    client = AnalyticsAdminServiceClient()
+    response = client.provision_account_ticket(
+        ProvisionAccountTicketRequest(
+            account=Account(display_name="Test Account", region_code="US"),
+            redirect_uri=redirect_uri,
+        )
+    )
+
+    print("Result:")
+    print(f"Account ticket id: {response.account_ticket_id}")
+    print(
+        f"You can now open the following URL to complete the account creation:"
+        f"https://analytics.google.com/analytics/web/?provisioningSignup=false#/termsofservice/{response.account_ticket_id}"
+    )
+    print()
+    print(
+        "Attention: make sure your browser is signed in to the same user "
+        "account that was used to provision the ticket."
+    )
+
+
+# [END analyticsadmin_accounts_provision_account_ticket]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/accounts_provision_account_ticket_test.py b/google-analytics-admin/accounts_provision_account_ticket_test.py
new file mode 100644
index 0000000..e08f940
--- /dev/null
+++ b/google-analytics-admin/accounts_provision_account_ticket_test.py
@@ -0,0 +1,24 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import accounts_provision_account_ticket
+
+
+TEST_REDIRECT_URL = "https://www.google.com"
+
+
+def test_accounts_provision_account_ticket(capsys):
+    accounts_provision_account_ticket.provision_account_ticket(TEST_REDIRECT_URL)
+    out, _ = capsys.readouterr()
+    assert "Result" in out
diff --git a/google-analytics-admin/accounts_update.py b/google-analytics-admin/accounts_update.py
new file mode 100644
index 0000000..e3ae56e
--- /dev/null
+++ b/google-analytics-admin/accounts_update.py
@@ -0,0 +1,69 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which updates the Google
+Analytics account.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts/update
+for more information.
+"""
+# [START analyticsadmin_accounts_update]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha.types import Account
+from google.protobuf.field_mask_pb2 import FieldMask
+
+from accounts_get import print_account
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics account ID from
+    # your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account ID (e.g. "123456") before running the sample.
+    account_id = "YOUR-GA-ACCOUNT-ID"
+    update_account(account_id)
+
+
+def update_account(account_id: str):
+    """Updates the Google Analytics account."""
+    client = AnalyticsAdminServiceClient()
+    # This call updates the display name and region code of the account, as
+    # indicated by the value of the `update_mask` field.
+    # The account to update is specified in the `name` field of the `Account`
+    # instance.
+    account = client.update_account(
+        account=Account(
+            name=f"accounts/{account_id}",
+            display_name="This is a test account",
+            region_code="US",
+        ),
+        update_mask=FieldMask(paths=["display_name", "region_code"]),
+    )
+
+    print("Result:")
+    print_account(account)
+
+
+# [END analyticsadmin_accounts_update]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/accounts_update_test.py b/google-analytics-admin/accounts_update_test.py
new file mode 100644
index 0000000..18c5f55
--- /dev/null
+++ b/google-analytics-admin/accounts_update_test.py
@@ -0,0 +1,27 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import accounts_update
+
+
+FAKE_ACCOUNT_ID = "1"
+
+
+def test_accounts_update():
+    # This test ensures that the call is valid and reaches the server, even
+    # though the operation does not succeed due to permission error.
+    with pytest.raises(Exception, match="403 The caller does not have permission"):
+        accounts_update.update_account(FAKE_ACCOUNT_ID)
diff --git a/google-analytics-admin/noxfile.py b/google-analytics-admin/noxfile.py
new file mode 100644
index 0000000..804f957
--- /dev/null
+++ b/google-analytics-admin/noxfile.py
@@ -0,0 +1,252 @@
+# Copyright 2019 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 __future__ import print_function
+
+import os
+from pathlib import Path
+import sys
+from typing import Callable, Dict, List, Optional
+
+import nox
+
+
+# WARNING - WARNING - WARNING - WARNING - WARNING
+# WARNING - WARNING - WARNING - WARNING - WARNING
+#           DO NOT EDIT THIS FILE EVER!
+# WARNING - WARNING - WARNING - WARNING - WARNING
+# WARNING - WARNING - WARNING - WARNING - WARNING
+
+# Copy `noxfile_config.py` to your directory and modify it instead.
+
+
+# `TEST_CONFIG` dict is a configuration hook that allows users to
+# modify the test configurations. The values here should be in sync
+# with `noxfile_config.py`. Users will copy `noxfile_config.py` into
+# their directory and modify it.
+
+TEST_CONFIG = {
+    # You can opt out from the test for specific Python versions.
+    'ignored_versions': ["2.7"],
+
+    # Old samples are opted out of enforcing Python type hints
+    # All new samples should feature them
+    'enforce_type_hints': False,
+
+    # An envvar key for determining the project id to use. Change it
+    # to 'BUILD_SPECIFIC_GCLOUD_PROJECT' if you want to opt in using a
+    # build specific Cloud project. You can also use your own string
+    # to use your own Cloud project.
+    'gcloud_project_env': 'GOOGLE_CLOUD_PROJECT',
+    # 'gcloud_project_env': 'BUILD_SPECIFIC_GCLOUD_PROJECT',
+
+    # A dictionary you want to inject into your test. Don't put any
+    # secrets here. These values will override predefined values.
+    'envs': {},
+}
+
+
+try:
+    # Ensure we can import noxfile_config in the project's directory.
+    sys.path.append('.')
+    from noxfile_config import TEST_CONFIG_OVERRIDE
+except ImportError as e:
+    print("No user noxfile_config found: detail: {}".format(e))
+    TEST_CONFIG_OVERRIDE = {}
+
+# Update the TEST_CONFIG with the user supplied values.
+TEST_CONFIG.update(TEST_CONFIG_OVERRIDE)
+
+
+def get_pytest_env_vars() -> Dict[str, str]:
+    """Returns a dict for pytest invocation."""
+    ret = {}
+
+    # Override the GCLOUD_PROJECT and the alias.
+    env_key = TEST_CONFIG['gcloud_project_env']
+    # This should error out if not set.
+    ret['GOOGLE_CLOUD_PROJECT'] = os.environ[env_key]
+    ret['GCLOUD_PROJECT'] = os.environ[env_key]  # deprecated
+
+    # Apply user supplied envs.
+    ret.update(TEST_CONFIG['envs'])
+    return ret
+
+
+# DO NOT EDIT - automatically generated.
+# All versions used to tested samples.
+ALL_VERSIONS = ["2.7", "3.6", "3.7", "3.8", "3.9"]
+
+# Any default versions that should be ignored.
+IGNORED_VERSIONS = TEST_CONFIG['ignored_versions']
+
+TESTED_VERSIONS = sorted([v for v in ALL_VERSIONS if v not in IGNORED_VERSIONS])
+
+INSTALL_LIBRARY_FROM_SOURCE = bool(os.environ.get("INSTALL_LIBRARY_FROM_SOURCE", False))
+#
+# Style Checks
+#
+
+
+def _determine_local_import_names(start_dir: str) -> List[str]:
+    """Determines all import names that should be considered "local".
+
+    This is used when running the linter to insure that import order is
+    properly checked.
+    """
+    file_ext_pairs = [os.path.splitext(path) for path in os.listdir(start_dir)]
+    return [
+        basename
+        for basename, extension in file_ext_pairs
+        if extension == ".py"
+           or os.path.isdir(os.path.join(start_dir, basename))
+           and basename not in ("__pycache__")
+    ]
+
+
+# Linting with flake8.
+#
+# We ignore the following rules:
+#   E203: whitespace before ‘:’
+#   E266: too many leading ‘#’ for block comment
+#   E501: line too long
+#   I202: Additional newline in a section of imports
+#
+# We also need to specify the rules which are ignored by default:
+# ['E226', 'W504', 'E126', 'E123', 'W503', 'E24', 'E704', 'E121']
+FLAKE8_COMMON_ARGS = [
+    "--show-source",
+    "--builtin=gettext",
+    "--max-complexity=20",
+    "--import-order-style=google",
+    "--exclude=.nox,.cache,env,lib,generated_pb2,*_pb2.py,*_pb2_grpc.py",
+    "--ignore=E121,E123,E126,E203,E226,E24,E266,E501,E704,W503,W504,I202",
+    "--max-line-length=88",
+]
+
+
+@nox.session
+def lint(session: nox.sessions.Session) -> None:
+    if not TEST_CONFIG['enforce_type_hints']:
+        session.install("flake8", "flake8-import-order")
+    else:
+        session.install("flake8", "flake8-import-order", "flake8-annotations")
+
+    local_names = _determine_local_import_names(".")
+    args = FLAKE8_COMMON_ARGS + [
+        "--application-import-names",
+        ",".join(local_names),
+        "."
+    ]
+    session.run("flake8", *args)
+
+
+#
+# Black
+#
+
+@nox.session
+def blacken(session: nox.sessions.Session) -> None:
+    session.install("black")
+    python_files = [path for path in os.listdir(".") if path.endswith(".py")]
+
+    session.run("black", *python_files)
+
+
+#
+# Sample Tests
+#
+
+
+PYTEST_COMMON_ARGS = ["--junitxml=sponge_log.xml"]
+
+
+def _session_tests(session: nox.sessions.Session, post_install: Callable = None) -> None:
+    """Runs py.test for a particular project."""
+    if os.path.exists("requirements.txt"):
+        if os.path.exists("constraints.txt"):
+            session.install("-r", "requirements.txt", "-c", "constraints.txt")
+        else:
+            session.install("-r", "requirements.txt")
+
+    if os.path.exists("requirements-test.txt"):
+        if os.path.exists("constraints-test.txt"):
+            session.install("-r", "requirements-test.txt", "-c", "constraints-test.txt")
+        else:
+            session.install("-r", "requirements-test.txt")
+
+    if INSTALL_LIBRARY_FROM_SOURCE:
+        session.install("-e", _get_repo_root())
+
+    if post_install:
+        post_install(session)
+
+    session.run(
+        "pytest",
+        *(PYTEST_COMMON_ARGS + session.posargs),
+        # Pytest will return 5 when no tests are collected. This can happen
+        # on travis where slow and flaky tests are excluded.
+        # See http://doc.pytest.org/en/latest/_modules/_pytest/main.html
+        success_codes=[0, 5],
+        env=get_pytest_env_vars()
+    )
+
+
+@nox.session(python=ALL_VERSIONS)
+def py(session: nox.sessions.Session) -> None:
+    """Runs py.test for a sample using the specified version of Python."""
+    if session.python in TESTED_VERSIONS:
+        _session_tests(session)
+    else:
+        session.skip("SKIPPED: {} tests are disabled for this sample.".format(
+            session.python
+        ))
+
+
+#
+# Readmegen
+#
+
+
+def _get_repo_root() -> Optional[str]:
+    """ Returns the root folder of the project. """
+    # Get root of this repository.
+    # Assume we don't have directories nested deeper than 10 items.
+    p = Path(os.getcwd())
+    for i in range(10):
+        if p is None:
+            break
+        if Path(p / ".git").exists():
+            return str(p)
+        p = p.parent
+    raise Exception("Unable to detect repository root.")
+
+
+GENERATED_READMES = sorted([x for x in Path(".").rglob("*.rst.in")])
+
+
+@nox.session
+@nox.parametrize("path", GENERATED_READMES)
+def readmegen(session: nox.sessions.Session, path: str) -> None:
+    """(Re-)generates the readme for a sample."""
+    session.install("jinja2", "pyyaml")
+    dir_ = os.path.dirname(path)
+
+    if os.path.exists(os.path.join(dir_, "requirements.txt")):
+        session.install("-r", os.path.join(dir_, "requirements.txt"))
+
+    in_file = os.path.join(dir_, "README.rst.in")
+    session.run(
+        "python", _get_repo_root() + "/scripts/readme-gen/readme_gen.py", in_file
+    )
diff --git a/google-analytics-admin/noxfile_config.py b/google-analytics-admin/noxfile_config.py
new file mode 100644
index 0000000..b883a88
--- /dev/null
+++ b/google-analytics-admin/noxfile_config.py
@@ -0,0 +1,23 @@
+TEST_CONFIG_OVERRIDE = {
+    # You can opt out from the test for specific Python versions.
+    "ignored_versions": ["2.7"],
+    # Old samples are opted out of enforcing Python type hints
+    # All new samples should feature them
+    "enforce_type_hints": True,
+    # An envvar key for determining the project id to use. Change it
+    # to 'BUILD_SPECIFIC_GCLOUD_PROJECT' if you want to opt in using a
+    # build specific Cloud project. You can also use your own string
+    # to use your own Cloud project.
+    "gcloud_project_env": "GOOGLE_CLOUD_PROJECT",
+    # 'gcloud_project_env': 'BUILD_SPECIFIC_GCLOUD_PROJECT',
+    # A dictionary you want to inject into your test. Don't put any
+    # secrets here. These values will override predefined values.
+    "envs": {
+        "GA_TEST_PROPERTY_ID": "222596558",
+        "GA_TEST_ACCOUNT_ID": "123",
+        "GA_TEST_USER_LINK_ID": "123",
+        "GA_TEST_ANDROID_APP_DATA_STREAM_ID": "123",
+        "GA_TEST_IOS_APP_DATA_STREAM_ID": "123",
+        "GA_TEST_WEB_DATA_STREAM_ID": "123",
+    },
+}
diff --git a/google-analytics-admin/noxfile_config_test.py b/google-analytics-admin/noxfile_config_test.py
new file mode 100644
index 0000000..e69de29
diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
new file mode 100644
index 0000000..11e7e0f
--- /dev/null
+++ b/google-analytics-admin/requirements.txt
@@ -0,0 +1,2 @@
+google-analytics-admin==0.2.0
+google-auth-oauthlib==0.4.4
\ No newline at end of file

From f5621f86e412e14969c2036326dc5fd93a2f53c8 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Sat, 15 May 2021 14:20:02 +0200
Subject: [PATCH 014/213] chore(deps): update dependency pytest to v6.2.4 (#73)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [pytest](https://docs.pytest.org/en/latest/) ([source](https://togithub.com/pytest-dev/pytest), [changelog](https://docs.pytest.org/en/stable/changelog.html)) | `==6.1.1` -> `==6.2.4` | [![age](https://badges.renovateapi.com/packages/pypi/pytest/6.2.4/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/pypi/pytest/6.2.4/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/pypi/pytest/6.2.4/compatibility-slim/6.1.1)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/pypi/pytest/6.2.4/confidence-slim/6.1.1)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>pytest-dev/pytest</summary>

### [`v6.2.4`](https://togithub.com/pytest-dev/pytest/releases/6.2.4)

[Compare Source](https://togithub.com/pytest-dev/pytest/compare/6.2.3...6.2.4)

# pytest 6.2.4 (2021-05-04)

## Bug Fixes

-   [#&#8203;8539](https://togithub.com/pytest-dev/pytest/issues/8539): Fixed assertion rewriting on Python 3.10.

### [`v6.2.3`](https://togithub.com/pytest-dev/pytest/releases/6.2.3)

[Compare Source](https://togithub.com/pytest-dev/pytest/compare/6.2.2...6.2.3)

# pytest 6.2.3 (2021-04-03)

## Bug Fixes

-   [#&#8203;8414](https://togithub.com/pytest-dev/pytest/issues/8414): pytest used to create directories under `/tmp` with world-readable
    permissions. This means that any user in the system was able to read
    information written by tests in temporary directories (such as those created by
    the `tmp_path`/`tmpdir` fixture). Now the directories are created with
    private permissions.

    pytest used silenty use a pre-existing `/tmp/pytest-of-<username>` directory,
    even if owned by another user. This means another user could pre-create such a
    directory and gain control of another user\\'s temporary directory. Now such a
    condition results in an error.

### [`v6.2.2`](https://togithub.com/pytest-dev/pytest/releases/6.2.2)

[Compare Source](https://togithub.com/pytest-dev/pytest/compare/6.2.1...6.2.2)

##### pytest 6.2.2 (2021-01-25)

##### Bug Fixes

-   [#&#8203;8152](https://togithub.com/pytest-dev/pytest/issues/8152): Fixed "(&lt;Skipped instance>)" being shown as a skip reason in the verbose test summary line when the reason is empty.
-   [#&#8203;8249](https://togithub.com/pytest-dev/pytest/issues/8249): Fix the `faulthandler` plugin for occasions when running with `twisted.logger` and using `pytest --capture=no`.

### [`v6.2.1`](https://togithub.com/pytest-dev/pytest/releases/6.2.1)

[Compare Source](https://togithub.com/pytest-dev/pytest/compare/6.2.0...6.2.1)

# pytest 6.2.1 (2020-12-15)

## Bug Fixes

-   [#&#8203;7678](https://togithub.com/pytest-dev/pytest/issues/7678): Fixed bug where `ImportPathMismatchError` would be raised for files compiled in
    the host and loaded later from an UNC mounted path (Windows).
-   [#&#8203;8132](https://togithub.com/pytest-dev/pytest/issues/8132): Fixed regression in `approx`: in 6.2.0 `approx` no longer raises
    `TypeError` when dealing with non-numeric types, falling back to normal comparison.
    Before 6.2.0, array types like tf.DeviceArray fell through to the scalar case,
    and happened to compare correctly to a scalar if they had only one element.
    After 6.2.0, these types began failing, because they inherited neither from
    standard Python number hierarchy nor from `numpy.ndarray`.

    `approx` now converts arguments to `numpy.ndarray` if they expose the array
    protocol and are not scalars. This treats array-like objects like numpy arrays,
    regardless of size.

### [`v6.2.0`](https://togithub.com/pytest-dev/pytest/releases/6.2.0)

[Compare Source](https://togithub.com/pytest-dev/pytest/compare/6.1.2...6.2.0)

# pytest 6.2.0 (2020-12-12)

## Breaking Changes

-   [#&#8203;7808](https://togithub.com/pytest-dev/pytest/issues/7808): pytest now supports python3.6+ only.

## Deprecations

-   [#&#8203;7469](https://togithub.com/pytest-dev/pytest/issues/7469): Directly constructing/calling the following classes/functions is now deprecated:

    -   `_pytest.cacheprovider.Cache`
    -   `_pytest.cacheprovider.Cache.for_config()`
    -   `_pytest.cacheprovider.Cache.clear_cache()`
    -   `_pytest.cacheprovider.Cache.cache_dir_from_config()`
    -   `_pytest.capture.CaptureFixture`
    -   `_pytest.fixtures.FixtureRequest`
    -   `_pytest.fixtures.SubRequest`
    -   `_pytest.logging.LogCaptureFixture`
    -   `_pytest.pytester.Pytester`
    -   `_pytest.pytester.Testdir`
    -   `_pytest.recwarn.WarningsRecorder`
    -   `_pytest.recwarn.WarningsChecker`
    -   `_pytest.tmpdir.TempPathFactory`
    -   `_pytest.tmpdir.TempdirFactory`

    These have always been considered private, but now issue a deprecation warning, which may become a hard error in pytest 7.0.0.

-   [#&#8203;7530](https://togithub.com/pytest-dev/pytest/issues/7530): The `--strict` command-line option has been deprecated, use `--strict-markers` instead.

    We have plans to maybe in the future to reintroduce `--strict` and make it an encompassing flag for all strictness
    related options (`--strict-markers` and `--strict-config` at the moment, more might be introduced in the future).

-   [#&#8203;7988](https://togithub.com/pytest-dev/pytest/issues/7988): The `@pytest.yield_fixture` decorator/function is now deprecated. Use pytest.fixture instead.

    `yield_fixture` has been an alias for `fixture` for a very long time, so can be search/replaced safely.

## Features

-   [#&#8203;5299](https://togithub.com/pytest-dev/pytest/issues/5299): pytest now warns about unraisable exceptions and unhandled thread exceptions that occur in tests on Python>=3.8.
    See unraisable for more information.
-   [#&#8203;7425](https://togithub.com/pytest-dev/pytest/issues/7425): New pytester fixture, which is identical to testdir but its methods return pathlib.Path when appropriate instead of `py.path.local`.

    This is part of the movement to use pathlib.Path objects internally, in order to remove the dependency to `py` in the future.

    Internally, the old Testdir &lt;\_pytest.pytester.Testdir> is now a thin wrapper around Pytester &lt;\_pytest.pytester.Pytester>, preserving the old interface.

-   [#&#8203;7695](https://togithub.com/pytest-dev/pytest/issues/7695): A new hook was added, pytest_markeval_namespace which should return a dictionary.
    This dictionary will be used to augment the "global" variables available to evaluate skipif/xfail/xpass markers.

    Pseudo example

    `conftest.py`:

    ```{.sourceCode .python}
    def pytest_markeval_namespace():
        return {"color": "red"}
    ```

    `test_func.py`:

    ```{.sourceCode .python}
    @&#8203;pytest.mark.skipif("color == 'blue'", reason="Color is not red")
    def test_func():
        assert False
    ```

-   [#&#8203;8006](https://togithub.com/pytest-dev/pytest/issues/8006): It is now possible to construct a ~pytest.MonkeyPatch object directly as `pytest.MonkeyPatch()`,
    in cases when the monkeypatch fixture cannot be used. Previously some users imported it
    from the private \_pytest.monkeypatch.MonkeyPatch namespace.

    Additionally, MonkeyPatch.context &lt;pytest.MonkeyPatch.context> is now a classmethod,
    and can be used as `with MonkeyPatch.context() as mp: ...`. This is the recommended way to use
    `MonkeyPatch` directly, since unlike the `monkeypatch` fixture, an instance created directly
    is not `undo()`-ed automatically.

## Improvements

-   [#&#8203;1265](https://togithub.com/pytest-dev/pytest/issues/1265): Added an `__str__` implementation to the ~pytest.pytester.LineMatcher class which is returned from `pytester.run_pytest().stdout` and similar. It returns the entire output, like the existing `str()` method.
-   [#&#8203;2044](https://togithub.com/pytest-dev/pytest/issues/2044): Verbose mode now shows the reason that a test was skipped in the test's terminal line after the "SKIPPED", "XFAIL" or "XPASS".
-   [#&#8203;7469](https://togithub.com/pytest-dev/pytest/issues/7469) The types of builtin pytest fixtures are now exported so they may be used in type annotations of test functions.
    The newly-exported types are:

    -   `pytest.FixtureRequest` for the request fixture.
    -   `pytest.Cache` for the cache fixture.
    -   `pytest.CaptureFixture[str]` for the capfd and capsys fixtures.
    -   `pytest.CaptureFixture[bytes]` for the capfdbinary and capsysbinary fixtures.
    -   `pytest.LogCaptureFixture` for the caplog fixture.
    -   `pytest.Pytester` for the pytester fixture.
    -   `pytest.Testdir` for the testdir fixture.
    -   `pytest.TempdirFactory` for the tmpdir_factory fixture.
    -   `pytest.TempPathFactory` for the tmp_path_factory fixture.
    -   `pytest.MonkeyPatch` for the monkeypatch fixture.
    -   `pytest.WarningsRecorder` for the recwarn fixture.

    Constructing them is not supported (except for MonkeyPatch); they are only meant for use in type annotations.
    Doing so will emit a deprecation warning, and may become a hard-error in pytest 7.0.

    Subclassing them is also not supported. This is not currently enforced at runtime, but is detected by type-checkers such as mypy.

-   [#&#8203;7527](https://togithub.com/pytest-dev/pytest/issues/7527): When a comparison between namedtuple &lt;collections.namedtuple> instances of the same type fails, pytest now shows the differing field names (possibly nested) instead of their indexes.
-   [#&#8203;7615](https://togithub.com/pytest-dev/pytest/issues/7615): Node.warn &lt;\_pytest.nodes.Node.warn> now permits any subclass of Warning, not just PytestWarning &lt;pytest.PytestWarning>.
-   [#&#8203;7701](https://togithub.com/pytest-dev/pytest/issues/7701): Improved reporting when using `--collected-only`. It will now show the number of collected tests in the summary stats.
-   [#&#8203;7710](https://togithub.com/pytest-dev/pytest/issues/7710): Use strict equality comparison for non-numeric types in pytest.approx instead of
    raising TypeError.

    This was the undocumented behavior before 3.7, but is now officially a supported feature.

-   [#&#8203;7938](https://togithub.com/pytest-dev/pytest/issues/7938): New `--sw-skip` argument which is a shorthand for `--stepwise-skip`.
-   [#&#8203;8023](https://togithub.com/pytest-dev/pytest/issues/8023): Added `'node_modules'` to default value for norecursedirs.
-   [#&#8203;8032](https://togithub.com/pytest-dev/pytest/issues/8032): doClassCleanups &lt;unittest.TestCase.doClassCleanups> (introduced in unittest in Python and 3.8) is now called appropriately.

## Bug Fixes

-   [#&#8203;4824](https://togithub.com/pytest-dev/pytest/issues/4824): Fixed quadratic behavior and improved performance of collection of items using autouse fixtures and xunit fixtures.
-   [#&#8203;7758](https://togithub.com/pytest-dev/pytest/issues/7758): Fixed an issue where some files in packages are getting lost from `--lf` even though they contain tests that failed. Regressed in pytest 5.4.0.
-   [#&#8203;7911](https://togithub.com/pytest-dev/pytest/issues/7911): Directories created by by tmp_path and tmpdir are now considered stale after 3 days without modification (previous value was 3 hours) to avoid deleting directories still in use in long running test suites.
-   [#&#8203;7913](https://togithub.com/pytest-dev/pytest/issues/7913): Fixed a crash or hang in pytester.spawn &lt;\_pytest.pytester.Pytester.spawn> when the readline module is involved.
-   [#&#8203;7951](https://togithub.com/pytest-dev/pytest/issues/7951): Fixed handling of recursive symlinks when collecting tests.
-   [#&#8203;7981](https://togithub.com/pytest-dev/pytest/issues/7981): Fixed symlinked directories not being followed during collection. Regressed in pytest 6.1.0.
-   [#&#8203;8016](https://togithub.com/pytest-dev/pytest/issues/8016): Fixed only one doctest being collected when using `pytest --doctest-modules path/to/an/__init__.py`.

## Improved Documentation

-   [#&#8203;7429](https://togithub.com/pytest-dev/pytest/issues/7429): Add more information and use cases about skipping doctests.
-   [#&#8203;7780](https://togithub.com/pytest-dev/pytest/issues/7780): Classes which should not be inherited from are now marked `final class` in the API reference.
-   [#&#8203;7872](https://togithub.com/pytest-dev/pytest/issues/7872): `_pytest.config.argparsing.Parser.addini()` accepts explicit `None` and `"string"`.
-   [#&#8203;7878](https://togithub.com/pytest-dev/pytest/issues/7878): In pull request section, ask to commit after editing changelog and authors file.

## Trivial/Internal Changes

-   [#&#8203;7802](https://togithub.com/pytest-dev/pytest/issues/7802): The `attrs` dependency requirement is now >=19.2.0 instead of >=17.4.0.
-   [#&#8203;8014](https://togithub.com/pytest-dev/pytest/issues/8014): .pyc files created by pytest's assertion rewriting now conform to the newer PEP-552 format on Python>=3.7.
    (These files are internal and only interpreted by pytest itself.)

### [`v6.1.2`](https://togithub.com/pytest-dev/pytest/releases/6.1.2)

[Compare Source](https://togithub.com/pytest-dev/pytest/compare/6.1.1...6.1.2)

# pytest 6.1.2 (2020-10-28)

## Bug Fixes

-   [#&#8203;7758](https://togithub.com/pytest-dev/pytest/issues/7758): Fixed an issue where some files in packages are getting lost from `--lf` even though they contain tests that failed. Regressed in pytest 5.4.0.
-   [#&#8203;7911](https://togithub.com/pytest-dev/pytest/issues/7911): Directories created by tmpdir are now considered stale after 3 days without modification (previous value was 3 hours) to avoid deleting directories still in use in long running test suites.

## Improved Documentation

-   [#&#8203;7815](https://togithub.com/pytest-dev/pytest/issues/7815): Improve deprecation warning message for `pytest._fillfuncargs()`.

</details>

---

### Configuration

📅 **Schedule**: At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻️ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box.

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/python-analytics-data).
---
 google-analytics-data/requirements-test.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements-test.txt b/google-analytics-data/requirements-test.txt
index be53bec..95ea1e6 100644
--- a/google-analytics-data/requirements-test.txt
+++ b/google-analytics-data/requirements-test.txt
@@ -1 +1 @@
-pytest==6.1.1
+pytest==6.2.4

From f6c7fc9e728527f08ef708e112b7c4be04b94a7f Mon Sep 17 00:00:00 2001
From: ikuleshov <ikuleshov@google.com>
Date: Thu, 27 May 2021 15:16:39 -0700
Subject: [PATCH 015/213] docs: add Admin API samples for property user link
 management methods (#67)

* docs: add Admin API samples for property user link management methods

* fix the copyright string, avoid importing functions from other samples
---
 .../properties_user_links_audit.py            | 61 ++++++++++++++
 .../properties_user_links_audit_test.py       | 26 ++++++
 .../properties_user_links_batch_create.py     | 78 ++++++++++++++++++
 ...properties_user_links_batch_create_test.py | 30 +++++++
 .../properties_user_links_batch_delete.py     | 68 ++++++++++++++++
 ...properties_user_links_batch_delete_test.py | 30 +++++++
 .../properties_user_links_batch_get.py        | 62 +++++++++++++++
 .../properties_user_links_batch_get_test.py   | 28 +++++++
 .../properties_user_links_batch_update.py     | 79 +++++++++++++++++++
 ...properties_user_links_batch_update_test.py | 30 +++++++
 .../properties_user_links_create.py           | 69 ++++++++++++++++
 .../properties_user_links_create_test.py      | 30 +++++++
 .../properties_user_links_delete.py           | 62 +++++++++++++++
 .../properties_user_links_delete_test.py      | 30 +++++++
 .../properties_user_links_get.py              | 63 +++++++++++++++
 .../properties_user_links_get_test.py         | 28 +++++++
 .../properties_user_links_list.py             | 51 ++++++++++++
 .../properties_user_links_list_test.py        | 25 ++++++
 .../properties_user_links_update.py           | 68 ++++++++++++++++
 .../properties_user_links_update_test.py      | 30 +++++++
 20 files changed, 948 insertions(+)
 create mode 100644 google-analytics-admin/properties_user_links_audit.py
 create mode 100644 google-analytics-admin/properties_user_links_audit_test.py
 create mode 100644 google-analytics-admin/properties_user_links_batch_create.py
 create mode 100644 google-analytics-admin/properties_user_links_batch_create_test.py
 create mode 100644 google-analytics-admin/properties_user_links_batch_delete.py
 create mode 100644 google-analytics-admin/properties_user_links_batch_delete_test.py
 create mode 100644 google-analytics-admin/properties_user_links_batch_get.py
 create mode 100644 google-analytics-admin/properties_user_links_batch_get_test.py
 create mode 100644 google-analytics-admin/properties_user_links_batch_update.py
 create mode 100644 google-analytics-admin/properties_user_links_batch_update_test.py
 create mode 100644 google-analytics-admin/properties_user_links_create.py
 create mode 100644 google-analytics-admin/properties_user_links_create_test.py
 create mode 100644 google-analytics-admin/properties_user_links_delete.py
 create mode 100644 google-analytics-admin/properties_user_links_delete_test.py
 create mode 100644 google-analytics-admin/properties_user_links_get.py
 create mode 100644 google-analytics-admin/properties_user_links_get_test.py
 create mode 100644 google-analytics-admin/properties_user_links_list.py
 create mode 100644 google-analytics-admin/properties_user_links_list_test.py
 create mode 100644 google-analytics-admin/properties_user_links_update.py
 create mode 100644 google-analytics-admin/properties_user_links_update_test.py

diff --git a/google-analytics-admin/properties_user_links_audit.py b/google-analytics-admin/properties_user_links_audit.py
new file mode 100644
index 0000000..366eb7e
--- /dev/null
+++ b/google-analytics-admin/properties_user_links_audit.py
@@ -0,0 +1,61 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which prints user links audit
+data on the Google Analytics 4 property.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.userLinks/audit
+for more information.
+"""
+# [START analyticsadmin_properties_user_links_audit]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha.types import AuditUserLinksRequest
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+    audit_property_user_links(property_id)
+
+
+def audit_property_user_links(property_id):
+    """Lists all user links on the Google Analytics 4 property, including
+    implicit ones that come from effective permissions granted by groups or
+    organization admin roles."""
+    client = AnalyticsAdminServiceClient()
+    results = client.audit_user_links(
+        AuditUserLinksRequest(parent=f"properties/{property_id}")
+    )
+
+    print("Result:")
+    for user_link in results:
+        print(f"Resource name: {user_link.name}")
+        print(f"Email address: {user_link.email_address}")
+        for direct_role in user_link.direct_roles:
+            print(f"Direct role: {direct_role}")
+
+        for effective_role in user_link.effective_roles:
+            print(f"Effective role: {effective_role}")
+        print()
+
+
+# [END analyticsadmin_properties_user_links_audit]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_user_links_audit_test.py b/google-analytics-admin/properties_user_links_audit_test.py
new file mode 100644
index 0000000..be35193
--- /dev/null
+++ b/google-analytics-admin/properties_user_links_audit_test.py
@@ -0,0 +1,26 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import os
+
+import properties_user_links_audit
+
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+
+
+def test_properties_user_links_audit(capsys):
+    properties_user_links_audit.audit_property_user_links(TEST_PROPERTY_ID)
+    out, _ = capsys.readouterr()
+    assert "Result" in out
diff --git a/google-analytics-admin/properties_user_links_batch_create.py b/google-analytics-admin/properties_user_links_batch_create.py
new file mode 100644
index 0000000..b75b3fe
--- /dev/null
+++ b/google-analytics-admin/properties_user_links_batch_create.py
@@ -0,0 +1,78 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which creates a user link for
+the Google Analytics 4 property using a batch call.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.userLinks/batchCreate
+for more information.
+"""
+# [START analyticsadmin_properties_user_links_batch_create]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha.types import BatchCreateUserLinksRequest
+from google.analytics.admin_v1alpha.types import CreateUserLinkRequest
+from google.analytics.admin_v1alpha.types import UserLink
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics account ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with an email address of the user to
+    #  link. This user will be given access to your account after running the
+    #  sample.
+    email_address = "TEST-EMAIL-ADDRESS"
+
+    batch_create_property_user_link(property_id, email_address)
+
+
+def batch_create_property_user_link(property_id, email_address):
+    """Creates a user link for the Google Analytics 4 property using a batch
+    call."""
+    client = AnalyticsAdminServiceClient()
+    response = client.batch_create_user_links(
+        BatchCreateUserLinksRequest(
+            parent=f"properties/{property_id}",
+            requests=[
+                CreateUserLinkRequest(
+                    user_link=UserLink(
+                        email_address=email_address,
+                        direct_roles=["predefinedRoles/read"],
+                    )
+                )
+            ],
+            notify_new_users=True,
+        )
+    )
+
+    print("Result:")
+    for user_link in response.user_links:
+        print(user_link)
+        print()
+
+
+# [END analyticsadmin_properties_user_links_batch_create]
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_user_links_batch_create_test.py b/google-analytics-admin/properties_user_links_batch_create_test.py
new file mode 100644
index 0000000..11637f7
--- /dev/null
+++ b/google-analytics-admin/properties_user_links_batch_create_test.py
@@ -0,0 +1,30 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import properties_user_links_batch_create
+
+
+FAKE_PROPERTY_ID = "1"
+FAKE_EMAIL_ADDRESS = "test@google.com"
+
+
+def test_properties_user_links_batch_create():
+    # This test ensures that the call is valid and reaches the server, even
+    # though the operation does not succeed due to permission error.
+    with pytest.raises(Exception, match="403 The caller does not have permission"):
+        properties_user_links_batch_create.batch_create_property_user_link(
+            FAKE_PROPERTY_ID, FAKE_EMAIL_ADDRESS
+        )
diff --git a/google-analytics-admin/properties_user_links_batch_delete.py b/google-analytics-admin/properties_user_links_batch_delete.py
new file mode 100644
index 0000000..b678b0d
--- /dev/null
+++ b/google-analytics-admin/properties_user_links_batch_delete.py
@@ -0,0 +1,68 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which delete the user link for
+the Google Analytics 4 property using a batch call.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.userLinks/batchDelete
+for more information.
+"""
+# [START analyticsadmin_properties_user_links_batch_delete]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha.types import BatchDeleteUserLinksRequest
+from google.analytics.admin_v1alpha.types import DeleteUserLinkRequest
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics property ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account user link ID (e.g. "123456") before running the sample.
+    property_user_link_id = "YOUR-ACCOUNT-USER-LINK-ID"
+
+    batch_delete_property_user_link(property_id, property_user_link_id)
+
+
+def batch_delete_property_user_link(property_id, property_user_link_id):
+    """Deletes the GA4 property user link using a batch call."""
+    client = AnalyticsAdminServiceClient()
+    client.batch_delete_user_links(
+        BatchDeleteUserLinksRequest(
+            parent=f"properties/{property_id}",
+            requests=[
+                DeleteUserLinkRequest(
+                    name=f"properties/{property_id}/userLinks/{property_user_link_id}"
+                )
+            ],
+        )
+    )
+    print("User link deleted")
+
+
+# [END analyticsadmin_properties_user_links_batch_delete]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_user_links_batch_delete_test.py b/google-analytics-admin/properties_user_links_batch_delete_test.py
new file mode 100644
index 0000000..eb086bf
--- /dev/null
+++ b/google-analytics-admin/properties_user_links_batch_delete_test.py
@@ -0,0 +1,30 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import properties_user_links_batch_delete
+
+
+FAKE_PROPERTY_ID = "1"
+FAKE_USER_LINK_ID = "1"
+
+
+def test_properties_user_links_batch_delete():
+    # This test ensures that the call is valid and reaches the server, even
+    # though the operation does not succeed due to permission error.
+    with pytest.raises(Exception, match="403 The caller does not have permission"):
+        properties_user_links_batch_delete.batch_delete_property_user_link(
+            FAKE_PROPERTY_ID, FAKE_USER_LINK_ID
+        )
diff --git a/google-analytics-admin/properties_user_links_batch_get.py b/google-analytics-admin/properties_user_links_batch_get.py
new file mode 100644
index 0000000..b7b3434
--- /dev/null
+++ b/google-analytics-admin/properties_user_links_batch_get.py
@@ -0,0 +1,62 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which prints details for the
+Google Analytics 4 property user link using a batch call.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.userLinks/batchGet
+for more information.
+"""
+# [START analyticsadmin_properties_user_links_batch_get]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha.types import BatchGetUserLinksRequest
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account user link ID (e.g. "123456") before running the sample.
+    property_user_link_id = "YOUR-ACCOUNT-USER-LINK-ID"
+
+    batch_get_property_user_link(property_id, property_user_link_id)
+
+
+def batch_get_property_user_link(property_id, property_user_link_id):
+    """Retrieves details for the Google Analytics 4 property user link using a
+    batch call."""
+    client = AnalyticsAdminServiceClient()
+    response = client.batch_get_user_links(
+        BatchGetUserLinksRequest(
+            parent=f"properties/{property_id}",
+            names=[f"properties/{property_id}/userLinks/{property_user_link_id}"],
+        )
+    )
+
+    print("Result:")
+    for user_link in response.user_links:
+        print(user_link)
+        print()
+
+
+# [END analyticsadmin_properties_user_links_batch_get]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_user_links_batch_get_test.py b/google-analytics-admin/properties_user_links_batch_get_test.py
new file mode 100644
index 0000000..a862070
--- /dev/null
+++ b/google-analytics-admin/properties_user_links_batch_get_test.py
@@ -0,0 +1,28 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import os
+
+import properties_user_links_batch_get
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+TEST_USER_LINK_ID = os.getenv("GA_USER_LINK_ID")
+
+
+def test_properties_user_links_batch_get(capsys):
+    properties_user_links_batch_get.batch_get_property_user_link(
+        TEST_PROPERTY_ID, TEST_USER_LINK_ID
+    )
+    out, _ = capsys.readouterr()
+    assert "Result" in out
diff --git a/google-analytics-admin/properties_user_links_batch_update.py b/google-analytics-admin/properties_user_links_batch_update.py
new file mode 100644
index 0000000..9c8e08b
--- /dev/null
+++ b/google-analytics-admin/properties_user_links_batch_update.py
@@ -0,0 +1,79 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which updates the Google
+Analytics 4 property user link using a batch call.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.userLinks/batchUpdate
+for more information.
+"""
+# [START analyticsadmin_properties_user_links_batch_update]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha.types import BatchUpdateUserLinksRequest
+from google.analytics.admin_v1alpha.types import UpdateUserLinkRequest
+from google.analytics.admin_v1alpha.types import UserLink
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics property ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account user link ID (e.g. "123456") before running the sample.
+    property_user_link_id = "YOUR-ACCOUNT-USER-LINK-ID"
+
+    batch_update_property_user_link(property_id, property_user_link_id)
+
+
+def batch_update_property_user_link(property_id, property_user_link_id):
+    """Updates the Google Analytics 4 property user link using a batch call."""
+    client = AnalyticsAdminServiceClient()
+    # This call updates the email address and direct roles of the user link.
+    # The user link to update is specified in the `name` field of the `UserLink`
+    # instance.
+    response = client.batch_update_user_links(
+        BatchUpdateUserLinksRequest(
+            parent=f"properties/{property_id}",
+            requests=[
+                UpdateUserLinkRequest(
+                    user_link=UserLink(
+                        name=f"properties/{property_id}/userLinks/{property_user_link_id}",
+                        direct_roles=["predefinedRoles/collaborate"],
+                    ),
+                )
+            ],
+        )
+    )
+
+    print("Result:")
+    for user_link in response.user_links:
+        print(user_link)
+        print()
+
+
+# [END analyticsadmin_properties_user_links_batch_update]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_user_links_batch_update_test.py b/google-analytics-admin/properties_user_links_batch_update_test.py
new file mode 100644
index 0000000..70b5cc4
--- /dev/null
+++ b/google-analytics-admin/properties_user_links_batch_update_test.py
@@ -0,0 +1,30 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import properties_user_links_batch_update
+
+
+FAKE_PROPERTY_ID = "1"
+FAKE_USER_LINK_ID = "1"
+
+
+def test_properties_user_links_batch_update():
+    # This test ensures that the call is valid and reaches the server, even
+    # though the operation does not succeed due to permission error.
+    with pytest.raises(Exception, match="403 The caller does not have permission"):
+        properties_user_links_batch_update.batch_update_property_user_link(
+            FAKE_PROPERTY_ID, FAKE_USER_LINK_ID
+        )
diff --git a/google-analytics-admin/properties_user_links_create.py b/google-analytics-admin/properties_user_links_create.py
new file mode 100644
index 0000000..0658648
--- /dev/null
+++ b/google-analytics-admin/properties_user_links_create.py
@@ -0,0 +1,69 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which creates a user link for
+the Google Analytics 4 property.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.userLinks/create
+for more information.
+"""
+# [START analyticsadmin_properties_user_links_create]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha.types import CreateUserLinkRequest
+from google.analytics.admin_v1alpha.types import UserLink
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics account ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with an email address of the user to
+    #  link. This user will be given access to your account after running the
+    #  sample.
+    email_address = "TEST-EMAIL-ADDRESS"
+
+    create_property_user_link(property_id, email_address)
+
+
+def create_property_user_link(property_id, email_address):
+    """Creates a user link for the Google Analytics 4 property."""
+    client = AnalyticsAdminServiceClient()
+    user_link = client.create_user_link(
+        CreateUserLinkRequest(
+            parent=f"properties/{property_id}",
+            user_link=UserLink(
+                email_address=email_address, direct_roles=["predefinedRoles/read"]
+            ),
+            notify_new_user=True,
+        )
+    )
+
+    print("Result:")
+    print(user_link)
+
+
+# [END analyticsadmin_properties_user_links_create]
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_user_links_create_test.py b/google-analytics-admin/properties_user_links_create_test.py
new file mode 100644
index 0000000..c072554
--- /dev/null
+++ b/google-analytics-admin/properties_user_links_create_test.py
@@ -0,0 +1,30 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import properties_user_links_create
+
+
+FAKE_PROPERTY_ID = "1"
+FAKE_EMAIL_ADDRESS = "test@google.com"
+
+
+def test_properties_user_links_create():
+    # This test ensures that the call is valid and reaches the server, even
+    # though the operation does not succeed due to permission error.
+    with pytest.raises(Exception, match="403 The caller does not have permission"):
+        properties_user_links_create.create_property_user_link(
+            FAKE_PROPERTY_ID, FAKE_EMAIL_ADDRESS
+        )
diff --git a/google-analytics-admin/properties_user_links_delete.py b/google-analytics-admin/properties_user_links_delete.py
new file mode 100644
index 0000000..3aeaa6b
--- /dev/null
+++ b/google-analytics-admin/properties_user_links_delete.py
@@ -0,0 +1,62 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which deletes the user link
+from the Google Analytics 4 property.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.userLinks/delete
+for more information.
+"""
+# [START analyticsadmin_properties_user_links_delete]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha.types import DeleteUserLinkRequest
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics property ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account user link ID (e.g. "123456") before running the sample.
+    property_user_link_id = "YOUR-ACCOUNT-USER-LINK-ID"
+
+    delete_property_user_link(property_id, property_user_link_id)
+
+
+def delete_property_user_link(property_id, property_user_link_id):
+    """Deletes the user link from the Google Analytics 4 property."""
+    client = AnalyticsAdminServiceClient()
+    client.delete_user_link(
+        DeleteUserLinkRequest(
+            name=f"properties/{property_id}/userLinks/{property_user_link_id}"
+        )
+    )
+    print("User link deleted")
+
+
+# [END analyticsadmin_properties_user_links_delete]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_user_links_delete_test.py b/google-analytics-admin/properties_user_links_delete_test.py
new file mode 100644
index 0000000..34bc956
--- /dev/null
+++ b/google-analytics-admin/properties_user_links_delete_test.py
@@ -0,0 +1,30 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import properties_user_links_delete
+
+
+FAKE_PROPERTY_ID = "1"
+FAKE_USER_LINK_ID = "1"
+
+
+def test_properties_user_links_delete():
+    # This test ensures that the call is valid and reaches the server, even
+    # though the operation does not succeed due to permission error.
+    with pytest.raises(Exception, match="403 The caller does not have permission"):
+        properties_user_links_delete.delete_property_user_link(
+            FAKE_PROPERTY_ID, FAKE_USER_LINK_ID
+        )
diff --git a/google-analytics-admin/properties_user_links_get.py b/google-analytics-admin/properties_user_links_get.py
new file mode 100644
index 0000000..ba9bacb
--- /dev/null
+++ b/google-analytics-admin/properties_user_links_get.py
@@ -0,0 +1,63 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which prints the Google
+Analytics 4 property user link details.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.userLinks/get
+for more information.
+"""
+# [START analyticsadmin_properties_user_links_get]
+from google.analytics.admin import AnalyticsAdminServiceClient
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account user link ID (e.g. "123456") before running the sample.
+    property_user_link_id = "YOUR-ACCOUNT-USER-LINK-ID"
+
+    get_property_user_link(property_id, property_user_link_id)
+
+
+def get_property_user_link(property_id, property_user_link_id):
+    """Retrieves the Google Analytics 4 property user link details."""
+    client = AnalyticsAdminServiceClient()
+    user_link = client.get_user_link(
+        name=f"properties/{property_id}/userLinks/{property_user_link_id}"
+    )
+
+    print("Result:")
+    print_user_link(user_link)
+
+
+def print_user_link(user_link):
+    """Prints the user link details."""
+    print(f"Resource name: {user_link.name}")
+    print(f"Email address: {user_link.email_address}")
+    for direct_role in user_link.direct_roles:
+        print(f"Direct role: {direct_role}")
+
+
+# [END analyticsadmin_properties_user_links_get]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_user_links_get_test.py b/google-analytics-admin/properties_user_links_get_test.py
new file mode 100644
index 0000000..dca1ca8
--- /dev/null
+++ b/google-analytics-admin/properties_user_links_get_test.py
@@ -0,0 +1,28 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import os
+
+import properties_user_links_get
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+TEST_USER_LINK_ID = os.getenv("GA_USER_LINK_ID")
+
+
+def test_properties_user_links_get(capsys):
+    properties_user_links_get.get_property_user_link(
+        TEST_PROPERTY_ID, TEST_USER_LINK_ID
+    )
+    out, _ = capsys.readouterr()
+    assert "Result" in out
diff --git a/google-analytics-admin/properties_user_links_list.py b/google-analytics-admin/properties_user_links_list.py
new file mode 100644
index 0000000..0a0dcba
--- /dev/null
+++ b/google-analytics-admin/properties_user_links_list.py
@@ -0,0 +1,51 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which prints user links under
+the specified parent Google Analytics 4 property.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.userLinks/list
+for more information.
+"""
+# [START analyticsadmin_properties_user_links_list]
+from google.analytics.admin import AnalyticsAdminServiceClient
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+    list_property_user_links(property_id)
+
+
+def list_property_user_links(property_id):
+    """Lists user links under the specified parent Google Analytics 4
+    property."""
+    client = AnalyticsAdminServiceClient()
+    results = client.list_user_links(parent=f"properties/{property_id}")
+
+    print("Result:")
+    for user_link in results:
+        print(user_link)
+        print()
+
+
+# [END analyticsadmin_properties_user_links_list]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_user_links_list_test.py b/google-analytics-admin/properties_user_links_list_test.py
new file mode 100644
index 0000000..a814ed2
--- /dev/null
+++ b/google-analytics-admin/properties_user_links_list_test.py
@@ -0,0 +1,25 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import os
+
+import properties_user_links_list
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+
+
+def test_properties_user_links_list(capsys):
+    properties_user_links_list.list_property_user_links(TEST_PROPERTY_ID)
+    out, _ = capsys.readouterr()
+    assert "Result" in out
diff --git a/google-analytics-admin/properties_user_links_update.py b/google-analytics-admin/properties_user_links_update.py
new file mode 100644
index 0000000..8b53f6b
--- /dev/null
+++ b/google-analytics-admin/properties_user_links_update.py
@@ -0,0 +1,68 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which updates the Google
+Analytics 4 property user link.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.userLinks/update
+for more information.
+"""
+# [START analyticsadmin_properties_user_links_update]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha.types import UserLink
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics property ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account user link ID (e.g. "123456") before running the sample.
+    property_user_link_id = "YOUR-ACCOUNT-USER-LINK-ID"
+
+    update_property_user_link(property_id, property_user_link_id)
+
+
+def update_property_user_link(property_id, property_user_link_id):
+    """Updates the Google Analytics 4 property user link."""
+    client = AnalyticsAdminServiceClient()
+    # This call updates the email address and direct roles of the user link.
+    # The user link to update is specified in the `name` field of the `UserLink`
+    # instance.
+    user_link = client.update_user_link(
+        user_link=UserLink(
+            name=f"properties/{property_id}/userLinks/{property_user_link_id}",
+            direct_roles=["predefinedRoles/collaborate"],
+        ),
+    )
+
+    print("Result:")
+    print(user_link)
+
+
+# [END analyticsadmin_properties_user_links_update]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_user_links_update_test.py b/google-analytics-admin/properties_user_links_update_test.py
new file mode 100644
index 0000000..157e70f
--- /dev/null
+++ b/google-analytics-admin/properties_user_links_update_test.py
@@ -0,0 +1,30 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import properties_user_links_update
+
+
+FAKE_PROPERTY_ID = "1"
+FAKE_USER_LINK_ID = "1"
+
+
+def test_properties_user_links_update():
+    # This test ensures that the call is valid and reaches the server, even
+    # though the operation does not succeed due to permission error.
+    with pytest.raises(Exception, match="403 The caller does not have permission"):
+        properties_user_links_update.update_property_user_link(
+            FAKE_PROPERTY_ID, FAKE_USER_LINK_ID
+        )

From 10b51fa9b5760d2c1bb2ed15c9f37efb74d231ee Mon Sep 17 00:00:00 2001
From: ikuleshov <ikuleshov@google.com>
Date: Thu, 27 May 2021 16:24:07 -0700
Subject: [PATCH 016/213] docs: add Admin API samples for property stream
 management methods (#68)

* docs: add Admin API samples for property stream management methods

* fix the copyright string, avoid importing functions from other samples
---
 ...perties_android_app_data_streams_delete.py | 59 ++++++++++++++
 ...es_android_app_data_streams_delete_test.py | 30 +++++++
 ...properties_android_app_data_streams_get.py | 65 +++++++++++++++
 ...rties_android_app_data_streams_get_test.py | 29 +++++++
 ...roperties_android_app_data_streams_list.py | 51 ++++++++++++
 ...ties_android_app_data_streams_list_test.py | 27 +++++++
 ...perties_android_app_data_streams_update.py | 71 +++++++++++++++++
 ...es_android_app_data_streams_update_test.py | 30 +++++++
 .../properties_ios_app_data_streams_delete.py | 59 ++++++++++++++
 ...erties_ios_app_data_streams_delete_test.py | 30 +++++++
 .../properties_ios_app_data_streams_get.py    | 65 +++++++++++++++
 ...roperties_ios_app_data_streams_get_test.py | 28 +++++++
 .../properties_ios_app_data_streams_list.py   | 51 ++++++++++++
 ...operties_ios_app_data_streams_list_test.py | 25 ++++++
 .../properties_ios_app_data_streams_update.py | 71 +++++++++++++++++
 ...erties_ios_app_data_streams_update_test.py | 30 +++++++
 .../properties_web_data_streams_create.py     | 60 ++++++++++++++
 ...properties_web_data_streams_create_test.py | 26 ++++++
 .../properties_web_data_streams_delete.py     | 59 ++++++++++++++
 ...properties_web_data_streams_delete_test.py | 29 +++++++
 .../properties_web_data_streams_get.py        | 66 ++++++++++++++++
 ...reams_get_enhanced_measurement_settings.py | 79 +++++++++++++++++++
 ..._get_enhanced_measurement_settings_test.py | 29 +++++++
 ...es_web_data_streams_get_global_site_tag.py | 55 +++++++++++++
 ...b_data_streams_get_global_site_tag_test.py | 29 +++++++
 .../properties_web_data_streams_get_test.py   | 29 +++++++
 .../properties_web_data_streams_list.py       | 51 ++++++++++++
 .../properties_web_data_streams_list_test.py  | 25 ++++++
 .../properties_web_data_streams_update.py     | 70 ++++++++++++++++
 ...ms_update_enhanced_measurement_settings.py | 73 +++++++++++++++++
 ...date_enhanced_measurement_settings_test.py | 30 +++++++
 ...properties_web_data_streams_update_test.py | 30 +++++++
 32 files changed, 1461 insertions(+)
 create mode 100644 google-analytics-admin/properties_android_app_data_streams_delete.py
 create mode 100644 google-analytics-admin/properties_android_app_data_streams_delete_test.py
 create mode 100644 google-analytics-admin/properties_android_app_data_streams_get.py
 create mode 100644 google-analytics-admin/properties_android_app_data_streams_get_test.py
 create mode 100644 google-analytics-admin/properties_android_app_data_streams_list.py
 create mode 100644 google-analytics-admin/properties_android_app_data_streams_list_test.py
 create mode 100644 google-analytics-admin/properties_android_app_data_streams_update.py
 create mode 100644 google-analytics-admin/properties_android_app_data_streams_update_test.py
 create mode 100644 google-analytics-admin/properties_ios_app_data_streams_delete.py
 create mode 100644 google-analytics-admin/properties_ios_app_data_streams_delete_test.py
 create mode 100644 google-analytics-admin/properties_ios_app_data_streams_get.py
 create mode 100644 google-analytics-admin/properties_ios_app_data_streams_get_test.py
 create mode 100644 google-analytics-admin/properties_ios_app_data_streams_list.py
 create mode 100644 google-analytics-admin/properties_ios_app_data_streams_list_test.py
 create mode 100644 google-analytics-admin/properties_ios_app_data_streams_update.py
 create mode 100644 google-analytics-admin/properties_ios_app_data_streams_update_test.py
 create mode 100644 google-analytics-admin/properties_web_data_streams_create.py
 create mode 100644 google-analytics-admin/properties_web_data_streams_create_test.py
 create mode 100644 google-analytics-admin/properties_web_data_streams_delete.py
 create mode 100644 google-analytics-admin/properties_web_data_streams_delete_test.py
 create mode 100644 google-analytics-admin/properties_web_data_streams_get.py
 create mode 100644 google-analytics-admin/properties_web_data_streams_get_enhanced_measurement_settings.py
 create mode 100644 google-analytics-admin/properties_web_data_streams_get_enhanced_measurement_settings_test.py
 create mode 100644 google-analytics-admin/properties_web_data_streams_get_global_site_tag.py
 create mode 100644 google-analytics-admin/properties_web_data_streams_get_global_site_tag_test.py
 create mode 100644 google-analytics-admin/properties_web_data_streams_get_test.py
 create mode 100644 google-analytics-admin/properties_web_data_streams_list.py
 create mode 100644 google-analytics-admin/properties_web_data_streams_list_test.py
 create mode 100644 google-analytics-admin/properties_web_data_streams_update.py
 create mode 100644 google-analytics-admin/properties_web_data_streams_update_enhanced_measurement_settings.py
 create mode 100644 google-analytics-admin/properties_web_data_streams_update_enhanced_measurement_settings_test.py
 create mode 100644 google-analytics-admin/properties_web_data_streams_update_test.py

diff --git a/google-analytics-admin/properties_android_app_data_streams_delete.py b/google-analytics-admin/properties_android_app_data_streams_delete.py
new file mode 100644
index 0000000..dfd6939
--- /dev/null
+++ b/google-analytics-admin/properties_android_app_data_streams_delete.py
@@ -0,0 +1,59 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which deletes the Android app
+data stream.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.androidAppDataStreams/delete
+for more information.
+"""
+# [START analyticsadmin_properties_android_app_data_streams_delete]
+from google.analytics.admin import AnalyticsAdminServiceClient
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics property ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with your Android app data stream ID
+    #  (e.g. "123456") before running the sample.
+    stream_id = "YOUR-ANDROID-APP-DATA-STREAM-ID"
+
+    delete_android_app_data_stream(property_id, stream_id)
+
+
+def delete_android_app_data_stream(property_id, stream_id):
+    """Deletes the Android app data stream."""
+    client = AnalyticsAdminServiceClient()
+    client.delete_android_app_data_stream(
+        name=f"properties/{property_id}/androidAppDataStreams/{stream_id}"
+    )
+    print("Android app data stream deleted")
+
+
+# [END analyticsadmin_properties_android_app_data_streams_delete]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_android_app_data_streams_delete_test.py b/google-analytics-admin/properties_android_app_data_streams_delete_test.py
new file mode 100644
index 0000000..bd63388
--- /dev/null
+++ b/google-analytics-admin/properties_android_app_data_streams_delete_test.py
@@ -0,0 +1,30 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import properties_android_app_data_streams_delete
+
+
+FAKE_PROPERTY_ID = "1"
+FAKE_STREAM_ID = "1"
+
+
+def test_properties_android_app_data_streams_delete():
+    # This test ensures that the call is valid and reaches the server, even
+    # though the operation does not succeed due to permission error.
+    with pytest.raises(Exception, match="403 The caller does not have permission"):
+        properties_android_app_data_streams_delete.delete_android_app_data_stream(
+            FAKE_PROPERTY_ID, FAKE_STREAM_ID
+        )
diff --git a/google-analytics-admin/properties_android_app_data_streams_get.py b/google-analytics-admin/properties_android_app_data_streams_get.py
new file mode 100644
index 0000000..68fcb8b
--- /dev/null
+++ b/google-analytics-admin/properties_android_app_data_streams_get.py
@@ -0,0 +1,65 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which prints the details for
+an Android app data stream.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.androidAppDataStreams/get
+for more information.
+"""
+# [START analyticsadmin_properties_android_app_data_streams_get]
+from google.analytics.admin import AnalyticsAdminServiceClient
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with your Android app data stream ID
+    #  (e.g. "123456") before running the sample.
+    stream_id = "YOUR-ANDROID-APP-DATA-STREAM-ID"
+
+    get_android_app_data_stream(property_id, stream_id)
+
+
+def get_android_app_data_stream(property_id, stream_id):
+    """Retrieves the details for an Android app data stream."""
+    client = AnalyticsAdminServiceClient()
+    android_app_data_stream = client.get_android_app_data_stream(
+        name=f"properties/{property_id}/androidAppDataStreams/{stream_id}"
+    )
+
+    print("Result:")
+    print_android_app_data_stream(android_app_data_stream)
+
+
+def print_android_app_data_stream(android_app_data_stream):
+    """Prints the Android app data stream details."""
+    print(f"Resource name: {android_app_data_stream.name}")
+    print(f"Display name: {android_app_data_stream.display_name}")
+    print(f"Firebase app ID: {android_app_data_stream.firebase_app_id}")
+    print(f"Package name: {android_app_data_stream.package_name}")
+    print(f"Create time: {android_app_data_stream.create_time}")
+    print(f"Update time: {android_app_data_stream.update_time}")
+
+
+# [END analyticsadmin_properties_android_app_data_streams_get]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_android_app_data_streams_get_test.py b/google-analytics-admin/properties_android_app_data_streams_get_test.py
new file mode 100644
index 0000000..33d2cea
--- /dev/null
+++ b/google-analytics-admin/properties_android_app_data_streams_get_test.py
@@ -0,0 +1,29 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import os
+
+import properties_android_app_data_streams_get
+
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+TEST_ANDROID_APP_DATA_STREAM_ID = os.getenv("GA_TEST_ANDROID_APP_DATA_STREAM_ID")
+
+
+def test_properties_android_app_data_streams_get(capsys):
+    properties_android_app_data_streams_get.get_android_app_data_stream(
+        TEST_PROPERTY_ID, TEST_ANDROID_APP_DATA_STREAM_ID
+    )
+    out, _ = capsys.readouterr()
+    assert "Result" in out
diff --git a/google-analytics-admin/properties_android_app_data_streams_list.py b/google-analytics-admin/properties_android_app_data_streams_list.py
new file mode 100644
index 0000000..97b67b0
--- /dev/null
+++ b/google-analytics-admin/properties_android_app_data_streams_list.py
@@ -0,0 +1,51 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which prints Android app data
+streams for a Google Analytics 4 property.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.androidAppDataStreams/list
+for more information.
+"""
+# [START analyticsadmin_properties_android_app_data_streams_list]
+from google.analytics.admin import AnalyticsAdminServiceClient
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    list_android_app_data_streams(property_id)
+
+
+def list_android_app_data_streams(property_id):
+    """Lists Android app data streams for a Google Analytics 4 property."""
+    client = AnalyticsAdminServiceClient()
+    results = client.list_android_app_data_streams(parent=f"properties/{property_id}")
+
+    print("Result:")
+    for android_app_data_stream in results:
+        print(android_app_data_stream)
+        print()
+
+
+# [END analyticsadmin_properties_android_app_data_streams_list]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_android_app_data_streams_list_test.py b/google-analytics-admin/properties_android_app_data_streams_list_test.py
new file mode 100644
index 0000000..90b47f7
--- /dev/null
+++ b/google-analytics-admin/properties_android_app_data_streams_list_test.py
@@ -0,0 +1,27 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import os
+
+import properties_android_app_data_streams_list
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+
+
+def test_properties_android_app_data_streams_list(capsys):
+    properties_android_app_data_streams_list.list_android_app_data_streams(
+        TEST_PROPERTY_ID
+    )
+    out, _ = capsys.readouterr()
+    assert "Result" in out
diff --git a/google-analytics-admin/properties_android_app_data_streams_update.py b/google-analytics-admin/properties_android_app_data_streams_update.py
new file mode 100644
index 0000000..72fc0a7
--- /dev/null
+++ b/google-analytics-admin/properties_android_app_data_streams_update.py
@@ -0,0 +1,71 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which updates the Android app
+data stream.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.androidAppDataStreams/update
+for more information.
+"""
+# [START analyticsadmin_properties_android_app_data_streams_update]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha.types import AndroidAppDataStream
+from google.protobuf.field_mask_pb2 import FieldMask
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics property ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with your Android app data stream ID
+    #  (e.g. "123456") before running the sample.
+    stream_id = "YOUR-ANDROID-APP-DATA-STREAM-ID"
+
+    update_android_app_data_stream(property_id, stream_id)
+
+
+def update_android_app_data_stream(property_id, stream_id):
+    """Updates the Android app data stream."""
+    client = AnalyticsAdminServiceClient()
+    # This call updates the display name of the Android app data stream, as
+    # indicated by the value of the `update_mask` field. The Android app data
+    # stream to update is specified in the `name` field of the
+    # `AndroidAppDataStream` instance.
+    android_app_data_stream = client.update_android_app_data_stream(
+        android_app_data_stream=AndroidAppDataStream(
+            name=f"properties/{property_id}/androidAppDataStreams/{stream_id}",
+            display_name="This is an updated test Android app data stream",
+        ),
+        update_mask=FieldMask(paths=["display_name"]),
+    )
+
+    print("Result:")
+    print(android_app_data_stream)
+
+
+# [END analyticsadmin_properties_android_app_data_streams_update]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_android_app_data_streams_update_test.py b/google-analytics-admin/properties_android_app_data_streams_update_test.py
new file mode 100644
index 0000000..de310b4
--- /dev/null
+++ b/google-analytics-admin/properties_android_app_data_streams_update_test.py
@@ -0,0 +1,30 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import properties_android_app_data_streams_update
+
+
+FAKE_PROPERTY_ID = "1"
+FAKE_STREAM_ID = "1"
+
+
+def test_properties_android_app_data_streams_update():
+    # This test ensures that the call is valid and reaches the server, even
+    # though the operation does not succeed due to permission error.
+    with pytest.raises(Exception, match="403 The caller does not have permission"):
+        properties_android_app_data_streams_update.update_android_app_data_stream(
+            FAKE_PROPERTY_ID, FAKE_STREAM_ID
+        )
diff --git a/google-analytics-admin/properties_ios_app_data_streams_delete.py b/google-analytics-admin/properties_ios_app_data_streams_delete.py
new file mode 100644
index 0000000..b02a280
--- /dev/null
+++ b/google-analytics-admin/properties_ios_app_data_streams_delete.py
@@ -0,0 +1,59 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which deletes the iOS app data
+stream.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.iosAppDataStreams/delete
+for more information.
+"""
+# [START analyticsadmin_properties_ios_app_data_streams_delete]
+from google.analytics.admin import AnalyticsAdminServiceClient
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics property ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with your iOS app data stream ID
+    #  (e.g. "123456") before running the sample.
+    stream_id = "YOUR-IOS-APP-DATA-STREAM-ID"
+
+    delete_ios_app_data_stream(property_id, stream_id)
+
+
+def delete_ios_app_data_stream(property_id, stream_id):
+    """Deletes the iOS app data stream."""
+    client = AnalyticsAdminServiceClient()
+    client.delete_ios_app_data_stream(
+        name=f"properties/{property_id}/iosAppDataStreams/{stream_id}"
+    )
+    print("iOS app data stream deleted")
+
+
+# [END analyticsadmin_properties_ios_app_data_streams_delete]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_ios_app_data_streams_delete_test.py b/google-analytics-admin/properties_ios_app_data_streams_delete_test.py
new file mode 100644
index 0000000..6c20728
--- /dev/null
+++ b/google-analytics-admin/properties_ios_app_data_streams_delete_test.py
@@ -0,0 +1,30 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import properties_ios_app_data_streams_delete
+
+
+FAKE_PROPERTY_ID = "1"
+FAKE_STREAM_ID = "1"
+
+
+def test_properties_ios_app_data_streams_delete():
+    # This test ensures that the call is valid and reaches the server, even
+    # though the operation does not succeed due to permission error.
+    with pytest.raises(Exception, match="403 The caller does not have permission"):
+        properties_ios_app_data_streams_delete.delete_ios_app_data_stream(
+            FAKE_PROPERTY_ID, FAKE_STREAM_ID
+        )
diff --git a/google-analytics-admin/properties_ios_app_data_streams_get.py b/google-analytics-admin/properties_ios_app_data_streams_get.py
new file mode 100644
index 0000000..02b775d
--- /dev/null
+++ b/google-analytics-admin/properties_ios_app_data_streams_get.py
@@ -0,0 +1,65 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which prints the iOS app data
+stream details.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.iosAppDataStreams/get
+for more information.
+"""
+# [START analyticsadmin_properties_ios_app_data_streams_get]
+from google.analytics.admin import AnalyticsAdminServiceClient
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with your iOS app data stream ID
+    #  (e.g. "123456") before running the sample.
+    stream_id = "YOUR-IOS-APP-DATA-STREAM-ID"
+
+    get_ios_app_data_stream(property_id, stream_id)
+
+
+def get_ios_app_data_stream(property_id, stream_id):
+    """Retrieves the details for the iOS app data stream."""
+    client = AnalyticsAdminServiceClient()
+    ios_app_data_stream = client.get_ios_app_data_stream(
+        name=f"properties/{property_id}/iosAppDataStreams/{stream_id}"
+    )
+
+    print("Result:")
+    print_ios_app_data_stream(ios_app_data_stream)
+
+
+def print_ios_app_data_stream(ios_app_data_stream):
+    """Prints the iOS app data stream details."""
+    print(f"Resource name: {ios_app_data_stream.name}")
+    print(f"Display name: {ios_app_data_stream.display_name}")
+    print(f"Firebase app ID: {ios_app_data_stream.firebase_app_id}")
+    print(f"Bundle ID: {ios_app_data_stream.bundleId}")
+    print(f"Create time: {ios_app_data_stream.create_time}")
+    print(f"Update time: {ios_app_data_stream.update_time}")
+
+
+# [END analyticsadmin_properties_ios_app_data_streams_get]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_ios_app_data_streams_get_test.py b/google-analytics-admin/properties_ios_app_data_streams_get_test.py
new file mode 100644
index 0000000..6eb8109
--- /dev/null
+++ b/google-analytics-admin/properties_ios_app_data_streams_get_test.py
@@ -0,0 +1,28 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import os
+
+import properties_ios_app_data_streams_get
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+TEST_IOS_APP_DATA_STREAM_ID = os.getenv("GA_TEST_IOS_APP_DATA_STREAM_ID")
+
+
+def test_properties_ios_app_data_streams_get(capsys):
+    properties_ios_app_data_streams_get.get_ios_app_data_stream(
+        TEST_PROPERTY_ID, TEST_IOS_APP_DATA_STREAM_ID
+    )
+    out, _ = capsys.readouterr()
+    assert "Result" in out
diff --git a/google-analytics-admin/properties_ios_app_data_streams_list.py b/google-analytics-admin/properties_ios_app_data_streams_list.py
new file mode 100644
index 0000000..4260802
--- /dev/null
+++ b/google-analytics-admin/properties_ios_app_data_streams_list.py
@@ -0,0 +1,51 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which prints iOS app data
+streams for the Google Analytics 4 property.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.iosAppDataStreams/list
+for more information.
+"""
+# [START analyticsadmin_properties_ios_app_data_streams_list]
+from google.analytics.admin import AnalyticsAdminServiceClient
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    list_ios_app_data_streams(property_id)
+
+
+def list_ios_app_data_streams(property_id):
+    """Lists iOS app data streams for the Google Analytics 4 property."""
+    client = AnalyticsAdminServiceClient()
+    results = client.list_ios_app_data_streams(parent=f"properties/{property_id}")
+
+    print("Result:")
+    for ios_app_data_stream in results:
+        print(ios_app_data_stream)
+        print()
+
+
+# [END analyticsadmin_properties_ios_app_data_streams_list]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_ios_app_data_streams_list_test.py b/google-analytics-admin/properties_ios_app_data_streams_list_test.py
new file mode 100644
index 0000000..449520c
--- /dev/null
+++ b/google-analytics-admin/properties_ios_app_data_streams_list_test.py
@@ -0,0 +1,25 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import os
+
+import properties_ios_app_data_streams_list
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+
+
+def test_properties_ios_app_data_streams_list(capsys):
+    properties_ios_app_data_streams_list.list_ios_app_data_streams(TEST_PROPERTY_ID)
+    out, _ = capsys.readouterr()
+    assert "Result" in out
diff --git a/google-analytics-admin/properties_ios_app_data_streams_update.py b/google-analytics-admin/properties_ios_app_data_streams_update.py
new file mode 100644
index 0000000..4612651
--- /dev/null
+++ b/google-analytics-admin/properties_ios_app_data_streams_update.py
@@ -0,0 +1,71 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which updates the iOS app data
+stream.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.iosAppDataStreams/update
+for more information.
+"""
+# [START analyticsadmin_properties_ios_app_data_streams_update]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha.types import IosAppDataStream
+from google.protobuf.field_mask_pb2 import FieldMask
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics property ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with your iOS app data stream ID
+    #  (e.g. "123456") before running the sample.
+    stream_id = "YOUR-IOS-APP-DATA-STREAM-ID"
+
+    update_ios_app_data_stream(property_id, stream_id)
+
+
+def update_ios_app_data_stream(property_id, stream_id):
+    """Updates the iOS app data stream."""
+    client = AnalyticsAdminServiceClient()
+    # This call updates the display name of the iOS app data stream, as
+    # indicated by the value of the `update_mask` field. The iOS app data
+    # stream to update is specified in the `name` field of the
+    # `IosAppDataStream` instance.
+    ios_app_data_stream = client.update_ios_app_data_stream(
+        ios_app_data_stream=IosAppDataStream(
+            name=f"properties/{property_id}/iosAppDataStreams/{stream_id}",
+            display_name="This is an updated test iOS app data stream",
+        ),
+        update_mask=FieldMask(paths=["display_name"]),
+    )
+
+    print("Result:")
+    print(ios_app_data_stream)
+
+
+# [END analyticsadmin_properties_ios_app_data_streams_update]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_ios_app_data_streams_update_test.py b/google-analytics-admin/properties_ios_app_data_streams_update_test.py
new file mode 100644
index 0000000..8c0843e
--- /dev/null
+++ b/google-analytics-admin/properties_ios_app_data_streams_update_test.py
@@ -0,0 +1,30 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import properties_ios_app_data_streams_update
+
+
+FAKE_PROPERTY_ID = "1"
+FAKE_STREAM_ID = "1"
+
+
+def test_properties_ios_app_data_streams_update():
+    # This test ensures that the call is valid and reaches the server, even
+    # though the operation does not succeed due to permission error.
+    with pytest.raises(Exception, match="403 The caller does not have permission"):
+        properties_ios_app_data_streams_update.update_ios_app_data_stream(
+            FAKE_PROPERTY_ID, FAKE_STREAM_ID
+        )
diff --git a/google-analytics-admin/properties_web_data_streams_create.py b/google-analytics-admin/properties_web_data_streams_create.py
new file mode 100644
index 0000000..17f8085
--- /dev/null
+++ b/google-analytics-admin/properties_web_data_streams_create.py
@@ -0,0 +1,60 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which creates a web data stream
+for the Google Analytics 4 property.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.webDataStreams/create
+for more information.
+"""
+# [START analyticsadmin_properties_web_data_streams_create]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha.types import WebDataStream
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics account ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+    create_web_data_stream(property_id)
+
+
+def create_web_data_stream(property_id):
+    """Creates a web data stream for the Google Analytics 4 property."""
+    client = AnalyticsAdminServiceClient()
+    web_data_stream = client.create_web_data_stream(
+        parent=f"properties/{property_id}",
+        web_data_stream=WebDataStream(
+            default_uri="https://www.google.com", display_name="Test web data stream"
+        ),
+    )
+
+    print("Result:")
+    print(web_data_stream)
+
+
+# [END analyticsadmin_properties_web_data_streams_create]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_web_data_streams_create_test.py b/google-analytics-admin/properties_web_data_streams_create_test.py
new file mode 100644
index 0000000..e79281c
--- /dev/null
+++ b/google-analytics-admin/properties_web_data_streams_create_test.py
@@ -0,0 +1,26 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import properties_web_data_streams_create
+
+FAKE_PROPERTY_ID = "1"
+
+
+def test_properties_web_data_streams_create():
+    # This test ensures that the call is valid and reaches the server, even
+    # though the operation does not succeed due to permission error.
+    with pytest.raises(Exception, match="403 The caller does not have permission"):
+        properties_web_data_streams_create.create_web_data_stream(FAKE_PROPERTY_ID)
diff --git a/google-analytics-admin/properties_web_data_streams_delete.py b/google-analytics-admin/properties_web_data_streams_delete.py
new file mode 100644
index 0000000..5c3da2f
--- /dev/null
+++ b/google-analytics-admin/properties_web_data_streams_delete.py
@@ -0,0 +1,59 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which deletes the web data
+stream from the Google Analytics 4 property.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.webDataStreams/delete
+for more information.
+"""
+# [START analyticsadmin_properties_web_data_streams_delete]
+from google.analytics.admin import AnalyticsAdminServiceClient
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics property ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with your web data stream ID
+    #  (e.g. "123456") before running the sample.
+    stream_id = "YOUR-WEB-DATA-STREAM-ID"
+
+    delete_web_data_stream(property_id, stream_id)
+
+
+def delete_web_data_stream(property_id, stream_id):
+    """Deletes the web data stream from the Google Analytics 4 property."""
+    client = AnalyticsAdminServiceClient()
+    client.delete_web_data_stream(
+        name=f"properties/{property_id}/webDataStreams/{stream_id}"
+    )
+    print("Web data stream deleted")
+
+
+# [END analyticsadmin_properties_web_data_streams_delete]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_web_data_streams_delete_test.py b/google-analytics-admin/properties_web_data_streams_delete_test.py
new file mode 100644
index 0000000..6e4276b
--- /dev/null
+++ b/google-analytics-admin/properties_web_data_streams_delete_test.py
@@ -0,0 +1,29 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import properties_web_data_streams_delete
+
+FAKE_PROPERTY_ID = "1"
+FAKE_STREAM_ID = "1"
+
+
+def test_properties_web_data_streams_delete():
+    # This test ensures that the call is valid and reaches the server, even
+    # though the operation does not succeed due to permission error.
+    with pytest.raises(Exception, match="403 The caller does not have permission"):
+        properties_web_data_streams_delete.delete_web_data_stream(
+            FAKE_PROPERTY_ID, FAKE_STREAM_ID
+        )
diff --git a/google-analytics-admin/properties_web_data_streams_get.py b/google-analytics-admin/properties_web_data_streams_get.py
new file mode 100644
index 0000000..27b9779
--- /dev/null
+++ b/google-analytics-admin/properties_web_data_streams_get.py
@@ -0,0 +1,66 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which prints the details for
+the web data stream.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.webDataStreams/get
+for more information.
+"""
+# [START analyticsadmin_properties_web_data_streams_get]
+from google.analytics.admin import AnalyticsAdminServiceClient
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with your web data stream ID
+    #  (e.g. "123456") before running the sample.
+    stream_id = "YOUR-WEB-DATA-STREAM-ID"
+
+    get_web_data_stream(property_id, stream_id)
+
+
+def get_web_data_stream(property_id, stream_id):
+    """Retrieves the details for the web data stream."""
+    client = AnalyticsAdminServiceClient()
+    web_data_stream = client.get_web_data_stream(
+        name=f"properties/{property_id}/webDataStreams/{stream_id}"
+    )
+
+    print("Result:")
+    print_web_data_stream(web_data_stream)
+
+
+def print_web_data_stream(web_data_stream):
+    """Prints the web data stream details."""
+    print(f"Resource name: {web_data_stream.name}")
+    print(f"Display name: {web_data_stream.display_name}")
+    print(f"Default URI: {web_data_stream.default_uri}")
+    print(f"Measurement ID: {web_data_stream.measurement_id}")
+    print(f"Firebase App ID: {web_data_stream.firebase_app_id}")
+    print(f"Create time: {web_data_stream.create_time}")
+    print(f"Update time: {web_data_stream.update_time}")
+
+
+# [END analyticsadmin_properties_web_data_streams_get]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_web_data_streams_get_enhanced_measurement_settings.py b/google-analytics-admin/properties_web_data_streams_get_enhanced_measurement_settings.py
new file mode 100644
index 0000000..65d7225
--- /dev/null
+++ b/google-analytics-admin/properties_web_data_streams_get_enhanced_measurement_settings.py
@@ -0,0 +1,79 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which prints the enhanced
+measurement settings for the web stream.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.webDataStreams/getEnhancedMeasurementSettings
+for more information.
+"""
+# [START analyticsadmin_properties_web_data_streams_get_enhanced_measurement_settings]
+from google.analytics.admin import AnalyticsAdminServiceClient
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with your web data stream ID
+    #  (e.g. "123456") before running the sample.
+    stream_id = "YOUR-WEB-DATA-STREAM-ID"
+
+    get_enhanced_measurement_settings(property_id, stream_id)
+
+
+def get_enhanced_measurement_settings(property_id, stream_id):
+    """Retrieves the enhanced measurement settings for the web stream."""
+    client = AnalyticsAdminServiceClient()
+    enhanced_measurement_settings = client.get_enhanced_measurement_settings(
+        name=f"properties/{property_id}/webDataStreams/{stream_id}/enhancedMeasurementSettings"
+    )
+
+    print("Result:")
+    print_enhanced_measurement_settings(enhanced_measurement_settings)
+
+
+def print_enhanced_measurement_settings(enhanced_measurement_settings):
+    """Prints the enhanced measurement settings for a web stream."""
+    print(f"Resource name: {enhanced_measurement_settings.name}")
+    print(f"Stream enabled: {enhanced_measurement_settings.streamEnabled}")
+    print(f"Page views enabled: {enhanced_measurement_settings.pageViewsEnabled}")
+    print(f"Scrolls enabled: {enhanced_measurement_settings.scrollsEnabled}")
+    print(
+        f"Outbound clicks enabled: {enhanced_measurement_settings.outboundClicksEnabled}"
+    )
+    print(f"Site search enabled: {enhanced_measurement_settings.siteSearchEnabled}")
+    print(
+        f"Video engagement enabled: {enhanced_measurement_settings.videoEngagementEnabled}"
+    )
+    print(
+        f"File downloads enabled: {enhanced_measurement_settings.fileDownloadsEnabled}"
+    )
+    print(f"Page loads enabled: {enhanced_measurement_settings.pageLoadsEnabled}")
+    print(f"Page changes enabled: {enhanced_measurement_settings.pageChangesEnabled}")
+    print(
+        f"Search query parameter: {enhanced_measurement_settings.searchQueryParameter}"
+    )
+    print(f"Uri query parameter: {enhanced_measurement_settings.uriQueryParameter}")
+
+
+# [END analyticsadmin_properties_web_data_streams_get_enhanced_measurement_settings]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_web_data_streams_get_enhanced_measurement_settings_test.py b/google-analytics-admin/properties_web_data_streams_get_enhanced_measurement_settings_test.py
new file mode 100644
index 0000000..34d7ccd
--- /dev/null
+++ b/google-analytics-admin/properties_web_data_streams_get_enhanced_measurement_settings_test.py
@@ -0,0 +1,29 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import os
+
+import properties_web_data_streams_get_enhanced_measurement_settings
+
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+TEST_WEB_DATA_STREAM_ID = os.getenv("GA_TEST_WEB_DATA_STREAM_ID")
+
+
+def test_properties_web_data_streams_get_enhanced_measurement_settings(capsys):
+    properties_web_data_streams_get_enhanced_measurement_settings.get_enhanced_measurement_settings(
+        TEST_PROPERTY_ID, TEST_WEB_DATA_STREAM_ID
+    )
+    out, _ = capsys.readouterr()
+    assert "Result" in out
diff --git a/google-analytics-admin/properties_web_data_streams_get_global_site_tag.py b/google-analytics-admin/properties_web_data_streams_get_global_site_tag.py
new file mode 100644
index 0000000..7534b2c
--- /dev/null
+++ b/google-analytics-admin/properties_web_data_streams_get_global_site_tag.py
@@ -0,0 +1,55 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which prints the Site Tag data
+for the specified web stream.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.webDataStreams/getGlobalSiteTag
+for more information.
+"""
+# [START analyticsadmin_properties_web_data_streams_get_global_site_tag]
+from google.analytics.admin import AnalyticsAdminServiceClient
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with your web data stream ID
+    #  (e.g. "123456") before running the sample.
+    stream_id = "YOUR-WEB-DATA-STREAM-ID"
+
+    get_global_site_tag(property_id, stream_id)
+
+
+def get_global_site_tag(property_id, stream_id):
+    """Retrieves the Site Tag for the specified web stream."""
+    client = AnalyticsAdminServiceClient()
+    global_site_tag = client.get_global_site_tag(
+        name=f"properties/{property_id}/webDataStreams/{stream_id}/globalSiteTag"
+    )
+
+    print("Result:")
+    print(global_site_tag.snippet)
+
+
+# [END analyticsadmin_properties_web_data_streams_get_global_site_tag]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_web_data_streams_get_global_site_tag_test.py b/google-analytics-admin/properties_web_data_streams_get_global_site_tag_test.py
new file mode 100644
index 0000000..b38a413
--- /dev/null
+++ b/google-analytics-admin/properties_web_data_streams_get_global_site_tag_test.py
@@ -0,0 +1,29 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import os
+
+import properties_web_data_streams_get_global_site_tag
+
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+TEST_WEB_DATA_STREAM_ID = os.getenv("GA_TEST_WEB_DATA_STREAM_ID")
+
+
+def test_properties_web_data_streams_get_global_site_tag(capsys):
+    properties_web_data_streams_get_global_site_tag.get_global_site_tag(
+        TEST_PROPERTY_ID, TEST_WEB_DATA_STREAM_ID
+    )
+    out, _ = capsys.readouterr()
+    assert "Result" in out
diff --git a/google-analytics-admin/properties_web_data_streams_get_test.py b/google-analytics-admin/properties_web_data_streams_get_test.py
new file mode 100644
index 0000000..c03c3be
--- /dev/null
+++ b/google-analytics-admin/properties_web_data_streams_get_test.py
@@ -0,0 +1,29 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import os
+
+import properties_web_data_streams_get
+
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+TEST_WEB_DATA_STREAM_ID = os.getenv("GA_TEST_WEB_DATA_STREAM_ID")
+
+
+def test_properties_android_app_data_streams_get(capsys):
+    properties_web_data_streams_get.get_web_data_stream(
+        TEST_PROPERTY_ID, TEST_WEB_DATA_STREAM_ID
+    )
+    out, _ = capsys.readouterr()
+    assert "Result" in out
diff --git a/google-analytics-admin/properties_web_data_streams_list.py b/google-analytics-admin/properties_web_data_streams_list.py
new file mode 100644
index 0000000..5ef657a
--- /dev/null
+++ b/google-analytics-admin/properties_web_data_streams_list.py
@@ -0,0 +1,51 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which prints web data streams
+for the Google Analytics 4 property.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.webDataStreams/list
+for more information.
+"""
+# [START analyticsadmin_properties_web_data_streams_list]
+from google.analytics.admin import AnalyticsAdminServiceClient
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    list_web_data_streams(property_id)
+
+
+def list_web_data_streams(property_id):
+    """Lists web data streams for the Google Analytics 4 property."""
+    client = AnalyticsAdminServiceClient()
+    results = client.list_web_data_streams(parent=f"properties/{property_id}")
+
+    print("Result:")
+    for web_data_stream in results:
+        print(web_data_stream)
+        print()
+
+
+# [END analyticsadmin_properties_web_data_streams_list]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_web_data_streams_list_test.py b/google-analytics-admin/properties_web_data_streams_list_test.py
new file mode 100644
index 0000000..e757c68
--- /dev/null
+++ b/google-analytics-admin/properties_web_data_streams_list_test.py
@@ -0,0 +1,25 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import os
+
+import properties_web_data_streams_list
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+
+
+def test_properties_web_data_streams_list(capsys):
+    properties_web_data_streams_list.list_web_data_streams(TEST_PROPERTY_ID)
+    out, _ = capsys.readouterr()
+    assert "Result" in out
diff --git a/google-analytics-admin/properties_web_data_streams_update.py b/google-analytics-admin/properties_web_data_streams_update.py
new file mode 100644
index 0000000..a26635d
--- /dev/null
+++ b/google-analytics-admin/properties_web_data_streams_update.py
@@ -0,0 +1,70 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which updates the web data
+stream.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.webDataStreams/update
+for more information.
+"""
+# [START analyticsadmin_properties_web_data_streams_update]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha.types import WebDataStream
+from google.protobuf.field_mask_pb2 import FieldMask
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics property ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with your web data stream ID
+    #  (e.g. "123456") before running the sample.
+    stream_id = "YOUR-WEB-DATA-STREAM-ID"
+
+    update_web_data_stream(property_id, stream_id)
+
+
+def update_web_data_stream(property_id, stream_id):
+    """Updates the web data stream."""
+    client = AnalyticsAdminServiceClient()
+    # This call updates the display name of the web data stream, as indicated by
+    # the value of the `update_mask` field. The web data stream to update is
+    # specified in the `name` field of the `WebDataStream` instance.
+    web_data_stream = client.update_web_data_stream(
+        web_data_stream=WebDataStream(
+            name=f"properties/{property_id}/webDataStreams/{stream_id}",
+            display_name="This is an updated test web data stream",
+        ),
+        update_mask=FieldMask(paths=["display_name"]),
+    )
+
+    print("Result:")
+    print(web_data_stream)
+
+
+# [END analyticsadmin_properties_web_data_streams_update]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_web_data_streams_update_enhanced_measurement_settings.py b/google-analytics-admin/properties_web_data_streams_update_enhanced_measurement_settings.py
new file mode 100644
index 0000000..f02e1fb
--- /dev/null
+++ b/google-analytics-admin/properties_web_data_streams_update_enhanced_measurement_settings.py
@@ -0,0 +1,73 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which updates the enhanced
+measurement settings for the web stream.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.webDataStreams/updateEnhancedMeasurementSettings
+for more information.
+"""
+# [START analyticsadmin_properties_web_data_streams_update_enhanced_measurement_settings]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha.types import EnhancedMeasurementSettings
+from google.protobuf.field_mask_pb2 import FieldMask
+
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics property ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with your web data stream ID
+    #  (e.g. "123456") before running the sample.
+    stream_id = "YOUR-WEB-DATA-STREAM-ID"
+
+    update_enhanced_measurement_settings(property_id, stream_id)
+
+
+def update_enhanced_measurement_settings(property_id, stream_id):
+    """Updates the enhanced measurement settings for the web stream."""
+    client = AnalyticsAdminServiceClient()
+    # This call updates the `streamEnabled`, `fileDownloadsEnabled` measurement
+    # settings of the web data stream, as indicated by the value of the
+    # `update_mask` field. The web data stream to update is specified in the
+    # `name` field of the `EnhancedMeasurementSettings` instance.
+    enhanced_measurement_settings = client.update_enhanced_measurement_settings(
+        enhanced_measurement_settings=EnhancedMeasurementSettings(
+            name=f"properties/{property_id}/webDataStreams/{stream_id}/enhancedMeasurementSettings",
+            stream_enabled=False,
+            file_downloads_enabled=False,
+        ),
+        update_mask=FieldMask(paths=["stream_enabled", "file_downloads_enabled"]),
+    )
+
+    print("Result:")
+    print(enhanced_measurement_settings)
+
+
+# [END analyticsadmin_properties_web_data_streams_update_enhanced_measurement_settings]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_web_data_streams_update_enhanced_measurement_settings_test.py b/google-analytics-admin/properties_web_data_streams_update_enhanced_measurement_settings_test.py
new file mode 100644
index 0000000..d692a0e
--- /dev/null
+++ b/google-analytics-admin/properties_web_data_streams_update_enhanced_measurement_settings_test.py
@@ -0,0 +1,30 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import properties_web_data_streams_update_enhanced_measurement_settings
+
+
+FAKE_PROPERTY_ID = "1"
+FAKE_STREAM_ID = "1"
+
+
+def test_properties_web_data_streams_update():
+    # This test ensures that the call is valid and reaches the server, even
+    # though the operation does not succeed due to permission error.
+    with pytest.raises(Exception, match="403 The caller does not have permission"):
+        properties_web_data_streams_update_enhanced_measurement_settings.update_enhanced_measurement_settings(
+            FAKE_PROPERTY_ID, FAKE_STREAM_ID
+        )
diff --git a/google-analytics-admin/properties_web_data_streams_update_test.py b/google-analytics-admin/properties_web_data_streams_update_test.py
new file mode 100644
index 0000000..03f06a7
--- /dev/null
+++ b/google-analytics-admin/properties_web_data_streams_update_test.py
@@ -0,0 +1,30 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import properties_web_data_streams_update
+
+
+FAKE_PROPERTY_ID = "1"
+FAKE_STREAM_ID = "1"
+
+
+def test_properties_web_data_streams_update():
+    # This test ensures that the call is valid and reaches the server, even
+    # though the operation does not succeed due to permission error.
+    with pytest.raises(Exception, match="403 The caller does not have permission"):
+        properties_web_data_streams_update.update_web_data_stream(
+            FAKE_PROPERTY_ID, FAKE_STREAM_ID
+        )

From 3fdffcf142e2691adcce510500daa743984f33e9 Mon Sep 17 00:00:00 2001
From: ikuleshov <ikuleshov@google.com>
Date: Thu, 27 May 2021 16:50:05 -0700
Subject: [PATCH 017/213] docs: add Admin API samples for account management
 methods (#65)

* docs: add Admin API samples for account management methods

* update copyright and remove redundant run_sample method

* update noxfile template and set enforce_type_hints=False

* add type annotations

* docs: add Admin API samples for account user link management methods

* fix the copyright string, avoid importing functions from other samples
---
 .../accounts_user_links_audit.py              | 59 ++++++++++++++
 .../accounts_user_links_audit_test.py         | 26 ++++++
 .../accounts_user_links_batch_create.py       | 77 ++++++++++++++++++
 .../accounts_user_links_batch_create_test.py  | 32 ++++++++
 .../accounts_user_links_batch_delete.py       | 68 ++++++++++++++++
 .../accounts_user_links_batch_delete_test.py  | 30 +++++++
 .../accounts_user_links_batch_get.py          | 61 ++++++++++++++
 .../accounts_user_links_batch_get_test.py     | 28 +++++++
 .../accounts_user_links_batch_update.py       | 79 +++++++++++++++++++
 .../accounts_user_links_batch_update_test.py  | 30 +++++++
 .../accounts_user_links_create.py             | 69 ++++++++++++++++
 .../accounts_user_links_create_test.py        | 32 ++++++++
 .../accounts_user_links_delete.py             | 62 +++++++++++++++
 .../accounts_user_links_delete_test.py        | 30 +++++++
 .../accounts_user_links_get.py                | 63 +++++++++++++++
 .../accounts_user_links_get_test.py           | 26 ++++++
 .../accounts_user_links_list.py               | 50 ++++++++++++
 .../accounts_user_links_list_test.py          | 25 ++++++
 .../accounts_user_links_update.py             | 68 ++++++++++++++++
 .../accounts_user_links_update_test.py        | 30 +++++++
 20 files changed, 945 insertions(+)
 create mode 100644 google-analytics-admin/accounts_user_links_audit.py
 create mode 100644 google-analytics-admin/accounts_user_links_audit_test.py
 create mode 100644 google-analytics-admin/accounts_user_links_batch_create.py
 create mode 100644 google-analytics-admin/accounts_user_links_batch_create_test.py
 create mode 100644 google-analytics-admin/accounts_user_links_batch_delete.py
 create mode 100644 google-analytics-admin/accounts_user_links_batch_delete_test.py
 create mode 100644 google-analytics-admin/accounts_user_links_batch_get.py
 create mode 100644 google-analytics-admin/accounts_user_links_batch_get_test.py
 create mode 100644 google-analytics-admin/accounts_user_links_batch_update.py
 create mode 100644 google-analytics-admin/accounts_user_links_batch_update_test.py
 create mode 100644 google-analytics-admin/accounts_user_links_create.py
 create mode 100644 google-analytics-admin/accounts_user_links_create_test.py
 create mode 100644 google-analytics-admin/accounts_user_links_delete.py
 create mode 100644 google-analytics-admin/accounts_user_links_delete_test.py
 create mode 100644 google-analytics-admin/accounts_user_links_get.py
 create mode 100644 google-analytics-admin/accounts_user_links_get_test.py
 create mode 100644 google-analytics-admin/accounts_user_links_list.py
 create mode 100644 google-analytics-admin/accounts_user_links_list_test.py
 create mode 100644 google-analytics-admin/accounts_user_links_update.py
 create mode 100644 google-analytics-admin/accounts_user_links_update_test.py

diff --git a/google-analytics-admin/accounts_user_links_audit.py b/google-analytics-admin/accounts_user_links_audit.py
new file mode 100644
index 0000000..106906a
--- /dev/null
+++ b/google-analytics-admin/accounts_user_links_audit.py
@@ -0,0 +1,59 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which prints all user links on
+an account.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts.userLinks/audit
+for more information.
+"""
+# [START analyticsadmin_accounts_user_links_audit]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha.types import AuditUserLinksRequest
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account ID (e.g. "123456") before running the sample.
+    account_id = "YOUR-GA-ACCOUNT-ID"
+    audit_account_user_links(account_id)
+
+
+def audit_account_user_links(account_id):
+    """Lists all user links on an account, including implicit ones that come
+    from effective permissions granted by groups or organization admin roles."""
+    client = AnalyticsAdminServiceClient()
+
+    print("Result:")
+    for user_link in client.audit_user_links(
+        AuditUserLinksRequest(parent=f"accounts/{account_id}")
+    ):
+        print(f"Resource name: {user_link.name}")
+        print(f"Email address: {user_link.email_address}")
+        for direct_role in user_link.direct_roles:
+            print(f"Direct role: {direct_role}")
+
+        for effective_role in user_link.effective_roles:
+            print(f"Effective role: {effective_role}")
+        print()
+
+
+# [END analyticsadmin_accounts_user_links_audit]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/accounts_user_links_audit_test.py b/google-analytics-admin/accounts_user_links_audit_test.py
new file mode 100644
index 0000000..d717c6c
--- /dev/null
+++ b/google-analytics-admin/accounts_user_links_audit_test.py
@@ -0,0 +1,26 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import os
+
+import accounts_user_links_audit
+
+
+TEST_ACCOUNT_ID = os.getenv("GA_TEST_ACCOUNT_ID")
+
+
+def test_accounts_user_links_audit(capsys):
+    accounts_user_links_audit.audit_account_user_links(TEST_ACCOUNT_ID)
+    out, _ = capsys.readouterr()
+    assert "Result" in out
diff --git a/google-analytics-admin/accounts_user_links_batch_create.py b/google-analytics-admin/accounts_user_links_batch_create.py
new file mode 100644
index 0000000..56d619e
--- /dev/null
+++ b/google-analytics-admin/accounts_user_links_batch_create.py
@@ -0,0 +1,77 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which creates a user link for
+the account using a batch call.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts.userLinks/batchCreate
+for more information.
+"""
+# [START analyticsadmin_accounts_user_links_batch_create]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha.types import BatchCreateUserLinksRequest
+from google.analytics.admin_v1alpha.types import CreateUserLinkRequest
+from google.analytics.admin_v1alpha.types import UserLink
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics account ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account ID (e.g. "123456") before running the sample.
+    account_id = "YOUR-GA-ACCOUNT-ID"
+
+    # TODO(developer): Replace this variable with an email address of the user to
+    #  link. This user will be given access to your account after running the
+    #  sample.
+    email_address = "TEST-EMAIL-ADDRESS"
+
+    batch_create_account_user_link(account_id, email_address)
+
+
+def batch_create_account_user_link(account_id, email_address):
+    """Creates a user link for the account using a batch call."""
+    client = AnalyticsAdminServiceClient()
+    response = client.batch_create_user_links(
+        BatchCreateUserLinksRequest(
+            parent=f"accounts/{account_id}",
+            requests=[
+                CreateUserLinkRequest(
+                    user_link=UserLink(
+                        email_address=email_address,
+                        direct_roles=["predefinedRoles/read"],
+                    )
+                )
+            ],
+            notify_new_users=True,
+        )
+    )
+
+    print("Result:")
+    for user_link in response.user_links:
+        print(user_link)
+        print()
+
+
+# [END analyticsadmin_accounts_user_links_batch_create]
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/accounts_user_links_batch_create_test.py b/google-analytics-admin/accounts_user_links_batch_create_test.py
new file mode 100644
index 0000000..5141c17
--- /dev/null
+++ b/google-analytics-admin/accounts_user_links_batch_create_test.py
@@ -0,0 +1,32 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import os
+
+import pytest
+
+import accounts_user_links_batch_create
+
+
+FAKE_ACCOUNT_ID = "1"
+TEST_EMAIL_ADDRESS = os.getenv("GA_TEST_EMAIL_ADDRESS")
+
+
+def test_accounts_user_links_batch_create():
+    # This test ensures that the call is valid and reaches the server, even
+    # though the operation does not succeed due to permission error.
+    with pytest.raises(Exception, match="403 The caller does not have permission"):
+        accounts_user_links_batch_create.batch_create_account_user_link(
+            FAKE_ACCOUNT_ID, TEST_EMAIL_ADDRESS
+        )
diff --git a/google-analytics-admin/accounts_user_links_batch_delete.py b/google-analytics-admin/accounts_user_links_batch_delete.py
new file mode 100644
index 0000000..102ad9e
--- /dev/null
+++ b/google-analytics-admin/accounts_user_links_batch_delete.py
@@ -0,0 +1,68 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which deletes the user link
+using a batch call.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts.userLinks/batchDelete
+for more information.
+"""
+# [START analyticsadmin_accounts_user_links_batch_delete]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha.types import BatchDeleteUserLinksRequest
+from google.analytics.admin_v1alpha.types import DeleteUserLinkRequest
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics property ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account ID (e.g. "123456") before running the sample.
+    account_id = "YOUR-GA-ACCOUNT-ID"
+
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account user link ID (e.g. "123456") before running the sample.
+    account_user_link_id = "YOUR-ACCOUNT-USER-LINK-ID"
+
+    batch_delete_account_user_link(account_id, account_user_link_id)
+
+
+def batch_delete_account_user_link(account_id, account_user_link_id):
+    """Deletes the user link using a batch call."""
+    client = AnalyticsAdminServiceClient()
+    client.batch_delete_user_links(
+        BatchDeleteUserLinksRequest(
+            parent=f"accounts/{account_id}",
+            requests=[
+                DeleteUserLinkRequest(
+                    name=f"accounts/{account_id}/userLinks/{account_user_link_id}"
+                )
+            ],
+        )
+    )
+    print("User link deleted")
+
+
+# [END analyticsadmin_accounts_user_links_batch_delete]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/accounts_user_links_batch_delete_test.py b/google-analytics-admin/accounts_user_links_batch_delete_test.py
new file mode 100644
index 0000000..3b9eac2
--- /dev/null
+++ b/google-analytics-admin/accounts_user_links_batch_delete_test.py
@@ -0,0 +1,30 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import accounts_user_links_batch_delete
+
+
+FAKE_ACCOUNT_ID = "1"
+FAKE_ACCOUNT_USER_LINK_ID = "1"
+
+
+def test_accounts_user_links_batch_delete():
+    # This test ensures that the call is valid and reaches the server, even
+    # though the operation does not succeed due to permission error.
+    with pytest.raises(Exception, match="403 The caller does not have permission"):
+        accounts_user_links_batch_delete.batch_delete_account_user_link(
+            FAKE_ACCOUNT_ID, FAKE_ACCOUNT_USER_LINK_ID
+        )
diff --git a/google-analytics-admin/accounts_user_links_batch_get.py b/google-analytics-admin/accounts_user_links_batch_get.py
new file mode 100644
index 0000000..d5506d3
--- /dev/null
+++ b/google-analytics-admin/accounts_user_links_batch_get.py
@@ -0,0 +1,61 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which prints the details for
+the account user link using a batch call.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts.userLinks/batchGet
+for more information.
+"""
+# [START analyticsadmin_accounts_user_links_batch_get]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha.types import BatchGetUserLinksRequest
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account ID (e.g. "123456") before running the sample.
+    account_id = "YOUR-GA-ACCOUNT-ID"
+
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account user link ID (e.g. "123456") before running the sample.
+    account_user_link_id = "YOUR-ACCOUNT-USER-LINK-ID"
+
+    batch_get_account_user_link(account_id, account_user_link_id)
+
+
+def batch_get_account_user_link(account_id, account_user_link_id):
+    """Retrieves details for the account user link using a batch call."""
+    client = AnalyticsAdminServiceClient()
+    response = client.batch_get_user_links(
+        BatchGetUserLinksRequest(
+            parent=f"accounts/{account_id}",
+            names=[f"accounts/{account_id}/userLinks/{account_user_link_id}"],
+        )
+    )
+
+    print("Result:")
+    for user_link in response.user_links:
+        print(user_link)
+        print()
+
+
+# [END analyticsadmin_accounts_user_links_batch_get]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/accounts_user_links_batch_get_test.py b/google-analytics-admin/accounts_user_links_batch_get_test.py
new file mode 100644
index 0000000..29775cb
--- /dev/null
+++ b/google-analytics-admin/accounts_user_links_batch_get_test.py
@@ -0,0 +1,28 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import os
+
+import accounts_user_links_batch_get
+
+TEST_ACCOUNT_ID = os.getenv("GA_TEST_ACCOUNT_ID")
+TEST_USER_LINK_ID = os.getenv("GA_TEST_USER_LINK_ID")
+
+
+def test_accounts_user_links_batch_get(capsys):
+    accounts_user_links_batch_get.batch_get_account_user_link(
+        TEST_ACCOUNT_ID, TEST_USER_LINK_ID
+    )
+    out, _ = capsys.readouterr()
+    assert "Result" in out
diff --git a/google-analytics-admin/accounts_user_links_batch_update.py b/google-analytics-admin/accounts_user_links_batch_update.py
new file mode 100644
index 0000000..9778a50
--- /dev/null
+++ b/google-analytics-admin/accounts_user_links_batch_update.py
@@ -0,0 +1,79 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which updates the account
+user link using a batch call.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts.userLinks/batchUpdate
+for more information.
+"""
+# [START analyticsadmin_accounts_user_links_batch_update]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha.types import BatchUpdateUserLinksRequest
+from google.analytics.admin_v1alpha.types import UpdateUserLinkRequest
+from google.analytics.admin_v1alpha.types import UserLink
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics property ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account ID (e.g. "123456") before running the sample.
+    account_id = "YOUR-GA-ACCOUNT-ID"
+
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account user link ID (e.g. "123456") before running the sample.
+    account_user_link_id = "YOUR-ACCOUNT-USER-LINK-ID"
+
+    batch_update_account_user_link(account_id, account_user_link_id)
+
+
+def batch_update_account_user_link(account_id, account_user_link_id):
+    """Updates the account user link using a batch call."""
+    client = AnalyticsAdminServiceClient()
+    # This call updates the email address and direct roles of the user link.
+    # The user link to update is specified in the `name` field of the `UserLink`
+    # instance.
+    response = client.batch_update_user_links(
+        BatchUpdateUserLinksRequest(
+            parent=f"accounts/{account_id}",
+            requests=[
+                UpdateUserLinkRequest(
+                    user_link=UserLink(
+                        name=f"accounts/{account_id}/userLinks/{account_user_link_id}",
+                        direct_roles=["predefinedRoles/collaborate"],
+                    ),
+                )
+            ],
+        )
+    )
+
+    print("Result:")
+    for user_link in response.user_links:
+        print(user_link)
+        print()
+
+
+# [END analyticsadmin_accounts_user_links_batch_update]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/accounts_user_links_batch_update_test.py b/google-analytics-admin/accounts_user_links_batch_update_test.py
new file mode 100644
index 0000000..b709c4f
--- /dev/null
+++ b/google-analytics-admin/accounts_user_links_batch_update_test.py
@@ -0,0 +1,30 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import accounts_user_links_batch_update
+
+
+FAKE_ACCOUNT_ID = "1"
+FAKE_ACCOUNT_USER_LINK_ID = "1"
+
+
+def test_accounts_user_links_batch_update():
+    # This test ensures that the call is valid and reaches the server, even
+    # though the operation does not succeed due to permission error.
+    with pytest.raises(Exception, match="403 The caller does not have permission"):
+        accounts_user_links_batch_update.batch_update_account_user_link(
+            FAKE_ACCOUNT_ID, FAKE_ACCOUNT_USER_LINK_ID
+        )
diff --git a/google-analytics-admin/accounts_user_links_create.py b/google-analytics-admin/accounts_user_links_create.py
new file mode 100644
index 0000000..5fe6ac3
--- /dev/null
+++ b/google-analytics-admin/accounts_user_links_create.py
@@ -0,0 +1,69 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which creates a user link
+for the account.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts.userLinks/create
+for more information.
+"""
+# [START analyticsadmin_accounts_user_links_create]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha.types import CreateUserLinkRequest
+from google.analytics.admin_v1alpha.types import UserLink
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics account ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account ID (e.g. "123456") before running the sample.
+    account_id = "YOUR-GA-ACCOUNT-ID"
+
+    # TODO(developer): Replace this variable with an email address of the user to
+    #  link. This user will be given access to your account after running the
+    #  sample.
+    email_address = "TEST-EMAIL-ADDRESS"
+
+    create_account_user_link(account_id, email_address)
+
+
+def create_account_user_link(account_id, email_address):
+    """Creates a user link for the account."""
+    client = AnalyticsAdminServiceClient()
+    user_link = client.create_user_link(
+        CreateUserLinkRequest(
+            parent=f"accounts/{account_id}",
+            user_link=UserLink(
+                email_address=email_address, direct_roles=["predefinedRoles/read"]
+            ),
+            notify_new_user=True,
+        )
+    )
+
+    print("Result:")
+    print(user_link)
+
+
+# [END analyticsadmin_accounts_user_links_create]
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/accounts_user_links_create_test.py b/google-analytics-admin/accounts_user_links_create_test.py
new file mode 100644
index 0000000..13c7212
--- /dev/null
+++ b/google-analytics-admin/accounts_user_links_create_test.py
@@ -0,0 +1,32 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import os
+
+import pytest
+
+import accounts_user_links_create
+
+
+FAKE_ACCOUNT_ID = "1"
+TEST_EMAIL_ADDRESS = os.getenv("GA_TEST_EMAIL_ADDRESS")
+
+
+def test_accounts_user_links_create():
+    # This test ensures that the call is valid and reaches the server, even
+    # though the operation does not succeed due to permission error.
+    with pytest.raises(Exception, match="403 The caller does not have permission"):
+        accounts_user_links_create.create_account_user_link(
+            FAKE_ACCOUNT_ID, TEST_EMAIL_ADDRESS
+        )
diff --git a/google-analytics-admin/accounts_user_links_delete.py b/google-analytics-admin/accounts_user_links_delete.py
new file mode 100644
index 0000000..1263d96
--- /dev/null
+++ b/google-analytics-admin/accounts_user_links_delete.py
@@ -0,0 +1,62 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which deletes the user link
+for the account.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts.userLinks/delete
+for more information.
+"""
+# [START analyticsadmin_accounts_user_links_delete]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha.types import DeleteUserLinkRequest
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics property ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account ID (e.g. "123456") before running the sample.
+    account_id = "YOUR-GA-ACCOUNT-ID"
+
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account user link ID (e.g. "123456") before running the sample.
+    account_user_link_id = "YOUR-ACCOUNT-USER-LINK-ID"
+
+    delete_account_user_link(account_id, account_user_link_id)
+
+
+def delete_account_user_link(account_id, account_user_link_id):
+    """Deletes the user link for the account."""
+    client = AnalyticsAdminServiceClient()
+    client.delete_user_link(
+        DeleteUserLinkRequest(
+            name=f"accounts/{account_id}/userLinks/{account_user_link_id}"
+        )
+    )
+    print("User link deleted")
+
+
+# [END analyticsadmin_accounts_user_links_delete]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/accounts_user_links_delete_test.py b/google-analytics-admin/accounts_user_links_delete_test.py
new file mode 100644
index 0000000..e8bd0a5
--- /dev/null
+++ b/google-analytics-admin/accounts_user_links_delete_test.py
@@ -0,0 +1,30 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import accounts_user_links_delete
+
+
+FAKE_ACCOUNT_ID = "1"
+FAKE_ACCOUNT_USER_LINK_ID = "1"
+
+
+def test_accounts_user_links_delete():
+    # This test ensures that the call is valid and reaches the server, even
+    # though the operation does not succeed due to permission error.
+    with pytest.raises(Exception, match="403 The caller does not have permission"):
+        accounts_user_links_delete.delete_account_user_link(
+            FAKE_ACCOUNT_ID, FAKE_ACCOUNT_USER_LINK_ID
+        )
diff --git a/google-analytics-admin/accounts_user_links_get.py b/google-analytics-admin/accounts_user_links_get.py
new file mode 100644
index 0000000..a9fc8b3
--- /dev/null
+++ b/google-analytics-admin/accounts_user_links_get.py
@@ -0,0 +1,63 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which prints the account user
+link details.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts.userLinks/get
+for more information.
+"""
+# [START analyticsadmin_accounts_user_links_get]
+from google.analytics.admin import AnalyticsAdminServiceClient
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account ID (e.g. "123456") before running the sample.
+    account_id = "YOUR-GA-ACCOUNT-ID"
+
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account user link ID (e.g. "123456") before running the sample.
+    account_user_link_id = "YOUR-ACCOUNT-USER-LINK-ID"
+
+    get_account_user_link(account_id, account_user_link_id)
+
+
+def get_account_user_link(account_id, account_user_link_id):
+    """Retrieves the account user link details."""
+    client = AnalyticsAdminServiceClient()
+    user_link = client.get_user_link(
+        name=f"accounts/{account_id}/userLinks/{account_user_link_id}"
+    )
+
+    print("Result:")
+    print_user_link(user_link)
+
+
+def print_user_link(user_link):
+    """Prints the user link details."""
+    print(f"Resource name: {user_link.name}")
+    print(f"Email address: {user_link.email_address}")
+    for direct_role in user_link.direct_roles:
+        print(f"Direct role: {direct_role}")
+
+
+# [END analyticsadmin_accounts_user_links_get]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/accounts_user_links_get_test.py b/google-analytics-admin/accounts_user_links_get_test.py
new file mode 100644
index 0000000..0e717d3
--- /dev/null
+++ b/google-analytics-admin/accounts_user_links_get_test.py
@@ -0,0 +1,26 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import os
+
+import accounts_user_links_get
+
+TEST_ACCOUNT_ID = os.getenv("GA_TEST_ACCOUNT_ID")
+TEST_USER_LINK_ID = os.getenv("GA_TEST_USER_LINK_ID")
+
+
+def test_accounts_user_links_get(capsys):
+    accounts_user_links_get.get_account_user_link(TEST_ACCOUNT_ID, TEST_USER_LINK_ID)
+    out, _ = capsys.readouterr()
+    assert "Result" in out
diff --git a/google-analytics-admin/accounts_user_links_list.py b/google-analytics-admin/accounts_user_links_list.py
new file mode 100644
index 0000000..f42f8ff
--- /dev/null
+++ b/google-analytics-admin/accounts_user_links_list.py
@@ -0,0 +1,50 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which prints user links
+under the specified parent account.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts.userLinks/list
+for more information.
+"""
+# [START analyticsadmin_accounts_user_links_list]
+from google.analytics.admin import AnalyticsAdminServiceClient
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account ID (e.g. "123456") before running the sample.
+    account_id = "YOUR-GA-ACCOUNT-ID"
+    list_account_user_links(account_id)
+
+
+def list_account_user_links(account_id):
+    """Lists user links under the specified parent account."""
+    client = AnalyticsAdminServiceClient()
+    results = client.list_user_links(parent=f"accounts/{account_id}")
+
+    print("Result:")
+    for user_link in results:
+        print(user_link)
+        print()
+
+
+# [END analyticsadmin_accounts_user_links_list]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/accounts_user_links_list_test.py b/google-analytics-admin/accounts_user_links_list_test.py
new file mode 100644
index 0000000..6eb0806
--- /dev/null
+++ b/google-analytics-admin/accounts_user_links_list_test.py
@@ -0,0 +1,25 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import os
+
+import accounts_user_links_list
+
+TEST_ACCOUNT_ID = os.getenv("GA_TEST_ACCOUNT_ID")
+
+
+def test_accounts_user_links_list(capsys):
+    accounts_user_links_list.list_account_user_links(TEST_ACCOUNT_ID)
+    out, _ = capsys.readouterr()
+    assert "Result" in out
diff --git a/google-analytics-admin/accounts_user_links_update.py b/google-analytics-admin/accounts_user_links_update.py
new file mode 100644
index 0000000..1a9424a
--- /dev/null
+++ b/google-analytics-admin/accounts_user_links_update.py
@@ -0,0 +1,68 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which updates the account
+user link.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts.userLinks/update
+for more information.
+"""
+# [START analyticsadmin_accounts_user_links_update]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha.types import UserLink
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics property ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account ID (e.g. "123456") before running the sample.
+    account_id = "YOUR-GA-ACCOUNT-ID"
+
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account user link ID (e.g. "123456") before running the sample.
+    account_user_link_id = "YOUR-ACCOUNT-USER-LINK-ID"
+
+    update_account_user_link(account_id, account_user_link_id)
+
+
+def update_account_user_link(account_id, account_user_link_id):
+    """Updates the account user link."""
+    client = AnalyticsAdminServiceClient()
+    # This call updates the email address and direct roles of the user link.
+    # The user link to update is specified in the `name` field of the `UserLink`
+    # instance.
+    user_link = client.update_user_link(
+        user_link=UserLink(
+            name=f"accounts/{account_id}/userLinks/{account_user_link_id}",
+            direct_roles=["predefinedRoles/collaborate"],
+        ),
+    )
+
+    print("Result:")
+    print(user_link)
+
+
+# [END analyticsadmin_accounts_user_links_update]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/accounts_user_links_update_test.py b/google-analytics-admin/accounts_user_links_update_test.py
new file mode 100644
index 0000000..a722930
--- /dev/null
+++ b/google-analytics-admin/accounts_user_links_update_test.py
@@ -0,0 +1,30 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import accounts_user_links_update
+
+
+FAKE_ACCOUNT_ID = "1"
+FAKE_ACCOUNT_USER_LINK_ID = "1"
+
+
+def test_accounts_user_links_update():
+    # This test ensures that the call is valid and reaches the server, even
+    # though the operation does not succeed due to permission error.
+    with pytest.raises(Exception, match="403 The caller does not have permission"):
+        accounts_user_links_update.update_account_user_link(
+            FAKE_ACCOUNT_ID, FAKE_ACCOUNT_USER_LINK_ID
+        )

From 6a905ce8e38685d9afe58e42526a2e3144495cd2 Mon Sep 17 00:00:00 2001
From: ikuleshov <ikuleshov@google.com>
Date: Thu, 3 Jun 2021 10:06:44 -0700
Subject: [PATCH 018/213] docs: add samples for Google Analytics property
 management methods (#74)

* docs: add Admin API samples for account management methods

* update copyright and remove redundant run_sample method

* update noxfile template and set enforce_type_hints=False

* add type annotations

* docs: add Admin API samples for account user link management methods

* fix the copyright string, avoid importing functions from other samples

* docs: add samples for Google Analytics property management methods
---
 google-analytics-admin/properties_create.py   | 63 ++++++++++++++++
 .../properties_create_test.py                 | 27 +++++++
 google-analytics-admin/properties_delete.py   | 52 ++++++++++++++
 .../properties_delete_test.py                 | 27 +++++++
 .../properties_firebase_links_create.py       | 65 +++++++++++++++++
 .../properties_firebase_links_create_test.py  | 30 ++++++++
 .../properties_firebase_links_delete.py       | 59 +++++++++++++++
 .../properties_firebase_links_delete_test.py  | 30 ++++++++
 .../properties_firebase_links_list.py         | 63 ++++++++++++++++
 .../properties_firebase_links_list_test.py    | 25 +++++++
 .../properties_firebase_links_update.py       | 71 +++++++++++++++++++
 .../properties_firebase_links_update_test.py  | 30 ++++++++
 google-analytics-admin/properties_get.py      | 66 +++++++++++++++++
 google-analytics-admin/properties_get_test.py | 26 +++++++
 .../properties_google_ads_links_create.py     | 63 ++++++++++++++++
 ...properties_google_ads_links_create_test.py | 30 ++++++++
 .../properties_google_ads_links_delete.py     | 59 +++++++++++++++
 ...properties_google_ads_links_delete_test.py | 30 ++++++++
 .../properties_google_ads_links_list.py       | 62 ++++++++++++++++
 .../properties_google_ads_links_list_test.py  | 25 +++++++
 .../properties_google_ads_links_update.py     | 70 ++++++++++++++++++
 ...properties_google_ads_links_update_test.py | 30 ++++++++
 google-analytics-admin/properties_list.py     | 55 ++++++++++++++
 .../properties_list_test.py                   | 25 +++++++
 google-analytics-admin/properties_update.py   | 67 +++++++++++++++++
 .../properties_update_test.py                 | 27 +++++++
 26 files changed, 1177 insertions(+)
 create mode 100644 google-analytics-admin/properties_create.py
 create mode 100644 google-analytics-admin/properties_create_test.py
 create mode 100644 google-analytics-admin/properties_delete.py
 create mode 100644 google-analytics-admin/properties_delete_test.py
 create mode 100644 google-analytics-admin/properties_firebase_links_create.py
 create mode 100644 google-analytics-admin/properties_firebase_links_create_test.py
 create mode 100644 google-analytics-admin/properties_firebase_links_delete.py
 create mode 100644 google-analytics-admin/properties_firebase_links_delete_test.py
 create mode 100644 google-analytics-admin/properties_firebase_links_list.py
 create mode 100644 google-analytics-admin/properties_firebase_links_list_test.py
 create mode 100644 google-analytics-admin/properties_firebase_links_update.py
 create mode 100644 google-analytics-admin/properties_firebase_links_update_test.py
 create mode 100644 google-analytics-admin/properties_get.py
 create mode 100644 google-analytics-admin/properties_get_test.py
 create mode 100644 google-analytics-admin/properties_google_ads_links_create.py
 create mode 100644 google-analytics-admin/properties_google_ads_links_create_test.py
 create mode 100644 google-analytics-admin/properties_google_ads_links_delete.py
 create mode 100644 google-analytics-admin/properties_google_ads_links_delete_test.py
 create mode 100644 google-analytics-admin/properties_google_ads_links_list.py
 create mode 100644 google-analytics-admin/properties_google_ads_links_list_test.py
 create mode 100644 google-analytics-admin/properties_google_ads_links_update.py
 create mode 100644 google-analytics-admin/properties_google_ads_links_update_test.py
 create mode 100644 google-analytics-admin/properties_list.py
 create mode 100644 google-analytics-admin/properties_list_test.py
 create mode 100644 google-analytics-admin/properties_update.py
 create mode 100644 google-analytics-admin/properties_update_test.py

diff --git a/google-analytics-admin/properties_create.py b/google-analytics-admin/properties_create.py
new file mode 100644
index 0000000..a7bbd79
--- /dev/null
+++ b/google-analytics-admin/properties_create.py
@@ -0,0 +1,63 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which creates a Google
+Analytics 4 property.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties/create
+for more information.
+"""
+# [START analyticsadmin_properties_create]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha.types import Property
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics account ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account ID (e.g. "123456") before running the sample.
+    account_id = "YOUR-GA-ACCOUNT-ID"
+    create_property(account_id)
+
+
+def create_property(account_id):
+    """Creates a Google Analytics 4 property."""
+    client = AnalyticsAdminServiceClient()
+    property_ = client.create_property(
+        property=Property(
+            parent=f"accounts/{account_id}",
+            currency_code="USD",
+            display_name="Test property",
+            industry_category="OTHER",
+            time_zone="America/Los_Angeles",
+        )
+    )
+
+    print("Result:")
+    print(property_)
+
+
+# [END analyticsadmin_properties_create]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_create_test.py b/google-analytics-admin/properties_create_test.py
new file mode 100644
index 0000000..43b0b10
--- /dev/null
+++ b/google-analytics-admin/properties_create_test.py
@@ -0,0 +1,27 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import properties_create
+
+
+FAKE_ACCOUNT_ID = "1"
+
+
+def test_properties_create():
+    # This test ensures that the call is valid and reaches the server, even
+    # though the operation does not succeed due to permission error.
+    with pytest.raises(Exception, match="403 The caller does not have permission"):
+        properties_create.create_property(FAKE_ACCOUNT_ID)
diff --git a/google-analytics-admin/properties_delete.py b/google-analytics-admin/properties_delete.py
new file mode 100644
index 0000000..e6defc6
--- /dev/null
+++ b/google-analytics-admin/properties_delete.py
@@ -0,0 +1,52 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which deletes the Google
+Analytics 4 property.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties/delete
+for more information.
+"""
+# [START analyticsadmin_properties_delete]
+from google.analytics.admin import AnalyticsAdminServiceClient
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics property ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+    delete_property(property_id)
+
+
+def delete_property(property_id):
+    """Deletes the Google Analytics 4 property."""
+    client = AnalyticsAdminServiceClient()
+    client.delete_property(name=f"properties/{property_id}")
+    print("Property deleted")
+
+
+# [END analyticsadmin_properties_delete]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_delete_test.py b/google-analytics-admin/properties_delete_test.py
new file mode 100644
index 0000000..5d3cf74
--- /dev/null
+++ b/google-analytics-admin/properties_delete_test.py
@@ -0,0 +1,27 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import properties_delete
+
+
+FAKE_PROPERTY_ID = "1"
+
+
+def test_properties_delete():
+    # This test ensures that the call is valid and reaches the server, even
+    # though the operation does not succeed due to permission error.
+    with pytest.raises(Exception, match="403 The caller does not have permission"):
+        properties_delete.delete_property(FAKE_PROPERTY_ID)
diff --git a/google-analytics-admin/properties_firebase_links_create.py b/google-analytics-admin/properties_firebase_links_create.py
new file mode 100644
index 0000000..d259612
--- /dev/null
+++ b/google-analytics-admin/properties_firebase_links_create.py
@@ -0,0 +1,65 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which creates a Firebase link
+for the Google Analytics 4 property.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.firebaseLinks/create
+for more information.
+"""
+# [START analyticsadmin_properties_firebase_links_create]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha.types import FirebaseLink
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics account ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with a Firebase project id.
+    #  This project will be linked to the GA4 property.
+    firebase_project_id = "YOUR-FIREBASE-PROJECT-ID"
+
+    create_firebase_link(property_id, firebase_project_id)
+
+
+def create_firebase_link(property_id, firebase_project_id):
+    """Creates a Firebase link for the Google Analytics 4 property."""
+    client = AnalyticsAdminServiceClient()
+    firebase_link = client.create_firebase_link(
+        parent=f"properties/{property_id}",
+        firebase_link=FirebaseLink(
+            project=f"projects/{firebase_project_id}",
+            maximum_user_access="READ_AND_ANALYZE",
+        ),
+    )
+
+    print("Result:")
+    print(firebase_link)
+
+
+# [END analyticsadmin_properties_firebase_links_create]
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_firebase_links_create_test.py b/google-analytics-admin/properties_firebase_links_create_test.py
new file mode 100644
index 0000000..85f468a
--- /dev/null
+++ b/google-analytics-admin/properties_firebase_links_create_test.py
@@ -0,0 +1,30 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import properties_firebase_links_create
+
+
+FAKE_PROPERTY_ID = "1"
+FAKE_FIREBASE_PROJECT_ID = "1"
+
+
+def test_properties_firebase_links_create():
+    # This test ensures that the call is valid and reaches the server, even
+    # though the operation does not succeed due to permission error.
+    with pytest.raises(Exception, match="403 The caller does not have permission"):
+        properties_firebase_links_create.create_firebase_link(
+            FAKE_PROPERTY_ID, FAKE_FIREBASE_PROJECT_ID
+        )
diff --git a/google-analytics-admin/properties_firebase_links_delete.py b/google-analytics-admin/properties_firebase_links_delete.py
new file mode 100644
index 0000000..9ef1edd
--- /dev/null
+++ b/google-analytics-admin/properties_firebase_links_delete.py
@@ -0,0 +1,59 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which deletes the Firebase
+link from the Google Analytics 4 property.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.firebaseLinks/delete
+for more information.
+"""
+# [START analyticsadmin_properties_firebase_links_delete]
+from google.analytics.admin import AnalyticsAdminServiceClient
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics property ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with your Firebase link ID
+    #  (e.g. "123456") before running the sample.
+    firebase_link_id = "YOUR-FIREBASE-LINK-ID"
+
+    delete_firebase_link(property_id, firebase_link_id)
+
+
+def delete_firebase_link(property_id, firebase_link_id):
+    """Deletes the Firebase link."""
+    client = AnalyticsAdminServiceClient()
+    client.delete_firebase_link(
+        name=f"properties/{property_id}/firebaseLinks/{firebase_link_id}"
+    )
+    print("Firebase link deleted")
+
+
+# [END analyticsadmin_properties_firebase_links_delete]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_firebase_links_delete_test.py b/google-analytics-admin/properties_firebase_links_delete_test.py
new file mode 100644
index 0000000..e55860e
--- /dev/null
+++ b/google-analytics-admin/properties_firebase_links_delete_test.py
@@ -0,0 +1,30 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import properties_firebase_links_delete
+
+
+FAKE_PROPERTY_ID = "1"
+FAKE_FIREBASE_LINK_ID = "1"
+
+
+def test_properties_firebase_links_delete():
+    # This test ensures that the call is valid and reaches the server, even
+    # though the operation does not succeed due to permission error.
+    with pytest.raises(Exception, match="403 The caller does not have permission"):
+        properties_firebase_links_delete.delete_firebase_link(
+            FAKE_PROPERTY_ID, FAKE_FIREBASE_LINK_ID
+        )
diff --git a/google-analytics-admin/properties_firebase_links_list.py b/google-analytics-admin/properties_firebase_links_list.py
new file mode 100644
index 0000000..0d5c2f1
--- /dev/null
+++ b/google-analytics-admin/properties_firebase_links_list.py
@@ -0,0 +1,63 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which prints Firebase links
+under the specified parent Google Analytics 4 property.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.firebaseLinks/list
+for more information.
+"""
+# [START analyticsadmin_properties_firebase_links_list]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha.types import MaximumUserAccess
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+    list_firebase_links(property_id)
+
+
+def list_firebase_links(property_id):
+    """Lists Firebase links under the specified parent Google Analytics 4
+    property."""
+    client = AnalyticsAdminServiceClient()
+    results = client.list_firebase_links(parent=f"properties/{property_id}")
+
+    print("Result:")
+    for firebase_link in results:
+        print_firebase_link(firebase_link)
+        print()
+
+
+def print_firebase_link(firebase_link):
+    """Prints the Firebase link details."""
+    print(f"Resource name: {firebase_link.name}")
+    print(f"Firebase project: {firebase_link.project}")
+    print(
+        f"Maximum user access to the GA4 property: "
+        f"{MaximumUserAccess(firebase_link.maximum_user_access).name}"
+    )
+    print(f"Create time: {firebase_link.create_time}")
+
+
+# [END analyticsadmin_properties_firebase_links_list]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_firebase_links_list_test.py b/google-analytics-admin/properties_firebase_links_list_test.py
new file mode 100644
index 0000000..b3e1f0a
--- /dev/null
+++ b/google-analytics-admin/properties_firebase_links_list_test.py
@@ -0,0 +1,25 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import os
+
+import properties_firebase_links_list
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+
+
+def test_properties_firebase_links_list(capsys):
+    properties_firebase_links_list.list_firebase_links(TEST_PROPERTY_ID)
+    out, _ = capsys.readouterr()
+    assert "Result" in out
diff --git a/google-analytics-admin/properties_firebase_links_update.py b/google-analytics-admin/properties_firebase_links_update.py
new file mode 100644
index 0000000..085f74d
--- /dev/null
+++ b/google-analytics-admin/properties_firebase_links_update.py
@@ -0,0 +1,71 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which updates the Firebase
+link on the specified Google Analytics 4 property.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.firebaseLinks/update
+for more information.
+"""
+# [START analyticsadmin_properties_firebase_links_update]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha.types import FirebaseLink
+from google.protobuf.field_mask_pb2 import FieldMask
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics property ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with your Firebase link ID
+    #  (e.g. "123456") before running the sample.
+    firebase_link_id = "YOUR-FIREBASE-LINK-ID"
+
+    update_firebase_link(property_id, firebase_link_id)
+
+
+def update_firebase_link(property_id, firebase_link_id):
+    """Updates the Firebase link."""
+    client = AnalyticsAdminServiceClient()
+    # This call updates the maximum user access to the GA4 property of the
+    # Firebase link as indicated by the value of the `update_mask` field.
+    # The Firebase link to update is specified in the `name` field of the
+    # `FirebaseLink` instance.
+    firebase_link = client.update_firebase_link(
+        firebase_link=FirebaseLink(
+            name=f"properties/{property_id}/firebaseLinks/{firebase_link_id}",
+            maximum_user_access="EDITOR_WITHOUT_LINK_MANAGEMENT",
+        ),
+        update_mask=FieldMask(paths=["maximum_user_access"]),
+    )
+
+    print("Result:")
+    print(firebase_link)
+
+
+# [END analyticsadmin_properties_firebase_links_update]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_firebase_links_update_test.py b/google-analytics-admin/properties_firebase_links_update_test.py
new file mode 100644
index 0000000..dc07fb6
--- /dev/null
+++ b/google-analytics-admin/properties_firebase_links_update_test.py
@@ -0,0 +1,30 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import properties_firebase_links_update
+
+
+FAKE_PROPERTY_ID = "1"
+FAKE_FIREBASE_LINK_ID = "1"
+
+
+def test_properties_firebase_links_update():
+    # This test ensures that the call is valid and reaches the server, even
+    # though the operation does not succeed due to permission error.
+    with pytest.raises(Exception, match="403 The caller does not have permission"):
+        properties_firebase_links_update.update_firebase_link(
+            FAKE_PROPERTY_ID, FAKE_FIREBASE_LINK_ID
+        )
diff --git a/google-analytics-admin/properties_get.py b/google-analytics-admin/properties_get.py
new file mode 100644
index 0000000..e63ec3a
--- /dev/null
+++ b/google-analytics-admin/properties_get.py
@@ -0,0 +1,66 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which print the Google
+Analytics 4 property details.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties/get
+for more information.
+"""
+# [START analyticsadmin_properties_get]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha.types import IndustryCategory
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+    get_property(property_id)
+
+
+def get_property(property_id):
+    """Retrieves the Google Analytics 4 property details."""
+    client = AnalyticsAdminServiceClient()
+    property_ = client.get_property(name=f"properties/{property_id}")
+
+    print("Result:")
+    print_property(property_)
+
+
+def print_property(property):
+    """Prints the Google Analytics 4 property details."""
+    print(f"Resource name: {property.name}")
+    print(f"Parent: {property.parent}")
+    print(f"Display name: {property.display_name}")
+    print(f"Create time: {property.create_time}")
+    print(f"Update time: {property.update_time}")
+    # print(f"Delete time: {property.delete_time}")
+    # print(f"Expire time: {property.expire_time}")
+
+    if property.industry_category:
+        print(f"Industry category: {IndustryCategory(property.industry_category).name}")
+
+    print(f"Time zone: {property.time_zone}")
+    print(f"Currency code: {property.currency_code}")
+
+
+# [END analyticsadmin_properties_get]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_get_test.py b/google-analytics-admin/properties_get_test.py
new file mode 100644
index 0000000..9035055
--- /dev/null
+++ b/google-analytics-admin/properties_get_test.py
@@ -0,0 +1,26 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import os
+
+import properties_get
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+TEST_USER_LINK_ID = os.getenv("GA_USER_LINK_ID")
+
+
+def test_properties_get(capsys):
+    properties_get.get_property(TEST_PROPERTY_ID)
+    out, _ = capsys.readouterr()
+    assert "Result" in out
diff --git a/google-analytics-admin/properties_google_ads_links_create.py b/google-analytics-admin/properties_google_ads_links_create.py
new file mode 100644
index 0000000..443b151
--- /dev/null
+++ b/google-analytics-admin/properties_google_ads_links_create.py
@@ -0,0 +1,63 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which creates a Google Ads
+link for the Google Analytics 4 property.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.googleAdsLinks/create
+for more information.
+"""
+# [START analyticsadmin_properties_google_ads_links_create]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha.types import GoogleAdsLink
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics account ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with a ten-digit Google Ads
+    #  customer ID (digits only, e.g. "1234567890").
+    #  This Google Ads account will be linked to the GA4 property.
+    google_ads_customer_id = "YOUR-GOOGLE-ADS-CUSTOMER-ID"
+
+    create_google_ads_link(property_id, google_ads_customer_id)
+
+
+def create_google_ads_link(property_id, google_ads_customer_id):
+    """Creates a Google Ads link for the Google Analytics 4 property."""
+    client = AnalyticsAdminServiceClient()
+    google_ads_link = client.create_google_ads_link(
+        parent=f"properties/{property_id}",
+        google_ads_link=GoogleAdsLink(customer_id=f"{google_ads_customer_id}"),
+    )
+
+    print("Result:")
+    print(google_ads_link)
+
+
+# [END analyticsadmin_properties_google_ads_links_create]
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_google_ads_links_create_test.py b/google-analytics-admin/properties_google_ads_links_create_test.py
new file mode 100644
index 0000000..07ae5dd
--- /dev/null
+++ b/google-analytics-admin/properties_google_ads_links_create_test.py
@@ -0,0 +1,30 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import properties_google_ads_links_create
+
+
+FAKE_PROPERTY_ID = "1"
+FAKE_ADS_CUSTOMER_ID = "1234567890"
+
+
+def test_properties_google_ads_links_create():
+    # This test ensures that the call is valid and reaches the server, even
+    # though the operation does not succeed due to permission error.
+    with pytest.raises(Exception, match="403 The caller does not have permission"):
+        properties_google_ads_links_create.create_google_ads_link(
+            FAKE_PROPERTY_ID, FAKE_ADS_CUSTOMER_ID
+        )
diff --git a/google-analytics-admin/properties_google_ads_links_delete.py b/google-analytics-admin/properties_google_ads_links_delete.py
new file mode 100644
index 0000000..74dd3ba
--- /dev/null
+++ b/google-analytics-admin/properties_google_ads_links_delete.py
@@ -0,0 +1,59 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application deletes the Google Ads link
+from the specified Google Analytics 4 property.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.googleAdsLinks/delete
+for more information.
+"""
+# [START analyticsadmin_properties_google_ads_links_delete]
+from google.analytics.admin import AnalyticsAdminServiceClient
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics property ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with your Google Analytics Ads
+    #  link ID (e.g. "123456") before running the sample.
+    google_ads_link_id = "YOUR-GOOGLE-ADS-LINK-ID"
+
+    delete_google_ads_link(property_id, google_ads_link_id)
+
+
+def delete_google_ads_link(property_id, google_ads_link_id):
+    """Deletes the Google Ads link."""
+    client = AnalyticsAdminServiceClient()
+    client.delete_google_ads_link(
+        name=f"properties/{property_id}/googleAdsLinks/{google_ads_link_id}"
+    )
+    print("Google Ads link deleted")
+
+
+# [END analyticsadmin_properties_google_ads_links_delete]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_google_ads_links_delete_test.py b/google-analytics-admin/properties_google_ads_links_delete_test.py
new file mode 100644
index 0000000..25c2768
--- /dev/null
+++ b/google-analytics-admin/properties_google_ads_links_delete_test.py
@@ -0,0 +1,30 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import properties_google_ads_links_delete
+
+
+FAKE_PROPERTY_ID = "1"
+FAKE_GOOGLE_ADS_LINK_ID = "1"
+
+
+def test_properties_google_ads_links_delete():
+    # This test ensures that the call is valid and reaches the server, even
+    # though the operation does not succeed due to permission error.
+    with pytest.raises(Exception, match="403 The caller does not have permission"):
+        properties_google_ads_links_delete.delete_google_ads_link(
+            FAKE_PROPERTY_ID, FAKE_GOOGLE_ADS_LINK_ID
+        )
diff --git a/google-analytics-admin/properties_google_ads_links_list.py b/google-analytics-admin/properties_google_ads_links_list.py
new file mode 100644
index 0000000..1aa7e06
--- /dev/null
+++ b/google-analytics-admin/properties_google_ads_links_list.py
@@ -0,0 +1,62 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which prints Google Ads links
+under the specified parent Google Analytics 4 property.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.googleAdsLinks/list
+for more information.
+"""
+# [START analyticsadmin_properties_google_ads_links_list]
+from google.analytics.admin import AnalyticsAdminServiceClient
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+    list_google_ads_links(property_id)
+
+
+def list_google_ads_links(property_id):
+    """Lists Google Ads links under the specified parent Google Analytics 4
+    property."""
+    client = AnalyticsAdminServiceClient()
+    results = client.list_google_ads_links(parent=f"properties/{property_id}")
+
+    print("Result:")
+    for google_ads_link in results:
+        print_google_ads_link(google_ads_link)
+        print()
+
+
+def print_google_ads_link(google_ads_link):
+    """Prints the Google Ads link details."""
+    print(f"Resource name: {google_ads_link.name}")
+    print(f"Google Ads customer ID: {google_ads_link.customer_id}")
+    print(f"Can manage clients: {google_ads_link.can_manage_clients}")
+    print(f"Ads personalization enabled: {google_ads_link.ads_personalization_enabled}")
+    print(f"Email address of the link creator: {google_ads_link.email_address}")
+    print(f"Create time: {google_ads_link.create_time}")
+    print(f"Update time: {google_ads_link.update_time}")
+
+
+# [END analyticsadmin_properties_google_ads_links_list]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_google_ads_links_list_test.py b/google-analytics-admin/properties_google_ads_links_list_test.py
new file mode 100644
index 0000000..1f850a4
--- /dev/null
+++ b/google-analytics-admin/properties_google_ads_links_list_test.py
@@ -0,0 +1,25 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import os
+
+import properties_google_ads_links_list
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+
+
+def test_properties_firebase_links_list(capsys):
+    properties_google_ads_links_list.list_google_ads_links(TEST_PROPERTY_ID)
+    out, _ = capsys.readouterr()
+    assert "Result" in out
diff --git a/google-analytics-admin/properties_google_ads_links_update.py b/google-analytics-admin/properties_google_ads_links_update.py
new file mode 100644
index 0000000..8959cfc
--- /dev/null
+++ b/google-analytics-admin/properties_google_ads_links_update.py
@@ -0,0 +1,70 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application updates the Google Ads link.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.googleAdsLinks/update
+for more information.
+"""
+# [START analyticsadmin_properties_google_ads_links_update]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha.types import GoogleAdsLink
+from google.protobuf.field_mask_pb2 import FieldMask
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics property ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with your Google Analytics Ads
+    #  link ID (e.g. "123456") before running the sample.
+    google_ads_link_id = "YOUR-GOOGLE-ADS-LINK-ID"
+
+    update_google_ads_link(property_id, google_ads_link_id)
+
+
+def update_google_ads_link(property_id, google_ads_link_id):
+    """Updates the Google Ads link."""
+    client = AnalyticsAdminServiceClient()
+    # This call updates the adsPersonalizationEnabled setting of the
+    # Google Ads link as indicated by the value of the `update_mask` field.
+    # The Google Ads link to update is specified in the `name` field of the
+    # `Google AdsLink` instance.
+    google_ads_link = client.update_google_ads_link(
+        google_ads_link=GoogleAdsLink(
+            name=f"properties/{property_id}/googleAdsLinks/{google_ads_link_id}",
+            ads_personalization_enabled=False,
+        ),
+        update_mask=FieldMask(paths=["ads_personalization_enabled"]),
+    )
+
+    print("Result:")
+    print(google_ads_link)
+
+
+# [END analyticsadmin_properties_google_ads_links_update]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_google_ads_links_update_test.py b/google-analytics-admin/properties_google_ads_links_update_test.py
new file mode 100644
index 0000000..b734c37
--- /dev/null
+++ b/google-analytics-admin/properties_google_ads_links_update_test.py
@@ -0,0 +1,30 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import properties_google_ads_links_update
+
+
+FAKE_PROPERTY_ID = "1"
+FAKE_GOOGLE_ADS_LINK_ID = "1"
+
+
+def test_properties_google_ads_links_update():
+    # This test ensures that the call is valid and reaches the server, even
+    # though the operation does not succeed due to permission error.
+    with pytest.raises(Exception, match="403 The caller does not have permission"):
+        properties_google_ads_links_update.update_google_ads_link(
+            FAKE_PROPERTY_ID, FAKE_GOOGLE_ADS_LINK_ID
+        )
diff --git a/google-analytics-admin/properties_list.py b/google-analytics-admin/properties_list.py
new file mode 100644
index 0000000..19bfcef
--- /dev/null
+++ b/google-analytics-admin/properties_list.py
@@ -0,0 +1,55 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which prints Google Analytics 4
+properties under the specified parent account that are available to the
+current user.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties/list
+for more information.
+"""
+# [START analyticsadmin_properties_list]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha.types import ListPropertiesRequest
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account ID (e.g. "123456") before running the sample.
+    account_id = "YOUR-GA-ACCOUNT-ID"
+    list_properties(account_id)
+
+
+def list_properties(account_id):
+    """Lists Google Analytics 4 properties under the specified parent account
+    that are available to the current user."""
+    client = AnalyticsAdminServiceClient()
+    results = client.list_properties(
+        ListPropertiesRequest(filter=f"parent:accounts/{account_id}", show_deleted=True)
+    )
+
+    print("Result:")
+    for property_ in results:
+        print(property_)
+        print()
+
+
+# [END analyticsadmin_properties_list]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_list_test.py b/google-analytics-admin/properties_list_test.py
new file mode 100644
index 0000000..97bf47d
--- /dev/null
+++ b/google-analytics-admin/properties_list_test.py
@@ -0,0 +1,25 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import os
+
+import properties_list
+
+TEST_ACCOUNT_ID = os.getenv("GA_TEST_ACCOUNT_ID")
+
+
+def test_properties_get(capsys):
+    properties_list.list_properties(TEST_ACCOUNT_ID)
+    out, _ = capsys.readouterr()
+    assert "Result" in out
diff --git a/google-analytics-admin/properties_update.py b/google-analytics-admin/properties_update.py
new file mode 100644
index 0000000..8700440
--- /dev/null
+++ b/google-analytics-admin/properties_update.py
@@ -0,0 +1,67 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties/update
+for more information.
+"""
+# [START analyticsadmin_properties_update]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha.types import Property
+from google.protobuf.field_mask_pb2 import FieldMask
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics property ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+    update_property(property_id)
+
+
+def update_property(property_id):
+    """Updates the Google Analytics 4 property."""
+    client = AnalyticsAdminServiceClient()
+    # This call updates the display name, industry category and time zone of the
+    # property, as indicated by the value of the `update_mask` field.
+    # The property to update is specified in the `name` field of the `Property`
+    # instance.
+    property_ = client.update_property(
+        property=Property(
+            name=f"properties/{property_id}",
+            display_name="This is an updated test property",
+            industry_category="GAMES",
+            time_zone="America/New_York",
+        ),
+        update_mask=FieldMask(paths=["display_name", "time_zone", "industry_category"]),
+    )
+
+    print("Result:")
+    print(property_)
+
+
+# [END analyticsadmin_properties_update]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_update_test.py b/google-analytics-admin/properties_update_test.py
new file mode 100644
index 0000000..9d94bb0
--- /dev/null
+++ b/google-analytics-admin/properties_update_test.py
@@ -0,0 +1,27 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import properties_update
+
+
+FAKE_PROPERTY_ID = "1"
+
+
+def test_properties_update():
+    # This test ensures that the call is valid and reaches the server, even
+    # though the operation does not succeed due to permission error.
+    with pytest.raises(Exception, match="403 The caller does not have permission"):
+        properties_update.update_property(FAKE_PROPERTY_ID)

From a43c83e1bd46ef3cc132a1e23e3734ab325ed7cb Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Sun, 6 Jun 2021 18:46:02 +0200
Subject: [PATCH 019/213] chore(deps): update dependency google-analytics-data
 to v0.5.1 (#78)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [google-analytics-data](https://togithub.com/googleapis/python-analytics-data) | `==0.5.0` -> `==0.5.1` | [![age](https://badges.renovateapi.com/packages/pypi/google-analytics-data/0.5.1/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/pypi/google-analytics-data/0.5.1/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/pypi/google-analytics-data/0.5.1/compatibility-slim/0.5.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/pypi/google-analytics-data/0.5.1/confidence-slim/0.5.0)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>googleapis/python-analytics-data</summary>

### [`v0.5.1`](https://togithub.com/googleapis/python-analytics-data/blob/master/CHANGELOG.md#&#8203;051-httpswwwgithubcomgoogleapispython-analytics-datacomparev050v051-2021-05-28)

[Compare Source](https://togithub.com/googleapis/python-analytics-data/compare/v0.5.0...v0.5.1)

</details>

---

### Configuration

📅 **Schedule**: At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻️ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box.

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/python-analytics-data).
---
 google-analytics-data/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index 2b2d2d6..4079fe1 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-data==0.5.0
+google-analytics-data==0.5.1
 google-auth-oauthlib==0.4.4
\ No newline at end of file

From f3033ebaa962220cf1c57e6a4c98e5b075ce1abb Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Tue, 8 Jun 2021 19:11:09 +0200
Subject: [PATCH 020/213] chore(deps): update dependency google-analytics-data
 to v0.6.0 (#81)

---
 google-analytics-data/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index 4079fe1..7700f43 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-data==0.5.1
+google-analytics-data==0.6.0
 google-auth-oauthlib==0.4.4
\ No newline at end of file

From 96cedfdc1f3b640d708108a7abbb114d077d0b3a Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <renovate@whitesourcesoftware.com>
Date: Fri, 18 Jun 2021 20:26:02 +0200
Subject: [PATCH 021/213] chore(deps): update dependency google-analytics-admin
 to v0.3.2 (#77)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [google-analytics-admin](https://togithub.com/googleapis/python-analytics-admin) | `==0.2.0` -> `==0.3.2` | [![age](https://badges.renovateapi.com/packages/pypi/google-analytics-admin/0.3.2/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/pypi/google-analytics-admin/0.3.2/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/pypi/google-analytics-admin/0.3.2/compatibility-slim/0.2.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/pypi/google-analytics-admin/0.3.2/confidence-slim/0.2.0)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>googleapis/python-analytics-admin</summary>

### [`v0.3.2`](https://togithub.com/googleapis/python-analytics-admin/blob/master/CHANGELOG.md#&#8203;032-httpswwwgithubcomgoogleapispython-analytics-admincomparev031v032-2021-06-16)

[Compare Source](https://togithub.com/googleapis/python-analytics-admin/compare/v0.3.1...v0.3.2)

### [`v0.3.1`](https://togithub.com/googleapis/python-analytics-admin/blob/master/CHANGELOG.md#&#8203;031-httpswwwgithubcomgoogleapispython-analytics-admincomparev030v031-2021-06-16)

[Compare Source](https://togithub.com/googleapis/python-analytics-admin/compare/v0.3.0...v0.3.1)

### [`v0.3.0`](https://togithub.com/googleapis/python-analytics-admin/blob/master/CHANGELOG.md#&#8203;030-httpswwwgithubcomgoogleapispython-analytics-admincomparev100v030-2021-06-09)

[Compare Source](https://togithub.com/googleapis/python-analytics-admin/compare/v0.2.0...v0.3.0)

##### Features

-   add `ConversionEvent` methods to the API ([ab703de](https://www.github.com/googleapis/python-analytics-admin/commit/ab703deccb763ebc3b8be35a09e1cec27b8ef107))
-   add `ConversionEvent` type ([ab703de](https://www.github.com/googleapis/python-analytics-admin/commit/ab703deccb763ebc3b8be35a09e1cec27b8ef107))
-   add `CustomDimension` methods to the API ([ab703de](https://www.github.com/googleapis/python-analytics-admin/commit/ab703deccb763ebc3b8be35a09e1cec27b8ef107))
-   add `CustomDimension` type ([ab703de](https://www.github.com/googleapis/python-analytics-admin/commit/ab703deccb763ebc3b8be35a09e1cec27b8ef107))
-   add `CustomMetric` methods to the API ([ab703de](https://www.github.com/googleapis/python-analytics-admin/commit/ab703deccb763ebc3b8be35a09e1cec27b8ef107))
-   add `CustomMetric` type ([ab703de](https://www.github.com/googleapis/python-analytics-admin/commit/ab703deccb763ebc3b8be35a09e1cec27b8ef107))
-   add `GetGoogleSignalsSettings`, `UpdateGoogleSignalsSettings` methods to the API ([ab703de](https://www.github.com/googleapis/python-analytics-admin/commit/ab703deccb763ebc3b8be35a09e1cec27b8ef107))
-   add `GoogleSignalsSettings`  type ([ab703de](https://www.github.com/googleapis/python-analytics-admin/commit/ab703deccb763ebc3b8be35a09e1cec27b8ef107))
-   add `GoogleSignalsState`, `GoogleSignalsConsent` types ([ab703de](https://www.github.com/googleapis/python-analytics-admin/commit/ab703deccb763ebc3b8be35a09e1cec27b8ef107))
-   add `MeasurementProtocolSecret` type ([ab703de](https://www.github.com/googleapis/python-analytics-admin/commit/ab703deccb763ebc3b8be35a09e1cec27b8ef107))
-   add MeasurementProtocolSecret methods to the API ([#&#8203;71](https://www.github.com/googleapis/python-analytics-admin/issues/71)) ([ab703de](https://www.github.com/googleapis/python-analytics-admin/commit/ab703deccb763ebc3b8be35a09e1cec27b8ef107))
-   extend `ChangeHistoryResourceType` enum ([ab703de](https://www.github.com/googleapis/python-analytics-admin/commit/ab703deccb763ebc3b8be35a09e1cec27b8ef107))

##### Bug Fixes

-   label `email_address` field of `UserLink` type as immutable ([ab703de](https://www.github.com/googleapis/python-analytics-admin/commit/ab703deccb763ebc3b8be35a09e1cec27b8ef107))
-   label `name` field of `UserLink` type as output only ([ab703de](https://www.github.com/googleapis/python-analytics-admin/commit/ab703deccb763ebc3b8be35a09e1cec27b8ef107))

##### Documentation

-   add Admin API samples for account management methods ([#&#8203;58](https://www.github.com/googleapis/python-analytics-admin/issues/58)) ([2ecc350](https://www.github.com/googleapis/python-analytics-admin/commit/2ecc350759cfa50f02c0f29f75b647e260cacec0))
-   add Admin API samples for account management methods ([#&#8203;65](https://www.github.com/googleapis/python-analytics-admin/issues/65)) ([a3fecc4](https://www.github.com/googleapis/python-analytics-admin/commit/a3fecc47bb329aeba3706b7d6f0b26196c3a8977))
-   add Admin API samples for property stream management methods ([#&#8203;68](https://www.github.com/googleapis/python-analytics-admin/issues/68)) ([27da97e](https://www.github.com/googleapis/python-analytics-admin/commit/27da97e4574baec81ba3c13be8aece1efa689f75))
-   add Admin API samples for property user link management methods ([#&#8203;67](https://www.github.com/googleapis/python-analytics-admin/issues/67)) ([aa55627](https://www.github.com/googleapis/python-analytics-admin/commit/aa5562777009bbdd21fdc39990b50ac5fb19cc53))
-   add samples for Google Analytics property management methods ([#&#8203;74](https://www.github.com/googleapis/python-analytics-admin/issues/74)) ([bdb85be](https://www.github.com/googleapis/python-analytics-admin/commit/bdb85bee0125db8199d6a2a3cf18fbcbd443070b))

##### Miscellaneous Chores

-   release 0.3.0 ([#&#8203;75](https://www.github.com/googleapis/python-analytics-admin/issues/75)) ([243b6c5](https://www.github.com/googleapis/python-analytics-admin/commit/243b6c558078bee738b01220384bc04840d59bbe))

</details>

---

### Configuration

📅 **Schedule**: At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box.

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/python-analytics-admin).
---
 google-analytics-admin/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index 11e7e0f..e408ea0 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-admin==0.2.0
+google-analytics-admin==0.3.2
 google-auth-oauthlib==0.4.4
\ No newline at end of file

From b16f29773712f0ac9ea91e70612f8d7a897d0ec9 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Thu, 24 Jun 2021 16:36:25 +0200
Subject: [PATCH 022/213] chore(deps): update dependency google-analytics-data
 to v0.6.1 (#86)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [google-analytics-data](https://togithub.com/googleapis/python-analytics-data) | `==0.6.0` -> `==0.6.1` | [![age](https://badges.renovateapi.com/packages/pypi/google-analytics-data/0.6.1/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/pypi/google-analytics-data/0.6.1/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/pypi/google-analytics-data/0.6.1/compatibility-slim/0.6.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/pypi/google-analytics-data/0.6.1/confidence-slim/0.6.0)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>googleapis/python-analytics-data</summary>

### [`v0.6.1`](https://togithub.com/googleapis/python-analytics-data/blob/master/CHANGELOG.md#&#8203;061-httpswwwgithubcomgoogleapispython-analytics-datacomparev060v061-2021-06-16)

[Compare Source](https://togithub.com/googleapis/python-analytics-data/compare/v0.6.0...v0.6.1)

</details>

---

### Configuration

📅 **Schedule**: At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box.

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/python-analytics-data).
---
 google-analytics-data/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index 7700f43..f5a566e 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-data==0.6.0
+google-analytics-data==0.6.1
 google-auth-oauthlib==0.4.4
\ No newline at end of file

From 29bdf9a16df16f633ff0257fe09ba2fca42c29ec Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Thu, 24 Jun 2021 20:00:11 +0200
Subject: [PATCH 023/213] chore(deps): update dependency google-analytics-admin
 to v0.4.0 (#91)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [google-analytics-admin](https://togithub.com/googleapis/python-analytics-admin) | `==0.3.2` -> `==0.4.0` | [![age](https://badges.renovateapi.com/packages/pypi/google-analytics-admin/0.4.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/pypi/google-analytics-admin/0.4.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/pypi/google-analytics-admin/0.4.0/compatibility-slim/0.3.2)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/pypi/google-analytics-admin/0.4.0/confidence-slim/0.3.2)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>googleapis/python-analytics-admin</summary>

### [`v0.4.0`](https://togithub.com/googleapis/python-analytics-admin/blob/master/CHANGELOG.md#&#8203;040-httpswwwgithubcomgoogleapispython-analytics-admincomparev032v040-2021-06-23)

[Compare Source](https://togithub.com/googleapis/python-analytics-admin/compare/v0.3.2...v0.4.0)

##### Features

-   add always_use_jwt_access ([#&#8203;89](https://www.github.com/googleapis/python-analytics-admin/issues/89)) ([268fdec](https://www.github.com/googleapis/python-analytics-admin/commit/268fdec4dd859a42d1025f94812053311df149ce))

##### Documentation

-   omit mention of Python 2.7 in 'CONTRIBUTING.rst' ([#&#8203;1127](https://www.github.com/googleapis/python-analytics-admin/issues/1127)) ([#&#8203;84](https://www.github.com/googleapis/python-analytics-admin/issues/84)) ([6ce863e](https://www.github.com/googleapis/python-analytics-admin/commit/6ce863e147dae3c1da40c27034a0ac42180c6303)), closes [#&#8203;1126](https://www.github.com/googleapis/python-analytics-admin/issues/1126)

##### [0.3.2](https://www.github.com/googleapis/python-analytics-admin/compare/v0.3.1...v0.3.2) (2021-06-16)

##### Bug Fixes

-   **deps:** add packaging requirement ([#&#8203;80](https://www.github.com/googleapis/python-analytics-admin/issues/80)) ([6d99bcc](https://www.github.com/googleapis/python-analytics-admin/commit/6d99bcc3e940e4f6bc857e7d4ede53e01537c7ec))

##### [0.3.1](https://www.github.com/googleapis/python-analytics-admin/compare/v0.3.0...v0.3.1) (2021-06-16)

##### Bug Fixes

-   exclude docs and tests from package ([#&#8203;78](https://www.github.com/googleapis/python-analytics-admin/issues/78)) ([680a695](https://www.github.com/googleapis/python-analytics-admin/commit/680a695e446c979e30542cd4dc563028b126aef5))

</details>

---

### Configuration

📅 **Schedule**: At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box.

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/python-analytics-admin).
---
 google-analytics-admin/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index e408ea0..4a38b9a 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-admin==0.3.2
+google-analytics-admin==0.4.0
 google-auth-oauthlib==0.4.4
\ No newline at end of file

From 87505943c0ff3bb8ef8eecc1e91cab8215fc741e Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Tue, 13 Jul 2021 16:08:23 +0200
Subject: [PATCH 024/213] chore(deps): update dependency google-analytics-admin
 to v0.4.1 (#98)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [google-analytics-admin](https://togithub.com/googleapis/python-analytics-admin) | `==0.4.0` -> `==0.4.1` | [![age](https://badges.renovateapi.com/packages/pypi/google-analytics-admin/0.4.1/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/pypi/google-analytics-admin/0.4.1/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/pypi/google-analytics-admin/0.4.1/compatibility-slim/0.4.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/pypi/google-analytics-admin/0.4.1/confidence-slim/0.4.0)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>googleapis/python-analytics-admin</summary>

### [`v0.4.1`](https://togithub.com/googleapis/python-analytics-admin/blob/master/CHANGELOG.md#&#8203;041-httpswwwgithubcomgoogleapispython-analytics-admincomparev040v041-2021-06-30)

[Compare Source](https://togithub.com/googleapis/python-analytics-admin/compare/v0.4.0...v0.4.1)

</details>

---

### Configuration

📅 **Schedule**: At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box.

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/python-analytics-admin).
---
 google-analytics-admin/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index 4a38b9a..0dc8a49 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-admin==0.4.0
+google-analytics-admin==0.4.1
 google-auth-oauthlib==0.4.4
\ No newline at end of file

From 7c3094a2f080eda192ffd8f95fd52ed829d4ce81 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Mon, 26 Jul 2021 15:54:25 +0200
Subject: [PATCH 025/213] chore(deps): update dependency google-analytics-admin
 to v0.4.2 (#104)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [google-analytics-admin](https://togithub.com/googleapis/python-analytics-admin) | `==0.4.1` -> `==0.4.2` | [![age](https://badges.renovateapi.com/packages/pypi/google-analytics-admin/0.4.2/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/pypi/google-analytics-admin/0.4.2/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/pypi/google-analytics-admin/0.4.2/compatibility-slim/0.4.1)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/pypi/google-analytics-admin/0.4.2/confidence-slim/0.4.1)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>googleapis/python-analytics-admin</summary>

### [`v0.4.2`](https://togithub.com/googleapis/python-analytics-admin/blob/master/CHANGELOG.md#&#8203;042-httpswwwgithubcomgoogleapispython-analytics-admincomparev041v042-2021-07-20)

[Compare Source](https://togithub.com/googleapis/python-analytics-admin/compare/v0.4.1...v0.4.2)

</details>

---

### Configuration

📅 **Schedule**: At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box.

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/python-analytics-admin).
---
 google-analytics-admin/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index 0dc8a49..6901d4e 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-admin==0.4.1
+google-analytics-admin==0.4.2
 google-auth-oauthlib==0.4.4
\ No newline at end of file

From ef790d947971bebe8511d8239d0cfde28a1bfae6 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Mon, 26 Jul 2021 18:32:27 +0200
Subject: [PATCH 026/213] chore(deps): update dependency google-analytics-data
 to v0.7.1 (#102)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [google-analytics-data](https://togithub.com/googleapis/python-analytics-data) | `==0.6.1` -> `==0.7.1` | [![age](https://badges.renovateapi.com/packages/pypi/google-analytics-data/0.7.1/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/pypi/google-analytics-data/0.7.1/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/pypi/google-analytics-data/0.7.1/compatibility-slim/0.6.1)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/pypi/google-analytics-data/0.7.1/confidence-slim/0.6.1)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>googleapis/python-analytics-data</summary>

### [`v0.7.1`](https://togithub.com/googleapis/python-analytics-data/blob/master/CHANGELOG.md#&#8203;071-httpswwwgithubcomgoogleapispython-analytics-datacomparev070v071-2021-07-20)

[Compare Source](https://togithub.com/googleapis/python-analytics-data/compare/v0.7.0...v0.7.1)

### [`v0.7.0`](https://togithub.com/googleapis/python-analytics-data/blob/master/CHANGELOG.md#&#8203;070-httpswwwgithubcomgoogleapispython-analytics-datacomparev061v070-2021-07-10)

[Compare Source](https://togithub.com/googleapis/python-analytics-data/compare/v0.6.1...v0.7.0)

##### Features

-   add `minute_ranges` field to `RunRealtimeReportRequest` object  ([#&#8203;101](https://www.github.com/googleapis/python-analytics-data/issues/101)) ([8523e6a](https://www.github.com/googleapis/python-analytics-data/commit/8523e6ad87f126766576d71b05d68478960bd10b))
-   add always_use_jwt_access ([1678019](https://www.github.com/googleapis/python-analytics-data/commit/16780195811dd93333afe6e27b674dd5e78705a3))

##### Bug Fixes

-   disable always_use_jwt_access ([#&#8203;97](https://www.github.com/googleapis/python-analytics-data/issues/97)) ([1678019](https://www.github.com/googleapis/python-analytics-data/commit/16780195811dd93333afe6e27b674dd5e78705a3))

##### Documentation

-   document the increase of the number of allowed dimensions in a report query ([8523e6a](https://www.github.com/googleapis/python-analytics-data/commit/8523e6ad87f126766576d71b05d68478960bd10b))
-   omit mention of Python 2.7 in 'CONTRIBUTING.rst' ([#&#8203;1127](https://www.github.com/googleapis/python-analytics-data/issues/1127)) ([#&#8203;87](https://www.github.com/googleapis/python-analytics-data/issues/87)) ([6e30719](https://www.github.com/googleapis/python-analytics-data/commit/6e30719c4158c0e2e7580bff373e94cf7dd91475)), closes [#&#8203;1126](https://www.github.com/googleapis/python-analytics-data/issues/1126)

##### [0.6.1](https://www.github.com/googleapis/python-analytics-data/compare/v0.6.0...v0.6.1) (2021-06-16)

##### Bug Fixes

-   exclude docs and tests from package ([#&#8203;82](https://www.github.com/googleapis/python-analytics-data/issues/82)) ([acd60f1](https://www.github.com/googleapis/python-analytics-data/commit/acd60f15ae2192e54b180776b62ee2ea9fce7d3f))

</details>

---

### Configuration

📅 **Schedule**: At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box.

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/python-analytics-data).
---
 google-analytics-data/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index f5a566e..f56ad0d 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-data==0.6.1
+google-analytics-data==0.7.1
 google-auth-oauthlib==0.4.4
\ No newline at end of file

From 6249d70288ee91810fb6cef73135d2e0c555db12 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Wed, 28 Jul 2021 16:40:40 +0200
Subject: [PATCH 027/213] chore(deps): update dependency google-analytics-admin
 to v0.4.3 (#110)

---
 google-analytics-admin/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index 6901d4e..542e667 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-admin==0.4.2
+google-analytics-admin==0.4.3
 google-auth-oauthlib==0.4.4
\ No newline at end of file

From 2c30b7497f4ef44a1361e36dae584c1e7c94f751 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Wed, 28 Jul 2021 16:41:16 +0200
Subject: [PATCH 028/213] chore(deps): update dependency google-analytics-data
 to v0.7.2 (#117)

---
 google-analytics-data/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index f56ad0d..7e43f89 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-data==0.7.1
+google-analytics-data==0.7.2
 google-auth-oauthlib==0.4.4
\ No newline at end of file

From 99fec21ba7d6fb8a2f862ac65cf8df65fde006b8 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Thu, 29 Jul 2021 19:57:26 +0200
Subject: [PATCH 029/213] chore(deps): update dependency google-auth-oauthlib
 to v0.4.5 (#111)

---
 google-analytics-admin/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index 542e667..d384ab2 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
 google-analytics-admin==0.4.3
-google-auth-oauthlib==0.4.4
\ No newline at end of file
+google-auth-oauthlib==0.4.5
\ No newline at end of file

From b4863c7e2de481fd7f3ddc1ca34e189bbf620798 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Thu, 29 Jul 2021 21:35:48 +0200
Subject: [PATCH 030/213] chore(deps): update dependency google-auth-oauthlib
 to v0.4.5 (#118)

---
 google-analytics-data/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index 7e43f89..0581816 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
 google-analytics-data==0.7.2
-google-auth-oauthlib==0.4.4
\ No newline at end of file
+google-auth-oauthlib==0.4.5
\ No newline at end of file

From f9096ec8f5184521ef4e07f5060a78138b28706a Mon Sep 17 00:00:00 2001
From: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com>
Date: Wed, 18 Aug 2021 07:42:23 -0600
Subject: [PATCH 031/213] chore: generate python samples templates in owlbot.py
 (#118)

Generate python samples templates in owlbot.py
---
 google-analytics-admin/noxfile.py | 38 +++++++++++++++++++------------
 1 file changed, 23 insertions(+), 15 deletions(-)

diff --git a/google-analytics-admin/noxfile.py b/google-analytics-admin/noxfile.py
index 804f957..e73436a 100644
--- a/google-analytics-admin/noxfile.py
+++ b/google-analytics-admin/noxfile.py
@@ -28,8 +28,9 @@
 # WARNING - WARNING - WARNING - WARNING - WARNING
 # WARNING - WARNING - WARNING - WARNING - WARNING
 
-# Copy `noxfile_config.py` to your directory and modify it instead.
+BLACK_VERSION = "black==19.10b0"
 
+# Copy `noxfile_config.py` to your directory and modify it instead.
 
 # `TEST_CONFIG` dict is a configuration hook that allows users to
 # modify the test configurations. The values here should be in sync
@@ -38,7 +39,7 @@
 
 TEST_CONFIG = {
     # You can opt out from the test for specific Python versions.
-    'ignored_versions': ["2.7"],
+    'ignored_versions': [],
 
     # Old samples are opted out of enforcing Python type hints
     # All new samples should feature them
@@ -50,7 +51,10 @@
     # to use your own Cloud project.
     'gcloud_project_env': 'GOOGLE_CLOUD_PROJECT',
     # 'gcloud_project_env': 'BUILD_SPECIFIC_GCLOUD_PROJECT',
-
+    # If you need to use a specific version of pip,
+    # change pip_version_override to the string representation
+    # of the version number, for example, "20.2.4"
+    "pip_version_override": None,
     # A dictionary you want to inject into your test. Don't put any
     # secrets here. These values will override predefined values.
     'envs': {},
@@ -77,7 +81,6 @@ def get_pytest_env_vars() -> Dict[str, str]:
     env_key = TEST_CONFIG['gcloud_project_env']
     # This should error out if not set.
     ret['GOOGLE_CLOUD_PROJECT'] = os.environ[env_key]
-    ret['GCLOUD_PROJECT'] = os.environ[env_key]  # deprecated
 
     # Apply user supplied envs.
     ret.update(TEST_CONFIG['envs'])
@@ -85,15 +88,15 @@ def get_pytest_env_vars() -> Dict[str, str]:
 
 
 # DO NOT EDIT - automatically generated.
-# All versions used to tested samples.
-ALL_VERSIONS = ["2.7", "3.6", "3.7", "3.8", "3.9"]
+# All versions used to test samples.
+ALL_VERSIONS = ["3.6", "3.7", "3.8", "3.9"]
 
 # Any default versions that should be ignored.
 IGNORED_VERSIONS = TEST_CONFIG['ignored_versions']
 
 TESTED_VERSIONS = sorted([v for v in ALL_VERSIONS if v not in IGNORED_VERSIONS])
 
-INSTALL_LIBRARY_FROM_SOURCE = bool(os.environ.get("INSTALL_LIBRARY_FROM_SOURCE", False))
+INSTALL_LIBRARY_FROM_SOURCE = os.environ.get("INSTALL_LIBRARY_FROM_SOURCE", False) in ("True", "true")
 #
 # Style Checks
 #
@@ -110,8 +113,8 @@ def _determine_local_import_names(start_dir: str) -> List[str]:
         basename
         for basename, extension in file_ext_pairs
         if extension == ".py"
-           or os.path.isdir(os.path.join(start_dir, basename))
-           and basename not in ("__pycache__")
+        or os.path.isdir(os.path.join(start_dir, basename))
+        and basename not in ("__pycache__")
     ]
 
 
@@ -150,20 +153,18 @@ def lint(session: nox.sessions.Session) -> None:
         "."
     ]
     session.run("flake8", *args)
-
-
 #
 # Black
 #
 
+
 @nox.session
 def blacken(session: nox.sessions.Session) -> None:
-    session.install("black")
+    session.install(BLACK_VERSION)
     python_files = [path for path in os.listdir(".") if path.endswith(".py")]
 
     session.run("black", *python_files)
 
-
 #
 # Sample Tests
 #
@@ -173,6 +174,9 @@ def blacken(session: nox.sessions.Session) -> None:
 
 
 def _session_tests(session: nox.sessions.Session, post_install: Callable = None) -> None:
+    if TEST_CONFIG["pip_version_override"]:
+        pip_version = TEST_CONFIG["pip_version_override"]
+        session.install(f"pip=={pip_version}")
     """Runs py.test for a particular project."""
     if os.path.exists("requirements.txt"):
         if os.path.exists("constraints.txt"):
@@ -221,14 +225,18 @@ def py(session: nox.sessions.Session) -> None:
 
 def _get_repo_root() -> Optional[str]:
     """ Returns the root folder of the project. """
-    # Get root of this repository.
-    # Assume we don't have directories nested deeper than 10 items.
+    # Get root of this repository. Assume we don't have directories nested deeper than 10 items.
     p = Path(os.getcwd())
     for i in range(10):
         if p is None:
             break
         if Path(p / ".git").exists():
             return str(p)
+        # .git is not available in repos cloned via Cloud Build
+        # setup.py is always in the library's root, so use that instead
+        # https://github.com/googleapis/synthtool/issues/792
+        if Path(p / "setup.py").exists():
+            return str(p)
         p = p.parent
     raise Exception("Unable to detect repository root.")
 

From 1dd0fee4d0bb9a8f7d5402fec9647c37b06d80d5 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Tue, 31 Aug 2021 17:09:56 +0200
Subject: [PATCH 032/213] chore(deps): update dependency pytest to v6.2.5
 (#127)

---
 google-analytics-data/requirements-test.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements-test.txt b/google-analytics-data/requirements-test.txt
index 95ea1e6..9270945 100644
--- a/google-analytics-data/requirements-test.txt
+++ b/google-analytics-data/requirements-test.txt
@@ -1 +1 @@
-pytest==6.2.4
+pytest==6.2.5

From 13454e5d4258ed81603a25ed2d3243d93c9bbbc1 Mon Sep 17 00:00:00 2001
From: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com>
Date: Wed, 1 Sep 2021 03:56:25 -0600
Subject: [PATCH 033/213] chore: generate python samples templates in owlbot.py
 (#122)

Generate python samples templates in owlbot.py
---
 google-analytics-data/noxfile.py        | 69 ++++++++++++++++---------
 google-analytics-data/noxfile_config.py |  3 --
 2 files changed, 46 insertions(+), 26 deletions(-)

diff --git a/google-analytics-data/noxfile.py b/google-analytics-data/noxfile.py
index 0bf9dba..e73436a 100644
--- a/google-analytics-data/noxfile.py
+++ b/google-analytics-data/noxfile.py
@@ -1,4 +1,4 @@
-# Copyright 2020 Google LLC
+# Copyright 2019 Google LLC
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@
 import os
 from pathlib import Path
 import sys
+from typing import Callable, Dict, List, Optional
 
 import nox
 
@@ -27,8 +28,9 @@
 # WARNING - WARNING - WARNING - WARNING - WARNING
 # WARNING - WARNING - WARNING - WARNING - WARNING
 
-# Copy `noxfile_config.py` to your directory and modify it instead.
+BLACK_VERSION = "black==19.10b0"
 
+# Copy `noxfile_config.py` to your directory and modify it instead.
 
 # `TEST_CONFIG` dict is a configuration hook that allows users to
 # modify the test configurations. The values here should be in sync
@@ -37,7 +39,11 @@
 
 TEST_CONFIG = {
     # You can opt out from the test for specific Python versions.
-    'ignored_versions': ["2.7"],
+    'ignored_versions': [],
+
+    # Old samples are opted out of enforcing Python type hints
+    # All new samples should feature them
+    'enforce_type_hints': False,
 
     # An envvar key for determining the project id to use. Change it
     # to 'BUILD_SPECIFIC_GCLOUD_PROJECT' if you want to opt in using a
@@ -45,7 +51,10 @@
     # to use your own Cloud project.
     'gcloud_project_env': 'GOOGLE_CLOUD_PROJECT',
     # 'gcloud_project_env': 'BUILD_SPECIFIC_GCLOUD_PROJECT',
-
+    # If you need to use a specific version of pip,
+    # change pip_version_override to the string representation
+    # of the version number, for example, "20.2.4"
+    "pip_version_override": None,
     # A dictionary you want to inject into your test. Don't put any
     # secrets here. These values will override predefined values.
     'envs': {},
@@ -64,7 +73,7 @@
 TEST_CONFIG.update(TEST_CONFIG_OVERRIDE)
 
 
-def get_pytest_env_vars():
+def get_pytest_env_vars() -> Dict[str, str]:
     """Returns a dict for pytest invocation."""
     ret = {}
 
@@ -72,7 +81,6 @@ def get_pytest_env_vars():
     env_key = TEST_CONFIG['gcloud_project_env']
     # This should error out if not set.
     ret['GOOGLE_CLOUD_PROJECT'] = os.environ[env_key]
-    ret['GCLOUD_PROJECT'] = os.environ[env_key]  # deprecated
 
     # Apply user supplied envs.
     ret.update(TEST_CONFIG['envs'])
@@ -80,21 +88,21 @@ def get_pytest_env_vars():
 
 
 # DO NOT EDIT - automatically generated.
-# All versions used to tested samples.
-ALL_VERSIONS = ["2.7", "3.6", "3.7", "3.8"]
+# All versions used to test samples.
+ALL_VERSIONS = ["3.6", "3.7", "3.8", "3.9"]
 
 # Any default versions that should be ignored.
 IGNORED_VERSIONS = TEST_CONFIG['ignored_versions']
 
 TESTED_VERSIONS = sorted([v for v in ALL_VERSIONS if v not in IGNORED_VERSIONS])
 
-INSTALL_LIBRARY_FROM_SOURCE = bool(os.environ.get("INSTALL_LIBRARY_FROM_SOURCE", False))
+INSTALL_LIBRARY_FROM_SOURCE = os.environ.get("INSTALL_LIBRARY_FROM_SOURCE", False) in ("True", "true")
 #
 # Style Checks
 #
 
 
-def _determine_local_import_names(start_dir):
+def _determine_local_import_names(start_dir: str) -> List[str]:
     """Determines all import names that should be considered "local".
 
     This is used when running the linter to insure that import order is
@@ -132,8 +140,11 @@ def _determine_local_import_names(start_dir):
 
 
 @nox.session
-def lint(session):
-    session.install("flake8", "flake8-import-order")
+def lint(session: nox.sessions.Session) -> None:
+    if not TEST_CONFIG['enforce_type_hints']:
+        session.install("flake8", "flake8-import-order")
+    else:
+        session.install("flake8", "flake8-import-order", "flake8-annotations")
 
     local_names = _determine_local_import_names(".")
     args = FLAKE8_COMMON_ARGS + [
@@ -142,20 +153,18 @@ def lint(session):
         "."
     ]
     session.run("flake8", *args)
-
-
 #
 # Black
 #
 
+
 @nox.session
-def blacken(session):
-    session.install("black")
+def blacken(session: nox.sessions.Session) -> None:
+    session.install(BLACK_VERSION)
     python_files = [path for path in os.listdir(".") if path.endswith(".py")]
 
     session.run("black", *python_files)
 
-
 #
 # Sample Tests
 #
@@ -164,13 +173,22 @@ def blacken(session):
 PYTEST_COMMON_ARGS = ["--junitxml=sponge_log.xml"]
 
 
-def _session_tests(session, post_install=None):
+def _session_tests(session: nox.sessions.Session, post_install: Callable = None) -> None:
+    if TEST_CONFIG["pip_version_override"]:
+        pip_version = TEST_CONFIG["pip_version_override"]
+        session.install(f"pip=={pip_version}")
     """Runs py.test for a particular project."""
     if os.path.exists("requirements.txt"):
-        session.install("-r", "requirements.txt")
+        if os.path.exists("constraints.txt"):
+            session.install("-r", "requirements.txt", "-c", "constraints.txt")
+        else:
+            session.install("-r", "requirements.txt")
 
     if os.path.exists("requirements-test.txt"):
-        session.install("-r", "requirements-test.txt")
+        if os.path.exists("constraints-test.txt"):
+            session.install("-r", "requirements-test.txt", "-c", "constraints-test.txt")
+        else:
+            session.install("-r", "requirements-test.txt")
 
     if INSTALL_LIBRARY_FROM_SOURCE:
         session.install("-e", _get_repo_root())
@@ -190,7 +208,7 @@ def _session_tests(session, post_install=None):
 
 
 @nox.session(python=ALL_VERSIONS)
-def py(session):
+def py(session: nox.sessions.Session) -> None:
     """Runs py.test for a sample using the specified version of Python."""
     if session.python in TESTED_VERSIONS:
         _session_tests(session)
@@ -205,7 +223,7 @@ def py(session):
 #
 
 
-def _get_repo_root():
+def _get_repo_root() -> Optional[str]:
     """ Returns the root folder of the project. """
     # Get root of this repository. Assume we don't have directories nested deeper than 10 items.
     p = Path(os.getcwd())
@@ -214,6 +232,11 @@ def _get_repo_root():
             break
         if Path(p / ".git").exists():
             return str(p)
+        # .git is not available in repos cloned via Cloud Build
+        # setup.py is always in the library's root, so use that instead
+        # https://github.com/googleapis/synthtool/issues/792
+        if Path(p / "setup.py").exists():
+            return str(p)
         p = p.parent
     raise Exception("Unable to detect repository root.")
 
@@ -223,7 +246,7 @@ def _get_repo_root():
 
 @nox.session
 @nox.parametrize("path", GENERATED_READMES)
-def readmegen(session, path):
+def readmegen(session: nox.sessions.Session, path: str) -> None:
     """(Re-)generates the readme for a sample."""
     session.install("jinja2", "pyyaml")
     dir_ = os.path.dirname(path)
diff --git a/google-analytics-data/noxfile_config.py b/google-analytics-data/noxfile_config.py
index 20c30ee..b6dddd6 100644
--- a/google-analytics-data/noxfile_config.py
+++ b/google-analytics-data/noxfile_config.py
@@ -1,9 +1,6 @@
 TEST_CONFIG_OVERRIDE = {
     # You can opt out from the test for specific Python versions.
     "ignored_versions": ["2.7"],
-    # Old samples are opted out of enforcing Python type hints
-    # All new samples should feature them
-    "enforce_type_hints": True,
     # An envvar key for determining the project id to use. Change it
     # to 'BUILD_SPECIFIC_GCLOUD_PROJECT' if you want to opt in using a
     # build specific Cloud project. You can also use your own string

From 8f18819424c41fbd16e5ec45c7056772e90ef210 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Wed, 1 Sep 2021 13:39:11 +0200
Subject: [PATCH 034/213] chore(deps): update dependency google-auth-oauthlib
 to v0.4.6 (#128)

---
 google-analytics-data/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index 0581816..79fcb59 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
 google-analytics-data==0.7.2
-google-auth-oauthlib==0.4.5
\ No newline at end of file
+google-auth-oauthlib==0.4.6
\ No newline at end of file

From 78e6a6478763b3607ab62fba9bd457dd258cd991 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Thu, 2 Sep 2021 02:13:55 +0200
Subject: [PATCH 035/213] chore(deps): update dependency google-analytics-data
 to v0.8.0 (#133)

---
 google-analytics-data/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index 79fcb59..ee7a27f 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-data==0.7.2
+google-analytics-data==0.8.0
 google-auth-oauthlib==0.4.6
\ No newline at end of file

From e0eccf8568b7cf4b4753d3fd3d2d8c6ea347a049 Mon Sep 17 00:00:00 2001
From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com>
Date: Fri, 17 Sep 2021 15:37:06 +0000
Subject: [PATCH 036/213] chore: blacken samples noxfile template (#132)

---
 google-analytics-admin/noxfile.py | 44 ++++++++++++++++++-------------
 1 file changed, 25 insertions(+), 19 deletions(-)

diff --git a/google-analytics-admin/noxfile.py b/google-analytics-admin/noxfile.py
index e73436a..b008613 100644
--- a/google-analytics-admin/noxfile.py
+++ b/google-analytics-admin/noxfile.py
@@ -39,17 +39,15 @@
 
 TEST_CONFIG = {
     # You can opt out from the test for specific Python versions.
-    'ignored_versions': [],
-
+    "ignored_versions": [],
     # Old samples are opted out of enforcing Python type hints
     # All new samples should feature them
-    'enforce_type_hints': False,
-
+    "enforce_type_hints": False,
     # An envvar key for determining the project id to use. Change it
     # to 'BUILD_SPECIFIC_GCLOUD_PROJECT' if you want to opt in using a
     # build specific Cloud project. You can also use your own string
     # to use your own Cloud project.
-    'gcloud_project_env': 'GOOGLE_CLOUD_PROJECT',
+    "gcloud_project_env": "GOOGLE_CLOUD_PROJECT",
     # 'gcloud_project_env': 'BUILD_SPECIFIC_GCLOUD_PROJECT',
     # If you need to use a specific version of pip,
     # change pip_version_override to the string representation
@@ -57,13 +55,13 @@
     "pip_version_override": None,
     # A dictionary you want to inject into your test. Don't put any
     # secrets here. These values will override predefined values.
-    'envs': {},
+    "envs": {},
 }
 
 
 try:
     # Ensure we can import noxfile_config in the project's directory.
-    sys.path.append('.')
+    sys.path.append(".")
     from noxfile_config import TEST_CONFIG_OVERRIDE
 except ImportError as e:
     print("No user noxfile_config found: detail: {}".format(e))
@@ -78,12 +76,12 @@ def get_pytest_env_vars() -> Dict[str, str]:
     ret = {}
 
     # Override the GCLOUD_PROJECT and the alias.
-    env_key = TEST_CONFIG['gcloud_project_env']
+    env_key = TEST_CONFIG["gcloud_project_env"]
     # This should error out if not set.
-    ret['GOOGLE_CLOUD_PROJECT'] = os.environ[env_key]
+    ret["GOOGLE_CLOUD_PROJECT"] = os.environ[env_key]
 
     # Apply user supplied envs.
-    ret.update(TEST_CONFIG['envs'])
+    ret.update(TEST_CONFIG["envs"])
     return ret
 
 
@@ -92,11 +90,14 @@ def get_pytest_env_vars() -> Dict[str, str]:
 ALL_VERSIONS = ["3.6", "3.7", "3.8", "3.9"]
 
 # Any default versions that should be ignored.
-IGNORED_VERSIONS = TEST_CONFIG['ignored_versions']
+IGNORED_VERSIONS = TEST_CONFIG["ignored_versions"]
 
 TESTED_VERSIONS = sorted([v for v in ALL_VERSIONS if v not in IGNORED_VERSIONS])
 
-INSTALL_LIBRARY_FROM_SOURCE = os.environ.get("INSTALL_LIBRARY_FROM_SOURCE", False) in ("True", "true")
+INSTALL_LIBRARY_FROM_SOURCE = os.environ.get("INSTALL_LIBRARY_FROM_SOURCE", False) in (
+    "True",
+    "true",
+)
 #
 # Style Checks
 #
@@ -141,7 +142,7 @@ def _determine_local_import_names(start_dir: str) -> List[str]:
 
 @nox.session
 def lint(session: nox.sessions.Session) -> None:
-    if not TEST_CONFIG['enforce_type_hints']:
+    if not TEST_CONFIG["enforce_type_hints"]:
         session.install("flake8", "flake8-import-order")
     else:
         session.install("flake8", "flake8-import-order", "flake8-annotations")
@@ -150,9 +151,11 @@ def lint(session: nox.sessions.Session) -> None:
     args = FLAKE8_COMMON_ARGS + [
         "--application-import-names",
         ",".join(local_names),
-        "."
+        ".",
     ]
     session.run("flake8", *args)
+
+
 #
 # Black
 #
@@ -165,6 +168,7 @@ def blacken(session: nox.sessions.Session) -> None:
 
     session.run("black", *python_files)
 
+
 #
 # Sample Tests
 #
@@ -173,7 +177,9 @@ def blacken(session: nox.sessions.Session) -> None:
 PYTEST_COMMON_ARGS = ["--junitxml=sponge_log.xml"]
 
 
-def _session_tests(session: nox.sessions.Session, post_install: Callable = None) -> None:
+def _session_tests(
+    session: nox.sessions.Session, post_install: Callable = None
+) -> None:
     if TEST_CONFIG["pip_version_override"]:
         pip_version = TEST_CONFIG["pip_version_override"]
         session.install(f"pip=={pip_version}")
@@ -203,7 +209,7 @@ def _session_tests(session: nox.sessions.Session, post_install: Callable = None)
         # on travis where slow and flaky tests are excluded.
         # See http://doc.pytest.org/en/latest/_modules/_pytest/main.html
         success_codes=[0, 5],
-        env=get_pytest_env_vars()
+        env=get_pytest_env_vars(),
     )
 
 
@@ -213,9 +219,9 @@ def py(session: nox.sessions.Session) -> None:
     if session.python in TESTED_VERSIONS:
         _session_tests(session)
     else:
-        session.skip("SKIPPED: {} tests are disabled for this sample.".format(
-            session.python
-        ))
+        session.skip(
+            "SKIPPED: {} tests are disabled for this sample.".format(session.python)
+        )
 
 
 #

From 74c7321780eb0eb3cdc4d4fc80b929e495729512 Mon Sep 17 00:00:00 2001
From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com>
Date: Fri, 17 Sep 2021 16:08:13 +0000
Subject: [PATCH 037/213] chore: blacken samples noxfile template (#136)

---
 google-analytics-data/noxfile.py | 44 ++++++++++++++++++--------------
 1 file changed, 25 insertions(+), 19 deletions(-)

diff --git a/google-analytics-data/noxfile.py b/google-analytics-data/noxfile.py
index e73436a..b008613 100644
--- a/google-analytics-data/noxfile.py
+++ b/google-analytics-data/noxfile.py
@@ -39,17 +39,15 @@
 
 TEST_CONFIG = {
     # You can opt out from the test for specific Python versions.
-    'ignored_versions': [],
-
+    "ignored_versions": [],
     # Old samples are opted out of enforcing Python type hints
     # All new samples should feature them
-    'enforce_type_hints': False,
-
+    "enforce_type_hints": False,
     # An envvar key for determining the project id to use. Change it
     # to 'BUILD_SPECIFIC_GCLOUD_PROJECT' if you want to opt in using a
     # build specific Cloud project. You can also use your own string
     # to use your own Cloud project.
-    'gcloud_project_env': 'GOOGLE_CLOUD_PROJECT',
+    "gcloud_project_env": "GOOGLE_CLOUD_PROJECT",
     # 'gcloud_project_env': 'BUILD_SPECIFIC_GCLOUD_PROJECT',
     # If you need to use a specific version of pip,
     # change pip_version_override to the string representation
@@ -57,13 +55,13 @@
     "pip_version_override": None,
     # A dictionary you want to inject into your test. Don't put any
     # secrets here. These values will override predefined values.
-    'envs': {},
+    "envs": {},
 }
 
 
 try:
     # Ensure we can import noxfile_config in the project's directory.
-    sys.path.append('.')
+    sys.path.append(".")
     from noxfile_config import TEST_CONFIG_OVERRIDE
 except ImportError as e:
     print("No user noxfile_config found: detail: {}".format(e))
@@ -78,12 +76,12 @@ def get_pytest_env_vars() -> Dict[str, str]:
     ret = {}
 
     # Override the GCLOUD_PROJECT and the alias.
-    env_key = TEST_CONFIG['gcloud_project_env']
+    env_key = TEST_CONFIG["gcloud_project_env"]
     # This should error out if not set.
-    ret['GOOGLE_CLOUD_PROJECT'] = os.environ[env_key]
+    ret["GOOGLE_CLOUD_PROJECT"] = os.environ[env_key]
 
     # Apply user supplied envs.
-    ret.update(TEST_CONFIG['envs'])
+    ret.update(TEST_CONFIG["envs"])
     return ret
 
 
@@ -92,11 +90,14 @@ def get_pytest_env_vars() -> Dict[str, str]:
 ALL_VERSIONS = ["3.6", "3.7", "3.8", "3.9"]
 
 # Any default versions that should be ignored.
-IGNORED_VERSIONS = TEST_CONFIG['ignored_versions']
+IGNORED_VERSIONS = TEST_CONFIG["ignored_versions"]
 
 TESTED_VERSIONS = sorted([v for v in ALL_VERSIONS if v not in IGNORED_VERSIONS])
 
-INSTALL_LIBRARY_FROM_SOURCE = os.environ.get("INSTALL_LIBRARY_FROM_SOURCE", False) in ("True", "true")
+INSTALL_LIBRARY_FROM_SOURCE = os.environ.get("INSTALL_LIBRARY_FROM_SOURCE", False) in (
+    "True",
+    "true",
+)
 #
 # Style Checks
 #
@@ -141,7 +142,7 @@ def _determine_local_import_names(start_dir: str) -> List[str]:
 
 @nox.session
 def lint(session: nox.sessions.Session) -> None:
-    if not TEST_CONFIG['enforce_type_hints']:
+    if not TEST_CONFIG["enforce_type_hints"]:
         session.install("flake8", "flake8-import-order")
     else:
         session.install("flake8", "flake8-import-order", "flake8-annotations")
@@ -150,9 +151,11 @@ def lint(session: nox.sessions.Session) -> None:
     args = FLAKE8_COMMON_ARGS + [
         "--application-import-names",
         ",".join(local_names),
-        "."
+        ".",
     ]
     session.run("flake8", *args)
+
+
 #
 # Black
 #
@@ -165,6 +168,7 @@ def blacken(session: nox.sessions.Session) -> None:
 
     session.run("black", *python_files)
 
+
 #
 # Sample Tests
 #
@@ -173,7 +177,9 @@ def blacken(session: nox.sessions.Session) -> None:
 PYTEST_COMMON_ARGS = ["--junitxml=sponge_log.xml"]
 
 
-def _session_tests(session: nox.sessions.Session, post_install: Callable = None) -> None:
+def _session_tests(
+    session: nox.sessions.Session, post_install: Callable = None
+) -> None:
     if TEST_CONFIG["pip_version_override"]:
         pip_version = TEST_CONFIG["pip_version_override"]
         session.install(f"pip=={pip_version}")
@@ -203,7 +209,7 @@ def _session_tests(session: nox.sessions.Session, post_install: Callable = None)
         # on travis where slow and flaky tests are excluded.
         # See http://doc.pytest.org/en/latest/_modules/_pytest/main.html
         success_codes=[0, 5],
-        env=get_pytest_env_vars()
+        env=get_pytest_env_vars(),
     )
 
 
@@ -213,9 +219,9 @@ def py(session: nox.sessions.Session) -> None:
     if session.python in TESTED_VERSIONS:
         _session_tests(session)
     else:
-        session.skip("SKIPPED: {} tests are disabled for this sample.".format(
-            session.python
-        ))
+        session.skip(
+            "SKIPPED: {} tests are disabled for this sample.".format(session.python)
+        )
 
 
 #

From ef002537689e2e74a13428309b3718300166034e Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Tue, 28 Sep 2021 16:43:30 +0200
Subject: [PATCH 038/213] chore(deps): update dependency google-analytics-data
 to v0.8.1 (#141)

---
 google-analytics-data/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index ee7a27f..3d7a7ed 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-data==0.8.0
+google-analytics-data==0.8.1
 google-auth-oauthlib==0.4.6
\ No newline at end of file

From 65c2b25ae4681841162d279f32e88814352a6996 Mon Sep 17 00:00:00 2001
From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com>
Date: Thu, 30 Sep 2021 15:44:22 +0000
Subject: [PATCH 039/213] chore: fail samples nox session if python version is
 missing (#143)

---
 google-analytics-data/noxfile.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/google-analytics-data/noxfile.py b/google-analytics-data/noxfile.py
index b008613..1fd8956 100644
--- a/google-analytics-data/noxfile.py
+++ b/google-analytics-data/noxfile.py
@@ -98,6 +98,10 @@ def get_pytest_env_vars() -> Dict[str, str]:
     "True",
     "true",
 )
+
+# Error if a python version is missing
+nox.options.error_on_missing_interpreters = True
+
 #
 # Style Checks
 #

From a817593c121f10d73dcdee650ef5b75012dfc31d Mon Sep 17 00:00:00 2001
From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com>
Date: Thu, 30 Sep 2021 15:44:29 +0000
Subject: [PATCH 040/213] chore: fail samples nox session if python version is
 missing (#140)

---
 google-analytics-admin/noxfile.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/google-analytics-admin/noxfile.py b/google-analytics-admin/noxfile.py
index b008613..1fd8956 100644
--- a/google-analytics-admin/noxfile.py
+++ b/google-analytics-admin/noxfile.py
@@ -98,6 +98,10 @@ def get_pytest_env_vars() -> Dict[str, str]:
     "True",
     "true",
 )
+
+# Error if a python version is missing
+nox.options.error_on_missing_interpreters = True
+
 #
 # Style Checks
 #

From 8d85167b01c5237174dfc7e619bd6353b4ad15d1 Mon Sep 17 00:00:00 2001
From: ikuleshov <ikuleshov@google.com>
Date: Tue, 5 Oct 2021 06:24:00 -0400
Subject: [PATCH 041/213] ci: update test configuration (#129)

* update test configuration

* remove custom noxfile configs for now

* remove MaximumUserAccess rom sample

* add comment in noxfile_config.py

* run blacken session

* lint

* add pytest

* Update noxfile_config.py

* Update noxfile_config.py

* delete enhanced measurement settings samples as this functionality is no longer supported in v1alpha

* fix the samples tests

* do not use the `maximum_user_access` field and `update` operation in properties.firebase_links tests as this is no longer supported in v1alpha

* use `creator_email_address` instead of `email_address` field in properties.google_ads_links_list() test as the field has been renamed in v1alpha

* fix the samples test

Co-authored-by: Anthonios Partheniou <partheniou@google.com>
---
 google-analytics-admin/noxfile_config.py      | 20 ++---
 .../properties_firebase_links_create.py       |  5 +-
 .../properties_firebase_links_list.py         |  5 --
 .../properties_firebase_links_update.py       | 71 -----------------
 .../properties_firebase_links_update_test.py  | 30 -------
 .../properties_google_ads_links_list.py       |  2 +-
 .../properties_google_ads_links_list_test.py  |  2 +-
 .../properties_ios_app_data_streams_get.py    |  2 +-
 .../properties_user_links_batch_get_test.py   |  2 +-
 .../properties_user_links_get_test.py         |  2 +-
 ...reams_get_enhanced_measurement_settings.py | 79 -------------------
 ..._get_enhanced_measurement_settings_test.py | 29 -------
 ...ms_update_enhanced_measurement_settings.py | 73 -----------------
 ...date_enhanced_measurement_settings_test.py | 30 -------
 google-analytics-admin/quickstart.py          | 26 +++---
 google-analytics-admin/requirements-test.txt  |  1 +
 16 files changed, 30 insertions(+), 349 deletions(-)
 delete mode 100644 google-analytics-admin/properties_firebase_links_update.py
 delete mode 100644 google-analytics-admin/properties_firebase_links_update_test.py
 delete mode 100644 google-analytics-admin/properties_web_data_streams_get_enhanced_measurement_settings.py
 delete mode 100644 google-analytics-admin/properties_web_data_streams_get_enhanced_measurement_settings_test.py
 delete mode 100644 google-analytics-admin/properties_web_data_streams_update_enhanced_measurement_settings.py
 delete mode 100644 google-analytics-admin/properties_web_data_streams_update_enhanced_measurement_settings_test.py
 create mode 100644 google-analytics-admin/requirements-test.txt

diff --git a/google-analytics-admin/noxfile_config.py b/google-analytics-admin/noxfile_config.py
index b883a88..f218482 100644
--- a/google-analytics-admin/noxfile_config.py
+++ b/google-analytics-admin/noxfile_config.py
@@ -1,23 +1,19 @@
 TEST_CONFIG_OVERRIDE = {
-    # You can opt out from the test for specific Python versions.
-    "ignored_versions": ["2.7"],
-    # Old samples are opted out of enforcing Python type hints
-    # All new samples should feature them
-    "enforce_type_hints": True,
     # An envvar key for determining the project id to use. Change it
     # to 'BUILD_SPECIFIC_GCLOUD_PROJECT' if you want to opt in using a
     # build specific Cloud project. You can also use your own string
     # to use your own Cloud project.
-    "gcloud_project_env": "GOOGLE_CLOUD_PROJECT",
+    "gcloud_project_env": "BUILD_SPECIFIC_GCLOUD_PROJECT",
     # 'gcloud_project_env': 'BUILD_SPECIFIC_GCLOUD_PROJECT',
     # A dictionary you want to inject into your test. Don't put any
     # secrets here. These values will override predefined values.
     "envs": {
-        "GA_TEST_PROPERTY_ID": "222596558",
-        "GA_TEST_ACCOUNT_ID": "123",
-        "GA_TEST_USER_LINK_ID": "123",
-        "GA_TEST_ANDROID_APP_DATA_STREAM_ID": "123",
-        "GA_TEST_IOS_APP_DATA_STREAM_ID": "123",
-        "GA_TEST_WEB_DATA_STREAM_ID": "123",
+        "GA_TEST_PROPERTY_ID": "276206997",
+        "GA_TEST_ACCOUNT_ID": "199820965",
+        "GA_TEST_USER_LINK_ID": "103401743041912607932",
+        "GA_TEST_PROPERTY_USER_LINK_ID": "105231969274497648555",
+        "GA_TEST_ANDROID_APP_DATA_STREAM_ID": "2828100949",
+        "GA_TEST_IOS_APP_DATA_STREAM_ID": "2828089289",
+        "GA_TEST_WEB_DATA_STREAM_ID": "2828068992",
     },
 }
diff --git a/google-analytics-admin/properties_firebase_links_create.py b/google-analytics-admin/properties_firebase_links_create.py
index d259612..843179e 100644
--- a/google-analytics-admin/properties_firebase_links_create.py
+++ b/google-analytics-admin/properties_firebase_links_create.py
@@ -49,10 +49,7 @@ def create_firebase_link(property_id, firebase_project_id):
     client = AnalyticsAdminServiceClient()
     firebase_link = client.create_firebase_link(
         parent=f"properties/{property_id}",
-        firebase_link=FirebaseLink(
-            project=f"projects/{firebase_project_id}",
-            maximum_user_access="READ_AND_ANALYZE",
-        ),
+        firebase_link=FirebaseLink(project=f"projects/{firebase_project_id}"),
     )
 
     print("Result:")
diff --git a/google-analytics-admin/properties_firebase_links_list.py b/google-analytics-admin/properties_firebase_links_list.py
index 0d5c2f1..560363c 100644
--- a/google-analytics-admin/properties_firebase_links_list.py
+++ b/google-analytics-admin/properties_firebase_links_list.py
@@ -22,7 +22,6 @@
 """
 # [START analyticsadmin_properties_firebase_links_list]
 from google.analytics.admin import AnalyticsAdminServiceClient
-from google.analytics.admin_v1alpha.types import MaximumUserAccess
 
 
 def run_sample():
@@ -49,10 +48,6 @@ def print_firebase_link(firebase_link):
     """Prints the Firebase link details."""
     print(f"Resource name: {firebase_link.name}")
     print(f"Firebase project: {firebase_link.project}")
-    print(
-        f"Maximum user access to the GA4 property: "
-        f"{MaximumUserAccess(firebase_link.maximum_user_access).name}"
-    )
     print(f"Create time: {firebase_link.create_time}")
 
 
diff --git a/google-analytics-admin/properties_firebase_links_update.py b/google-analytics-admin/properties_firebase_links_update.py
deleted file mode 100644
index 085f74d..0000000
--- a/google-analytics-admin/properties_firebase_links_update.py
+++ /dev/null
@@ -1,71 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2021 Google Inc. All Rights Reserved.
-#
-# 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.
-
-"""Google Analytics Admin API sample application which updates the Firebase
-link on the specified Google Analytics 4 property.
-
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.firebaseLinks/update
-for more information.
-"""
-# [START analyticsadmin_properties_firebase_links_update]
-from google.analytics.admin import AnalyticsAdminServiceClient
-from google.analytics.admin_v1alpha.types import FirebaseLink
-from google.protobuf.field_mask_pb2 import FieldMask
-
-
-def run_sample():
-    """Runs the sample."""
-
-    # !!! ATTENTION !!!
-    #  Running this sample may change/delete your Google Analytics account
-    #  configuration. Make sure to not use the Google Analytics property ID from
-    #  your production environment below.
-
-    # TODO(developer): Replace this variable with your Google Analytics 4
-    #  property ID (e.g. "123456") before running the sample.
-    property_id = "YOUR-GA4-PROPERTY-ID"
-
-    # TODO(developer): Replace this variable with your Firebase link ID
-    #  (e.g. "123456") before running the sample.
-    firebase_link_id = "YOUR-FIREBASE-LINK-ID"
-
-    update_firebase_link(property_id, firebase_link_id)
-
-
-def update_firebase_link(property_id, firebase_link_id):
-    """Updates the Firebase link."""
-    client = AnalyticsAdminServiceClient()
-    # This call updates the maximum user access to the GA4 property of the
-    # Firebase link as indicated by the value of the `update_mask` field.
-    # The Firebase link to update is specified in the `name` field of the
-    # `FirebaseLink` instance.
-    firebase_link = client.update_firebase_link(
-        firebase_link=FirebaseLink(
-            name=f"properties/{property_id}/firebaseLinks/{firebase_link_id}",
-            maximum_user_access="EDITOR_WITHOUT_LINK_MANAGEMENT",
-        ),
-        update_mask=FieldMask(paths=["maximum_user_access"]),
-    )
-
-    print("Result:")
-    print(firebase_link)
-
-
-# [END analyticsadmin_properties_firebase_links_update]
-
-
-if __name__ == "__main__":
-    run_sample()
diff --git a/google-analytics-admin/properties_firebase_links_update_test.py b/google-analytics-admin/properties_firebase_links_update_test.py
deleted file mode 100644
index dc07fb6..0000000
--- a/google-analytics-admin/properties_firebase_links_update_test.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-import pytest
-
-import properties_firebase_links_update
-
-
-FAKE_PROPERTY_ID = "1"
-FAKE_FIREBASE_LINK_ID = "1"
-
-
-def test_properties_firebase_links_update():
-    # This test ensures that the call is valid and reaches the server, even
-    # though the operation does not succeed due to permission error.
-    with pytest.raises(Exception, match="403 The caller does not have permission"):
-        properties_firebase_links_update.update_firebase_link(
-            FAKE_PROPERTY_ID, FAKE_FIREBASE_LINK_ID
-        )
diff --git a/google-analytics-admin/properties_google_ads_links_list.py b/google-analytics-admin/properties_google_ads_links_list.py
index 1aa7e06..7109f1e 100644
--- a/google-analytics-admin/properties_google_ads_links_list.py
+++ b/google-analytics-admin/properties_google_ads_links_list.py
@@ -50,7 +50,7 @@ def print_google_ads_link(google_ads_link):
     print(f"Google Ads customer ID: {google_ads_link.customer_id}")
     print(f"Can manage clients: {google_ads_link.can_manage_clients}")
     print(f"Ads personalization enabled: {google_ads_link.ads_personalization_enabled}")
-    print(f"Email address of the link creator: {google_ads_link.email_address}")
+    print(f"Email address of the link creator: {google_ads_link.creator_email_address}")
     print(f"Create time: {google_ads_link.create_time}")
     print(f"Update time: {google_ads_link.update_time}")
 
diff --git a/google-analytics-admin/properties_google_ads_links_list_test.py b/google-analytics-admin/properties_google_ads_links_list_test.py
index 1f850a4..5396da0 100644
--- a/google-analytics-admin/properties_google_ads_links_list_test.py
+++ b/google-analytics-admin/properties_google_ads_links_list_test.py
@@ -19,7 +19,7 @@
 TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
 
 
-def test_properties_firebase_links_list(capsys):
+def test_properties_google_ads_links_list(capsys):
     properties_google_ads_links_list.list_google_ads_links(TEST_PROPERTY_ID)
     out, _ = capsys.readouterr()
     assert "Result" in out
diff --git a/google-analytics-admin/properties_ios_app_data_streams_get.py b/google-analytics-admin/properties_ios_app_data_streams_get.py
index 02b775d..50a617a 100644
--- a/google-analytics-admin/properties_ios_app_data_streams_get.py
+++ b/google-analytics-admin/properties_ios_app_data_streams_get.py
@@ -53,7 +53,7 @@ def print_ios_app_data_stream(ios_app_data_stream):
     print(f"Resource name: {ios_app_data_stream.name}")
     print(f"Display name: {ios_app_data_stream.display_name}")
     print(f"Firebase app ID: {ios_app_data_stream.firebase_app_id}")
-    print(f"Bundle ID: {ios_app_data_stream.bundleId}")
+    print(f"Bundle ID: {ios_app_data_stream.bundle_id}")
     print(f"Create time: {ios_app_data_stream.create_time}")
     print(f"Update time: {ios_app_data_stream.update_time}")
 
diff --git a/google-analytics-admin/properties_user_links_batch_get_test.py b/google-analytics-admin/properties_user_links_batch_get_test.py
index a862070..4c8c4bb 100644
--- a/google-analytics-admin/properties_user_links_batch_get_test.py
+++ b/google-analytics-admin/properties_user_links_batch_get_test.py
@@ -17,7 +17,7 @@
 import properties_user_links_batch_get
 
 TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
-TEST_USER_LINK_ID = os.getenv("GA_USER_LINK_ID")
+TEST_USER_LINK_ID = os.getenv("GA_TEST_PROPERTY_USER_LINK_ID")
 
 
 def test_properties_user_links_batch_get(capsys):
diff --git a/google-analytics-admin/properties_user_links_get_test.py b/google-analytics-admin/properties_user_links_get_test.py
index dca1ca8..14c9970 100644
--- a/google-analytics-admin/properties_user_links_get_test.py
+++ b/google-analytics-admin/properties_user_links_get_test.py
@@ -17,7 +17,7 @@
 import properties_user_links_get
 
 TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
-TEST_USER_LINK_ID = os.getenv("GA_USER_LINK_ID")
+TEST_USER_LINK_ID = os.getenv("GA_TEST_PROPERTY_USER_LINK_ID")
 
 
 def test_properties_user_links_get(capsys):
diff --git a/google-analytics-admin/properties_web_data_streams_get_enhanced_measurement_settings.py b/google-analytics-admin/properties_web_data_streams_get_enhanced_measurement_settings.py
deleted file mode 100644
index 65d7225..0000000
--- a/google-analytics-admin/properties_web_data_streams_get_enhanced_measurement_settings.py
+++ /dev/null
@@ -1,79 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-"""Google Analytics Admin API sample application which prints the enhanced
-measurement settings for the web stream.
-
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.webDataStreams/getEnhancedMeasurementSettings
-for more information.
-"""
-# [START analyticsadmin_properties_web_data_streams_get_enhanced_measurement_settings]
-from google.analytics.admin import AnalyticsAdminServiceClient
-
-
-def run_sample():
-    """Runs the sample."""
-    # TODO(developer): Replace this variable with your Google Analytics 4
-    #  property ID (e.g. "123456") before running the sample.
-    property_id = "YOUR-GA4-PROPERTY-ID"
-
-    # TODO(developer): Replace this variable with your web data stream ID
-    #  (e.g. "123456") before running the sample.
-    stream_id = "YOUR-WEB-DATA-STREAM-ID"
-
-    get_enhanced_measurement_settings(property_id, stream_id)
-
-
-def get_enhanced_measurement_settings(property_id, stream_id):
-    """Retrieves the enhanced measurement settings for the web stream."""
-    client = AnalyticsAdminServiceClient()
-    enhanced_measurement_settings = client.get_enhanced_measurement_settings(
-        name=f"properties/{property_id}/webDataStreams/{stream_id}/enhancedMeasurementSettings"
-    )
-
-    print("Result:")
-    print_enhanced_measurement_settings(enhanced_measurement_settings)
-
-
-def print_enhanced_measurement_settings(enhanced_measurement_settings):
-    """Prints the enhanced measurement settings for a web stream."""
-    print(f"Resource name: {enhanced_measurement_settings.name}")
-    print(f"Stream enabled: {enhanced_measurement_settings.streamEnabled}")
-    print(f"Page views enabled: {enhanced_measurement_settings.pageViewsEnabled}")
-    print(f"Scrolls enabled: {enhanced_measurement_settings.scrollsEnabled}")
-    print(
-        f"Outbound clicks enabled: {enhanced_measurement_settings.outboundClicksEnabled}"
-    )
-    print(f"Site search enabled: {enhanced_measurement_settings.siteSearchEnabled}")
-    print(
-        f"Video engagement enabled: {enhanced_measurement_settings.videoEngagementEnabled}"
-    )
-    print(
-        f"File downloads enabled: {enhanced_measurement_settings.fileDownloadsEnabled}"
-    )
-    print(f"Page loads enabled: {enhanced_measurement_settings.pageLoadsEnabled}")
-    print(f"Page changes enabled: {enhanced_measurement_settings.pageChangesEnabled}")
-    print(
-        f"Search query parameter: {enhanced_measurement_settings.searchQueryParameter}"
-    )
-    print(f"Uri query parameter: {enhanced_measurement_settings.uriQueryParameter}")
-
-
-# [END analyticsadmin_properties_web_data_streams_get_enhanced_measurement_settings]
-
-
-if __name__ == "__main__":
-    run_sample()
diff --git a/google-analytics-admin/properties_web_data_streams_get_enhanced_measurement_settings_test.py b/google-analytics-admin/properties_web_data_streams_get_enhanced_measurement_settings_test.py
deleted file mode 100644
index 34d7ccd..0000000
--- a/google-analytics-admin/properties_web_data_streams_get_enhanced_measurement_settings_test.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-import os
-
-import properties_web_data_streams_get_enhanced_measurement_settings
-
-
-TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
-TEST_WEB_DATA_STREAM_ID = os.getenv("GA_TEST_WEB_DATA_STREAM_ID")
-
-
-def test_properties_web_data_streams_get_enhanced_measurement_settings(capsys):
-    properties_web_data_streams_get_enhanced_measurement_settings.get_enhanced_measurement_settings(
-        TEST_PROPERTY_ID, TEST_WEB_DATA_STREAM_ID
-    )
-    out, _ = capsys.readouterr()
-    assert "Result" in out
diff --git a/google-analytics-admin/properties_web_data_streams_update_enhanced_measurement_settings.py b/google-analytics-admin/properties_web_data_streams_update_enhanced_measurement_settings.py
deleted file mode 100644
index f02e1fb..0000000
--- a/google-analytics-admin/properties_web_data_streams_update_enhanced_measurement_settings.py
+++ /dev/null
@@ -1,73 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-"""Google Analytics Admin API sample application which updates the enhanced
-measurement settings for the web stream.
-
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.webDataStreams/updateEnhancedMeasurementSettings
-for more information.
-"""
-# [START analyticsadmin_properties_web_data_streams_update_enhanced_measurement_settings]
-from google.analytics.admin import AnalyticsAdminServiceClient
-from google.analytics.admin_v1alpha.types import EnhancedMeasurementSettings
-from google.protobuf.field_mask_pb2 import FieldMask
-
-
-
-def run_sample():
-    """Runs the sample."""
-
-    # !!! ATTENTION !!!
-    #  Running this sample may change/delete your Google Analytics account
-    #  configuration. Make sure to not use the Google Analytics property ID from
-    #  your production environment below.
-
-    # TODO(developer): Replace this variable with your Google Analytics 4
-    #  property ID (e.g. "123456") before running the sample.
-    property_id = "YOUR-GA4-PROPERTY-ID"
-
-    # TODO(developer): Replace this variable with your web data stream ID
-    #  (e.g. "123456") before running the sample.
-    stream_id = "YOUR-WEB-DATA-STREAM-ID"
-
-    update_enhanced_measurement_settings(property_id, stream_id)
-
-
-def update_enhanced_measurement_settings(property_id, stream_id):
-    """Updates the enhanced measurement settings for the web stream."""
-    client = AnalyticsAdminServiceClient()
-    # This call updates the `streamEnabled`, `fileDownloadsEnabled` measurement
-    # settings of the web data stream, as indicated by the value of the
-    # `update_mask` field. The web data stream to update is specified in the
-    # `name` field of the `EnhancedMeasurementSettings` instance.
-    enhanced_measurement_settings = client.update_enhanced_measurement_settings(
-        enhanced_measurement_settings=EnhancedMeasurementSettings(
-            name=f"properties/{property_id}/webDataStreams/{stream_id}/enhancedMeasurementSettings",
-            stream_enabled=False,
-            file_downloads_enabled=False,
-        ),
-        update_mask=FieldMask(paths=["stream_enabled", "file_downloads_enabled"]),
-    )
-
-    print("Result:")
-    print(enhanced_measurement_settings)
-
-
-# [END analyticsadmin_properties_web_data_streams_update_enhanced_measurement_settings]
-
-
-if __name__ == "__main__":
-    run_sample()
diff --git a/google-analytics-admin/properties_web_data_streams_update_enhanced_measurement_settings_test.py b/google-analytics-admin/properties_web_data_streams_update_enhanced_measurement_settings_test.py
deleted file mode 100644
index d692a0e..0000000
--- a/google-analytics-admin/properties_web_data_streams_update_enhanced_measurement_settings_test.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-import pytest
-
-import properties_web_data_streams_update_enhanced_measurement_settings
-
-
-FAKE_PROPERTY_ID = "1"
-FAKE_STREAM_ID = "1"
-
-
-def test_properties_web_data_streams_update():
-    # This test ensures that the call is valid and reaches the server, even
-    # though the operation does not succeed due to permission error.
-    with pytest.raises(Exception, match="403 The caller does not have permission"):
-        properties_web_data_streams_update_enhanced_measurement_settings.update_enhanced_measurement_settings(
-            FAKE_PROPERTY_ID, FAKE_STREAM_ID
-        )
diff --git a/google-analytics-admin/quickstart.py b/google-analytics-admin/quickstart.py
index 5653af4..0e22289 100644
--- a/google-analytics-admin/quickstart.py
+++ b/google-analytics-admin/quickstart.py
@@ -49,20 +49,24 @@
   pip install google-analytics-admin
 """
 
+
 # [START ga_admin_list_accounts]
 def list_accounts():
-  """Lists the available Google Analytics accounts."""
-  from google.analytics.admin import AnalyticsAdminServiceClient
-  # Using a default constructor instructs the client to use the credentials
-  # specified in GOOGLE_APPLICATION_CREDENTIALS environment variable.
-  client = AnalyticsAdminServiceClient()
-
-  # Displays the configuration information for all Google Analytics accounts
-  # available to the authenticated user.
-  for account in client.list_accounts():
-    print(account)
+    """Lists the available Google Analytics accounts."""
+    from google.analytics.admin import AnalyticsAdminServiceClient
+
+    # Using a default constructor instructs the client to use the credentials
+    # specified in GOOGLE_APPLICATION_CREDENTIALS environment variable.
+    client = AnalyticsAdminServiceClient()
+
+    # Displays the configuration information for all Google Analytics accounts
+    # available to the authenticated user.
+    for account in client.list_accounts():
+        print(account)
+
+
 # [END ga_admin_list_accounts]
 
 
 if __name__ == "__main__":
-  list_accounts()
+    list_accounts()
diff --git a/google-analytics-admin/requirements-test.txt b/google-analytics-admin/requirements-test.txt
new file mode 100644
index 0000000..9299a7a
--- /dev/null
+++ b/google-analytics-admin/requirements-test.txt
@@ -0,0 +1 @@
+pytest==6.2.5
\ No newline at end of file

From fa9385f07ad778a279c903fd0e94ed7f05e4e017 Mon Sep 17 00:00:00 2001
From: ikuleshov <ikuleshov@google.com>
Date: Thu, 7 Oct 2021 06:41:47 -0400
Subject: [PATCH 042/213] docs: add samples for
 accounts.search_change_history_events() method (#137)

* docs: add Admin API samples for account management methods

* update copyright and remove redundant run_sample method

* update noxfile template and set enforce_type_hints=False

* add type annotations

* docs: add Admin API samples for account user link management methods

* fix the copyright string, avoid importing functions from other samples

* docs: add samples for Google Analytics property management methods

* add samples for accounts.search_change_hostory_events method

* fix broken documentation urls

* fix imports

Co-authored-by: Anthonios Partheniou <partheniou@google.com>
---
 .../accounts_search_change_history_events.py  | 124 ++++++++++++++++++
 ...ounts_search_change_history_events_test.py |  28 ++++
 google-analytics-admin/accounts_update.py     |   2 +-
 .../accounts_user_links_update.py             |   2 +-
 4 files changed, 154 insertions(+), 2 deletions(-)
 create mode 100644 google-analytics-admin/accounts_search_change_history_events.py
 create mode 100644 google-analytics-admin/accounts_search_change_history_events_test.py

diff --git a/google-analytics-admin/accounts_search_change_history_events.py b/google-analytics-admin/accounts_search_change_history_events.py
new file mode 100644
index 0000000..38f0fec
--- /dev/null
+++ b/google-analytics-admin/accounts_search_change_history_events.py
@@ -0,0 +1,124 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which displays the change
+history for the Google Analytics account.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts/searchChangeHistoryEvents
+for more information.
+"""
+# [START analyticsadmin_properties_conversion_events_create]
+from datetime import datetime
+from datetime import timedelta
+
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin import SearchChangeHistoryEventsRequest
+from google.analytics.admin_v1alpha.types import ActionType
+from google.analytics.admin_v1alpha.types import ActorType
+
+from google.protobuf.timestamp_pb2 import Timestamp
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account ID (e.g. "123456") before running the sample.
+    account_id = "YOUR-GA-ACCOUNT-ID"
+
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+    search_change_history_events(account_id, property_id)
+
+
+def search_change_history_events(account_id: str, property_id: str):
+    """Lists the change history events for the Google Analytics 4 property
+  within the specified date range."""
+    client = AnalyticsAdminServiceClient()
+    # Create a timestamp object and subtract 7 days from the current date/time.
+    earliest_change_time = Timestamp()
+    earliest_change_time.FromDatetime(datetime.now() - timedelta(days=7))
+
+    results = client.search_change_history_events(
+        SearchChangeHistoryEventsRequest(
+            account=f"accounts/{account_id}",
+            property=f"properties/{property_id}",
+            action=["CREATED", "UPDATED"],
+            earliest_change_time=earliest_change_time,
+        )
+    )
+
+    print("Result:")
+    for event in results:
+        print(f"Event ID: {event.id}")
+        print(f"Change time: {event.change_time}")
+        print(f"Actor type: {ActorType(event.actor_type).name}")
+        print(f"User actor e-mail: {event.user_actor_email}")
+        print(f"Changes filtered: {event.changes_filtered}")
+        for change in event.changes:
+            print(" Change details")
+            print(f"  Resource name: {change.resource}")
+            print(f"  Action: {ActionType(change.action).name}")
+            print("  Resource before change: ")
+            print_resource(change.resource_before_change)
+            print("  Resource after change: ")
+            print_resource(change.resource_after_change)
+        print()
+
+
+def print_resource(resource):
+    """Prints the change history resource."""
+    # Detect the type of the resource by checking value of a oneof field.
+    if resource.property:
+        print("  Property resource")
+    elif resource.account:
+        print("  Account resource")
+    elif resource.web_data_stream:
+        print("  WebDataStream resource")
+    elif resource.android_app_data_stream:
+        print("  AndroidAppDataStream resource")
+    elif resource.ios_app_data_stream:
+        print("  IosAppDataStream resource")
+    elif resource.firebase_link:
+        print("  FirebaseLink resource")
+    elif resource.google_ads_link:
+        print("  GoogleAdsLink resource")
+    elif resource.google_signals_settings:
+        print("  GoogleSignalsSettings resource")
+    elif resource.display_video_360_advertiser_link:
+        print("  DisplayVideo360AdvertiserLink resource")
+    elif resource.display_video_360_advertiser_link_proposal:
+        print("  DisplayVideo360AdvertiserLinkProposal resource")
+    elif resource.conversion_event:
+        print("  ConversionEvent resource")
+    elif resource.measurement_protocol_secret:
+        print("  MeasurementProtocolSecret resource")
+    elif resource.custom_dimension:
+        print("  CustomDimension resource")
+    elif resource.custom_metric:
+        print("  CustomMetric resource")
+    elif resource.data_retention_settings:
+        print("  DataRetentionSettings resource")
+    else:
+        print("  Resource not set")
+    print(f"  Resource value: {resource}")
+    print()
+
+
+# [END analyticsadmin_properties_conversion_events_create]
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/accounts_search_change_history_events_test.py b/google-analytics-admin/accounts_search_change_history_events_test.py
new file mode 100644
index 0000000..9a3e63c
--- /dev/null
+++ b/google-analytics-admin/accounts_search_change_history_events_test.py
@@ -0,0 +1,28 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import os
+
+import accounts_search_change_history_events
+
+TEST_ACCOUNT_ID = os.getenv("GA_TEST_ACCOUNT_ID")
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+
+
+def test_accounts_search_change_history_events(capsys):
+    accounts_search_change_history_events.search_change_history_events(
+        TEST_ACCOUNT_ID, TEST_PROPERTY_ID
+    )
+    out, _ = capsys.readouterr()
+    assert "Result" in out
diff --git a/google-analytics-admin/accounts_update.py b/google-analytics-admin/accounts_update.py
index e3ae56e..b87142c 100644
--- a/google-analytics-admin/accounts_update.py
+++ b/google-analytics-admin/accounts_update.py
@@ -17,7 +17,7 @@
 """Google Analytics Admin API sample application which updates the Google
 Analytics account.
 
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts/update
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts/patch
 for more information.
 """
 # [START analyticsadmin_accounts_update]
diff --git a/google-analytics-admin/accounts_user_links_update.py b/google-analytics-admin/accounts_user_links_update.py
index 1a9424a..868403f 100644
--- a/google-analytics-admin/accounts_user_links_update.py
+++ b/google-analytics-admin/accounts_user_links_update.py
@@ -17,7 +17,7 @@
 """Google Analytics Admin API sample application which updates the account
 user link.
 
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts.userLinks/update
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts.userLinks/patch
 for more information.
 """
 # [START analyticsadmin_accounts_user_links_update]

From 93cafd1e0e7199b77fcf9916135574a140dda890 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Thu, 7 Oct 2021 14:18:51 +0200
Subject: [PATCH 043/213] chore(deps): update all dependencies (#127)

Co-authored-by: Anthonios Partheniou <partheniou@google.com>
---
 google-analytics-admin/requirements.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index d384ab2..09107d7 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-admin==0.4.3
-google-auth-oauthlib==0.4.5
\ No newline at end of file
+google-analytics-admin==0.5.0
+google-auth-oauthlib==0.4.6
\ No newline at end of file

From 105088c04faa0cee21afc1407a9d06dce9da19c6 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Thu, 7 Oct 2021 14:27:12 +0200
Subject: [PATCH 044/213] chore(deps): update dependency google-analytics-admin
 to v0.5.1 (#143)

---
 google-analytics-admin/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index 09107d7..497883f 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-admin==0.5.0
+google-analytics-admin==0.5.1
 google-auth-oauthlib==0.4.6
\ No newline at end of file

From 49b13ad3113bd44904253d8f53bd123831151f4d Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Thu, 7 Oct 2021 15:58:27 +0200
Subject: [PATCH 045/213] chore(deps): update dependency google-analytics-admin
 to v0.5.2 (#144)

---
 google-analytics-admin/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index 497883f..8a584d9 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-admin==0.5.1
+google-analytics-admin==0.5.2
 google-auth-oauthlib==0.4.6
\ No newline at end of file

From 9ae050056c2a1bff8ade45817af0e272df1b8f68 Mon Sep 17 00:00:00 2001
From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com>
Date: Fri, 8 Oct 2021 17:18:42 +0000
Subject: [PATCH 046/213] chore(python): Add kokoro configs for python 3.10
 samples testing (#148)

---
 google-analytics-data/noxfile.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/noxfile.py b/google-analytics-data/noxfile.py
index 1fd8956..93a9122 100644
--- a/google-analytics-data/noxfile.py
+++ b/google-analytics-data/noxfile.py
@@ -87,7 +87,7 @@ def get_pytest_env_vars() -> Dict[str, str]:
 
 # DO NOT EDIT - automatically generated.
 # All versions used to test samples.
-ALL_VERSIONS = ["3.6", "3.7", "3.8", "3.9"]
+ALL_VERSIONS = ["3.6", "3.7", "3.8", "3.9", "3.10"]
 
 # Any default versions that should be ignored.
 IGNORED_VERSIONS = TEST_CONFIG["ignored_versions"]

From 52bf4ac12adb5455e52760c7498b419c4a545d6b Mon Sep 17 00:00:00 2001
From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com>
Date: Fri, 8 Oct 2021 17:20:36 +0000
Subject: [PATCH 047/213] chore(python): Add kokoro configs for python 3.10
 samples testing (#147)

---
 google-analytics-admin/noxfile.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/noxfile.py b/google-analytics-admin/noxfile.py
index 1fd8956..93a9122 100644
--- a/google-analytics-admin/noxfile.py
+++ b/google-analytics-admin/noxfile.py
@@ -87,7 +87,7 @@ def get_pytest_env_vars() -> Dict[str, str]:
 
 # DO NOT EDIT - automatically generated.
 # All versions used to test samples.
-ALL_VERSIONS = ["3.6", "3.7", "3.8", "3.9"]
+ALL_VERSIONS = ["3.6", "3.7", "3.8", "3.9", "3.10"]
 
 # Any default versions that should be ignored.
 IGNORED_VERSIONS = TEST_CONFIG["ignored_versions"]

From 8fae211b0ce25162a42fc04be9dc30f7a96dd2e7 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Mon, 11 Oct 2021 20:49:53 +0200
Subject: [PATCH 048/213] chore(deps): update dependency google-analytics-data
 to v0.9.0 (#151)

---
 google-analytics-data/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index 3d7a7ed..eac014f 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-data==0.8.1
+google-analytics-data==0.9.0
 google-auth-oauthlib==0.4.6
\ No newline at end of file

From e60fc1605784d2db3b3a57b0b91976296f3abd87 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Tue, 12 Oct 2021 19:51:24 +0200
Subject: [PATCH 049/213] chore(deps): update dependency google-analytics-admin
 to v0.6.0 (#149)

---
 google-analytics-admin/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index 8a584d9..8ac052d 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-admin==0.5.2
+google-analytics-admin==0.6.0
 google-auth-oauthlib==0.4.6
\ No newline at end of file

From bd4f6efba751a1cd34763ff102eeb89bb47a1be0 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Tue, 19 Oct 2021 03:40:42 +0200
Subject: [PATCH 050/213] chore(deps): update dependency google-analytics-admin
 to v0.7.0 (#154)

---
 google-analytics-admin/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index 8ac052d..8668c1e 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-admin==0.6.0
+google-analytics-admin==0.7.0
 google-auth-oauthlib==0.4.6
\ No newline at end of file

From ab5966b7712144974f73e4d613703d4bcbe7ea50 Mon Sep 17 00:00:00 2001
From: ikuleshov <ikuleshov@google.com>
Date: Tue, 19 Oct 2021 04:10:23 -0400
Subject: [PATCH 051/213] docs(samples): add samples for Conversion Event
 management methods (#153)

* update test configuration

* remove custom noxfile configs for now

* remove MaximumUserAccess rom sample

* add comment in noxfile_config.py

* run blacken session

* lint

* add pytest

* Update noxfile_config.py

* Update noxfile_config.py

* delete enhanced measurement settings samples as this functionality is no longer supported in v1alpha

* fix the samples tests

* do not use the `maximum_user_access` field and `update` operation in properties.firebase_links tests as this is no longer supported in v1alpha

* use `creator_email_address` instead of `email_address` field in properties.google_ads_links_list() test as the field has been renamed in v1alpha

* fix the samples test

* add samples for Conversion Event management methods

* add samples for Conversion Event management methods

Co-authored-by: Anthonios Partheniou <partheniou@google.com>
---
 google-analytics-admin/noxfile_config.py      |  1 +
 .../properties_conversion_events_create.py    | 62 +++++++++++++++++++
 ...roperties_conversion_events_create_test.py | 26 ++++++++
 .../properties_conversion_events_delete.py    | 60 ++++++++++++++++++
 ...roperties_conversion_events_delete_test.py | 29 +++++++++
 .../properties_conversion_events_get.py       | 59 ++++++++++++++++++
 .../properties_conversion_events_get_test.py  | 28 +++++++++
 .../properties_conversion_events_list.py      | 55 ++++++++++++++++
 .../properties_conversion_events_list_test.py | 25 ++++++++
 9 files changed, 345 insertions(+)
 create mode 100644 google-analytics-admin/properties_conversion_events_create.py
 create mode 100644 google-analytics-admin/properties_conversion_events_create_test.py
 create mode 100644 google-analytics-admin/properties_conversion_events_delete.py
 create mode 100644 google-analytics-admin/properties_conversion_events_delete_test.py
 create mode 100644 google-analytics-admin/properties_conversion_events_get.py
 create mode 100644 google-analytics-admin/properties_conversion_events_get_test.py
 create mode 100644 google-analytics-admin/properties_conversion_events_list.py
 create mode 100644 google-analytics-admin/properties_conversion_events_list_test.py

diff --git a/google-analytics-admin/noxfile_config.py b/google-analytics-admin/noxfile_config.py
index f218482..3c8359b 100644
--- a/google-analytics-admin/noxfile_config.py
+++ b/google-analytics-admin/noxfile_config.py
@@ -15,5 +15,6 @@
         "GA_TEST_ANDROID_APP_DATA_STREAM_ID": "2828100949",
         "GA_TEST_IOS_APP_DATA_STREAM_ID": "2828089289",
         "GA_TEST_WEB_DATA_STREAM_ID": "2828068992",
+        "GA_TEST_CONVERSION_EVENT_ID": "2719963095"
     },
 }
diff --git a/google-analytics-admin/properties_conversion_events_create.py b/google-analytics-admin/properties_conversion_events_create.py
new file mode 100644
index 0000000..4c00dd1
--- /dev/null
+++ b/google-analytics-admin/properties_conversion_events_create.py
@@ -0,0 +1,62 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which creates a conversion
+event for the Google Analytics 4 property.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.conversionEvents/create
+for more information.
+"""
+# [START analyticsadmin_properties_conversion_events_create]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha import ConversionEvent
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics account ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    create_conversion_event(property_id)
+
+
+def create_conversion_event(property_id):
+    """Creates a conversion event for the Google Analytics 4 property."""
+    client = AnalyticsAdminServiceClient()
+    conversion_event = client.create_conversion_event(
+        parent=f"properties/{property_id}",
+        conversion_event=ConversionEvent(event_name="test_purchase"),
+    )
+
+    print("Result:")
+    print(f"Resource name: {conversion_event.name}")
+    print(f"Event name: {conversion_event.event_name}")
+    print(f"Create time: {conversion_event.create_time}")
+    print(f"Deletable: {conversion_event.deletable}")
+    print(f"Custom: {conversion_event.custom}")
+
+
+# [END analyticsadmin_properties_conversion_events_create]
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_conversion_events_create_test.py b/google-analytics-admin/properties_conversion_events_create_test.py
new file mode 100644
index 0000000..7e2c1ad
--- /dev/null
+++ b/google-analytics-admin/properties_conversion_events_create_test.py
@@ -0,0 +1,26 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import properties_conversion_events_create
+
+FAKE_PROPERTY_ID = "1"
+
+
+def test_properties_conversion_events_create():
+    # This test ensures that the call is valid and reaches the server, even
+    # though the operation does not succeed due to permission error.
+    with pytest.raises(Exception, match="403 The caller does not have permission"):
+        properties_conversion_events_create.create_conversion_event(FAKE_PROPERTY_ID)
diff --git a/google-analytics-admin/properties_conversion_events_delete.py b/google-analytics-admin/properties_conversion_events_delete.py
new file mode 100644
index 0000000..19d2fc3
--- /dev/null
+++ b/google-analytics-admin/properties_conversion_events_delete.py
@@ -0,0 +1,60 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which deletes a conversion
+event for the Google Analytics 4 property.
+
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.conversionEvents/delete
+for more information.
+"""
+# [START analyticsadmin_properties_conversion_events_delete]
+from google.analytics.admin import AnalyticsAdminServiceClient
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics property ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with your conversion event ID
+    #  (e.g. "123456") before running the sample.
+    conversion_event_id = "YOUR-CONVERSION-EVENT-ID"
+
+    delete_conversion_event(property_id, conversion_event_id)
+
+
+def delete_conversion_event(property_id, conversion_event_id):
+    """Deletes the conversion event for the Google Analytics 4 property."""
+    client = AnalyticsAdminServiceClient()
+    client.delete_conversion_event(
+        name=f"properties/{property_id}/conversionEvents/{conversion_event_id}"
+    )
+    print("Conversion event deleted")
+
+
+# [END analyticsadmin_properties_conversion_events_delete]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_conversion_events_delete_test.py b/google-analytics-admin/properties_conversion_events_delete_test.py
new file mode 100644
index 0000000..ba42e4e
--- /dev/null
+++ b/google-analytics-admin/properties_conversion_events_delete_test.py
@@ -0,0 +1,29 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import properties_conversion_events_delete
+
+FAKE_PROPERTY_ID = "1"
+FAKE_CONVERSION_EVENT_ID = "1"
+
+
+def test_properties_conversion_events_delete():
+    # This test ensures that the call is valid and reaches the server, even
+    # though the operation does not succeed due to permission error.
+    with pytest.raises(Exception, match="403 The caller does not have permission"):
+        properties_conversion_events_delete.delete_conversion_event(
+            FAKE_PROPERTY_ID, FAKE_CONVERSION_EVENT_ID
+        )
diff --git a/google-analytics-admin/properties_conversion_events_get.py b/google-analytics-admin/properties_conversion_events_get.py
new file mode 100644
index 0000000..0c74a39
--- /dev/null
+++ b/google-analytics-admin/properties_conversion_events_get.py
@@ -0,0 +1,59 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which prints the conversion
+event details.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.conversionEvents/get
+for more information.
+"""
+# [START analyticsadmin_properties_conversion_events_get]
+from google.analytics.admin import AnalyticsAdminServiceClient
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with your conversion event ID
+    #  (e.g. "123456") before running the sample.
+    conversion_event_id = "YOUR-CONVERSION-EVENT-ID"
+
+    get_conversion_event(property_id, conversion_event_id)
+
+
+def get_conversion_event(property_id, conversion_event_id):
+    """Retrieves the details for the conversion event."""
+    client = AnalyticsAdminServiceClient()
+    conversion_event = client.get_conversion_event(
+        name=f"properties/{property_id}/conversionEvents/{conversion_event_id}"
+    )
+
+    print("Result:")
+    print(f"Resource name: {conversion_event.name}")
+    print(f"Event name: {conversion_event.event_name}")
+    print(f"Create time: {conversion_event.create_time}")
+    print(f"Deletable: {conversion_event.deletable}")
+    print(f"Custom: {conversion_event.custom}")
+
+
+# [END analyticsadmin_properties_conversion_events_get]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_conversion_events_get_test.py b/google-analytics-admin/properties_conversion_events_get_test.py
new file mode 100644
index 0000000..5faac8d
--- /dev/null
+++ b/google-analytics-admin/properties_conversion_events_get_test.py
@@ -0,0 +1,28 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import os
+
+import properties_conversion_events_get
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+TEST_CONVERSION_EVENT_ID = os.getenv("GA_TEST_CONVERSION_EVENT_ID")
+
+
+def test_properties_conversion_events_get(capsys):
+    properties_conversion_events_get.get_conversion_event(
+        TEST_PROPERTY_ID, TEST_CONVERSION_EVENT_ID
+    )
+    out, _ = capsys.readouterr()
+    assert "Result" in out
diff --git a/google-analytics-admin/properties_conversion_events_list.py b/google-analytics-admin/properties_conversion_events_list.py
new file mode 100644
index 0000000..71a82af
--- /dev/null
+++ b/google-analytics-admin/properties_conversion_events_list.py
@@ -0,0 +1,55 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which lists conversion events
+for the Google Analytics 4 property.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.conversionEvents/list
+for more information.
+"""
+# [START analyticsadmin_properties_conversion_events_list]
+from google.analytics.admin import AnalyticsAdminServiceClient
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    list_conversion_events(property_id)
+
+
+def list_conversion_events(property_id):
+    """Lists conversion events for the Google Analytics 4 property."""
+    client = AnalyticsAdminServiceClient()
+    results = client.list_conversion_events(parent=f"properties/{property_id}")
+
+    print("Result:")
+    for conversion_event in results:
+        print(f"Resource name: {conversion_event.name}")
+        print(f"Event name: {conversion_event.event_name}")
+        print(f"Create time: {conversion_event.create_time}")
+        print(f"Deletable: {conversion_event.deletable}")
+        print(f"Custom: {conversion_event.custom}")
+        print()
+
+
+# [END analyticsadmin_properties_conversion_events_list]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_conversion_events_list_test.py b/google-analytics-admin/properties_conversion_events_list_test.py
new file mode 100644
index 0000000..e93405a
--- /dev/null
+++ b/google-analytics-admin/properties_conversion_events_list_test.py
@@ -0,0 +1,25 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import os
+
+import properties_conversion_events_list
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+
+
+def test_properties_conversion_events_list(capsys):
+    properties_conversion_events_list.list_conversion_events(TEST_PROPERTY_ID)
+    out, _ = capsys.readouterr()
+    assert "Result" in out

From 2d2d6a8ba0e1451b4ca52f53f8584c91dd409f55 Mon Sep 17 00:00:00 2001
From: ikuleshov <ikuleshov@google.com>
Date: Tue, 19 Oct 2021 06:28:56 -0400
Subject: [PATCH 052/213] docs: add samples for Measurement Protocol Secrets
 management methods (#152)

* update test configuration

* remove custom noxfile configs for now

* remove MaximumUserAccess rom sample

* add comment in noxfile_config.py

* run blacken session

* lint

* add pytest

* Update noxfile_config.py

* Update noxfile_config.py

* delete enhanced measurement settings samples as this functionality is no longer supported in v1alpha

* fix the samples tests

* do not use the `maximum_user_access` field and `update` operation in properties.firebase_links tests as this is no longer supported in v1alpha

* use `creator_email_address` instead of `email_address` field in properties.google_ads_links_list() test as the field has been renamed in v1alpha

* fix the samples test

* add samples for Measurement Protocol Secrets management methods

* add samples for Measurement Protocol Secrets management methods

* add samples for Measurement Protocol Secrets management methods

* Update samples/properties_web_data_streams_measurement_protocol_secrets_delete.py

Co-authored-by: Anthonios Partheniou <partheniou@google.com>

* Update samples/properties_web_data_streams_measurement_protocol_secrets_delete.py

Co-authored-by: Anthonios Partheniou <partheniou@google.com>

* Update samples/properties_web_data_streams_measurement_protocol_secrets_delete.py

Co-authored-by: Anthonios Partheniou <partheniou@google.com>

* Update samples/properties_web_data_streams_measurement_protocol_secrets_delete.py

Co-authored-by: Anthonios Partheniou <partheniou@google.com>

* Update samples/properties_web_data_streams_measurement_protocol_secrets_delete.py

Co-authored-by: Anthonios Partheniou <partheniou@google.com>

* Update samples/properties_web_data_streams_measurement_protocol_secrets_delete.py

Co-authored-by: Anthonios Partheniou <partheniou@google.com>

Co-authored-by: Anthonios Partheniou <partheniou@google.com>
---
 google-analytics-admin/noxfile_config.py      |  3 +
 ...ams_measurement_protocol_secrets_create.py | 67 ++++++++++++++++
 ...easurement_protocol_secrets_create_test.py | 30 ++++++++
 ...ams_measurement_protocol_secrets_delete.py | 64 +++++++++++++++
 ...easurement_protocol_secrets_delete_test.py | 31 ++++++++
 ...treams_measurement_protocol_secrets_get.py | 61 +++++++++++++++
 ...s_measurement_protocol_secrets_get_test.py | 29 +++++++
 ...reams_measurement_protocol_secrets_list.py | 59 ++++++++++++++
 ..._measurement_protocol_secrets_list_test.py | 29 +++++++
 ...ams_measurement_protocol_secrets_update.py | 77 +++++++++++++++++++
 ...easurement_protocol_secrets_update_test.py | 31 ++++++++
 ...ams_measurement_protocol_secrets_create.py | 67 ++++++++++++++++
 ...easurement_protocol_secrets_create_test.py | 30 ++++++++
 ...ams_measurement_protocol_secrets_delete.py | 64 +++++++++++++++
 ...easurement_protocol_secrets_delete_test.py | 31 ++++++++
 ...treams_measurement_protocol_secrets_get.py | 61 +++++++++++++++
 ...s_measurement_protocol_secrets_get_test.py | 29 +++++++
 ...reams_measurement_protocol_secrets_list.py | 59 ++++++++++++++
 ..._measurement_protocol_secrets_list_test.py | 29 +++++++
 ...ams_measurement_protocol_secrets_update.py | 77 +++++++++++++++++++
 ...easurement_protocol_secrets_update_test.py | 31 ++++++++
 ...ams_measurement_protocol_secrets_create.py | 67 ++++++++++++++++
 ...easurement_protocol_secrets_create_test.py | 30 ++++++++
 ...ams_measurement_protocol_secrets_delete.py | 63 +++++++++++++++
 ...easurement_protocol_secrets_delete_test.py | 31 ++++++++
 ...treams_measurement_protocol_secrets_get.py | 61 +++++++++++++++
 ...s_measurement_protocol_secrets_get_test.py | 29 +++++++
 ...reams_measurement_protocol_secrets_list.py | 59 ++++++++++++++
 ..._measurement_protocol_secrets_list_test.py | 29 +++++++
 ...ams_measurement_protocol_secrets_update.py | 77 +++++++++++++++++++
 ...easurement_protocol_secrets_update_test.py | 30 ++++++++
 31 files changed, 1435 insertions(+)
 create mode 100644 google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_create.py
 create mode 100644 google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_create_test.py
 create mode 100644 google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_delete.py
 create mode 100644 google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_delete_test.py
 create mode 100644 google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_get.py
 create mode 100644 google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_get_test.py
 create mode 100644 google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_list.py
 create mode 100644 google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_list_test.py
 create mode 100644 google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_update.py
 create mode 100644 google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_update_test.py
 create mode 100644 google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_create.py
 create mode 100644 google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_create_test.py
 create mode 100644 google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_delete.py
 create mode 100644 google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_delete_test.py
 create mode 100644 google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_get.py
 create mode 100644 google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_get_test.py
 create mode 100644 google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_list.py
 create mode 100644 google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_list_test.py
 create mode 100644 google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_update.py
 create mode 100644 google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_update_test.py
 create mode 100644 google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_create.py
 create mode 100644 google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_create_test.py
 create mode 100644 google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_delete.py
 create mode 100644 google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_delete_test.py
 create mode 100644 google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_get.py
 create mode 100644 google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_get_test.py
 create mode 100644 google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_list.py
 create mode 100644 google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_list_test.py
 create mode 100644 google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_update.py
 create mode 100644 google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_update_test.py

diff --git a/google-analytics-admin/noxfile_config.py b/google-analytics-admin/noxfile_config.py
index 3c8359b..04d745d 100644
--- a/google-analytics-admin/noxfile_config.py
+++ b/google-analytics-admin/noxfile_config.py
@@ -15,6 +15,9 @@
         "GA_TEST_ANDROID_APP_DATA_STREAM_ID": "2828100949",
         "GA_TEST_IOS_APP_DATA_STREAM_ID": "2828089289",
         "GA_TEST_WEB_DATA_STREAM_ID": "2828068992",
+        "GA_TEST_ANDROID_APP_DATA_SECRET_ID": "2994941777",
+        "GA_TEST_IOS_APP_DATA_SECRET_ID": "2994979281",
+        "GA_TEST_WEB_DATA_SECRET_ID": "2994983412",
         "GA_TEST_CONVERSION_EVENT_ID": "2719963095"
     },
 }
diff --git a/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_create.py b/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_create.py
new file mode 100644
index 0000000..f7e6b9d
--- /dev/null
+++ b/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_create.py
@@ -0,0 +1,67 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which creates a measurement
+protocol secret for the Android app data stream.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.androidAppDataStreams.measurementProtocolSecrets/create
+for more information.
+"""
+# [START analyticsadmin_properties_android_app_data_streams_measurement_protocol_secrets_create]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha import MeasurementProtocolSecret
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics property ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with your Android app data stream ID
+    #  (e.g. "123456") before running the sample.
+    stream_id = "YOUR-ANDROID-APP-DATA-STREAM-ID"
+
+    create_measurement_protocol_secret(property_id, stream_id)
+
+
+def create_measurement_protocol_secret(property_id, stream_id):
+    """Creates a measurement protocol secret for the Android app data stream."""
+    client = AnalyticsAdminServiceClient()
+    measurement_protocol_secret = client.create_measurement_protocol_secret(
+        parent=f"properties/{property_id}/androidAppDataStreams/{stream_id}",
+        measurement_protocol_secret=MeasurementProtocolSecret(
+            display_name="New secret"
+        ),
+    )
+
+    print("Result:")
+    print(f"Resource name: {measurement_protocol_secret.name}")
+    print(f"Secret value: {measurement_protocol_secret.secret_value}")
+    print(f"Display name: {measurement_protocol_secret.display_name}")
+
+
+# [END analyticsadmin_properties_android_app_data_streams_measurement_protocol_secrets_create]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_create_test.py b/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_create_test.py
new file mode 100644
index 0000000..a373f86
--- /dev/null
+++ b/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_create_test.py
@@ -0,0 +1,30 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import properties_android_app_data_streams_measurement_protocol_secrets_create
+
+
+FAKE_PROPERTY_ID = "1"
+FAKE_STREAM_ID = "1"
+
+
+def test_properties_android_app_data_streams_measurement_protocol_secrets_create():
+    # This test ensures that the call is valid and reaches the server, even
+    # though the operation does not succeed due to permission error.
+    with pytest.raises(Exception, match="403 The caller does not have permission"):
+        properties_android_app_data_streams_measurement_protocol_secrets_create.create_measurement_protocol_secret(
+            FAKE_PROPERTY_ID, FAKE_STREAM_ID
+        )
diff --git a/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_delete.py b/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_delete.py
new file mode 100644
index 0000000..50426ab
--- /dev/null
+++ b/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_delete.py
@@ -0,0 +1,64 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which deletes the measurement
+protocol secret for the Android app data stream.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.androidAppDataStreams.measurementProtocolSecrets/delete
+for more information.
+"""
+# [START analyticsadmin_properties_android_app_data_streams_measurement_protocol_secrets_delete]
+from google.analytics.admin import AnalyticsAdminServiceClient
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics property ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with your Android app data stream ID
+    #  (e.g. "123456") before running the sample.
+    stream_id = "YOUR-ANDROID-APP-DATA-STREAM-ID"
+
+    # TODO(developer): Replace this variable with your measurement protocol
+    #  secret ID (e.g. "123456") before running the sample.
+    secret_id = "YOUR-MEASUREMENT-PROTOCOL-SECRET-ID"
+
+    delete_measurement_protocol_secret(property_id, stream_id, secret_id)
+
+
+def delete_measurement_protocol_secret(property_id, stream_id, secret_id):
+    """Deletes the measurement protocol secret for the Android app data
+    stream."""
+    client = AnalyticsAdminServiceClient()
+    client.delete_measurement_protocol_secret(
+        name=f"properties/{property_id}/androidAppDataStreams/{stream_id}/measurementProtocolSecrets/{secret_id}"
+    )
+    print("Measurement protocol secret deleted")
+
+
+# [END analyticsadmin_properties_android_app_data_streams_measurement_protocol_secrets_delete]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_delete_test.py b/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_delete_test.py
new file mode 100644
index 0000000..5f17bce
--- /dev/null
+++ b/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_delete_test.py
@@ -0,0 +1,31 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import properties_android_app_data_streams_measurement_protocol_secrets_delete
+
+
+FAKE_PROPERTY_ID = "1"
+FAKE_STREAM_ID = "1"
+FAKE_SECRET_ID = "1"
+
+
+def test_properties_android_app_data_streams_measurement_protocol_secrets_delete():
+    # This test ensures that the call is valid and reaches the server, even
+    # though the operation does not succeed due to permission error.
+    with pytest.raises(Exception, match="403 The caller does not have permission"):
+        properties_android_app_data_streams_measurement_protocol_secrets_delete.delete_measurement_protocol_secret(
+            FAKE_PROPERTY_ID, FAKE_STREAM_ID, FAKE_SECRET_ID
+        )
diff --git a/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_get.py b/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_get.py
new file mode 100644
index 0000000..c26b8f5
--- /dev/null
+++ b/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_get.py
@@ -0,0 +1,61 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which retrieves the details
+for the measurement protocol secret.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.androidAppDataStreams.measurementProtocolSecrets/get
+for more information.
+"""
+# [START analyticsadmin_properties_android_app_data_streams_measurement_protocol_secrets_get]
+from google.analytics.admin import AnalyticsAdminServiceClient
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with your Android app data stream ID
+    #  (e.g. "123456") before running the sample.
+    stream_id = "YOUR-ANDROID-APP-DATA-STREAM-ID"
+
+    # TODO(developer): Replace this variable with your measurement protocol
+    #  secret ID (e.g. "123456") before running the sample.
+    secret_id = "YOUR-MEASUREMENT-PROTOCOL-SECRET-ID"
+
+    get_measurement_protocol_secret(property_id, stream_id, secret_id)
+
+
+def get_measurement_protocol_secret(property_id, stream_id, secret_id):
+    """Retrieves the details for the measurement protocol secret."""
+    client = AnalyticsAdminServiceClient()
+    measurement_protocol_secret = client.get_measurement_protocol_secret(
+        name=f"properties/{property_id}/androidAppDataStreams/{stream_id}/measurementProtocolSecrets/{secret_id}"
+    )
+
+    print("Result:")
+    print(f"Resource name: {measurement_protocol_secret.name}")
+    print(f"Secret value: {measurement_protocol_secret.secret_value}")
+    print(f"Display name: {measurement_protocol_secret.display_name}")
+
+
+# [END analyticsadmin_properties_android_app_data_streams_measurement_protocol_secrets_get]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_get_test.py b/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_get_test.py
new file mode 100644
index 0000000..7b4bbca
--- /dev/null
+++ b/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_get_test.py
@@ -0,0 +1,29 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import os
+
+import properties_android_app_data_streams_measurement_protocol_secrets_get
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+TEST_STREAM_ID = os.getenv("GA_TEST_ANDROID_APP_DATA_STREAM_ID")
+TEST_SECRET_ID = os.getenv("GA_TEST_ANDROID_APP_DATA_SECRET_ID")
+
+
+def test_properties_android_app_data_streams_measurement_protocol_secrets_get(capsys):
+    properties_android_app_data_streams_measurement_protocol_secrets_get.get_measurement_protocol_secret(
+        TEST_PROPERTY_ID, TEST_STREAM_ID, TEST_SECRET_ID
+    )
+    out, _ = capsys.readouterr()
+    assert "Result" in out
diff --git a/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_list.py b/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_list.py
new file mode 100644
index 0000000..4fd17b7
--- /dev/null
+++ b/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_list.py
@@ -0,0 +1,59 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which lists measurement
+protocol secrets for the Android app data stream.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.androidAppDataStreams.measurementProtocolSecrets/list
+for more information.
+"""
+# [START analyticsadmin_properties_android_app_data_streams_measurement_protocol_secrets_list]
+from google.analytics.admin import AnalyticsAdminServiceClient
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with your Android app data stream ID
+    #  (e.g. "123456") before running the sample.
+    stream_id = "YOUR-ANDROID-APP-DATA-STREAM-ID"
+    list_measurement_protocol_secrets(property_id, stream_id)
+
+
+def list_measurement_protocol_secrets(property_id, stream_id):
+    """Lists measurement protocol secrets for the Android app data stream."""
+    client = AnalyticsAdminServiceClient()
+    results = client.list_measurement_protocol_secrets(
+        parent=f"properties/{property_id}/androidAppDataStreams/{stream_id}"
+    )
+
+    print("Result:")
+    for measurement_protocol_secret in results:
+        print("Result:")
+        print(f"Resource name: {measurement_protocol_secret.name}")
+        print(f"Secret value: {measurement_protocol_secret.secret_value}")
+        print(f"Display name: {measurement_protocol_secret.display_name}")
+        print()
+
+
+# [END analyticsadmin_properties_android_app_data_streams_measurement_protocol_secrets_list]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_list_test.py b/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_list_test.py
new file mode 100644
index 0000000..e2f417f
--- /dev/null
+++ b/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_list_test.py
@@ -0,0 +1,29 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import os
+
+import properties_android_app_data_streams_measurement_protocol_secrets_list
+
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+TEST_STREAM_ID = os.getenv("GA_TEST_ANDROID_APP_DATA_STREAM_ID")
+
+
+def test_properties_android_app_data_streams_measurement_protocol_secrets_list(capsys):
+    properties_android_app_data_streams_measurement_protocol_secrets_list.list_measurement_protocol_secrets(
+        TEST_PROPERTY_ID, TEST_STREAM_ID
+    )
+    out, _ = capsys.readouterr()
+    assert "Result" in out
diff --git a/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_update.py b/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_update.py
new file mode 100644
index 0000000..12b3c9b
--- /dev/null
+++ b/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_update.py
@@ -0,0 +1,77 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which updates the measurement
+protocol secret for the Android app data stream.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.androidAppDataStreams.measurementProtocolSecrets/patch
+for more information.
+"""
+# [START analyticsadmin_properties_android_app_data_streams_measurement_protocol_secrets_update]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha import MeasurementProtocolSecret
+from google.protobuf.field_mask_pb2 import FieldMask
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics property ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with your Android app data stream ID
+    #  (e.g. "123456") before running the sample.
+    stream_id = "YOUR-ANDROID-APP-DATA-STREAM-ID"
+
+    # TODO(developer): Replace this variable with your measurement protocol
+    #  secret ID (e.g. "123456") before running the sample.
+    secret_id = "YOUR-MEASUREMENT-PROTOCOL-SECRET-ID"
+
+    update_measurement_protocol_secret(property_id, stream_id, secret_id)
+
+
+def update_measurement_protocol_secret(property_id, stream_id, secret_id):
+    """Updates the measurement protocol secret."""
+    client = AnalyticsAdminServiceClient()
+    # This call updates the display name of the measurement protocol secret, as
+    # indicated by the value of the `update_mask` field. The measurement
+    # protocol secret to update is specified in the `name` field of the
+    # `MeasurementProtocolSecret` instance.
+    measurement_protocol_secret = client.update_measurement_protocol_secret(
+        measurement_protocol_secret=MeasurementProtocolSecret(
+            name=f"properties/{property_id}/androidAppDataStreams/{stream_id}/measurementProtocolSecrets/{secret_id}",
+            display_name="This is an updated measurement protocol secret",
+        ),
+        update_mask=FieldMask(paths=["display_name"]),
+    )
+
+    print("Result:")
+    print(f"Resource name: {measurement_protocol_secret.name}")
+    print(f"Secret value: {measurement_protocol_secret.secret_value}")
+    print(f"Display name: {measurement_protocol_secret.display_name}")
+
+
+# [END analyticsadmin_properties_android_app_data_streams_measurement_protocol_secrets_update]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_update_test.py b/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_update_test.py
new file mode 100644
index 0000000..67fd954
--- /dev/null
+++ b/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_update_test.py
@@ -0,0 +1,31 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import properties_android_app_data_streams_measurement_protocol_secrets_update
+
+
+FAKE_PROPERTY_ID = "1"
+FAKE_STREAM_ID = "1"
+FAKE_SECRET_ID = "1"
+
+
+def test_properties_android_app_data_streams_measurement_protocol_secrets_update():
+    # This test ensures that the call is valid and reaches the server, even
+    # though the operation does not succeed due to permission error.
+    with pytest.raises(Exception, match="403 The caller does not have permission"):
+        properties_android_app_data_streams_measurement_protocol_secrets_update.update_measurement_protocol_secret(
+            FAKE_PROPERTY_ID, FAKE_STREAM_ID, FAKE_SECRET_ID
+        )
diff --git a/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_create.py b/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_create.py
new file mode 100644
index 0000000..53da458
--- /dev/null
+++ b/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_create.py
@@ -0,0 +1,67 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which creates a measurement
+protocol secret for the iOS app data stream.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.iosAppDataStreams.measurementProtocolSecrets/create
+for more information.
+"""
+# [START analyticsadmin_properties_ios_app_data_streams_measurement_protocol_secrets_create]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha import MeasurementProtocolSecret
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics property ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with your iOS app data stream ID
+    #  (e.g. "123456") before running the sample.
+    stream_id = "YOUR-IOS-APP-DATA-STREAM-ID"
+
+    create_measurement_protocol_secret(property_id, stream_id)
+
+
+def create_measurement_protocol_secret(property_id, stream_id):
+    """Creates a measurement protocol secret for the iOS app data stream."""
+    client = AnalyticsAdminServiceClient()
+    measurement_protocol_secret = client.create_measurement_protocol_secret(
+        parent=f"properties/{property_id}/iosAppDataStreams/{stream_id}",
+        measurement_protocol_secret=MeasurementProtocolSecret(
+            display_name="New secret"
+        ),
+    )
+
+    print("Result:")
+    print(f"Resource name: {measurement_protocol_secret.name}")
+    print(f"Secret value: {measurement_protocol_secret.secret_value}")
+    print(f"Display name: {measurement_protocol_secret.display_name}")
+
+
+# [END analyticsadmin_properties_ios_app_data_streams_measurement_protocol_secrets_create]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_create_test.py b/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_create_test.py
new file mode 100644
index 0000000..cbacd2d
--- /dev/null
+++ b/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_create_test.py
@@ -0,0 +1,30 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import properties_ios_app_data_streams_measurement_protocol_secrets_create
+
+
+FAKE_PROPERTY_ID = "1"
+FAKE_STREAM_ID = "1"
+
+
+def test_properties_ios_app_data_streams_measurement_protocol_secrets_create():
+    # This test ensures that the call is valid and reaches the server, even
+    # though the operation does not succeed due to permission error.
+    with pytest.raises(Exception, match="403 The caller does not have permission"):
+        properties_ios_app_data_streams_measurement_protocol_secrets_create.create_measurement_protocol_secret(
+            FAKE_PROPERTY_ID, FAKE_STREAM_ID
+        )
diff --git a/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_delete.py b/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_delete.py
new file mode 100644
index 0000000..8a5a5bf
--- /dev/null
+++ b/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_delete.py
@@ -0,0 +1,64 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which deletes the measurement
+protocol secret for the iOS app data stream.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.iosAppDataStreams.measurementProtocolSecrets/delete
+for more information.
+"""
+# [START analyticsadmin_properties_ios_app_data_streams_measurement_protocol_secrets_delete]
+from google.analytics.admin import AnalyticsAdminServiceClient
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics property ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with your iOS app data stream ID
+    #  (e.g. "123456") before running the sample.
+    stream_id = "YOUR-IOS-APP-DATA-STREAM-ID"
+
+    # TODO(developer): Replace this variable with your measurement protocol
+    #  secret ID (e.g. "123456") before running the sample.
+    secret_id = "YOUR-MEASUREMENT-PROTOCOL-SECRET-ID"
+
+    delete_measurement_protocol_secret(property_id, stream_id, secret_id)
+
+
+def delete_measurement_protocol_secret(property_id, stream_id, secret_id):
+    """Deletes the measurement protocol secret for the web data
+    stream."""
+    client = AnalyticsAdminServiceClient()
+    client.delete_measurement_protocol_secret(
+        name=f"properties/{property_id}/iosAppDataStreams/{stream_id}/measurementProtocolSecrets/{secret_id}"
+    )
+    print("Measurement protocol secret deleted")
+
+
+# [END analyticsadmin_properties_ios_app_data_streams_measurement_protocol_secrets_delete]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_delete_test.py b/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_delete_test.py
new file mode 100644
index 0000000..0070d00
--- /dev/null
+++ b/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_delete_test.py
@@ -0,0 +1,31 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import properties_ios_app_data_streams_measurement_protocol_secrets_delete
+
+
+FAKE_PROPERTY_ID = "1"
+FAKE_STREAM_ID = "1"
+FAKE_SECRET_ID = "1"
+
+
+def test_properties_ios_app_data_streams_measurement_protocol_secrets_delete():
+    # This test ensures that the call is valid and reaches the server, even
+    # though the operation does not succeed due to permission error.
+    with pytest.raises(Exception, match="403 The caller does not have permission"):
+        properties_ios_app_data_streams_measurement_protocol_secrets_delete.delete_measurement_protocol_secret(
+            FAKE_PROPERTY_ID, FAKE_STREAM_ID, FAKE_SECRET_ID
+        )
diff --git a/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_get.py b/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_get.py
new file mode 100644
index 0000000..75f20ee
--- /dev/null
+++ b/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_get.py
@@ -0,0 +1,61 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which retrieves the details
+for the measurement protocol secret.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.iosAppDataStreams.measurementProtocolSecrets/get
+for more information.
+"""
+# [START analyticsadmin_properties_ios_app_data_streams_measurement_protocol_secrets_get]
+from google.analytics.admin import AnalyticsAdminServiceClient
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with your iOS app data stream ID
+    #  (e.g. "123456") before running the sample.
+    stream_id = "YOUR-IOS-APP-DATA-STREAM-ID"
+
+    # TODO(developer): Replace this variable with your measurement protocol
+    #  secret ID (e.g. "123456") before running the sample.
+    secret_id = "YOUR-MEASUREMENT-PROTOCOL-SECRET-ID"
+
+    get_measurement_protocol_secret(property_id, stream_id, secret_id)
+
+
+def get_measurement_protocol_secret(property_id, stream_id, secret_id):
+    """Retrieves the details for the measurement protocol secret."""
+    client = AnalyticsAdminServiceClient()
+    measurement_protocol_secret = client.get_measurement_protocol_secret(
+        name=f"properties/{property_id}/iosAppDataStreams/{stream_id}/measurementProtocolSecrets/{secret_id}"
+    )
+
+    print("Result:")
+    print(f"Resource name: {measurement_protocol_secret.name}")
+    print(f"Secret value: {measurement_protocol_secret.secret_value}")
+    print(f"Display name: {measurement_protocol_secret.display_name}")
+
+
+# [END analyticsadmin_properties_ios_app_data_streams_measurement_protocol_secrets_get]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_get_test.py b/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_get_test.py
new file mode 100644
index 0000000..28a5b15
--- /dev/null
+++ b/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_get_test.py
@@ -0,0 +1,29 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import os
+
+import properties_ios_app_data_streams_measurement_protocol_secrets_get
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+TEST_STREAM_ID = os.getenv("GA_TEST_IOS_APP_DATA_STREAM_ID")
+TEST_SECRET_ID = os.getenv("GA_TEST_IOS_APP_DATA_SECRET_ID")
+
+
+def test_properties_ios_app_data_streams_measurement_protocol_secrets_get(capsys):
+    properties_ios_app_data_streams_measurement_protocol_secrets_get.get_measurement_protocol_secret(
+        TEST_PROPERTY_ID, TEST_STREAM_ID, TEST_SECRET_ID
+    )
+    out, _ = capsys.readouterr()
+    assert "Result" in out
diff --git a/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_list.py b/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_list.py
new file mode 100644
index 0000000..689313f
--- /dev/null
+++ b/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_list.py
@@ -0,0 +1,59 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which lists measurement
+protocol secrets for the iOS app data stream.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.iosAppDataStreams.measurementProtocolSecrets/list
+for more information.
+"""
+# [START analyticsadmin_properties_ios_app_data_streams_measurement_protocol_secrets_list]
+from google.analytics.admin import AnalyticsAdminServiceClient
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with your iOS app data stream ID
+    #  (e.g. "123456") before running the sample.
+    stream_id = "YOUR-IOS-APP-DATA-STREAM-ID"
+    list_measurement_protocol_secrets(property_id, stream_id)
+
+
+def list_measurement_protocol_secrets(property_id, stream_id):
+    """Lists measurement protocol secrets for the iOS app data stream."""
+    client = AnalyticsAdminServiceClient()
+    results = client.list_measurement_protocol_secrets(
+        parent=f"properties/{property_id}/iosAppDataStreams/{stream_id}"
+    )
+
+    print("Result:")
+    for measurement_protocol_secret in results:
+        print("Result:")
+        print(f"Resource name: {measurement_protocol_secret.name}")
+        print(f"Secret value: {measurement_protocol_secret.secret_value}")
+        print(f"Display name: {measurement_protocol_secret.display_name}")
+        print()
+
+
+# [END analyticsadmin_properties_ios_app_data_streams_measurement_protocol_secrets_list]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_list_test.py b/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_list_test.py
new file mode 100644
index 0000000..fe9869c
--- /dev/null
+++ b/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_list_test.py
@@ -0,0 +1,29 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import os
+
+import properties_ios_app_data_streams_measurement_protocol_secrets_list
+
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+TEST_IOS_APP_DATA_STREAM_ID = os.getenv("GA_TEST_IOS_APP_DATA_STREAM_ID")
+
+
+def test_properties_ios_app_data_streams_measurement_protocol_secrets_list(capsys):
+    properties_ios_app_data_streams_measurement_protocol_secrets_list.list_measurement_protocol_secrets(
+        TEST_PROPERTY_ID, TEST_IOS_APP_DATA_STREAM_ID
+    )
+    out, _ = capsys.readouterr()
+    assert "Result" in out
diff --git a/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_update.py b/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_update.py
new file mode 100644
index 0000000..b5cbfd0
--- /dev/null
+++ b/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_update.py
@@ -0,0 +1,77 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which updates the measurement
+protocol secret for the iOS app data stream.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.iosAppDataStreams.measurementProtocolSecrets/patch
+for more information.
+"""
+# [START analyticsadmin_properties_ios_app_data_streams_measurement_protocol_secrets_update]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha import MeasurementProtocolSecret
+from google.protobuf.field_mask_pb2 import FieldMask
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics property ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with your iOS app data stream ID
+    #  (e.g. "123456") before running the sample.
+    stream_id = "YOUR-IOS-APP-DATA-STREAM-ID"
+
+    # TODO(developer): Replace this variable with your measurement protocol
+    #  secret ID (e.g. "123456") before running the sample.
+    secret_id = "YOUR-MEASUREMENT-PROTOCOL-SECRET-ID"
+
+    update_measurement_protocol_secret(property_id, stream_id, secret_id)
+
+
+def update_measurement_protocol_secret(property_id, stream_id, secret_id):
+    """Updates the measurement protocol secret."""
+    client = AnalyticsAdminServiceClient()
+    # This call updates the display name of the measurement protocol secret, as
+    # indicated by the value of the `update_mask` field. The measurement
+    # protocol secret to update is specified in the `name` field of the
+    # `MeasurementProtocolSecret` instance.
+    measurement_protocol_secret = client.update_measurement_protocol_secret(
+        measurement_protocol_secret=MeasurementProtocolSecret(
+            name=f"properties/{property_id}/iosAppDataStreams/{stream_id}/measurementProtocolSecrets/{secret_id}",
+            display_name="This is an updated measurement protocol secret",
+        ),
+        update_mask=FieldMask(paths=["display_name"]),
+    )
+
+    print("Result:")
+    print(f"Resource name: {measurement_protocol_secret.name}")
+    print(f"Secret value: {measurement_protocol_secret.secret_value}")
+    print(f"Display name: {measurement_protocol_secret.display_name}")
+
+
+# [END analyticsadmin_properties_ios_app_data_streams_measurement_protocol_secrets_update]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_update_test.py b/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_update_test.py
new file mode 100644
index 0000000..7c850fa
--- /dev/null
+++ b/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_update_test.py
@@ -0,0 +1,31 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import properties_ios_app_data_streams_measurement_protocol_secrets_update
+
+
+FAKE_PROPERTY_ID = "1"
+FAKE_STREAM_ID = "1"
+FAKE_SECRET_ID = "1"
+
+
+def test_properties_ios_app_data_streams_measurement_protocol_secrets_update():
+    # This test ensures that the call is valid and reaches the server, even
+    # though the operation does not succeed due to permission error.
+    with pytest.raises(Exception, match="403 The caller does not have permission"):
+        properties_ios_app_data_streams_measurement_protocol_secrets_update.update_measurement_protocol_secret(
+            FAKE_PROPERTY_ID, FAKE_STREAM_ID, FAKE_SECRET_ID
+        )
diff --git a/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_create.py b/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_create.py
new file mode 100644
index 0000000..d0a9ee1
--- /dev/null
+++ b/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_create.py
@@ -0,0 +1,67 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which creates a measurement
+protocol secret for the web data stream.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.webDataStreams.measurementProtocolSecrets/create
+for more information.
+"""
+# [START analyticsadmin_properties_web_data_streams_measurement_protocol_secrets_create]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha import MeasurementProtocolSecret
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics property ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with your web data stream ID
+    #  (e.g. "123456") before running the sample.
+    stream_id = "YOUR-WEB-DATA-STREAM-ID"
+
+    create_measurement_protocol_secret(property_id, stream_id)
+
+
+def create_measurement_protocol_secret(property_id, stream_id):
+    """Creates a measurement protocol secret for the web data stream."""
+    client = AnalyticsAdminServiceClient()
+    measurement_protocol_secret = client.create_measurement_protocol_secret(
+        parent=f"properties/{property_id}/webDataStreams/{stream_id}",
+        measurement_protocol_secret=MeasurementProtocolSecret(
+            display_name="New secret"
+        ),
+    )
+
+    print("Result:")
+    print(f"Resource name: {measurement_protocol_secret.name}")
+    print(f"Secret value: {measurement_protocol_secret.secret_value}")
+    print(f"Display name: {measurement_protocol_secret.display_name}")
+
+
+# [END analyticsadmin_properties_web_data_streams_measurement_protocol_secrets_create]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_create_test.py b/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_create_test.py
new file mode 100644
index 0000000..1fb76f3
--- /dev/null
+++ b/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_create_test.py
@@ -0,0 +1,30 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import properties_web_data_streams_measurement_protocol_secrets_create
+
+
+FAKE_PROPERTY_ID = "1"
+FAKE_STREAM_ID = "1"
+
+
+def test_properties_web_data_streams_measurement_protocol_secrets_create():
+    # This test ensures that the call is valid and reaches the server, even
+    # though the operation does not succeed due to permission error.
+    with pytest.raises(Exception, match="403 The caller does not have permission"):
+        properties_web_data_streams_measurement_protocol_secrets_create.create_measurement_protocol_secret(
+            FAKE_PROPERTY_ID, FAKE_STREAM_ID
+        )
diff --git a/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_delete.py b/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_delete.py
new file mode 100644
index 0000000..527de4e
--- /dev/null
+++ b/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_delete.py
@@ -0,0 +1,63 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which deletes a measurement
+protocol secret for the web data stream.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.webDataStreams.measurementProtocolSecrets/delete
+for more information.
+"""
+# [START analyticsadmin_properties_web_data_streams_measurement_protocol_secrets_delete]
+from google.analytics.admin import AnalyticsAdminServiceClient
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics property ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with your web data stream ID
+    #  (e.g. "123456") before running the sample.
+    stream_id = "YOUR-WEB-DATA-STREAM-ID"
+
+    # TODO(developer): Replace this variable with your measurement protocol
+    #  secret ID (e.g. "123456") before running the sample.
+    secret_id = "YOUR-MEASUREMENT-PROTOCOL-SECRET-ID"
+
+    delete_measurement_protocol_secret(property_id, stream_id, secret_id)
+
+
+def delete_measurement_protocol_secret(property_id, stream_id, secret_id):
+    """Deletes a measurement protocol secret for the web data stream."""
+    client = AnalyticsAdminServiceClient()
+    client.delete_measurement_protocol_secret(
+        name=f"properties/{property_id}/webDataStreams/{stream_id}/measurementProtocolSecrets/{secret_id}"
+    )
+    print("Measurement protocol secret deleted")
+
+
+# [END analyticsadmin_properties_web_data_streams_measurement_protocol_secrets_delete]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_delete_test.py b/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_delete_test.py
new file mode 100644
index 0000000..df5c48f
--- /dev/null
+++ b/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_delete_test.py
@@ -0,0 +1,31 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import properties_web_data_streams_measurement_protocol_secrets_delete
+
+
+FAKE_PROPERTY_ID = "1"
+FAKE_STREAM_ID = "1"
+FAKE_SECRET_ID = "1"
+
+
+def test_properties_web_data_streams_measurement_protocol_secrets_delete():
+    # This test ensures that the call is valid and reaches the server, even
+    # though the operation does not succeed due to permission error.
+    with pytest.raises(Exception, match="403 The caller does not have permission"):
+        properties_web_data_streams_measurement_protocol_secrets_delete.delete_measurement_protocol_secret(
+            FAKE_PROPERTY_ID, FAKE_STREAM_ID, FAKE_SECRET_ID
+        )
diff --git a/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_get.py b/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_get.py
new file mode 100644
index 0000000..78b8235
--- /dev/null
+++ b/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_get.py
@@ -0,0 +1,61 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which retrieves the details
+for the measurement protocol secret.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.webDataStreams.measurementProtocolSecrets/get
+for more information.
+"""
+# [START analyticsadmin_properties_web_data_streams_measurement_protocol_secrets_get]
+from google.analytics.admin import AnalyticsAdminServiceClient
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with your web data stream ID
+    #  (e.g. "123456") before running the sample.
+    stream_id = "YOUR-WEB-DATA-STREAM-ID"
+
+    # TODO(developer): Replace this variable with your measurement protocol
+    #  secret ID (e.g. "123456") before running the sample.
+    secret_id = "YOUR-MEASUREMENT-PROTOCOL-SECRET-ID"
+
+    get_measurement_protocol_secret(property_id, stream_id, secret_id)
+
+
+def get_measurement_protocol_secret(property_id, stream_id, secret_id):
+    """Retrieves the details for the measurement protocol secret."""
+    client = AnalyticsAdminServiceClient()
+    measurement_protocol_secret = client.get_measurement_protocol_secret(
+        name=f"properties/{property_id}/webDataStreams/{stream_id}/measurementProtocolSecrets/{secret_id}"
+    )
+
+    print("Result:")
+    print(f"Resource name: {measurement_protocol_secret.name}")
+    print(f"Secret value: {measurement_protocol_secret.secret_value}")
+    print(f"Display name: {measurement_protocol_secret.display_name}")
+
+
+# [END analyticsadmin_properties_web_data_streams_measurement_protocol_secrets_get]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_get_test.py b/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_get_test.py
new file mode 100644
index 0000000..6e1f530
--- /dev/null
+++ b/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_get_test.py
@@ -0,0 +1,29 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import os
+
+import properties_web_data_streams_measurement_protocol_secrets_get
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+TEST_STREAM_ID = os.getenv("GA_TEST_WEB_DATA_STREAM_ID")
+TEST_SECRET_ID = os.getenv("GA_TEST_WEB_DATA_SECRET_ID")
+
+
+def test_properties_web_data_streams_measurement_protocol_secrets_get(capsys):
+    properties_web_data_streams_measurement_protocol_secrets_get.get_measurement_protocol_secret(
+        TEST_PROPERTY_ID, TEST_STREAM_ID, TEST_SECRET_ID
+    )
+    out, _ = capsys.readouterr()
+    assert "Result" in out
diff --git a/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_list.py b/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_list.py
new file mode 100644
index 0000000..cf12344
--- /dev/null
+++ b/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_list.py
@@ -0,0 +1,59 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which lists measurement
+protocol secrets for the web data stream.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.webDataStreams.measurementProtocolSecrets/list
+for more information.
+"""
+# [START analyticsadmin_properties_android_app_data_streams_measurement_protocol_secrets_list]
+from google.analytics.admin import AnalyticsAdminServiceClient
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with your web data stream ID
+    #  (e.g. "123456") before running the sample.
+    stream_id = "YOUR-WEB-DATA-STREAM-ID"
+    list_measurement_protocol_secrets(property_id, stream_id)
+
+
+def list_measurement_protocol_secrets(property_id, stream_id):
+    """Lists measurement protocol secrets for the web data stream."""
+    client = AnalyticsAdminServiceClient()
+    results = client.list_measurement_protocol_secrets(
+        parent=f"properties/{property_id}/webDataStreams/{stream_id}"
+    )
+
+    print("Result:")
+    for measurement_protocol_secret in results:
+        print("Result:")
+        print(f"Resource name: {measurement_protocol_secret.name}")
+        print(f"Secret value: {measurement_protocol_secret.secret_value}")
+        print(f"Display name: {measurement_protocol_secret.display_name}")
+        print()
+
+
+# [END analyticsadmin_properties_android_app_data_streams_measurement_protocol_secrets_list]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_list_test.py b/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_list_test.py
new file mode 100644
index 0000000..87d7068
--- /dev/null
+++ b/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_list_test.py
@@ -0,0 +1,29 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import os
+
+import properties_web_data_streams_measurement_protocol_secrets_list
+
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+TEST_STREAM_ID = os.getenv("GA_TEST_WEB_DATA_STREAM_ID")
+
+
+def test_properties_web_data_streams_measurement_protocol_secrets_list(capsys):
+    properties_web_data_streams_measurement_protocol_secrets_list.list_measurement_protocol_secrets(
+        TEST_PROPERTY_ID, TEST_STREAM_ID
+    )
+    out, _ = capsys.readouterr()
+    assert "Result" in out
diff --git a/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_update.py b/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_update.py
new file mode 100644
index 0000000..32bd92c
--- /dev/null
+++ b/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_update.py
@@ -0,0 +1,77 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which updates the measurement
+protocol secret for the web data stream.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.webDataStreams.measurementProtocolSecrets/patch
+for more information.
+"""
+# [START analyticsadmin_properties_web_data_streams_measurement_protocol_secrets_update]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha import MeasurementProtocolSecret
+from google.protobuf.field_mask_pb2 import FieldMask
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics property ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with your web data stream ID
+    #  (e.g. "123456") before running the sample.
+    stream_id = "YOUR-WEB-DATA-STREAM-ID"
+
+    # TODO(developer): Replace this variable with your measurement protocol
+    #  secret ID (e.g. "123456") before running the sample.
+    secret_id = "YOUR-MEASUREMENT-PROTOCOL-SECRET-ID"
+
+    update_measurement_protocol_secret(property_id, stream_id, secret_id)
+
+
+def update_measurement_protocol_secret(property_id, stream_id, secret_id):
+    """Updates the measurement protocol secret."""
+    client = AnalyticsAdminServiceClient()
+    # This call updates the display name of the measurement protocol secret, as
+    # indicated by the value of the `update_mask` field. The measurement
+    # protocol secret to update is specified in the `name` field of the
+    # `MeasurementProtocolSecret` instance.
+    measurement_protocol_secret = client.update_measurement_protocol_secret(
+        measurement_protocol_secret=MeasurementProtocolSecret(
+            name=f"properties/{property_id}/webDataStreams/{stream_id}/measurementProtocolSecrets/{secret_id}",
+            display_name="This is an updated measurement protocol secret",
+        ),
+        update_mask=FieldMask(paths=["display_name"]),
+    )
+
+    print("Result:")
+    print(f"Resource name: {measurement_protocol_secret.name}")
+    print(f"Secret value: {measurement_protocol_secret.secret_value}")
+    print(f"Display name: {measurement_protocol_secret.display_name}")
+
+
+# [END analyticsadmin_properties_web_data_streams_measurement_protocol_secrets_update]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_update_test.py b/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_update_test.py
new file mode 100644
index 0000000..8a4d458
--- /dev/null
+++ b/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_update_test.py
@@ -0,0 +1,30 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import properties_web_data_streams_measurement_protocol_secrets_update
+
+FAKE_PROPERTY_ID = "1"
+FAKE_STREAM_ID = "1"
+FAKE_SECRET_ID = "1"
+
+
+def test_properties_web_data_streams_measurement_protocol_secrets_update():
+    # This test ensures that the call is valid and reaches the server, even
+    # though the operation does not succeed due to permission error.
+    with pytest.raises(Exception, match="403 The caller does not have permission"):
+        properties_web_data_streams_measurement_protocol_secrets_update.update_measurement_protocol_secret(
+            FAKE_PROPERTY_ID, FAKE_STREAM_ID, FAKE_SECRET_ID
+        )

From d52969a8608005127021ba8521150b8ce1fc1eb5 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Wed, 20 Oct 2021 16:47:27 +0200
Subject: [PATCH 053/213] chore(deps): update dependency google-analytics-admin
 to v0.7.1 (#156)

---
 google-analytics-admin/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index 8668c1e..e7859db 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-admin==0.7.0
+google-analytics-admin==0.7.1
 google-auth-oauthlib==0.4.6
\ No newline at end of file

From 6168d6f942308188c421d20df542fe0de1c8ad92 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Tue, 2 Nov 2021 15:36:45 +0100
Subject: [PATCH 054/213] chore(deps): update dependency google-analytics-admin
 to v0.7.2 (#163)

---
 google-analytics-admin/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index e7859db..58d2fc7 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-admin==0.7.1
+google-analytics-admin==0.7.2
 google-auth-oauthlib==0.4.6
\ No newline at end of file

From eed5353bfefd13f4694bd7e99e47fcb69b2385df Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Tue, 2 Nov 2021 15:37:26 +0100
Subject: [PATCH 055/213] chore(deps): update dependency google-analytics-data
 to v0.10.0 (#160)

---
 google-analytics-data/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index eac014f..4321b45 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-data==0.9.0
+google-analytics-data==0.10.0
 google-auth-oauthlib==0.4.6
\ No newline at end of file

From 93b3c70f967dcf86591c714544815721e0d4e4fb Mon Sep 17 00:00:00 2001
From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com>
Date: Wed, 10 Nov 2021 20:33:00 -0500
Subject: [PATCH 056/213] chore(python): run blacken session for all
 directories with a noxfile (#166)

Source-Link: https://github.com/googleapis/synthtool/commit/bc0de6ee2489da6fb8eafd021a8c58b5cc30c947
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:39ad8c0570e4f5d2d3124a509de4fe975e799e2b97e0f58aed88f8880d5a8b60

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
---
 google-analytics-admin/noxfile_config.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/noxfile_config.py b/google-analytics-admin/noxfile_config.py
index 04d745d..7b1cf5b 100644
--- a/google-analytics-admin/noxfile_config.py
+++ b/google-analytics-admin/noxfile_config.py
@@ -18,6 +18,6 @@
         "GA_TEST_ANDROID_APP_DATA_SECRET_ID": "2994941777",
         "GA_TEST_IOS_APP_DATA_SECRET_ID": "2994979281",
         "GA_TEST_WEB_DATA_SECRET_ID": "2994983412",
-        "GA_TEST_CONVERSION_EVENT_ID": "2719963095"
+        "GA_TEST_CONVERSION_EVENT_ID": "2719963095",
     },
 }

From 65cdad616b357327fe97f682b605dc206b3005bf Mon Sep 17 00:00:00 2001
From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com>
Date: Tue, 11 Jan 2022 07:31:08 -0500
Subject: [PATCH 057/213] chore(samples): Add check for tests in directory
 (#177)

Source-Link: https://github.com/googleapis/synthtool/commit/52aef91f8d25223d9dbdb4aebd94ba8eea2101f3
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:36a95b8f494e4674dc9eee9af98961293b51b86b3649942aac800ae6c1f796d4

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
---
 google-analytics-admin/noxfile.py | 70 +++++++++++++++++--------------
 1 file changed, 39 insertions(+), 31 deletions(-)

diff --git a/google-analytics-admin/noxfile.py b/google-analytics-admin/noxfile.py
index 93a9122..3bbef5d 100644
--- a/google-analytics-admin/noxfile.py
+++ b/google-analytics-admin/noxfile.py
@@ -14,6 +14,7 @@
 
 from __future__ import print_function
 
+import glob
 import os
 from pathlib import Path
 import sys
@@ -184,37 +185,44 @@ def blacken(session: nox.sessions.Session) -> None:
 def _session_tests(
     session: nox.sessions.Session, post_install: Callable = None
 ) -> None:
-    if TEST_CONFIG["pip_version_override"]:
-        pip_version = TEST_CONFIG["pip_version_override"]
-        session.install(f"pip=={pip_version}")
-    """Runs py.test for a particular project."""
-    if os.path.exists("requirements.txt"):
-        if os.path.exists("constraints.txt"):
-            session.install("-r", "requirements.txt", "-c", "constraints.txt")
-        else:
-            session.install("-r", "requirements.txt")
-
-    if os.path.exists("requirements-test.txt"):
-        if os.path.exists("constraints-test.txt"):
-            session.install("-r", "requirements-test.txt", "-c", "constraints-test.txt")
-        else:
-            session.install("-r", "requirements-test.txt")
-
-    if INSTALL_LIBRARY_FROM_SOURCE:
-        session.install("-e", _get_repo_root())
-
-    if post_install:
-        post_install(session)
-
-    session.run(
-        "pytest",
-        *(PYTEST_COMMON_ARGS + session.posargs),
-        # Pytest will return 5 when no tests are collected. This can happen
-        # on travis where slow and flaky tests are excluded.
-        # See http://doc.pytest.org/en/latest/_modules/_pytest/main.html
-        success_codes=[0, 5],
-        env=get_pytest_env_vars(),
-    )
+    # check for presence of tests
+    test_list = glob.glob("*_test.py") + glob.glob("test_*.py")
+    if len(test_list) == 0:
+        print("No tests found, skipping directory.")
+    else:
+        if TEST_CONFIG["pip_version_override"]:
+            pip_version = TEST_CONFIG["pip_version_override"]
+            session.install(f"pip=={pip_version}")
+        """Runs py.test for a particular project."""
+        if os.path.exists("requirements.txt"):
+            if os.path.exists("constraints.txt"):
+                session.install("-r", "requirements.txt", "-c", "constraints.txt")
+            else:
+                session.install("-r", "requirements.txt")
+
+        if os.path.exists("requirements-test.txt"):
+            if os.path.exists("constraints-test.txt"):
+                session.install(
+                    "-r", "requirements-test.txt", "-c", "constraints-test.txt"
+                )
+            else:
+                session.install("-r", "requirements-test.txt")
+
+        if INSTALL_LIBRARY_FROM_SOURCE:
+            session.install("-e", _get_repo_root())
+
+        if post_install:
+            post_install(session)
+
+        session.run(
+            "pytest",
+            *(PYTEST_COMMON_ARGS + session.posargs),
+            # Pytest will return 5 when no tests are collected. This can happen
+            # on travis where slow and flaky tests are excluded.
+            # See http://doc.pytest.org/en/latest/_modules/_pytest/main.html
+            success_codes=[0, 5],
+            env=get_pytest_env_vars(),
+        )
 
 
 @nox.session(python=ALL_VERSIONS)

From bd14e4416ce349675c1cc73405b13c43509e77c0 Mon Sep 17 00:00:00 2001
From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com>
Date: Tue, 11 Jan 2022 07:31:52 -0500
Subject: [PATCH 058/213] chore(samples): Add check for tests in directory
 (#174)

Source-Link: https://github.com/googleapis/synthtool/commit/52aef91f8d25223d9dbdb4aebd94ba8eea2101f3
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:36a95b8f494e4674dc9eee9af98961293b51b86b3649942aac800ae6c1f796d4

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
---
 google-analytics-data/noxfile.py | 70 ++++++++++++++++++--------------
 1 file changed, 39 insertions(+), 31 deletions(-)

diff --git a/google-analytics-data/noxfile.py b/google-analytics-data/noxfile.py
index 93a9122..3bbef5d 100644
--- a/google-analytics-data/noxfile.py
+++ b/google-analytics-data/noxfile.py
@@ -14,6 +14,7 @@
 
 from __future__ import print_function
 
+import glob
 import os
 from pathlib import Path
 import sys
@@ -184,37 +185,44 @@ def blacken(session: nox.sessions.Session) -> None:
 def _session_tests(
     session: nox.sessions.Session, post_install: Callable = None
 ) -> None:
-    if TEST_CONFIG["pip_version_override"]:
-        pip_version = TEST_CONFIG["pip_version_override"]
-        session.install(f"pip=={pip_version}")
-    """Runs py.test for a particular project."""
-    if os.path.exists("requirements.txt"):
-        if os.path.exists("constraints.txt"):
-            session.install("-r", "requirements.txt", "-c", "constraints.txt")
-        else:
-            session.install("-r", "requirements.txt")
-
-    if os.path.exists("requirements-test.txt"):
-        if os.path.exists("constraints-test.txt"):
-            session.install("-r", "requirements-test.txt", "-c", "constraints-test.txt")
-        else:
-            session.install("-r", "requirements-test.txt")
-
-    if INSTALL_LIBRARY_FROM_SOURCE:
-        session.install("-e", _get_repo_root())
-
-    if post_install:
-        post_install(session)
-
-    session.run(
-        "pytest",
-        *(PYTEST_COMMON_ARGS + session.posargs),
-        # Pytest will return 5 when no tests are collected. This can happen
-        # on travis where slow and flaky tests are excluded.
-        # See http://doc.pytest.org/en/latest/_modules/_pytest/main.html
-        success_codes=[0, 5],
-        env=get_pytest_env_vars(),
-    )
+    # check for presence of tests
+    test_list = glob.glob("*_test.py") + glob.glob("test_*.py")
+    if len(test_list) == 0:
+        print("No tests found, skipping directory.")
+    else:
+        if TEST_CONFIG["pip_version_override"]:
+            pip_version = TEST_CONFIG["pip_version_override"]
+            session.install(f"pip=={pip_version}")
+        """Runs py.test for a particular project."""
+        if os.path.exists("requirements.txt"):
+            if os.path.exists("constraints.txt"):
+                session.install("-r", "requirements.txt", "-c", "constraints.txt")
+            else:
+                session.install("-r", "requirements.txt")
+
+        if os.path.exists("requirements-test.txt"):
+            if os.path.exists("constraints-test.txt"):
+                session.install(
+                    "-r", "requirements-test.txt", "-c", "constraints-test.txt"
+                )
+            else:
+                session.install("-r", "requirements-test.txt")
+
+        if INSTALL_LIBRARY_FROM_SOURCE:
+            session.install("-e", _get_repo_root())
+
+        if post_install:
+            post_install(session)
+
+        session.run(
+            "pytest",
+            *(PYTEST_COMMON_ARGS + session.posargs),
+            # Pytest will return 5 when no tests are collected. This can happen
+            # on travis where slow and flaky tests are excluded.
+            # See http://doc.pytest.org/en/latest/_modules/_pytest/main.html
+            success_codes=[0, 5],
+            env=get_pytest_env_vars(),
+        )
 
 
 @nox.session(python=ALL_VERSIONS)

From 42ffa632dc1b9bc46c16927bc7fa4147265978a5 Mon Sep 17 00:00:00 2001
From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com>
Date: Tue, 18 Jan 2022 21:03:08 -0500
Subject: [PATCH 059/213] chore(python): Noxfile recognizes that tests can live
 in a folder (#179)

Source-Link: https://github.com/googleapis/synthtool/commit/4760d8dce1351d93658cb11d02a1b7ceb23ae5d7
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:f0e4b51deef56bed74d3e2359c583fc104a8d6367da3984fc5c66938db738828

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
---
 google-analytics-data/noxfile.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/google-analytics-data/noxfile.py b/google-analytics-data/noxfile.py
index 3bbef5d..20cdfc6 100644
--- a/google-analytics-data/noxfile.py
+++ b/google-analytics-data/noxfile.py
@@ -187,6 +187,7 @@ def _session_tests(
 ) -> None:
     # check for presence of tests
     test_list = glob.glob("*_test.py") + glob.glob("test_*.py")
+    test_list.extend(glob.glob("tests"))
     if len(test_list) == 0:
         print("No tests found, skipping directory.")
     else:

From b7c564c5580fbd1793a7fc227b1fbc96727baf63 Mon Sep 17 00:00:00 2001
From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com>
Date: Fri, 21 Jan 2022 20:26:27 -0500
Subject: [PATCH 060/213] chore(python): Noxfile recognizes that tests can live
 in a folder (#182)

Source-Link: https://github.com/googleapis/synthtool/commit/4760d8dce1351d93658cb11d02a1b7ceb23ae5d7
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:f0e4b51deef56bed74d3e2359c583fc104a8d6367da3984fc5c66938db738828

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
---
 google-analytics-admin/noxfile.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/google-analytics-admin/noxfile.py b/google-analytics-admin/noxfile.py
index 3bbef5d..20cdfc6 100644
--- a/google-analytics-admin/noxfile.py
+++ b/google-analytics-admin/noxfile.py
@@ -187,6 +187,7 @@ def _session_tests(
 ) -> None:
     # check for presence of tests
     test_list = glob.glob("*_test.py") + glob.glob("test_*.py")
+    test_list.extend(glob.glob("tests"))
     if len(test_list) == 0:
         print("No tests found, skipping directory.")
     else:

From 8316a2b83130400eb89de23b8ef8ed811e34b839 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Fri, 4 Feb 2022 15:12:45 +0100
Subject: [PATCH 061/213] chore(deps): update dependency pytest to v7 (#187)

---
 google-analytics-data/requirements-test.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements-test.txt b/google-analytics-data/requirements-test.txt
index 9270945..4a46ff6 100644
--- a/google-analytics-data/requirements-test.txt
+++ b/google-analytics-data/requirements-test.txt
@@ -1 +1 @@
-pytest==6.2.5
+pytest==7.0.0

From 674d3a6c0f7ce219166e22343181aa817b197fc9 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Mon, 14 Feb 2022 16:52:22 +0100
Subject: [PATCH 062/213] chore(deps): update dependency pytest to v7.0.1
 (#190)

---
 google-analytics-data/requirements-test.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements-test.txt b/google-analytics-data/requirements-test.txt
index 4a46ff6..c2845bf 100644
--- a/google-analytics-data/requirements-test.txt
+++ b/google-analytics-data/requirements-test.txt
@@ -1 +1 @@
-pytest==7.0.0
+pytest==7.0.1

From 3f233c507b6966e523648f2433d4180131712b14 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Thu, 24 Feb 2022 16:44:50 +0100
Subject: [PATCH 063/213] chore(deps): update dependency google-auth-oauthlib
 to v0.5.0 (#192)

---
 google-analytics-data/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index 4321b45..91f58db 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
 google-analytics-data==0.10.0
-google-auth-oauthlib==0.4.6
\ No newline at end of file
+google-auth-oauthlib==0.5.0
\ No newline at end of file

From 57e92e134d445e1b1b852c22dab6dda3b7582a6b Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Thu, 24 Feb 2022 19:20:17 +0100
Subject: [PATCH 064/213] chore(deps): update dependency google-analytics-data
 to v0.11.0 (#193)

---
 google-analytics-data/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index 91f58db..7399868 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-data==0.10.0
+google-analytics-data==0.11.0
 google-auth-oauthlib==0.5.0
\ No newline at end of file

From add7281464dfbe6b1db4e8db8c45dd6622590b57 Mon Sep 17 00:00:00 2001
From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com>
Date: Fri, 25 Feb 2022 08:52:35 -0500
Subject: [PATCH 065/213] chore: use gapic-generator-python 0.63.4 (#194)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* chore: use gapic-generator-python 0.63.4

chore: fix snippet region tag format
chore: fix docstring code block formatting
PiperOrigin-RevId: 430730865

Source-Link: https://github.com/googleapis/googleapis/commit/ea5800229f73f94fd7204915a86ed09dcddf429a

Source-Link: https://github.com/googleapis/googleapis-gen/commit/ca893ff8af25fc7fe001de1405a517d80446ecca
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiY2E4OTNmZjhhZjI1ZmM3ZmUwMDFkZTE0MDVhNTE3ZDgwNDQ2ZWNjYSJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* remove redundant samples

* lint

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
---
 google-analytics-data/run_batch_report.py               | 4 +---
 google-analytics-data/run_pivot_report.py               | 9 ++-------
 google-analytics-data/run_report_with_property_quota.py | 4 +---
 3 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/google-analytics-data/run_batch_report.py b/google-analytics-data/run_batch_report.py
index dfd155e..1915dbc 100644
--- a/google-analytics-data/run_batch_report.py
+++ b/google-analytics-data/run_batch_report.py
@@ -56,9 +56,7 @@ def run_batch_report(property_id="YOUR-GA4-PROPERTY-ID"):
                 date_ranges=[DateRange(start_date="2021-01-03", end_date="2021-01-09")],
             ),
             RunReportRequest(
-                dimensions=[
-                    Dimension(name="browser"),
-                ],
+                dimensions=[Dimension(name="browser")],
                 metrics=[Metric(name="activeUsers")],
                 date_ranges=[DateRange(start_date="2021-01-01", end_date="2021-01-31")],
             ),
diff --git a/google-analytics-data/run_pivot_report.py b/google-analytics-data/run_pivot_report.py
index dc3ce91..3400870 100644
--- a/google-analytics-data/run_pivot_report.py
+++ b/google-analytics-data/run_pivot_report.py
@@ -45,9 +45,7 @@ def run_pivot_report(property_id="YOUR-GA4-PROPERTY-ID"):
 
     request = RunPivotReportRequest(
         property=f"properties/{property_id}",
-        date_ranges=[
-            DateRange(start_date="2021-01-01", end_date="2021-01-30"),
-        ],
+        date_ranges=[DateRange(start_date="2021-01-01", end_date="2021-01-30")],
         pivots=[
             Pivot(
                 field_names=["country"],
@@ -70,10 +68,7 @@ def run_pivot_report(property_id="YOUR-GA4-PROPERTY-ID"):
             ),
         ],
         metrics=[Metric(name="sessions")],
-        dimensions=[
-            Dimension(name="country"),
-            Dimension(name="browser"),
-        ],
+        dimensions=[Dimension(name="country"), Dimension(name="browser")],
     )
     response = client.run_pivot_report(request)
     print_run_pivot_report_response(response)
diff --git a/google-analytics-data/run_report_with_property_quota.py b/google-analytics-data/run_report_with_property_quota.py
index f62414a..76bc3d3 100644
--- a/google-analytics-data/run_report_with_property_quota.py
+++ b/google-analytics-data/run_report_with_property_quota.py
@@ -44,9 +44,7 @@ def run_report_with_property_quota(property_id="YOUR-GA4-PROPERTY-ID"):
         property=f"properties/{property_id}",
         return_property_quota=True,
         dimensions=[Dimension(name="country")],
-        metrics=[
-            Metric(name="activeUsers"),
-        ],
+        metrics=[Metric(name="activeUsers")],
         date_ranges=[DateRange(start_date="7daysAgo", end_date="today")],
     )
     response = client.run_report(request)

From e5e015dd70a5e0ddd1ee84d8c457aa5d8b1ae8d4 Mon Sep 17 00:00:00 2001
From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com>
Date: Fri, 4 Mar 2022 16:46:11 +0000
Subject: [PATCH 066/213] feat: remove `WebDataStream`, `IosAppDataStream`,
 `AndroidAppDataStream` resources (#195)

- [ ] Regenerate this pull request now.

feat: add `restricted_metric_type` field to the `CustomMetric` resource
feat: move the `GlobalSiteTag` resource from the property level to the data stream level

PiperOrigin-RevId: 432342398

Source-Link: https://github.com/googleapis/googleapis/commit/a079cb09ba1573ee7422a8b0bbc2197db6a5d69e

Source-Link: https://github.com/googleapis/googleapis-gen/commit/2f29c5af3054a6e38df2158f09b76ec2fafd0b2f
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMmYyOWM1YWYzMDU0YTZlMzhkZjIxNThmMDliNzZlYzJmYWZkMGIyZiJ9

Closes #184
---
 .../accounts_search_change_history_events.py  |  8 +-
 google-analytics-admin/noxfile_config.py      |  4 -
 ...perties_android_app_data_streams_delete.py | 59 --------------
 ...es_android_app_data_streams_delete_test.py | 30 --------
 ...properties_android_app_data_streams_get.py | 65 ----------------
 ...rties_android_app_data_streams_get_test.py | 29 -------
 ...roperties_android_app_data_streams_list.py | 51 ------------
 ...ties_android_app_data_streams_list_test.py | 27 -------
 ...ams_measurement_protocol_secrets_create.py | 67 ----------------
 ...easurement_protocol_secrets_create_test.py | 30 --------
 ...ams_measurement_protocol_secrets_delete.py | 64 ---------------
 ...easurement_protocol_secrets_delete_test.py | 31 --------
 ...treams_measurement_protocol_secrets_get.py | 61 ---------------
 ...s_measurement_protocol_secrets_get_test.py | 29 -------
 ...reams_measurement_protocol_secrets_list.py | 59 --------------
 ..._measurement_protocol_secrets_list_test.py | 29 -------
 ...ams_measurement_protocol_secrets_update.py | 77 -------------------
 ...easurement_protocol_secrets_update_test.py | 31 --------
 ...perties_android_app_data_streams_update.py | 71 -----------------
 ...e.py => properties_data_streams_create.py} | 30 ++++----
 ...=> properties_data_streams_create_test.py} |  6 +-
 ...e.py => properties_data_streams_delete.py} | 24 +++---
 ...=> properties_data_streams_delete_test.py} |  6 +-
 ..._get.py => properties_data_streams_get.py} | 43 ++++++-----
 ...rties_data_streams_get_global_site_tag.py} | 15 ++--
 ..._data_streams_get_global_site_tag_test.py} | 11 +--
 ...py => properties_data_streams_get_test.py} |  8 +-
 ...ist.py => properties_data_streams_list.py} | 20 ++---
 ...y => properties_data_streams_list_test.py} |  6 +-
 ...ms_measurement_protocol_secrets_create.py} | 16 ++--
 ...asurement_protocol_secrets_create_test.py} |  6 +-
 ...ms_measurement_protocol_secrets_delete.py} | 16 ++--
 ...asurement_protocol_secrets_delete_test.py} |  6 +-
 ...reams_measurement_protocol_secrets_get.py} | 12 +--
 ..._measurement_protocol_secrets_get_test.py} |  6 +-
 ...eams_measurement_protocol_secrets_list.py} | 16 ++--
 ...measurement_protocol_secrets_list_test.py} | 10 +--
 ...ms_measurement_protocol_secrets_update.py} | 14 ++--
 ...asurement_protocol_secrets_update_test.py} |  6 +-
 ...e.py => properties_data_streams_update.py} | 36 ++++-----
 ...=> properties_data_streams_update_test.py} |  6 +-
 .../properties_ios_app_data_streams_delete.py | 59 --------------
 ...erties_ios_app_data_streams_delete_test.py | 30 --------
 .../properties_ios_app_data_streams_get.py    | 65 ----------------
 .../properties_ios_app_data_streams_list.py   | 51 ------------
 ...ams_measurement_protocol_secrets_create.py | 67 ----------------
 ...easurement_protocol_secrets_create_test.py | 30 --------
 ...ams_measurement_protocol_secrets_delete.py | 64 ---------------
 ...easurement_protocol_secrets_delete_test.py | 31 --------
 ...treams_measurement_protocol_secrets_get.py | 61 ---------------
 ...s_measurement_protocol_secrets_get_test.py | 29 -------
 ...reams_measurement_protocol_secrets_list.py | 59 --------------
 ..._measurement_protocol_secrets_list_test.py | 29 -------
 ...ams_measurement_protocol_secrets_update.py | 77 -------------------
 ...easurement_protocol_secrets_update_test.py | 31 --------
 .../properties_ios_app_data_streams_update.py | 71 -----------------
 ...erties_ios_app_data_streams_update_test.py | 30 --------
 ...b_data_streams_get_global_site_tag_test.py | 29 -------
 ...easurement_protocol_secrets_create_test.py | 30 --------
 ..._measurement_protocol_secrets_list_test.py | 29 -------
 60 files changed, 158 insertions(+), 1855 deletions(-)
 delete mode 100644 google-analytics-admin/properties_android_app_data_streams_delete.py
 delete mode 100644 google-analytics-admin/properties_android_app_data_streams_delete_test.py
 delete mode 100644 google-analytics-admin/properties_android_app_data_streams_get.py
 delete mode 100644 google-analytics-admin/properties_android_app_data_streams_get_test.py
 delete mode 100644 google-analytics-admin/properties_android_app_data_streams_list.py
 delete mode 100644 google-analytics-admin/properties_android_app_data_streams_list_test.py
 delete mode 100644 google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_create.py
 delete mode 100644 google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_create_test.py
 delete mode 100644 google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_delete.py
 delete mode 100644 google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_delete_test.py
 delete mode 100644 google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_get.py
 delete mode 100644 google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_get_test.py
 delete mode 100644 google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_list.py
 delete mode 100644 google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_list_test.py
 delete mode 100644 google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_update.py
 delete mode 100644 google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_update_test.py
 delete mode 100644 google-analytics-admin/properties_android_app_data_streams_update.py
 rename google-analytics-admin/{properties_web_data_streams_create.py => properties_data_streams_create.py} (66%)
 rename google-analytics-admin/{properties_web_data_streams_create_test.py => properties_data_streams_create_test.py} (83%)
 rename google-analytics-admin/{properties_web_data_streams_delete.py => properties_data_streams_delete.py} (70%)
 rename google-analytics-admin/{properties_web_data_streams_delete_test.py => properties_data_streams_delete_test.py} (85%)
 rename google-analytics-admin/{properties_web_data_streams_get.py => properties_data_streams_get.py} (52%)
 rename google-analytics-admin/{properties_web_data_streams_get_global_site_tag.py => properties_data_streams_get_global_site_tag.py} (71%)
 rename google-analytics-admin/{properties_ios_app_data_streams_get_test.py => properties_data_streams_get_global_site_tag_test.py} (71%)
 rename google-analytics-admin/{properties_ios_app_data_streams_list_test.py => properties_data_streams_get_test.py} (75%)
 rename google-analytics-admin/{properties_web_data_streams_list.py => properties_data_streams_list.py} (68%)
 rename google-analytics-admin/{properties_web_data_streams_list_test.py => properties_data_streams_list_test.py} (81%)
 rename google-analytics-admin/{properties_web_data_streams_measurement_protocol_secrets_create.py => properties_data_streams_measurement_protocol_secrets_create.py} (75%)
 rename google-analytics-admin/{properties_android_app_data_streams_update_test.py => properties_data_streams_measurement_protocol_secrets_create_test.py} (79%)
 rename google-analytics-admin/{properties_web_data_streams_measurement_protocol_secrets_delete.py => properties_data_streams_measurement_protocol_secrets_delete.py} (72%)
 rename google-analytics-admin/{properties_web_data_streams_measurement_protocol_secrets_delete_test.py => properties_data_streams_measurement_protocol_secrets_delete_test.py} (79%)
 rename google-analytics-admin/{properties_web_data_streams_measurement_protocol_secrets_get.py => properties_data_streams_measurement_protocol_secrets_get.py} (80%)
 rename google-analytics-admin/{properties_web_data_streams_measurement_protocol_secrets_get_test.py => properties_data_streams_measurement_protocol_secrets_get_test.py} (78%)
 rename google-analytics-admin/{properties_web_data_streams_measurement_protocol_secrets_list.py => properties_data_streams_measurement_protocol_secrets_list.py} (71%)
 rename google-analytics-admin/{properties_web_data_streams_get_test.py => properties_data_streams_measurement_protocol_secrets_list_test.py} (67%)
 rename google-analytics-admin/{properties_web_data_streams_measurement_protocol_secrets_update.py => properties_data_streams_measurement_protocol_secrets_update.py} (81%)
 rename google-analytics-admin/{properties_web_data_streams_measurement_protocol_secrets_update_test.py => properties_data_streams_measurement_protocol_secrets_update_test.py} (79%)
 rename google-analytics-admin/{properties_web_data_streams_update.py => properties_data_streams_update.py} (61%)
 rename google-analytics-admin/{properties_web_data_streams_update_test.py => properties_data_streams_update_test.py} (85%)
 delete mode 100644 google-analytics-admin/properties_ios_app_data_streams_delete.py
 delete mode 100644 google-analytics-admin/properties_ios_app_data_streams_delete_test.py
 delete mode 100644 google-analytics-admin/properties_ios_app_data_streams_get.py
 delete mode 100644 google-analytics-admin/properties_ios_app_data_streams_list.py
 delete mode 100644 google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_create.py
 delete mode 100644 google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_create_test.py
 delete mode 100644 google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_delete.py
 delete mode 100644 google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_delete_test.py
 delete mode 100644 google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_get.py
 delete mode 100644 google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_get_test.py
 delete mode 100644 google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_list.py
 delete mode 100644 google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_list_test.py
 delete mode 100644 google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_update.py
 delete mode 100644 google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_update_test.py
 delete mode 100644 google-analytics-admin/properties_ios_app_data_streams_update.py
 delete mode 100644 google-analytics-admin/properties_ios_app_data_streams_update_test.py
 delete mode 100644 google-analytics-admin/properties_web_data_streams_get_global_site_tag_test.py
 delete mode 100644 google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_create_test.py
 delete mode 100644 google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_list_test.py

diff --git a/google-analytics-admin/accounts_search_change_history_events.py b/google-analytics-admin/accounts_search_change_history_events.py
index 38f0fec..a9639fc 100644
--- a/google-analytics-admin/accounts_search_change_history_events.py
+++ b/google-analytics-admin/accounts_search_change_history_events.py
@@ -86,12 +86,8 @@ def print_resource(resource):
         print("  Property resource")
     elif resource.account:
         print("  Account resource")
-    elif resource.web_data_stream:
-        print("  WebDataStream resource")
-    elif resource.android_app_data_stream:
-        print("  AndroidAppDataStream resource")
-    elif resource.ios_app_data_stream:
-        print("  IosAppDataStream resource")
+    elif resource.data_stream:
+        print("  DataStream resource")
     elif resource.firebase_link:
         print("  FirebaseLink resource")
     elif resource.google_ads_link:
diff --git a/google-analytics-admin/noxfile_config.py b/google-analytics-admin/noxfile_config.py
index 7b1cf5b..03ab539 100644
--- a/google-analytics-admin/noxfile_config.py
+++ b/google-analytics-admin/noxfile_config.py
@@ -12,11 +12,7 @@
         "GA_TEST_ACCOUNT_ID": "199820965",
         "GA_TEST_USER_LINK_ID": "103401743041912607932",
         "GA_TEST_PROPERTY_USER_LINK_ID": "105231969274497648555",
-        "GA_TEST_ANDROID_APP_DATA_STREAM_ID": "2828100949",
-        "GA_TEST_IOS_APP_DATA_STREAM_ID": "2828089289",
         "GA_TEST_WEB_DATA_STREAM_ID": "2828068992",
-        "GA_TEST_ANDROID_APP_DATA_SECRET_ID": "2994941777",
-        "GA_TEST_IOS_APP_DATA_SECRET_ID": "2994979281",
         "GA_TEST_WEB_DATA_SECRET_ID": "2994983412",
         "GA_TEST_CONVERSION_EVENT_ID": "2719963095",
     },
diff --git a/google-analytics-admin/properties_android_app_data_streams_delete.py b/google-analytics-admin/properties_android_app_data_streams_delete.py
deleted file mode 100644
index dfd6939..0000000
--- a/google-analytics-admin/properties_android_app_data_streams_delete.py
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2021 Google Inc. All Rights Reserved.
-#
-# 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.
-
-"""Google Analytics Admin API sample application which deletes the Android app
-data stream.
-
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.androidAppDataStreams/delete
-for more information.
-"""
-# [START analyticsadmin_properties_android_app_data_streams_delete]
-from google.analytics.admin import AnalyticsAdminServiceClient
-
-
-def run_sample():
-    """Runs the sample."""
-
-    # !!! ATTENTION !!!
-    #  Running this sample may change/delete your Google Analytics account
-    #  configuration. Make sure to not use the Google Analytics property ID from
-    #  your production environment below.
-
-    # TODO(developer): Replace this variable with your Google Analytics 4
-    #  property ID (e.g. "123456") before running the sample.
-    property_id = "YOUR-GA4-PROPERTY-ID"
-
-    # TODO(developer): Replace this variable with your Android app data stream ID
-    #  (e.g. "123456") before running the sample.
-    stream_id = "YOUR-ANDROID-APP-DATA-STREAM-ID"
-
-    delete_android_app_data_stream(property_id, stream_id)
-
-
-def delete_android_app_data_stream(property_id, stream_id):
-    """Deletes the Android app data stream."""
-    client = AnalyticsAdminServiceClient()
-    client.delete_android_app_data_stream(
-        name=f"properties/{property_id}/androidAppDataStreams/{stream_id}"
-    )
-    print("Android app data stream deleted")
-
-
-# [END analyticsadmin_properties_android_app_data_streams_delete]
-
-
-if __name__ == "__main__":
-    run_sample()
diff --git a/google-analytics-admin/properties_android_app_data_streams_delete_test.py b/google-analytics-admin/properties_android_app_data_streams_delete_test.py
deleted file mode 100644
index bd63388..0000000
--- a/google-analytics-admin/properties_android_app_data_streams_delete_test.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-import pytest
-
-import properties_android_app_data_streams_delete
-
-
-FAKE_PROPERTY_ID = "1"
-FAKE_STREAM_ID = "1"
-
-
-def test_properties_android_app_data_streams_delete():
-    # This test ensures that the call is valid and reaches the server, even
-    # though the operation does not succeed due to permission error.
-    with pytest.raises(Exception, match="403 The caller does not have permission"):
-        properties_android_app_data_streams_delete.delete_android_app_data_stream(
-            FAKE_PROPERTY_ID, FAKE_STREAM_ID
-        )
diff --git a/google-analytics-admin/properties_android_app_data_streams_get.py b/google-analytics-admin/properties_android_app_data_streams_get.py
deleted file mode 100644
index 68fcb8b..0000000
--- a/google-analytics-admin/properties_android_app_data_streams_get.py
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2021 Google Inc. All Rights Reserved.
-#
-# 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.
-
-"""Google Analytics Admin API sample application which prints the details for
-an Android app data stream.
-
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.androidAppDataStreams/get
-for more information.
-"""
-# [START analyticsadmin_properties_android_app_data_streams_get]
-from google.analytics.admin import AnalyticsAdminServiceClient
-
-
-def run_sample():
-    """Runs the sample."""
-    # TODO(developer): Replace this variable with your Google Analytics 4
-    #  property ID (e.g. "123456") before running the sample.
-    property_id = "YOUR-GA4-PROPERTY-ID"
-
-    # TODO(developer): Replace this variable with your Android app data stream ID
-    #  (e.g. "123456") before running the sample.
-    stream_id = "YOUR-ANDROID-APP-DATA-STREAM-ID"
-
-    get_android_app_data_stream(property_id, stream_id)
-
-
-def get_android_app_data_stream(property_id, stream_id):
-    """Retrieves the details for an Android app data stream."""
-    client = AnalyticsAdminServiceClient()
-    android_app_data_stream = client.get_android_app_data_stream(
-        name=f"properties/{property_id}/androidAppDataStreams/{stream_id}"
-    )
-
-    print("Result:")
-    print_android_app_data_stream(android_app_data_stream)
-
-
-def print_android_app_data_stream(android_app_data_stream):
-    """Prints the Android app data stream details."""
-    print(f"Resource name: {android_app_data_stream.name}")
-    print(f"Display name: {android_app_data_stream.display_name}")
-    print(f"Firebase app ID: {android_app_data_stream.firebase_app_id}")
-    print(f"Package name: {android_app_data_stream.package_name}")
-    print(f"Create time: {android_app_data_stream.create_time}")
-    print(f"Update time: {android_app_data_stream.update_time}")
-
-
-# [END analyticsadmin_properties_android_app_data_streams_get]
-
-
-if __name__ == "__main__":
-    run_sample()
diff --git a/google-analytics-admin/properties_android_app_data_streams_get_test.py b/google-analytics-admin/properties_android_app_data_streams_get_test.py
deleted file mode 100644
index 33d2cea..0000000
--- a/google-analytics-admin/properties_android_app_data_streams_get_test.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-import os
-
-import properties_android_app_data_streams_get
-
-
-TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
-TEST_ANDROID_APP_DATA_STREAM_ID = os.getenv("GA_TEST_ANDROID_APP_DATA_STREAM_ID")
-
-
-def test_properties_android_app_data_streams_get(capsys):
-    properties_android_app_data_streams_get.get_android_app_data_stream(
-        TEST_PROPERTY_ID, TEST_ANDROID_APP_DATA_STREAM_ID
-    )
-    out, _ = capsys.readouterr()
-    assert "Result" in out
diff --git a/google-analytics-admin/properties_android_app_data_streams_list.py b/google-analytics-admin/properties_android_app_data_streams_list.py
deleted file mode 100644
index 97b67b0..0000000
--- a/google-analytics-admin/properties_android_app_data_streams_list.py
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2021 Google Inc. All Rights Reserved.
-#
-# 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.
-
-"""Google Analytics Admin API sample application which prints Android app data
-streams for a Google Analytics 4 property.
-
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.androidAppDataStreams/list
-for more information.
-"""
-# [START analyticsadmin_properties_android_app_data_streams_list]
-from google.analytics.admin import AnalyticsAdminServiceClient
-
-
-def run_sample():
-    """Runs the sample."""
-    # TODO(developer): Replace this variable with your Google Analytics 4
-    #  property ID (e.g. "123456") before running the sample.
-    property_id = "YOUR-GA4-PROPERTY-ID"
-
-    list_android_app_data_streams(property_id)
-
-
-def list_android_app_data_streams(property_id):
-    """Lists Android app data streams for a Google Analytics 4 property."""
-    client = AnalyticsAdminServiceClient()
-    results = client.list_android_app_data_streams(parent=f"properties/{property_id}")
-
-    print("Result:")
-    for android_app_data_stream in results:
-        print(android_app_data_stream)
-        print()
-
-
-# [END analyticsadmin_properties_android_app_data_streams_list]
-
-
-if __name__ == "__main__":
-    run_sample()
diff --git a/google-analytics-admin/properties_android_app_data_streams_list_test.py b/google-analytics-admin/properties_android_app_data_streams_list_test.py
deleted file mode 100644
index 90b47f7..0000000
--- a/google-analytics-admin/properties_android_app_data_streams_list_test.py
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-import os
-
-import properties_android_app_data_streams_list
-
-TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
-
-
-def test_properties_android_app_data_streams_list(capsys):
-    properties_android_app_data_streams_list.list_android_app_data_streams(
-        TEST_PROPERTY_ID
-    )
-    out, _ = capsys.readouterr()
-    assert "Result" in out
diff --git a/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_create.py b/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_create.py
deleted file mode 100644
index f7e6b9d..0000000
--- a/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_create.py
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2021 Google Inc. All Rights Reserved.
-#
-# 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.
-
-"""Google Analytics Admin API sample application which creates a measurement
-protocol secret for the Android app data stream.
-
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.androidAppDataStreams.measurementProtocolSecrets/create
-for more information.
-"""
-# [START analyticsadmin_properties_android_app_data_streams_measurement_protocol_secrets_create]
-from google.analytics.admin import AnalyticsAdminServiceClient
-from google.analytics.admin_v1alpha import MeasurementProtocolSecret
-
-
-def run_sample():
-    """Runs the sample."""
-
-    # !!! ATTENTION !!!
-    #  Running this sample may change/delete your Google Analytics account
-    #  configuration. Make sure to not use the Google Analytics property ID from
-    #  your production environment below.
-
-    # TODO(developer): Replace this variable with your Google Analytics 4
-    #  property ID (e.g. "123456") before running the sample.
-    property_id = "YOUR-GA4-PROPERTY-ID"
-
-    # TODO(developer): Replace this variable with your Android app data stream ID
-    #  (e.g. "123456") before running the sample.
-    stream_id = "YOUR-ANDROID-APP-DATA-STREAM-ID"
-
-    create_measurement_protocol_secret(property_id, stream_id)
-
-
-def create_measurement_protocol_secret(property_id, stream_id):
-    """Creates a measurement protocol secret for the Android app data stream."""
-    client = AnalyticsAdminServiceClient()
-    measurement_protocol_secret = client.create_measurement_protocol_secret(
-        parent=f"properties/{property_id}/androidAppDataStreams/{stream_id}",
-        measurement_protocol_secret=MeasurementProtocolSecret(
-            display_name="New secret"
-        ),
-    )
-
-    print("Result:")
-    print(f"Resource name: {measurement_protocol_secret.name}")
-    print(f"Secret value: {measurement_protocol_secret.secret_value}")
-    print(f"Display name: {measurement_protocol_secret.display_name}")
-
-
-# [END analyticsadmin_properties_android_app_data_streams_measurement_protocol_secrets_create]
-
-
-if __name__ == "__main__":
-    run_sample()
diff --git a/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_create_test.py b/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_create_test.py
deleted file mode 100644
index a373f86..0000000
--- a/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_create_test.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-import pytest
-
-import properties_android_app_data_streams_measurement_protocol_secrets_create
-
-
-FAKE_PROPERTY_ID = "1"
-FAKE_STREAM_ID = "1"
-
-
-def test_properties_android_app_data_streams_measurement_protocol_secrets_create():
-    # This test ensures that the call is valid and reaches the server, even
-    # though the operation does not succeed due to permission error.
-    with pytest.raises(Exception, match="403 The caller does not have permission"):
-        properties_android_app_data_streams_measurement_protocol_secrets_create.create_measurement_protocol_secret(
-            FAKE_PROPERTY_ID, FAKE_STREAM_ID
-        )
diff --git a/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_delete.py b/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_delete.py
deleted file mode 100644
index 50426ab..0000000
--- a/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_delete.py
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2021 Google Inc. All Rights Reserved.
-#
-# 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.
-
-"""Google Analytics Admin API sample application which deletes the measurement
-protocol secret for the Android app data stream.
-
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.androidAppDataStreams.measurementProtocolSecrets/delete
-for more information.
-"""
-# [START analyticsadmin_properties_android_app_data_streams_measurement_protocol_secrets_delete]
-from google.analytics.admin import AnalyticsAdminServiceClient
-
-
-def run_sample():
-    """Runs the sample."""
-
-    # !!! ATTENTION !!!
-    #  Running this sample may change/delete your Google Analytics account
-    #  configuration. Make sure to not use the Google Analytics property ID from
-    #  your production environment below.
-
-    # TODO(developer): Replace this variable with your Google Analytics 4
-    #  property ID (e.g. "123456") before running the sample.
-    property_id = "YOUR-GA4-PROPERTY-ID"
-
-    # TODO(developer): Replace this variable with your Android app data stream ID
-    #  (e.g. "123456") before running the sample.
-    stream_id = "YOUR-ANDROID-APP-DATA-STREAM-ID"
-
-    # TODO(developer): Replace this variable with your measurement protocol
-    #  secret ID (e.g. "123456") before running the sample.
-    secret_id = "YOUR-MEASUREMENT-PROTOCOL-SECRET-ID"
-
-    delete_measurement_protocol_secret(property_id, stream_id, secret_id)
-
-
-def delete_measurement_protocol_secret(property_id, stream_id, secret_id):
-    """Deletes the measurement protocol secret for the Android app data
-    stream."""
-    client = AnalyticsAdminServiceClient()
-    client.delete_measurement_protocol_secret(
-        name=f"properties/{property_id}/androidAppDataStreams/{stream_id}/measurementProtocolSecrets/{secret_id}"
-    )
-    print("Measurement protocol secret deleted")
-
-
-# [END analyticsadmin_properties_android_app_data_streams_measurement_protocol_secrets_delete]
-
-
-if __name__ == "__main__":
-    run_sample()
diff --git a/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_delete_test.py b/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_delete_test.py
deleted file mode 100644
index 5f17bce..0000000
--- a/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_delete_test.py
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-import pytest
-
-import properties_android_app_data_streams_measurement_protocol_secrets_delete
-
-
-FAKE_PROPERTY_ID = "1"
-FAKE_STREAM_ID = "1"
-FAKE_SECRET_ID = "1"
-
-
-def test_properties_android_app_data_streams_measurement_protocol_secrets_delete():
-    # This test ensures that the call is valid and reaches the server, even
-    # though the operation does not succeed due to permission error.
-    with pytest.raises(Exception, match="403 The caller does not have permission"):
-        properties_android_app_data_streams_measurement_protocol_secrets_delete.delete_measurement_protocol_secret(
-            FAKE_PROPERTY_ID, FAKE_STREAM_ID, FAKE_SECRET_ID
-        )
diff --git a/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_get.py b/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_get.py
deleted file mode 100644
index c26b8f5..0000000
--- a/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_get.py
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2021 Google Inc. All Rights Reserved.
-#
-# 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.
-
-"""Google Analytics Admin API sample application which retrieves the details
-for the measurement protocol secret.
-
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.androidAppDataStreams.measurementProtocolSecrets/get
-for more information.
-"""
-# [START analyticsadmin_properties_android_app_data_streams_measurement_protocol_secrets_get]
-from google.analytics.admin import AnalyticsAdminServiceClient
-
-
-def run_sample():
-    """Runs the sample."""
-    # TODO(developer): Replace this variable with your Google Analytics 4
-    #  property ID (e.g. "123456") before running the sample.
-    property_id = "YOUR-GA4-PROPERTY-ID"
-
-    # TODO(developer): Replace this variable with your Android app data stream ID
-    #  (e.g. "123456") before running the sample.
-    stream_id = "YOUR-ANDROID-APP-DATA-STREAM-ID"
-
-    # TODO(developer): Replace this variable with your measurement protocol
-    #  secret ID (e.g. "123456") before running the sample.
-    secret_id = "YOUR-MEASUREMENT-PROTOCOL-SECRET-ID"
-
-    get_measurement_protocol_secret(property_id, stream_id, secret_id)
-
-
-def get_measurement_protocol_secret(property_id, stream_id, secret_id):
-    """Retrieves the details for the measurement protocol secret."""
-    client = AnalyticsAdminServiceClient()
-    measurement_protocol_secret = client.get_measurement_protocol_secret(
-        name=f"properties/{property_id}/androidAppDataStreams/{stream_id}/measurementProtocolSecrets/{secret_id}"
-    )
-
-    print("Result:")
-    print(f"Resource name: {measurement_protocol_secret.name}")
-    print(f"Secret value: {measurement_protocol_secret.secret_value}")
-    print(f"Display name: {measurement_protocol_secret.display_name}")
-
-
-# [END analyticsadmin_properties_android_app_data_streams_measurement_protocol_secrets_get]
-
-
-if __name__ == "__main__":
-    run_sample()
diff --git a/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_get_test.py b/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_get_test.py
deleted file mode 100644
index 7b4bbca..0000000
--- a/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_get_test.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-import os
-
-import properties_android_app_data_streams_measurement_protocol_secrets_get
-
-TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
-TEST_STREAM_ID = os.getenv("GA_TEST_ANDROID_APP_DATA_STREAM_ID")
-TEST_SECRET_ID = os.getenv("GA_TEST_ANDROID_APP_DATA_SECRET_ID")
-
-
-def test_properties_android_app_data_streams_measurement_protocol_secrets_get(capsys):
-    properties_android_app_data_streams_measurement_protocol_secrets_get.get_measurement_protocol_secret(
-        TEST_PROPERTY_ID, TEST_STREAM_ID, TEST_SECRET_ID
-    )
-    out, _ = capsys.readouterr()
-    assert "Result" in out
diff --git a/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_list.py b/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_list.py
deleted file mode 100644
index 4fd17b7..0000000
--- a/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_list.py
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2021 Google Inc. All Rights Reserved.
-#
-# 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.
-
-"""Google Analytics Admin API sample application which lists measurement
-protocol secrets for the Android app data stream.
-
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.androidAppDataStreams.measurementProtocolSecrets/list
-for more information.
-"""
-# [START analyticsadmin_properties_android_app_data_streams_measurement_protocol_secrets_list]
-from google.analytics.admin import AnalyticsAdminServiceClient
-
-
-def run_sample():
-    """Runs the sample."""
-    # TODO(developer): Replace this variable with your Google Analytics 4
-    #  property ID (e.g. "123456") before running the sample.
-    property_id = "YOUR-GA4-PROPERTY-ID"
-
-    # TODO(developer): Replace this variable with your Android app data stream ID
-    #  (e.g. "123456") before running the sample.
-    stream_id = "YOUR-ANDROID-APP-DATA-STREAM-ID"
-    list_measurement_protocol_secrets(property_id, stream_id)
-
-
-def list_measurement_protocol_secrets(property_id, stream_id):
-    """Lists measurement protocol secrets for the Android app data stream."""
-    client = AnalyticsAdminServiceClient()
-    results = client.list_measurement_protocol_secrets(
-        parent=f"properties/{property_id}/androidAppDataStreams/{stream_id}"
-    )
-
-    print("Result:")
-    for measurement_protocol_secret in results:
-        print("Result:")
-        print(f"Resource name: {measurement_protocol_secret.name}")
-        print(f"Secret value: {measurement_protocol_secret.secret_value}")
-        print(f"Display name: {measurement_protocol_secret.display_name}")
-        print()
-
-
-# [END analyticsadmin_properties_android_app_data_streams_measurement_protocol_secrets_list]
-
-
-if __name__ == "__main__":
-    run_sample()
diff --git a/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_list_test.py b/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_list_test.py
deleted file mode 100644
index e2f417f..0000000
--- a/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_list_test.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-import os
-
-import properties_android_app_data_streams_measurement_protocol_secrets_list
-
-
-TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
-TEST_STREAM_ID = os.getenv("GA_TEST_ANDROID_APP_DATA_STREAM_ID")
-
-
-def test_properties_android_app_data_streams_measurement_protocol_secrets_list(capsys):
-    properties_android_app_data_streams_measurement_protocol_secrets_list.list_measurement_protocol_secrets(
-        TEST_PROPERTY_ID, TEST_STREAM_ID
-    )
-    out, _ = capsys.readouterr()
-    assert "Result" in out
diff --git a/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_update.py b/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_update.py
deleted file mode 100644
index 12b3c9b..0000000
--- a/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_update.py
+++ /dev/null
@@ -1,77 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2021 Google Inc. All Rights Reserved.
-#
-# 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.
-
-"""Google Analytics Admin API sample application which updates the measurement
-protocol secret for the Android app data stream.
-
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.androidAppDataStreams.measurementProtocolSecrets/patch
-for more information.
-"""
-# [START analyticsadmin_properties_android_app_data_streams_measurement_protocol_secrets_update]
-from google.analytics.admin import AnalyticsAdminServiceClient
-from google.analytics.admin_v1alpha import MeasurementProtocolSecret
-from google.protobuf.field_mask_pb2 import FieldMask
-
-
-def run_sample():
-    """Runs the sample."""
-
-    # !!! ATTENTION !!!
-    #  Running this sample may change/delete your Google Analytics account
-    #  configuration. Make sure to not use the Google Analytics property ID from
-    #  your production environment below.
-
-    # TODO(developer): Replace this variable with your Google Analytics 4
-    #  property ID (e.g. "123456") before running the sample.
-    property_id = "YOUR-GA4-PROPERTY-ID"
-
-    # TODO(developer): Replace this variable with your Android app data stream ID
-    #  (e.g. "123456") before running the sample.
-    stream_id = "YOUR-ANDROID-APP-DATA-STREAM-ID"
-
-    # TODO(developer): Replace this variable with your measurement protocol
-    #  secret ID (e.g. "123456") before running the sample.
-    secret_id = "YOUR-MEASUREMENT-PROTOCOL-SECRET-ID"
-
-    update_measurement_protocol_secret(property_id, stream_id, secret_id)
-
-
-def update_measurement_protocol_secret(property_id, stream_id, secret_id):
-    """Updates the measurement protocol secret."""
-    client = AnalyticsAdminServiceClient()
-    # This call updates the display name of the measurement protocol secret, as
-    # indicated by the value of the `update_mask` field. The measurement
-    # protocol secret to update is specified in the `name` field of the
-    # `MeasurementProtocolSecret` instance.
-    measurement_protocol_secret = client.update_measurement_protocol_secret(
-        measurement_protocol_secret=MeasurementProtocolSecret(
-            name=f"properties/{property_id}/androidAppDataStreams/{stream_id}/measurementProtocolSecrets/{secret_id}",
-            display_name="This is an updated measurement protocol secret",
-        ),
-        update_mask=FieldMask(paths=["display_name"]),
-    )
-
-    print("Result:")
-    print(f"Resource name: {measurement_protocol_secret.name}")
-    print(f"Secret value: {measurement_protocol_secret.secret_value}")
-    print(f"Display name: {measurement_protocol_secret.display_name}")
-
-
-# [END analyticsadmin_properties_android_app_data_streams_measurement_protocol_secrets_update]
-
-
-if __name__ == "__main__":
-    run_sample()
diff --git a/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_update_test.py b/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_update_test.py
deleted file mode 100644
index 67fd954..0000000
--- a/google-analytics-admin/properties_android_app_data_streams_measurement_protocol_secrets_update_test.py
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-import pytest
-
-import properties_android_app_data_streams_measurement_protocol_secrets_update
-
-
-FAKE_PROPERTY_ID = "1"
-FAKE_STREAM_ID = "1"
-FAKE_SECRET_ID = "1"
-
-
-def test_properties_android_app_data_streams_measurement_protocol_secrets_update():
-    # This test ensures that the call is valid and reaches the server, even
-    # though the operation does not succeed due to permission error.
-    with pytest.raises(Exception, match="403 The caller does not have permission"):
-        properties_android_app_data_streams_measurement_protocol_secrets_update.update_measurement_protocol_secret(
-            FAKE_PROPERTY_ID, FAKE_STREAM_ID, FAKE_SECRET_ID
-        )
diff --git a/google-analytics-admin/properties_android_app_data_streams_update.py b/google-analytics-admin/properties_android_app_data_streams_update.py
deleted file mode 100644
index 72fc0a7..0000000
--- a/google-analytics-admin/properties_android_app_data_streams_update.py
+++ /dev/null
@@ -1,71 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2021 Google Inc. All Rights Reserved.
-#
-# 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.
-
-"""Google Analytics Admin API sample application which updates the Android app
-data stream.
-
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.androidAppDataStreams/update
-for more information.
-"""
-# [START analyticsadmin_properties_android_app_data_streams_update]
-from google.analytics.admin import AnalyticsAdminServiceClient
-from google.analytics.admin_v1alpha.types import AndroidAppDataStream
-from google.protobuf.field_mask_pb2 import FieldMask
-
-
-def run_sample():
-    """Runs the sample."""
-
-    # !!! ATTENTION !!!
-    #  Running this sample may change/delete your Google Analytics account
-    #  configuration. Make sure to not use the Google Analytics property ID from
-    #  your production environment below.
-
-    # TODO(developer): Replace this variable with your Google Analytics 4
-    #  property ID (e.g. "123456") before running the sample.
-    property_id = "YOUR-GA4-PROPERTY-ID"
-
-    # TODO(developer): Replace this variable with your Android app data stream ID
-    #  (e.g. "123456") before running the sample.
-    stream_id = "YOUR-ANDROID-APP-DATA-STREAM-ID"
-
-    update_android_app_data_stream(property_id, stream_id)
-
-
-def update_android_app_data_stream(property_id, stream_id):
-    """Updates the Android app data stream."""
-    client = AnalyticsAdminServiceClient()
-    # This call updates the display name of the Android app data stream, as
-    # indicated by the value of the `update_mask` field. The Android app data
-    # stream to update is specified in the `name` field of the
-    # `AndroidAppDataStream` instance.
-    android_app_data_stream = client.update_android_app_data_stream(
-        android_app_data_stream=AndroidAppDataStream(
-            name=f"properties/{property_id}/androidAppDataStreams/{stream_id}",
-            display_name="This is an updated test Android app data stream",
-        ),
-        update_mask=FieldMask(paths=["display_name"]),
-    )
-
-    print("Result:")
-    print(android_app_data_stream)
-
-
-# [END analyticsadmin_properties_android_app_data_streams_update]
-
-
-if __name__ == "__main__":
-    run_sample()
diff --git a/google-analytics-admin/properties_web_data_streams_create.py b/google-analytics-admin/properties_data_streams_create.py
similarity index 66%
rename from google-analytics-admin/properties_web_data_streams_create.py
rename to google-analytics-admin/properties_data_streams_create.py
index 17f8085..4caa801 100644
--- a/google-analytics-admin/properties_web_data_streams_create.py
+++ b/google-analytics-admin/properties_data_streams_create.py
@@ -14,15 +14,15 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-"""Google Analytics Admin API sample application which creates a web data stream
+"""Google Analytics Admin API sample application which creates a data stream
 for the Google Analytics 4 property.
 
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.webDataStreams/create
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.dataStreams/create
 for more information.
 """
-# [START analyticsadmin_properties_web_data_streams_create]
+# [START analyticsadmin_properties_data_streams_create]
 from google.analytics.admin import AnalyticsAdminServiceClient
-from google.analytics.admin_v1alpha.types import WebDataStream
+from google.analytics.admin_v1alpha.types import DataStream
 
 
 def run_sample():
@@ -36,24 +36,26 @@ def run_sample():
     # TODO(developer): Replace this variable with your Google Analytics 4
     #  property ID (e.g. "123456") before running the sample.
     property_id = "YOUR-GA4-PROPERTY-ID"
-    create_web_data_stream(property_id)
+    create_data_stream(property_id)
 
 
-def create_web_data_stream(property_id):
-    """Creates a web data stream for the Google Analytics 4 property."""
+def create_data_stream(property_id):
+    """Creates a data stream for the Google Analytics 4 property."""
     client = AnalyticsAdminServiceClient()
-    web_data_stream = client.create_web_data_stream(
-        parent=f"properties/{property_id}",
-        web_data_stream=WebDataStream(
-            default_uri="https://www.google.com", display_name="Test web data stream"
-        ),
+    data_stream = DataStream(
+        display_name="Test web data stream",
+        web_stream_data=DataStream.WebStreamData(default_uri="https://www.google.com"),
+    )
+    data_stream.type_ = "WEB_DATA_STREAM"
+    result = client.create_data_stream(
+        parent=f"properties/{property_id}", data_stream=data_stream,
     )
 
     print("Result:")
-    print(web_data_stream)
+    print(result)
 
 
-# [END analyticsadmin_properties_web_data_streams_create]
+# [END analyticsadmin_properties_data_streams_create]
 
 
 if __name__ == "__main__":
diff --git a/google-analytics-admin/properties_web_data_streams_create_test.py b/google-analytics-admin/properties_data_streams_create_test.py
similarity index 83%
rename from google-analytics-admin/properties_web_data_streams_create_test.py
rename to google-analytics-admin/properties_data_streams_create_test.py
index e79281c..2ba1de7 100644
--- a/google-analytics-admin/properties_web_data_streams_create_test.py
+++ b/google-analytics-admin/properties_data_streams_create_test.py
@@ -14,13 +14,13 @@
 
 import pytest
 
-import properties_web_data_streams_create
+import properties_data_streams_create
 
 FAKE_PROPERTY_ID = "1"
 
 
-def test_properties_web_data_streams_create():
+def test_properties_data_streams_create():
     # This test ensures that the call is valid and reaches the server, even
     # though the operation does not succeed due to permission error.
     with pytest.raises(Exception, match="403 The caller does not have permission"):
-        properties_web_data_streams_create.create_web_data_stream(FAKE_PROPERTY_ID)
+        properties_data_streams_create.create_data_stream(FAKE_PROPERTY_ID)
diff --git a/google-analytics-admin/properties_web_data_streams_delete.py b/google-analytics-admin/properties_data_streams_delete.py
similarity index 70%
rename from google-analytics-admin/properties_web_data_streams_delete.py
rename to google-analytics-admin/properties_data_streams_delete.py
index 5c3da2f..18d1749 100644
--- a/google-analytics-admin/properties_web_data_streams_delete.py
+++ b/google-analytics-admin/properties_data_streams_delete.py
@@ -14,13 +14,13 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-"""Google Analytics Admin API sample application which deletes the web data
+"""Google Analytics Admin API sample application which deletes the data
 stream from the Google Analytics 4 property.
 
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.webDataStreams/delete
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.dataStreams/delete
 for more information.
 """
-# [START analyticsadmin_properties_web_data_streams_delete]
+# [START analyticsadmin_properties_data_streams_delete]
 from google.analytics.admin import AnalyticsAdminServiceClient
 
 
@@ -36,23 +36,21 @@ def run_sample():
     #  property ID (e.g. "123456") before running the sample.
     property_id = "YOUR-GA4-PROPERTY-ID"
 
-    # TODO(developer): Replace this variable with your web data stream ID
+    # TODO(developer): Replace this variable with your data stream ID
     #  (e.g. "123456") before running the sample.
-    stream_id = "YOUR-WEB-DATA-STREAM-ID"
+    stream_id = "YOUR-DATA-STREAM-ID"
 
-    delete_web_data_stream(property_id, stream_id)
+    delete_data_stream(property_id, stream_id)
 
 
-def delete_web_data_stream(property_id, stream_id):
-    """Deletes the web data stream from the Google Analytics 4 property."""
+def delete_data_stream(property_id, stream_id):
+    """Deletes the data stream from the Google Analytics 4 property."""
     client = AnalyticsAdminServiceClient()
-    client.delete_web_data_stream(
-        name=f"properties/{property_id}/webDataStreams/{stream_id}"
-    )
-    print("Web data stream deleted")
+    client.delete_data_stream(name=f"properties/{property_id}/dataStreams/{stream_id}")
+    print("Data stream deleted")
 
 
-# [END analyticsadmin_properties_web_data_streams_delete]
+# [END analyticsadmin_properties_data_streams_delete]
 
 
 if __name__ == "__main__":
diff --git a/google-analytics-admin/properties_web_data_streams_delete_test.py b/google-analytics-admin/properties_data_streams_delete_test.py
similarity index 85%
rename from google-analytics-admin/properties_web_data_streams_delete_test.py
rename to google-analytics-admin/properties_data_streams_delete_test.py
index 6e4276b..58c846e 100644
--- a/google-analytics-admin/properties_web_data_streams_delete_test.py
+++ b/google-analytics-admin/properties_data_streams_delete_test.py
@@ -14,16 +14,16 @@
 
 import pytest
 
-import properties_web_data_streams_delete
+import properties_data_streams_delete
 
 FAKE_PROPERTY_ID = "1"
 FAKE_STREAM_ID = "1"
 
 
-def test_properties_web_data_streams_delete():
+def test_properties_data_streams_delete():
     # This test ensures that the call is valid and reaches the server, even
     # though the operation does not succeed due to permission error.
     with pytest.raises(Exception, match="403 The caller does not have permission"):
-        properties_web_data_streams_delete.delete_web_data_stream(
+        properties_data_streams_delete.delete_data_stream(
             FAKE_PROPERTY_ID, FAKE_STREAM_ID
         )
diff --git a/google-analytics-admin/properties_web_data_streams_get.py b/google-analytics-admin/properties_data_streams_get.py
similarity index 52%
rename from google-analytics-admin/properties_web_data_streams_get.py
rename to google-analytics-admin/properties_data_streams_get.py
index 27b9779..6d53d46 100644
--- a/google-analytics-admin/properties_web_data_streams_get.py
+++ b/google-analytics-admin/properties_data_streams_get.py
@@ -15,12 +15,12 @@
 # limitations under the License.
 
 """Google Analytics Admin API sample application which prints the details for
-the web data stream.
+the data stream.
 
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.webDataStreams/get
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.dataStreams/get
 for more information.
 """
-# [START analyticsadmin_properties_web_data_streams_get]
+# [START analyticsadmin_properties_data_streams_get]
 from google.analytics.admin import AnalyticsAdminServiceClient
 
 
@@ -30,36 +30,37 @@ def run_sample():
     #  property ID (e.g. "123456") before running the sample.
     property_id = "YOUR-GA4-PROPERTY-ID"
 
-    # TODO(developer): Replace this variable with your web data stream ID
+    # TODO(developer): Replace this variable with your data stream ID
     #  (e.g. "123456") before running the sample.
-    stream_id = "YOUR-WEB-DATA-STREAM-ID"
+    stream_id = "YOUR-DATA-STREAM-ID"
 
-    get_web_data_stream(property_id, stream_id)
+    get_data_stream(property_id, stream_id)
 
 
-def get_web_data_stream(property_id, stream_id):
-    """Retrieves the details for the web data stream."""
+def get_data_stream(property_id, stream_id):
+    """Retrieves the details for the data stream."""
     client = AnalyticsAdminServiceClient()
-    web_data_stream = client.get_web_data_stream(
-        name=f"properties/{property_id}/webDataStreams/{stream_id}"
+    data_stream = client.get_data_stream(
+        name=f"properties/{property_id}/dataStreams/{stream_id}"
     )
 
     print("Result:")
-    print_web_data_stream(web_data_stream)
+    print_data_stream(data_stream)
 
 
-def print_web_data_stream(web_data_stream):
-    """Prints the web data stream details."""
-    print(f"Resource name: {web_data_stream.name}")
-    print(f"Display name: {web_data_stream.display_name}")
-    print(f"Default URI: {web_data_stream.default_uri}")
-    print(f"Measurement ID: {web_data_stream.measurement_id}")
-    print(f"Firebase App ID: {web_data_stream.firebase_app_id}")
-    print(f"Create time: {web_data_stream.create_time}")
-    print(f"Update time: {web_data_stream.update_time}")
+def print_data_stream(data_stream):
+    """Prints the data stream details."""
+    print(f"Resource name: {data_stream.name}")
+    print(f"Display name: {data_stream.display_name}")
+    print(f"Type: {data_stream.type}")
+    print(f"Default URI: {data_stream.web_stream_data.default_uri}")
+    print(f"Measurement ID: {data_stream.web_stream_data.measurement_id}")
+    print(f"Firebase App ID: {data_stream.web_stream_data.firebase_app_id}")
+    print(f"Create time: {data_stream.create_time}")
+    print(f"Update time: {data_stream.update_time}")
 
 
-# [END analyticsadmin_properties_web_data_streams_get]
+# [END analyticsadmin_properties_data_streams_get]
 
 
 if __name__ == "__main__":
diff --git a/google-analytics-admin/properties_web_data_streams_get_global_site_tag.py b/google-analytics-admin/properties_data_streams_get_global_site_tag.py
similarity index 71%
rename from google-analytics-admin/properties_web_data_streams_get_global_site_tag.py
rename to google-analytics-admin/properties_data_streams_get_global_site_tag.py
index 7534b2c..0d26970 100644
--- a/google-analytics-admin/properties_web_data_streams_get_global_site_tag.py
+++ b/google-analytics-admin/properties_data_streams_get_global_site_tag.py
@@ -16,11 +16,8 @@
 
 """Google Analytics Admin API sample application which prints the Site Tag data
 for the specified web stream.
-
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.webDataStreams/getGlobalSiteTag
-for more information.
 """
-# [START analyticsadmin_properties_web_data_streams_get_global_site_tag]
+# [START analyticsadmin_properties_data_streams_get_global_site_tag]
 from google.analytics.admin import AnalyticsAdminServiceClient
 
 
@@ -30,25 +27,25 @@ def run_sample():
     #  property ID (e.g. "123456") before running the sample.
     property_id = "YOUR-GA4-PROPERTY-ID"
 
-    # TODO(developer): Replace this variable with your web data stream ID
+    # TODO(developer): Replace this variable with your data stream ID
     #  (e.g. "123456") before running the sample.
-    stream_id = "YOUR-WEB-DATA-STREAM-ID"
+    stream_id = "YOUR-DATA-STREAM-ID"
 
     get_global_site_tag(property_id, stream_id)
 
 
 def get_global_site_tag(property_id, stream_id):
-    """Retrieves the Site Tag for the specified web stream."""
+    """Retrieves the Site Tag for the specified data stream."""
     client = AnalyticsAdminServiceClient()
     global_site_tag = client.get_global_site_tag(
-        name=f"properties/{property_id}/webDataStreams/{stream_id}/globalSiteTag"
+        name=f"properties/{property_id}/dataStreams/{stream_id}/globalSiteTag"
     )
 
     print("Result:")
     print(global_site_tag.snippet)
 
 
-# [END analyticsadmin_properties_web_data_streams_get_global_site_tag]
+# [END analyticsadmin_properties_data_streams_get_global_site_tag]
 
 
 if __name__ == "__main__":
diff --git a/google-analytics-admin/properties_ios_app_data_streams_get_test.py b/google-analytics-admin/properties_data_streams_get_global_site_tag_test.py
similarity index 71%
rename from google-analytics-admin/properties_ios_app_data_streams_get_test.py
rename to google-analytics-admin/properties_data_streams_get_global_site_tag_test.py
index 6eb8109..7e0d649 100644
--- a/google-analytics-admin/properties_ios_app_data_streams_get_test.py
+++ b/google-analytics-admin/properties_data_streams_get_global_site_tag_test.py
@@ -14,15 +14,16 @@
 
 import os
 
-import properties_ios_app_data_streams_get
+import properties_data_streams_get_global_site_tag
+
 
 TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
-TEST_IOS_APP_DATA_STREAM_ID = os.getenv("GA_TEST_IOS_APP_DATA_STREAM_ID")
+TEST_DATA_STREAM_ID = os.getenv("GA_TEST_WEB_DATA_STREAM_ID")
 
 
-def test_properties_ios_app_data_streams_get(capsys):
-    properties_ios_app_data_streams_get.get_ios_app_data_stream(
-        TEST_PROPERTY_ID, TEST_IOS_APP_DATA_STREAM_ID
+def test_properties_data_streams_get_global_site_tag(capsys):
+    properties_data_streams_get_global_site_tag.get_global_site_tag(
+        TEST_PROPERTY_ID, TEST_DATA_STREAM_ID
     )
     out, _ = capsys.readouterr()
     assert "Result" in out
diff --git a/google-analytics-admin/properties_ios_app_data_streams_list_test.py b/google-analytics-admin/properties_data_streams_get_test.py
similarity index 75%
rename from google-analytics-admin/properties_ios_app_data_streams_list_test.py
rename to google-analytics-admin/properties_data_streams_get_test.py
index 449520c..d05cf19 100644
--- a/google-analytics-admin/properties_ios_app_data_streams_list_test.py
+++ b/google-analytics-admin/properties_data_streams_get_test.py
@@ -14,12 +14,14 @@
 
 import os
 
-import properties_ios_app_data_streams_list
+import properties_data_streams_get
+
 
 TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+TEST_DATA_STREAM_ID = os.getenv("GA_TEST_WEB_DATA_STREAM_ID")
 
 
-def test_properties_ios_app_data_streams_list(capsys):
-    properties_ios_app_data_streams_list.list_ios_app_data_streams(TEST_PROPERTY_ID)
+def test_properties_data_streams_get(capsys):
+    properties_data_streams_get.get_data_stream(TEST_PROPERTY_ID, TEST_DATA_STREAM_ID)
     out, _ = capsys.readouterr()
     assert "Result" in out
diff --git a/google-analytics-admin/properties_web_data_streams_list.py b/google-analytics-admin/properties_data_streams_list.py
similarity index 68%
rename from google-analytics-admin/properties_web_data_streams_list.py
rename to google-analytics-admin/properties_data_streams_list.py
index 5ef657a..73a9bd2 100644
--- a/google-analytics-admin/properties_web_data_streams_list.py
+++ b/google-analytics-admin/properties_data_streams_list.py
@@ -14,13 +14,13 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-"""Google Analytics Admin API sample application which prints web data streams
+"""Google Analytics Admin API sample application which prints data streams
 for the Google Analytics 4 property.
 
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.webDataStreams/list
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.dataStreams/list
 for more information.
 """
-# [START analyticsadmin_properties_web_data_streams_list]
+# [START analyticsadmin_properties_data_streams_list]
 from google.analytics.admin import AnalyticsAdminServiceClient
 
 
@@ -30,21 +30,21 @@ def run_sample():
     #  property ID (e.g. "123456") before running the sample.
     property_id = "YOUR-GA4-PROPERTY-ID"
 
-    list_web_data_streams(property_id)
+    list_data_streams(property_id)
 
 
-def list_web_data_streams(property_id):
-    """Lists web data streams for the Google Analytics 4 property."""
+def list_data_streams(property_id):
+    """Lists data streams for the Google Analytics 4 property."""
     client = AnalyticsAdminServiceClient()
-    results = client.list_web_data_streams(parent=f"properties/{property_id}")
+    results = client.list_data_streams(parent=f"properties/{property_id}")
 
     print("Result:")
-    for web_data_stream in results:
-        print(web_data_stream)
+    for data_stream in results:
+        print(data_stream)
         print()
 
 
-# [END analyticsadmin_properties_web_data_streams_list]
+# [END analyticsadmin_properties_data_streams_list]
 
 
 if __name__ == "__main__":
diff --git a/google-analytics-admin/properties_web_data_streams_list_test.py b/google-analytics-admin/properties_data_streams_list_test.py
similarity index 81%
rename from google-analytics-admin/properties_web_data_streams_list_test.py
rename to google-analytics-admin/properties_data_streams_list_test.py
index e757c68..fb8594e 100644
--- a/google-analytics-admin/properties_web_data_streams_list_test.py
+++ b/google-analytics-admin/properties_data_streams_list_test.py
@@ -14,12 +14,12 @@
 
 import os
 
-import properties_web_data_streams_list
+import properties_data_streams_list
 
 TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
 
 
-def test_properties_web_data_streams_list(capsys):
-    properties_web_data_streams_list.list_web_data_streams(TEST_PROPERTY_ID)
+def test_properties_data_streams_list(capsys):
+    properties_data_streams_list.list_data_streams(TEST_PROPERTY_ID)
     out, _ = capsys.readouterr()
     assert "Result" in out
diff --git a/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_create.py b/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_create.py
similarity index 75%
rename from google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_create.py
rename to google-analytics-admin/properties_data_streams_measurement_protocol_secrets_create.py
index d0a9ee1..c7b8717 100644
--- a/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_create.py
+++ b/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_create.py
@@ -15,12 +15,10 @@
 # limitations under the License.
 
 """Google Analytics Admin API sample application which creates a measurement
-protocol secret for the web data stream.
+protocol secret for the data stream.
 
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.webDataStreams.measurementProtocolSecrets/create
-for more information.
 """
-# [START analyticsadmin_properties_web_data_streams_measurement_protocol_secrets_create]
+# [START analyticsadmin_properties_data_streams_measurement_protocol_secrets_create]
 from google.analytics.admin import AnalyticsAdminServiceClient
 from google.analytics.admin_v1alpha import MeasurementProtocolSecret
 
@@ -37,18 +35,18 @@ def run_sample():
     #  property ID (e.g. "123456") before running the sample.
     property_id = "YOUR-GA4-PROPERTY-ID"
 
-    # TODO(developer): Replace this variable with your web data stream ID
+    # TODO(developer): Replace this variable with your data stream ID
     #  (e.g. "123456") before running the sample.
-    stream_id = "YOUR-WEB-DATA-STREAM-ID"
+    stream_id = "YOUR-DATA-STREAM-ID"
 
     create_measurement_protocol_secret(property_id, stream_id)
 
 
 def create_measurement_protocol_secret(property_id, stream_id):
-    """Creates a measurement protocol secret for the web data stream."""
+    """Creates a measurement protocol secret for the data stream."""
     client = AnalyticsAdminServiceClient()
     measurement_protocol_secret = client.create_measurement_protocol_secret(
-        parent=f"properties/{property_id}/webDataStreams/{stream_id}",
+        parent=f"properties/{property_id}/dataStreams/{stream_id}",
         measurement_protocol_secret=MeasurementProtocolSecret(
             display_name="New secret"
         ),
@@ -60,7 +58,7 @@ def create_measurement_protocol_secret(property_id, stream_id):
     print(f"Display name: {measurement_protocol_secret.display_name}")
 
 
-# [END analyticsadmin_properties_web_data_streams_measurement_protocol_secrets_create]
+# [END analyticsadmin_properties_data_streams_measurement_protocol_secrets_create]
 
 
 if __name__ == "__main__":
diff --git a/google-analytics-admin/properties_android_app_data_streams_update_test.py b/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_create_test.py
similarity index 79%
rename from google-analytics-admin/properties_android_app_data_streams_update_test.py
rename to google-analytics-admin/properties_data_streams_measurement_protocol_secrets_create_test.py
index de310b4..424579a 100644
--- a/google-analytics-admin/properties_android_app_data_streams_update_test.py
+++ b/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_create_test.py
@@ -14,17 +14,17 @@
 
 import pytest
 
-import properties_android_app_data_streams_update
+import properties_data_streams_measurement_protocol_secrets_create
 
 
 FAKE_PROPERTY_ID = "1"
 FAKE_STREAM_ID = "1"
 
 
-def test_properties_android_app_data_streams_update():
+def test_properties_data_streams_measurement_protocol_secrets_create():
     # This test ensures that the call is valid and reaches the server, even
     # though the operation does not succeed due to permission error.
     with pytest.raises(Exception, match="403 The caller does not have permission"):
-        properties_android_app_data_streams_update.update_android_app_data_stream(
+        properties_data_streams_measurement_protocol_secrets_create.create_measurement_protocol_secret(
             FAKE_PROPERTY_ID, FAKE_STREAM_ID
         )
diff --git a/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_delete.py b/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_delete.py
similarity index 72%
rename from google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_delete.py
rename to google-analytics-admin/properties_data_streams_measurement_protocol_secrets_delete.py
index 527de4e..a398c35 100644
--- a/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_delete.py
+++ b/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_delete.py
@@ -15,12 +15,10 @@
 # limitations under the License.
 
 """Google Analytics Admin API sample application which deletes a measurement
-protocol secret for the web data stream.
+protocol secret for the data stream.
 
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.webDataStreams.measurementProtocolSecrets/delete
-for more information.
 """
-# [START analyticsadmin_properties_web_data_streams_measurement_protocol_secrets_delete]
+# [START analyticsadmin_properties_data_streams_measurement_protocol_secrets_delete]
 from google.analytics.admin import AnalyticsAdminServiceClient
 
 
@@ -36,9 +34,9 @@ def run_sample():
     #  property ID (e.g. "123456") before running the sample.
     property_id = "YOUR-GA4-PROPERTY-ID"
 
-    # TODO(developer): Replace this variable with your web data stream ID
+    # TODO(developer): Replace this variable with your data stream ID
     #  (e.g. "123456") before running the sample.
-    stream_id = "YOUR-WEB-DATA-STREAM-ID"
+    stream_id = "YOUR-DATA-STREAM-ID"
 
     # TODO(developer): Replace this variable with your measurement protocol
     #  secret ID (e.g. "123456") before running the sample.
@@ -48,15 +46,15 @@ def run_sample():
 
 
 def delete_measurement_protocol_secret(property_id, stream_id, secret_id):
-    """Deletes a measurement protocol secret for the web data stream."""
+    """Deletes a measurement protocol secret for the data stream."""
     client = AnalyticsAdminServiceClient()
     client.delete_measurement_protocol_secret(
-        name=f"properties/{property_id}/webDataStreams/{stream_id}/measurementProtocolSecrets/{secret_id}"
+        name=f"properties/{property_id}/dataStreams/{stream_id}/measurementProtocolSecrets/{secret_id}"
     )
     print("Measurement protocol secret deleted")
 
 
-# [END analyticsadmin_properties_web_data_streams_measurement_protocol_secrets_delete]
+# [END analyticsadmin_properties_data_streams_measurement_protocol_secrets_delete]
 
 
 if __name__ == "__main__":
diff --git a/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_delete_test.py b/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_delete_test.py
similarity index 79%
rename from google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_delete_test.py
rename to google-analytics-admin/properties_data_streams_measurement_protocol_secrets_delete_test.py
index df5c48f..e34c33f 100644
--- a/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_delete_test.py
+++ b/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_delete_test.py
@@ -14,7 +14,7 @@
 
 import pytest
 
-import properties_web_data_streams_measurement_protocol_secrets_delete
+import properties_data_streams_measurement_protocol_secrets_delete
 
 
 FAKE_PROPERTY_ID = "1"
@@ -22,10 +22,10 @@
 FAKE_SECRET_ID = "1"
 
 
-def test_properties_web_data_streams_measurement_protocol_secrets_delete():
+def test_properties_data_streams_measurement_protocol_secrets_delete():
     # This test ensures that the call is valid and reaches the server, even
     # though the operation does not succeed due to permission error.
     with pytest.raises(Exception, match="403 The caller does not have permission"):
-        properties_web_data_streams_measurement_protocol_secrets_delete.delete_measurement_protocol_secret(
+        properties_data_streams_measurement_protocol_secrets_delete.delete_measurement_protocol_secret(
             FAKE_PROPERTY_ID, FAKE_STREAM_ID, FAKE_SECRET_ID
         )
diff --git a/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_get.py b/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_get.py
similarity index 80%
rename from google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_get.py
rename to google-analytics-admin/properties_data_streams_measurement_protocol_secrets_get.py
index 78b8235..2df88aa 100644
--- a/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_get.py
+++ b/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_get.py
@@ -17,10 +17,10 @@
 """Google Analytics Admin API sample application which retrieves the details
 for the measurement protocol secret.
 
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.webDataStreams.measurementProtocolSecrets/get
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.dataStreams.measurementProtocolSecrets/get
 for more information.
 """
-# [START analyticsadmin_properties_web_data_streams_measurement_protocol_secrets_get]
+# [START analyticsadmin_properties_data_streams_measurement_protocol_secrets_get]
 from google.analytics.admin import AnalyticsAdminServiceClient
 
 
@@ -30,9 +30,9 @@ def run_sample():
     #  property ID (e.g. "123456") before running the sample.
     property_id = "YOUR-GA4-PROPERTY-ID"
 
-    # TODO(developer): Replace this variable with your web data stream ID
+    # TODO(developer): Replace this variable with your data stream ID
     #  (e.g. "123456") before running the sample.
-    stream_id = "YOUR-WEB-DATA-STREAM-ID"
+    stream_id = "YOUR-DATA-STREAM-ID"
 
     # TODO(developer): Replace this variable with your measurement protocol
     #  secret ID (e.g. "123456") before running the sample.
@@ -45,7 +45,7 @@ def get_measurement_protocol_secret(property_id, stream_id, secret_id):
     """Retrieves the details for the measurement protocol secret."""
     client = AnalyticsAdminServiceClient()
     measurement_protocol_secret = client.get_measurement_protocol_secret(
-        name=f"properties/{property_id}/webDataStreams/{stream_id}/measurementProtocolSecrets/{secret_id}"
+        name=f"properties/{property_id}/dataStreams/{stream_id}/measurementProtocolSecrets/{secret_id}"
     )
 
     print("Result:")
@@ -54,7 +54,7 @@ def get_measurement_protocol_secret(property_id, stream_id, secret_id):
     print(f"Display name: {measurement_protocol_secret.display_name}")
 
 
-# [END analyticsadmin_properties_web_data_streams_measurement_protocol_secrets_get]
+# [END analyticsadmin_properties_data_streams_measurement_protocol_secrets_get]
 
 
 if __name__ == "__main__":
diff --git a/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_get_test.py b/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_get_test.py
similarity index 78%
rename from google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_get_test.py
rename to google-analytics-admin/properties_data_streams_measurement_protocol_secrets_get_test.py
index 6e1f530..8d280e6 100644
--- a/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_get_test.py
+++ b/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_get_test.py
@@ -14,15 +14,15 @@
 
 import os
 
-import properties_web_data_streams_measurement_protocol_secrets_get
+import properties_data_streams_measurement_protocol_secrets_get
 
 TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
 TEST_STREAM_ID = os.getenv("GA_TEST_WEB_DATA_STREAM_ID")
 TEST_SECRET_ID = os.getenv("GA_TEST_WEB_DATA_SECRET_ID")
 
 
-def test_properties_web_data_streams_measurement_protocol_secrets_get(capsys):
-    properties_web_data_streams_measurement_protocol_secrets_get.get_measurement_protocol_secret(
+def test_properties_data_streams_measurement_protocol_secrets_get(capsys):
+    properties_data_streams_measurement_protocol_secrets_get.get_measurement_protocol_secret(
         TEST_PROPERTY_ID, TEST_STREAM_ID, TEST_SECRET_ID
     )
     out, _ = capsys.readouterr()
diff --git a/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_list.py b/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_list.py
similarity index 71%
rename from google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_list.py
rename to google-analytics-admin/properties_data_streams_measurement_protocol_secrets_list.py
index cf12344..5abdc93 100644
--- a/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_list.py
+++ b/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_list.py
@@ -15,12 +15,10 @@
 # limitations under the License.
 
 """Google Analytics Admin API sample application which lists measurement
-protocol secrets for the web data stream.
+protocol secrets for the data stream.
 
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.webDataStreams.measurementProtocolSecrets/list
-for more information.
 """
-# [START analyticsadmin_properties_android_app_data_streams_measurement_protocol_secrets_list]
+# [START analyticsadmin_properties_data_streams_measurement_protocol_secrets_list]
 from google.analytics.admin import AnalyticsAdminServiceClient
 
 
@@ -30,17 +28,17 @@ def run_sample():
     #  property ID (e.g. "123456") before running the sample.
     property_id = "YOUR-GA4-PROPERTY-ID"
 
-    # TODO(developer): Replace this variable with your web data stream ID
+    # TODO(developer): Replace this variable with your data stream ID
     #  (e.g. "123456") before running the sample.
-    stream_id = "YOUR-WEB-DATA-STREAM-ID"
+    stream_id = "YOUR-DATA-STREAM-ID"
     list_measurement_protocol_secrets(property_id, stream_id)
 
 
 def list_measurement_protocol_secrets(property_id, stream_id):
-    """Lists measurement protocol secrets for the web data stream."""
+    """Lists measurement protocol secrets for the data stream."""
     client = AnalyticsAdminServiceClient()
     results = client.list_measurement_protocol_secrets(
-        parent=f"properties/{property_id}/webDataStreams/{stream_id}"
+        parent=f"properties/{property_id}/dataStreams/{stream_id}"
     )
 
     print("Result:")
@@ -52,7 +50,7 @@ def list_measurement_protocol_secrets(property_id, stream_id):
         print()
 
 
-# [END analyticsadmin_properties_android_app_data_streams_measurement_protocol_secrets_list]
+# [END analyticsadmin_properties_data_streams_measurement_protocol_secrets_list]
 
 
 if __name__ == "__main__":
diff --git a/google-analytics-admin/properties_web_data_streams_get_test.py b/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_list_test.py
similarity index 67%
rename from google-analytics-admin/properties_web_data_streams_get_test.py
rename to google-analytics-admin/properties_data_streams_measurement_protocol_secrets_list_test.py
index c03c3be..c8c4137 100644
--- a/google-analytics-admin/properties_web_data_streams_get_test.py
+++ b/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_list_test.py
@@ -14,16 +14,16 @@
 
 import os
 
-import properties_web_data_streams_get
+import properties_data_streams_measurement_protocol_secrets_list
 
 
 TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
-TEST_WEB_DATA_STREAM_ID = os.getenv("GA_TEST_WEB_DATA_STREAM_ID")
+TEST_DATA_STREAM_ID = os.getenv("GA_TEST_WEB_DATA_STREAM_ID")
 
 
-def test_properties_android_app_data_streams_get(capsys):
-    properties_web_data_streams_get.get_web_data_stream(
-        TEST_PROPERTY_ID, TEST_WEB_DATA_STREAM_ID
+def test_properties_data_streams_measurement_protocol_secrets_list(capsys):
+    properties_data_streams_measurement_protocol_secrets_list.list_measurement_protocol_secrets(
+        TEST_PROPERTY_ID, TEST_DATA_STREAM_ID
     )
     out, _ = capsys.readouterr()
     assert "Result" in out
diff --git a/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_update.py b/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_update.py
similarity index 81%
rename from google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_update.py
rename to google-analytics-admin/properties_data_streams_measurement_protocol_secrets_update.py
index 32bd92c..0db2dcd 100644
--- a/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_update.py
+++ b/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_update.py
@@ -15,12 +15,10 @@
 # limitations under the License.
 
 """Google Analytics Admin API sample application which updates the measurement
-protocol secret for the web data stream.
+protocol secret for the data stream.
 
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.webDataStreams.measurementProtocolSecrets/patch
-for more information.
 """
-# [START analyticsadmin_properties_web_data_streams_measurement_protocol_secrets_update]
+# [START analyticsadmin_properties_data_streams_measurement_protocol_secrets_update]
 from google.analytics.admin import AnalyticsAdminServiceClient
 from google.analytics.admin_v1alpha import MeasurementProtocolSecret
 from google.protobuf.field_mask_pb2 import FieldMask
@@ -38,9 +36,9 @@ def run_sample():
     #  property ID (e.g. "123456") before running the sample.
     property_id = "YOUR-GA4-PROPERTY-ID"
 
-    # TODO(developer): Replace this variable with your web data stream ID
+    # TODO(developer): Replace this variable with your data stream ID
     #  (e.g. "123456") before running the sample.
-    stream_id = "YOUR-WEB-DATA-STREAM-ID"
+    stream_id = "YOUR-DATA-STREAM-ID"
 
     # TODO(developer): Replace this variable with your measurement protocol
     #  secret ID (e.g. "123456") before running the sample.
@@ -58,7 +56,7 @@ def update_measurement_protocol_secret(property_id, stream_id, secret_id):
     # `MeasurementProtocolSecret` instance.
     measurement_protocol_secret = client.update_measurement_protocol_secret(
         measurement_protocol_secret=MeasurementProtocolSecret(
-            name=f"properties/{property_id}/webDataStreams/{stream_id}/measurementProtocolSecrets/{secret_id}",
+            name=f"properties/{property_id}/dataStreams/{stream_id}/measurementProtocolSecrets/{secret_id}",
             display_name="This is an updated measurement protocol secret",
         ),
         update_mask=FieldMask(paths=["display_name"]),
@@ -70,7 +68,7 @@ def update_measurement_protocol_secret(property_id, stream_id, secret_id):
     print(f"Display name: {measurement_protocol_secret.display_name}")
 
 
-# [END analyticsadmin_properties_web_data_streams_measurement_protocol_secrets_update]
+# [END analyticsadmin_properties_data_streams_measurement_protocol_secrets_update]
 
 
 if __name__ == "__main__":
diff --git a/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_update_test.py b/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_update_test.py
similarity index 79%
rename from google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_update_test.py
rename to google-analytics-admin/properties_data_streams_measurement_protocol_secrets_update_test.py
index 8a4d458..697e794 100644
--- a/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_update_test.py
+++ b/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_update_test.py
@@ -14,17 +14,17 @@
 
 import pytest
 
-import properties_web_data_streams_measurement_protocol_secrets_update
+import properties_data_streams_measurement_protocol_secrets_update
 
 FAKE_PROPERTY_ID = "1"
 FAKE_STREAM_ID = "1"
 FAKE_SECRET_ID = "1"
 
 
-def test_properties_web_data_streams_measurement_protocol_secrets_update():
+def test_properties_data_streams_measurement_protocol_secrets_update():
     # This test ensures that the call is valid and reaches the server, even
     # though the operation does not succeed due to permission error.
     with pytest.raises(Exception, match="403 The caller does not have permission"):
-        properties_web_data_streams_measurement_protocol_secrets_update.update_measurement_protocol_secret(
+        properties_data_streams_measurement_protocol_secrets_update.update_measurement_protocol_secret(
             FAKE_PROPERTY_ID, FAKE_STREAM_ID, FAKE_SECRET_ID
         )
diff --git a/google-analytics-admin/properties_web_data_streams_update.py b/google-analytics-admin/properties_data_streams_update.py
similarity index 61%
rename from google-analytics-admin/properties_web_data_streams_update.py
rename to google-analytics-admin/properties_data_streams_update.py
index a26635d..b573fa1 100644
--- a/google-analytics-admin/properties_web_data_streams_update.py
+++ b/google-analytics-admin/properties_data_streams_update.py
@@ -14,15 +14,15 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-"""Google Analytics Admin API sample application which updates the web data
+"""Google Analytics Admin API sample application which updates the data
 stream.
 
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.webDataStreams/update
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.dataStreams/update
 for more information.
 """
-# [START analyticsadmin_properties_web_data_streams_update]
+# [START analyticsadmin_properties_data_streams_update]
 from google.analytics.admin import AnalyticsAdminServiceClient
-from google.analytics.admin_v1alpha.types import WebDataStream
+from google.analytics.admin_v1alpha.types import DataStream
 from google.protobuf.field_mask_pb2 import FieldMask
 
 
@@ -38,32 +38,32 @@ def run_sample():
     #  property ID (e.g. "123456") before running the sample.
     property_id = "YOUR-GA4-PROPERTY-ID"
 
-    # TODO(developer): Replace this variable with your web data stream ID
+    # TODO(developer): Replace this variable with your data stream ID
     #  (e.g. "123456") before running the sample.
-    stream_id = "YOUR-WEB-DATA-STREAM-ID"
+    stream_id = "YOUR-DATA-STREAM-ID"
 
-    update_web_data_stream(property_id, stream_id)
+    update_data_stream(property_id, stream_id)
 
 
-def update_web_data_stream(property_id, stream_id):
-    """Updates the web data stream."""
+def update_data_stream(property_id, stream_id):
+    """Updates the data stream."""
     client = AnalyticsAdminServiceClient()
-    # This call updates the display name of the web data stream, as indicated by
-    # the value of the `update_mask` field. The web data stream to update is
-    # specified in the `name` field of the `WebDataStream` instance.
-    web_data_stream = client.update_web_data_stream(
-        web_data_stream=WebDataStream(
-            name=f"properties/{property_id}/webDataStreams/{stream_id}",
-            display_name="This is an updated test web data stream",
+    # This call updates the display name of the data stream, as indicated by
+    # the value of the `update_mask` field. The data stream to update is
+    # specified in the `name` field of the `dataStream` instance.
+    data_stream = client.update_data_stream(
+        data_stream=DataStream(
+            name=f"properties/{property_id}/dataStreams/{stream_id}",
+            display_name="This is an updated test data stream",
         ),
         update_mask=FieldMask(paths=["display_name"]),
     )
 
     print("Result:")
-    print(web_data_stream)
+    print(data_stream)
 
 
-# [END analyticsadmin_properties_web_data_streams_update]
+# [END analyticsadmin_properties_data_streams_update]
 
 
 if __name__ == "__main__":
diff --git a/google-analytics-admin/properties_web_data_streams_update_test.py b/google-analytics-admin/properties_data_streams_update_test.py
similarity index 85%
rename from google-analytics-admin/properties_web_data_streams_update_test.py
rename to google-analytics-admin/properties_data_streams_update_test.py
index 03f06a7..e95a8dc 100644
--- a/google-analytics-admin/properties_web_data_streams_update_test.py
+++ b/google-analytics-admin/properties_data_streams_update_test.py
@@ -14,17 +14,17 @@
 
 import pytest
 
-import properties_web_data_streams_update
+import properties_data_streams_update
 
 
 FAKE_PROPERTY_ID = "1"
 FAKE_STREAM_ID = "1"
 
 
-def test_properties_web_data_streams_update():
+def test_properties_data_streams_update():
     # This test ensures that the call is valid and reaches the server, even
     # though the operation does not succeed due to permission error.
     with pytest.raises(Exception, match="403 The caller does not have permission"):
-        properties_web_data_streams_update.update_web_data_stream(
+        properties_data_streams_update.update_data_stream(
             FAKE_PROPERTY_ID, FAKE_STREAM_ID
         )
diff --git a/google-analytics-admin/properties_ios_app_data_streams_delete.py b/google-analytics-admin/properties_ios_app_data_streams_delete.py
deleted file mode 100644
index b02a280..0000000
--- a/google-analytics-admin/properties_ios_app_data_streams_delete.py
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-"""Google Analytics Admin API sample application which deletes the iOS app data
-stream.
-
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.iosAppDataStreams/delete
-for more information.
-"""
-# [START analyticsadmin_properties_ios_app_data_streams_delete]
-from google.analytics.admin import AnalyticsAdminServiceClient
-
-
-def run_sample():
-    """Runs the sample."""
-
-    # !!! ATTENTION !!!
-    #  Running this sample may change/delete your Google Analytics account
-    #  configuration. Make sure to not use the Google Analytics property ID from
-    #  your production environment below.
-
-    # TODO(developer): Replace this variable with your Google Analytics 4
-    #  property ID (e.g. "123456") before running the sample.
-    property_id = "YOUR-GA4-PROPERTY-ID"
-
-    # TODO(developer): Replace this variable with your iOS app data stream ID
-    #  (e.g. "123456") before running the sample.
-    stream_id = "YOUR-IOS-APP-DATA-STREAM-ID"
-
-    delete_ios_app_data_stream(property_id, stream_id)
-
-
-def delete_ios_app_data_stream(property_id, stream_id):
-    """Deletes the iOS app data stream."""
-    client = AnalyticsAdminServiceClient()
-    client.delete_ios_app_data_stream(
-        name=f"properties/{property_id}/iosAppDataStreams/{stream_id}"
-    )
-    print("iOS app data stream deleted")
-
-
-# [END analyticsadmin_properties_ios_app_data_streams_delete]
-
-
-if __name__ == "__main__":
-    run_sample()
diff --git a/google-analytics-admin/properties_ios_app_data_streams_delete_test.py b/google-analytics-admin/properties_ios_app_data_streams_delete_test.py
deleted file mode 100644
index 6c20728..0000000
--- a/google-analytics-admin/properties_ios_app_data_streams_delete_test.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-import pytest
-
-import properties_ios_app_data_streams_delete
-
-
-FAKE_PROPERTY_ID = "1"
-FAKE_STREAM_ID = "1"
-
-
-def test_properties_ios_app_data_streams_delete():
-    # This test ensures that the call is valid and reaches the server, even
-    # though the operation does not succeed due to permission error.
-    with pytest.raises(Exception, match="403 The caller does not have permission"):
-        properties_ios_app_data_streams_delete.delete_ios_app_data_stream(
-            FAKE_PROPERTY_ID, FAKE_STREAM_ID
-        )
diff --git a/google-analytics-admin/properties_ios_app_data_streams_get.py b/google-analytics-admin/properties_ios_app_data_streams_get.py
deleted file mode 100644
index 50a617a..0000000
--- a/google-analytics-admin/properties_ios_app_data_streams_get.py
+++ /dev/null
@@ -1,65 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-"""Google Analytics Admin API sample application which prints the iOS app data
-stream details.
-
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.iosAppDataStreams/get
-for more information.
-"""
-# [START analyticsadmin_properties_ios_app_data_streams_get]
-from google.analytics.admin import AnalyticsAdminServiceClient
-
-
-def run_sample():
-    """Runs the sample."""
-    # TODO(developer): Replace this variable with your Google Analytics 4
-    #  property ID (e.g. "123456") before running the sample.
-    property_id = "YOUR-GA4-PROPERTY-ID"
-
-    # TODO(developer): Replace this variable with your iOS app data stream ID
-    #  (e.g. "123456") before running the sample.
-    stream_id = "YOUR-IOS-APP-DATA-STREAM-ID"
-
-    get_ios_app_data_stream(property_id, stream_id)
-
-
-def get_ios_app_data_stream(property_id, stream_id):
-    """Retrieves the details for the iOS app data stream."""
-    client = AnalyticsAdminServiceClient()
-    ios_app_data_stream = client.get_ios_app_data_stream(
-        name=f"properties/{property_id}/iosAppDataStreams/{stream_id}"
-    )
-
-    print("Result:")
-    print_ios_app_data_stream(ios_app_data_stream)
-
-
-def print_ios_app_data_stream(ios_app_data_stream):
-    """Prints the iOS app data stream details."""
-    print(f"Resource name: {ios_app_data_stream.name}")
-    print(f"Display name: {ios_app_data_stream.display_name}")
-    print(f"Firebase app ID: {ios_app_data_stream.firebase_app_id}")
-    print(f"Bundle ID: {ios_app_data_stream.bundle_id}")
-    print(f"Create time: {ios_app_data_stream.create_time}")
-    print(f"Update time: {ios_app_data_stream.update_time}")
-
-
-# [END analyticsadmin_properties_ios_app_data_streams_get]
-
-
-if __name__ == "__main__":
-    run_sample()
diff --git a/google-analytics-admin/properties_ios_app_data_streams_list.py b/google-analytics-admin/properties_ios_app_data_streams_list.py
deleted file mode 100644
index 4260802..0000000
--- a/google-analytics-admin/properties_ios_app_data_streams_list.py
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-"""Google Analytics Admin API sample application which prints iOS app data
-streams for the Google Analytics 4 property.
-
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.iosAppDataStreams/list
-for more information.
-"""
-# [START analyticsadmin_properties_ios_app_data_streams_list]
-from google.analytics.admin import AnalyticsAdminServiceClient
-
-
-def run_sample():
-    """Runs the sample."""
-    # TODO(developer): Replace this variable with your Google Analytics 4
-    #  property ID (e.g. "123456") before running the sample.
-    property_id = "YOUR-GA4-PROPERTY-ID"
-
-    list_ios_app_data_streams(property_id)
-
-
-def list_ios_app_data_streams(property_id):
-    """Lists iOS app data streams for the Google Analytics 4 property."""
-    client = AnalyticsAdminServiceClient()
-    results = client.list_ios_app_data_streams(parent=f"properties/{property_id}")
-
-    print("Result:")
-    for ios_app_data_stream in results:
-        print(ios_app_data_stream)
-        print()
-
-
-# [END analyticsadmin_properties_ios_app_data_streams_list]
-
-
-if __name__ == "__main__":
-    run_sample()
diff --git a/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_create.py b/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_create.py
deleted file mode 100644
index 53da458..0000000
--- a/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_create.py
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2021 Google Inc. All Rights Reserved.
-#
-# 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.
-
-"""Google Analytics Admin API sample application which creates a measurement
-protocol secret for the iOS app data stream.
-
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.iosAppDataStreams.measurementProtocolSecrets/create
-for more information.
-"""
-# [START analyticsadmin_properties_ios_app_data_streams_measurement_protocol_secrets_create]
-from google.analytics.admin import AnalyticsAdminServiceClient
-from google.analytics.admin_v1alpha import MeasurementProtocolSecret
-
-
-def run_sample():
-    """Runs the sample."""
-
-    # !!! ATTENTION !!!
-    #  Running this sample may change/delete your Google Analytics account
-    #  configuration. Make sure to not use the Google Analytics property ID from
-    #  your production environment below.
-
-    # TODO(developer): Replace this variable with your Google Analytics 4
-    #  property ID (e.g. "123456") before running the sample.
-    property_id = "YOUR-GA4-PROPERTY-ID"
-
-    # TODO(developer): Replace this variable with your iOS app data stream ID
-    #  (e.g. "123456") before running the sample.
-    stream_id = "YOUR-IOS-APP-DATA-STREAM-ID"
-
-    create_measurement_protocol_secret(property_id, stream_id)
-
-
-def create_measurement_protocol_secret(property_id, stream_id):
-    """Creates a measurement protocol secret for the iOS app data stream."""
-    client = AnalyticsAdminServiceClient()
-    measurement_protocol_secret = client.create_measurement_protocol_secret(
-        parent=f"properties/{property_id}/iosAppDataStreams/{stream_id}",
-        measurement_protocol_secret=MeasurementProtocolSecret(
-            display_name="New secret"
-        ),
-    )
-
-    print("Result:")
-    print(f"Resource name: {measurement_protocol_secret.name}")
-    print(f"Secret value: {measurement_protocol_secret.secret_value}")
-    print(f"Display name: {measurement_protocol_secret.display_name}")
-
-
-# [END analyticsadmin_properties_ios_app_data_streams_measurement_protocol_secrets_create]
-
-
-if __name__ == "__main__":
-    run_sample()
diff --git a/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_create_test.py b/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_create_test.py
deleted file mode 100644
index cbacd2d..0000000
--- a/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_create_test.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-import pytest
-
-import properties_ios_app_data_streams_measurement_protocol_secrets_create
-
-
-FAKE_PROPERTY_ID = "1"
-FAKE_STREAM_ID = "1"
-
-
-def test_properties_ios_app_data_streams_measurement_protocol_secrets_create():
-    # This test ensures that the call is valid and reaches the server, even
-    # though the operation does not succeed due to permission error.
-    with pytest.raises(Exception, match="403 The caller does not have permission"):
-        properties_ios_app_data_streams_measurement_protocol_secrets_create.create_measurement_protocol_secret(
-            FAKE_PROPERTY_ID, FAKE_STREAM_ID
-        )
diff --git a/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_delete.py b/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_delete.py
deleted file mode 100644
index 8a5a5bf..0000000
--- a/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_delete.py
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2021 Google Inc. All Rights Reserved.
-#
-# 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.
-
-"""Google Analytics Admin API sample application which deletes the measurement
-protocol secret for the iOS app data stream.
-
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.iosAppDataStreams.measurementProtocolSecrets/delete
-for more information.
-"""
-# [START analyticsadmin_properties_ios_app_data_streams_measurement_protocol_secrets_delete]
-from google.analytics.admin import AnalyticsAdminServiceClient
-
-
-def run_sample():
-    """Runs the sample."""
-
-    # !!! ATTENTION !!!
-    #  Running this sample may change/delete your Google Analytics account
-    #  configuration. Make sure to not use the Google Analytics property ID from
-    #  your production environment below.
-
-    # TODO(developer): Replace this variable with your Google Analytics 4
-    #  property ID (e.g. "123456") before running the sample.
-    property_id = "YOUR-GA4-PROPERTY-ID"
-
-    # TODO(developer): Replace this variable with your iOS app data stream ID
-    #  (e.g. "123456") before running the sample.
-    stream_id = "YOUR-IOS-APP-DATA-STREAM-ID"
-
-    # TODO(developer): Replace this variable with your measurement protocol
-    #  secret ID (e.g. "123456") before running the sample.
-    secret_id = "YOUR-MEASUREMENT-PROTOCOL-SECRET-ID"
-
-    delete_measurement_protocol_secret(property_id, stream_id, secret_id)
-
-
-def delete_measurement_protocol_secret(property_id, stream_id, secret_id):
-    """Deletes the measurement protocol secret for the web data
-    stream."""
-    client = AnalyticsAdminServiceClient()
-    client.delete_measurement_protocol_secret(
-        name=f"properties/{property_id}/iosAppDataStreams/{stream_id}/measurementProtocolSecrets/{secret_id}"
-    )
-    print("Measurement protocol secret deleted")
-
-
-# [END analyticsadmin_properties_ios_app_data_streams_measurement_protocol_secrets_delete]
-
-
-if __name__ == "__main__":
-    run_sample()
diff --git a/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_delete_test.py b/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_delete_test.py
deleted file mode 100644
index 0070d00..0000000
--- a/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_delete_test.py
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-import pytest
-
-import properties_ios_app_data_streams_measurement_protocol_secrets_delete
-
-
-FAKE_PROPERTY_ID = "1"
-FAKE_STREAM_ID = "1"
-FAKE_SECRET_ID = "1"
-
-
-def test_properties_ios_app_data_streams_measurement_protocol_secrets_delete():
-    # This test ensures that the call is valid and reaches the server, even
-    # though the operation does not succeed due to permission error.
-    with pytest.raises(Exception, match="403 The caller does not have permission"):
-        properties_ios_app_data_streams_measurement_protocol_secrets_delete.delete_measurement_protocol_secret(
-            FAKE_PROPERTY_ID, FAKE_STREAM_ID, FAKE_SECRET_ID
-        )
diff --git a/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_get.py b/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_get.py
deleted file mode 100644
index 75f20ee..0000000
--- a/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_get.py
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2021 Google Inc. All Rights Reserved.
-#
-# 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.
-
-"""Google Analytics Admin API sample application which retrieves the details
-for the measurement protocol secret.
-
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.iosAppDataStreams.measurementProtocolSecrets/get
-for more information.
-"""
-# [START analyticsadmin_properties_ios_app_data_streams_measurement_protocol_secrets_get]
-from google.analytics.admin import AnalyticsAdminServiceClient
-
-
-def run_sample():
-    """Runs the sample."""
-    # TODO(developer): Replace this variable with your Google Analytics 4
-    #  property ID (e.g. "123456") before running the sample.
-    property_id = "YOUR-GA4-PROPERTY-ID"
-
-    # TODO(developer): Replace this variable with your iOS app data stream ID
-    #  (e.g. "123456") before running the sample.
-    stream_id = "YOUR-IOS-APP-DATA-STREAM-ID"
-
-    # TODO(developer): Replace this variable with your measurement protocol
-    #  secret ID (e.g. "123456") before running the sample.
-    secret_id = "YOUR-MEASUREMENT-PROTOCOL-SECRET-ID"
-
-    get_measurement_protocol_secret(property_id, stream_id, secret_id)
-
-
-def get_measurement_protocol_secret(property_id, stream_id, secret_id):
-    """Retrieves the details for the measurement protocol secret."""
-    client = AnalyticsAdminServiceClient()
-    measurement_protocol_secret = client.get_measurement_protocol_secret(
-        name=f"properties/{property_id}/iosAppDataStreams/{stream_id}/measurementProtocolSecrets/{secret_id}"
-    )
-
-    print("Result:")
-    print(f"Resource name: {measurement_protocol_secret.name}")
-    print(f"Secret value: {measurement_protocol_secret.secret_value}")
-    print(f"Display name: {measurement_protocol_secret.display_name}")
-
-
-# [END analyticsadmin_properties_ios_app_data_streams_measurement_protocol_secrets_get]
-
-
-if __name__ == "__main__":
-    run_sample()
diff --git a/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_get_test.py b/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_get_test.py
deleted file mode 100644
index 28a5b15..0000000
--- a/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_get_test.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-import os
-
-import properties_ios_app_data_streams_measurement_protocol_secrets_get
-
-TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
-TEST_STREAM_ID = os.getenv("GA_TEST_IOS_APP_DATA_STREAM_ID")
-TEST_SECRET_ID = os.getenv("GA_TEST_IOS_APP_DATA_SECRET_ID")
-
-
-def test_properties_ios_app_data_streams_measurement_protocol_secrets_get(capsys):
-    properties_ios_app_data_streams_measurement_protocol_secrets_get.get_measurement_protocol_secret(
-        TEST_PROPERTY_ID, TEST_STREAM_ID, TEST_SECRET_ID
-    )
-    out, _ = capsys.readouterr()
-    assert "Result" in out
diff --git a/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_list.py b/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_list.py
deleted file mode 100644
index 689313f..0000000
--- a/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_list.py
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2021 Google Inc. All Rights Reserved.
-#
-# 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.
-
-"""Google Analytics Admin API sample application which lists measurement
-protocol secrets for the iOS app data stream.
-
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.iosAppDataStreams.measurementProtocolSecrets/list
-for more information.
-"""
-# [START analyticsadmin_properties_ios_app_data_streams_measurement_protocol_secrets_list]
-from google.analytics.admin import AnalyticsAdminServiceClient
-
-
-def run_sample():
-    """Runs the sample."""
-    # TODO(developer): Replace this variable with your Google Analytics 4
-    #  property ID (e.g. "123456") before running the sample.
-    property_id = "YOUR-GA4-PROPERTY-ID"
-
-    # TODO(developer): Replace this variable with your iOS app data stream ID
-    #  (e.g. "123456") before running the sample.
-    stream_id = "YOUR-IOS-APP-DATA-STREAM-ID"
-    list_measurement_protocol_secrets(property_id, stream_id)
-
-
-def list_measurement_protocol_secrets(property_id, stream_id):
-    """Lists measurement protocol secrets for the iOS app data stream."""
-    client = AnalyticsAdminServiceClient()
-    results = client.list_measurement_protocol_secrets(
-        parent=f"properties/{property_id}/iosAppDataStreams/{stream_id}"
-    )
-
-    print("Result:")
-    for measurement_protocol_secret in results:
-        print("Result:")
-        print(f"Resource name: {measurement_protocol_secret.name}")
-        print(f"Secret value: {measurement_protocol_secret.secret_value}")
-        print(f"Display name: {measurement_protocol_secret.display_name}")
-        print()
-
-
-# [END analyticsadmin_properties_ios_app_data_streams_measurement_protocol_secrets_list]
-
-
-if __name__ == "__main__":
-    run_sample()
diff --git a/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_list_test.py b/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_list_test.py
deleted file mode 100644
index fe9869c..0000000
--- a/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_list_test.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-import os
-
-import properties_ios_app_data_streams_measurement_protocol_secrets_list
-
-
-TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
-TEST_IOS_APP_DATA_STREAM_ID = os.getenv("GA_TEST_IOS_APP_DATA_STREAM_ID")
-
-
-def test_properties_ios_app_data_streams_measurement_protocol_secrets_list(capsys):
-    properties_ios_app_data_streams_measurement_protocol_secrets_list.list_measurement_protocol_secrets(
-        TEST_PROPERTY_ID, TEST_IOS_APP_DATA_STREAM_ID
-    )
-    out, _ = capsys.readouterr()
-    assert "Result" in out
diff --git a/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_update.py b/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_update.py
deleted file mode 100644
index b5cbfd0..0000000
--- a/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_update.py
+++ /dev/null
@@ -1,77 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2021 Google Inc. All Rights Reserved.
-#
-# 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.
-
-"""Google Analytics Admin API sample application which updates the measurement
-protocol secret for the iOS app data stream.
-
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.iosAppDataStreams.measurementProtocolSecrets/patch
-for more information.
-"""
-# [START analyticsadmin_properties_ios_app_data_streams_measurement_protocol_secrets_update]
-from google.analytics.admin import AnalyticsAdminServiceClient
-from google.analytics.admin_v1alpha import MeasurementProtocolSecret
-from google.protobuf.field_mask_pb2 import FieldMask
-
-
-def run_sample():
-    """Runs the sample."""
-
-    # !!! ATTENTION !!!
-    #  Running this sample may change/delete your Google Analytics account
-    #  configuration. Make sure to not use the Google Analytics property ID from
-    #  your production environment below.
-
-    # TODO(developer): Replace this variable with your Google Analytics 4
-    #  property ID (e.g. "123456") before running the sample.
-    property_id = "YOUR-GA4-PROPERTY-ID"
-
-    # TODO(developer): Replace this variable with your iOS app data stream ID
-    #  (e.g. "123456") before running the sample.
-    stream_id = "YOUR-IOS-APP-DATA-STREAM-ID"
-
-    # TODO(developer): Replace this variable with your measurement protocol
-    #  secret ID (e.g. "123456") before running the sample.
-    secret_id = "YOUR-MEASUREMENT-PROTOCOL-SECRET-ID"
-
-    update_measurement_protocol_secret(property_id, stream_id, secret_id)
-
-
-def update_measurement_protocol_secret(property_id, stream_id, secret_id):
-    """Updates the measurement protocol secret."""
-    client = AnalyticsAdminServiceClient()
-    # This call updates the display name of the measurement protocol secret, as
-    # indicated by the value of the `update_mask` field. The measurement
-    # protocol secret to update is specified in the `name` field of the
-    # `MeasurementProtocolSecret` instance.
-    measurement_protocol_secret = client.update_measurement_protocol_secret(
-        measurement_protocol_secret=MeasurementProtocolSecret(
-            name=f"properties/{property_id}/iosAppDataStreams/{stream_id}/measurementProtocolSecrets/{secret_id}",
-            display_name="This is an updated measurement protocol secret",
-        ),
-        update_mask=FieldMask(paths=["display_name"]),
-    )
-
-    print("Result:")
-    print(f"Resource name: {measurement_protocol_secret.name}")
-    print(f"Secret value: {measurement_protocol_secret.secret_value}")
-    print(f"Display name: {measurement_protocol_secret.display_name}")
-
-
-# [END analyticsadmin_properties_ios_app_data_streams_measurement_protocol_secrets_update]
-
-
-if __name__ == "__main__":
-    run_sample()
diff --git a/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_update_test.py b/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_update_test.py
deleted file mode 100644
index 7c850fa..0000000
--- a/google-analytics-admin/properties_ios_app_data_streams_measurement_protocol_secrets_update_test.py
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-import pytest
-
-import properties_ios_app_data_streams_measurement_protocol_secrets_update
-
-
-FAKE_PROPERTY_ID = "1"
-FAKE_STREAM_ID = "1"
-FAKE_SECRET_ID = "1"
-
-
-def test_properties_ios_app_data_streams_measurement_protocol_secrets_update():
-    # This test ensures that the call is valid and reaches the server, even
-    # though the operation does not succeed due to permission error.
-    with pytest.raises(Exception, match="403 The caller does not have permission"):
-        properties_ios_app_data_streams_measurement_protocol_secrets_update.update_measurement_protocol_secret(
-            FAKE_PROPERTY_ID, FAKE_STREAM_ID, FAKE_SECRET_ID
-        )
diff --git a/google-analytics-admin/properties_ios_app_data_streams_update.py b/google-analytics-admin/properties_ios_app_data_streams_update.py
deleted file mode 100644
index 4612651..0000000
--- a/google-analytics-admin/properties_ios_app_data_streams_update.py
+++ /dev/null
@@ -1,71 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-"""Google Analytics Admin API sample application which updates the iOS app data
-stream.
-
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.iosAppDataStreams/update
-for more information.
-"""
-# [START analyticsadmin_properties_ios_app_data_streams_update]
-from google.analytics.admin import AnalyticsAdminServiceClient
-from google.analytics.admin_v1alpha.types import IosAppDataStream
-from google.protobuf.field_mask_pb2 import FieldMask
-
-
-def run_sample():
-    """Runs the sample."""
-
-    # !!! ATTENTION !!!
-    #  Running this sample may change/delete your Google Analytics account
-    #  configuration. Make sure to not use the Google Analytics property ID from
-    #  your production environment below.
-
-    # TODO(developer): Replace this variable with your Google Analytics 4
-    #  property ID (e.g. "123456") before running the sample.
-    property_id = "YOUR-GA4-PROPERTY-ID"
-
-    # TODO(developer): Replace this variable with your iOS app data stream ID
-    #  (e.g. "123456") before running the sample.
-    stream_id = "YOUR-IOS-APP-DATA-STREAM-ID"
-
-    update_ios_app_data_stream(property_id, stream_id)
-
-
-def update_ios_app_data_stream(property_id, stream_id):
-    """Updates the iOS app data stream."""
-    client = AnalyticsAdminServiceClient()
-    # This call updates the display name of the iOS app data stream, as
-    # indicated by the value of the `update_mask` field. The iOS app data
-    # stream to update is specified in the `name` field of the
-    # `IosAppDataStream` instance.
-    ios_app_data_stream = client.update_ios_app_data_stream(
-        ios_app_data_stream=IosAppDataStream(
-            name=f"properties/{property_id}/iosAppDataStreams/{stream_id}",
-            display_name="This is an updated test iOS app data stream",
-        ),
-        update_mask=FieldMask(paths=["display_name"]),
-    )
-
-    print("Result:")
-    print(ios_app_data_stream)
-
-
-# [END analyticsadmin_properties_ios_app_data_streams_update]
-
-
-if __name__ == "__main__":
-    run_sample()
diff --git a/google-analytics-admin/properties_ios_app_data_streams_update_test.py b/google-analytics-admin/properties_ios_app_data_streams_update_test.py
deleted file mode 100644
index 8c0843e..0000000
--- a/google-analytics-admin/properties_ios_app_data_streams_update_test.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-import pytest
-
-import properties_ios_app_data_streams_update
-
-
-FAKE_PROPERTY_ID = "1"
-FAKE_STREAM_ID = "1"
-
-
-def test_properties_ios_app_data_streams_update():
-    # This test ensures that the call is valid and reaches the server, even
-    # though the operation does not succeed due to permission error.
-    with pytest.raises(Exception, match="403 The caller does not have permission"):
-        properties_ios_app_data_streams_update.update_ios_app_data_stream(
-            FAKE_PROPERTY_ID, FAKE_STREAM_ID
-        )
diff --git a/google-analytics-admin/properties_web_data_streams_get_global_site_tag_test.py b/google-analytics-admin/properties_web_data_streams_get_global_site_tag_test.py
deleted file mode 100644
index b38a413..0000000
--- a/google-analytics-admin/properties_web_data_streams_get_global_site_tag_test.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-import os
-
-import properties_web_data_streams_get_global_site_tag
-
-
-TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
-TEST_WEB_DATA_STREAM_ID = os.getenv("GA_TEST_WEB_DATA_STREAM_ID")
-
-
-def test_properties_web_data_streams_get_global_site_tag(capsys):
-    properties_web_data_streams_get_global_site_tag.get_global_site_tag(
-        TEST_PROPERTY_ID, TEST_WEB_DATA_STREAM_ID
-    )
-    out, _ = capsys.readouterr()
-    assert "Result" in out
diff --git a/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_create_test.py b/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_create_test.py
deleted file mode 100644
index 1fb76f3..0000000
--- a/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_create_test.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-import pytest
-
-import properties_web_data_streams_measurement_protocol_secrets_create
-
-
-FAKE_PROPERTY_ID = "1"
-FAKE_STREAM_ID = "1"
-
-
-def test_properties_web_data_streams_measurement_protocol_secrets_create():
-    # This test ensures that the call is valid and reaches the server, even
-    # though the operation does not succeed due to permission error.
-    with pytest.raises(Exception, match="403 The caller does not have permission"):
-        properties_web_data_streams_measurement_protocol_secrets_create.create_measurement_protocol_secret(
-            FAKE_PROPERTY_ID, FAKE_STREAM_ID
-        )
diff --git a/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_list_test.py b/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_list_test.py
deleted file mode 100644
index 87d7068..0000000
--- a/google-analytics-admin/properties_web_data_streams_measurement_protocol_secrets_list_test.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-import os
-
-import properties_web_data_streams_measurement_protocol_secrets_list
-
-
-TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
-TEST_STREAM_ID = os.getenv("GA_TEST_WEB_DATA_STREAM_ID")
-
-
-def test_properties_web_data_streams_measurement_protocol_secrets_list(capsys):
-    properties_web_data_streams_measurement_protocol_secrets_list.list_measurement_protocol_secrets(
-        TEST_PROPERTY_ID, TEST_STREAM_ID
-    )
-    out, _ = capsys.readouterr()
-    assert "Result" in out

From a82c9a3947e6eaecb718ab7fe4896fd74b85c8b0 Mon Sep 17 00:00:00 2001
From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com>
Date: Fri, 4 Mar 2022 13:14:53 -0500
Subject: [PATCH 067/213] chore: Adding support for pytest-xdist and
 pytest-parallel (#203)

Source-Link: https://github.com/googleapis/synthtool/commit/82f5cb283efffe96e1b6cd634738e0e7de2cd90a
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:5d8da01438ece4021d135433f2cf3227aa39ef0eaccc941d62aa35e6902832ae

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
---
 google-analytics-data/noxfile.py | 80 ++++++++++++++++++--------------
 1 file changed, 46 insertions(+), 34 deletions(-)

diff --git a/google-analytics-data/noxfile.py b/google-analytics-data/noxfile.py
index 20cdfc6..4c808af 100644
--- a/google-analytics-data/noxfile.py
+++ b/google-analytics-data/noxfile.py
@@ -188,42 +188,54 @@ def _session_tests(
     # check for presence of tests
     test_list = glob.glob("*_test.py") + glob.glob("test_*.py")
     test_list.extend(glob.glob("tests"))
+
     if len(test_list) == 0:
         print("No tests found, skipping directory.")
-    else:
-        if TEST_CONFIG["pip_version_override"]:
-            pip_version = TEST_CONFIG["pip_version_override"]
-            session.install(f"pip=={pip_version}")
-        """Runs py.test for a particular project."""
-        if os.path.exists("requirements.txt"):
-            if os.path.exists("constraints.txt"):
-                session.install("-r", "requirements.txt", "-c", "constraints.txt")
-            else:
-                session.install("-r", "requirements.txt")
-
-        if os.path.exists("requirements-test.txt"):
-            if os.path.exists("constraints-test.txt"):
-                session.install(
-                    "-r", "requirements-test.txt", "-c", "constraints-test.txt"
-                )
-            else:
-                session.install("-r", "requirements-test.txt")
-
-        if INSTALL_LIBRARY_FROM_SOURCE:
-            session.install("-e", _get_repo_root())
-
-        if post_install:
-            post_install(session)
-
-        session.run(
-            "pytest",
-            *(PYTEST_COMMON_ARGS + session.posargs),
-            # Pytest will return 5 when no tests are collected. This can happen
-            # on travis where slow and flaky tests are excluded.
-            # See http://doc.pytest.org/en/latest/_modules/_pytest/main.html
-            success_codes=[0, 5],
-            env=get_pytest_env_vars(),
-        )
+        return
+
+    if TEST_CONFIG["pip_version_override"]:
+        pip_version = TEST_CONFIG["pip_version_override"]
+        session.install(f"pip=={pip_version}")
+    """Runs py.test for a particular project."""
+    concurrent_args = []
+    if os.path.exists("requirements.txt"):
+        if os.path.exists("constraints.txt"):
+            session.install("-r", "requirements.txt", "-c", "constraints.txt")
+        else:
+            session.install("-r", "requirements.txt")
+        with open("requirements.txt") as rfile:
+            packages = rfile.read()
+
+    if os.path.exists("requirements-test.txt"):
+        if os.path.exists("constraints-test.txt"):
+            session.install(
+                "-r", "requirements-test.txt", "-c", "constraints-test.txt"
+            )
+        else:
+            session.install("-r", "requirements-test.txt")
+        with open("requirements-test.txt") as rtfile:
+            packages += rtfile.read()
+
+    if INSTALL_LIBRARY_FROM_SOURCE:
+        session.install("-e", _get_repo_root())
+
+    if post_install:
+        post_install(session)
+
+    if "pytest-parallel" in packages:
+        concurrent_args.extend(['--workers', 'auto', '--tests-per-worker', 'auto'])
+    elif "pytest-xdist" in packages:
+        concurrent_args.extend(['-n', 'auto'])
+
+    session.run(
+        "pytest",
+        *(PYTEST_COMMON_ARGS + session.posargs + concurrent_args),
+        # Pytest will return 5 when no tests are collected. This can happen
+        # on travis where slow and flaky tests are excluded.
+        # See http://doc.pytest.org/en/latest/_modules/_pytest/main.html
+        success_codes=[0, 5],
+        env=get_pytest_env_vars(),
+    )
 
 
 @nox.session(python=ALL_VERSIONS)

From 2e636a28d5183ddf544c4ffee3a0f8b51c505599 Mon Sep 17 00:00:00 2001
From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com>
Date: Fri, 4 Mar 2022 13:19:33 -0500
Subject: [PATCH 068/213] chore: Adding support for pytest-xdist and
 pytest-parallel (#196)

Source-Link: https://github.com/googleapis/synthtool/commit/82f5cb283efffe96e1b6cd634738e0e7de2cd90a
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:5d8da01438ece4021d135433f2cf3227aa39ef0eaccc941d62aa35e6902832ae

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
---
 google-analytics-admin/noxfile.py | 78 +++++++++++++++++--------------
 1 file changed, 44 insertions(+), 34 deletions(-)

diff --git a/google-analytics-admin/noxfile.py b/google-analytics-admin/noxfile.py
index 20cdfc6..85f5836 100644
--- a/google-analytics-admin/noxfile.py
+++ b/google-analytics-admin/noxfile.py
@@ -188,42 +188,52 @@ def _session_tests(
     # check for presence of tests
     test_list = glob.glob("*_test.py") + glob.glob("test_*.py")
     test_list.extend(glob.glob("tests"))
+
     if len(test_list) == 0:
         print("No tests found, skipping directory.")
-    else:
-        if TEST_CONFIG["pip_version_override"]:
-            pip_version = TEST_CONFIG["pip_version_override"]
-            session.install(f"pip=={pip_version}")
-        """Runs py.test for a particular project."""
-        if os.path.exists("requirements.txt"):
-            if os.path.exists("constraints.txt"):
-                session.install("-r", "requirements.txt", "-c", "constraints.txt")
-            else:
-                session.install("-r", "requirements.txt")
-
-        if os.path.exists("requirements-test.txt"):
-            if os.path.exists("constraints-test.txt"):
-                session.install(
-                    "-r", "requirements-test.txt", "-c", "constraints-test.txt"
-                )
-            else:
-                session.install("-r", "requirements-test.txt")
-
-        if INSTALL_LIBRARY_FROM_SOURCE:
-            session.install("-e", _get_repo_root())
-
-        if post_install:
-            post_install(session)
-
-        session.run(
-            "pytest",
-            *(PYTEST_COMMON_ARGS + session.posargs),
-            # Pytest will return 5 when no tests are collected. This can happen
-            # on travis where slow and flaky tests are excluded.
-            # See http://doc.pytest.org/en/latest/_modules/_pytest/main.html
-            success_codes=[0, 5],
-            env=get_pytest_env_vars(),
-        )
+        return
+
+    if TEST_CONFIG["pip_version_override"]:
+        pip_version = TEST_CONFIG["pip_version_override"]
+        session.install(f"pip=={pip_version}")
+    """Runs py.test for a particular project."""
+    concurrent_args = []
+    if os.path.exists("requirements.txt"):
+        if os.path.exists("constraints.txt"):
+            session.install("-r", "requirements.txt", "-c", "constraints.txt")
+        else:
+            session.install("-r", "requirements.txt")
+        with open("requirements.txt") as rfile:
+            packages = rfile.read()
+
+    if os.path.exists("requirements-test.txt"):
+        if os.path.exists("constraints-test.txt"):
+            session.install("-r", "requirements-test.txt", "-c", "constraints-test.txt")
+        else:
+            session.install("-r", "requirements-test.txt")
+        with open("requirements-test.txt") as rtfile:
+            packages += rtfile.read()
+
+    if INSTALL_LIBRARY_FROM_SOURCE:
+        session.install("-e", _get_repo_root())
+
+    if post_install:
+        post_install(session)
+
+    if "pytest-parallel" in packages:
+        concurrent_args.extend(["--workers", "auto", "--tests-per-worker", "auto"])
+    elif "pytest-xdist" in packages:
+        concurrent_args.extend(["-n", "auto"])
+
+    session.run(
+        "pytest",
+        *(PYTEST_COMMON_ARGS + session.posargs + concurrent_args),
+        # Pytest will return 5 when no tests are collected. This can happen
+        # on travis where slow and flaky tests are excluded.
+        # See http://doc.pytest.org/en/latest/_modules/_pytest/main.html
+        success_codes=[0, 5],
+        env=get_pytest_env_vars(),
+    )
 
 
 @nox.session(python=ALL_VERSIONS)

From e9c7dde1a034c5a746ae797e1df5d9ee9f2c78d8 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Mon, 7 Mar 2022 17:57:03 +0100
Subject: [PATCH 069/213] chore(deps): update all dependencies (#198)

---
 google-analytics-admin/requirements-test.txt | 2 +-
 google-analytics-admin/requirements.txt      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/google-analytics-admin/requirements-test.txt b/google-analytics-admin/requirements-test.txt
index 9299a7a..76593bb 100644
--- a/google-analytics-admin/requirements-test.txt
+++ b/google-analytics-admin/requirements-test.txt
@@ -1 +1 @@
-pytest==6.2.5
\ No newline at end of file
+pytest==7.0.1
\ No newline at end of file
diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index 58d2fc7..12f2ae0 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
 google-analytics-admin==0.7.2
-google-auth-oauthlib==0.4.6
\ No newline at end of file
+google-auth-oauthlib==0.5.0
\ No newline at end of file

From f464ae4d3ad3c1476bec9687cb186da805e12bd8 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Mon, 7 Mar 2022 21:58:51 +0100
Subject: [PATCH 070/213] chore(deps): update dependency google-analytics-data
 to v0.11.1 (#206)

---
 google-analytics-data/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index 7399868..cec3a6b 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-data==0.11.0
+google-analytics-data==0.11.1
 google-auth-oauthlib==0.5.0
\ No newline at end of file

From c3fd19ee4b7dbf0057ab26cbd47f58f8c004fd55 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Mon, 7 Mar 2022 22:27:04 +0100
Subject: [PATCH 071/213] chore(deps): update dependency google-analytics-admin
 to v0.8.0 (#199)

---
 google-analytics-admin/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index 12f2ae0..77dd14f 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-admin==0.7.2
+google-analytics-admin==0.8.0
 google-auth-oauthlib==0.5.0
\ No newline at end of file

From 903ee8a024205ac7f866d5a009c875eed5540145 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Sun, 13 Mar 2022 16:16:48 +0100
Subject: [PATCH 072/213] chore(deps): update dependency pytest to v7.1.0
 (#200)

---
 google-analytics-admin/requirements-test.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements-test.txt b/google-analytics-admin/requirements-test.txt
index 76593bb..90f614f 100644
--- a/google-analytics-admin/requirements-test.txt
+++ b/google-analytics-admin/requirements-test.txt
@@ -1 +1 @@
-pytest==7.0.1
\ No newline at end of file
+pytest==7.1.0
\ No newline at end of file

From 129eac1e5b6deeed5754b8bca0c4ac60f75eb50b Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Sun, 13 Mar 2022 17:21:22 +0100
Subject: [PATCH 073/213] chore(deps): update dependency pytest to v7.1.0
 (#208)

---
 google-analytics-data/requirements-test.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements-test.txt b/google-analytics-data/requirements-test.txt
index c2845bf..824a8a7 100644
--- a/google-analytics-data/requirements-test.txt
+++ b/google-analytics-data/requirements-test.txt
@@ -1 +1 @@
-pytest==7.0.1
+pytest==7.1.0

From 8f69a8a63851a61725b09e4faf2cb25db2d547bc Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Tue, 15 Mar 2022 20:46:41 +0100
Subject: [PATCH 074/213] chore(deps): update dependency google-auth-oauthlib
 to v0.5.1 (#201)

---
 google-analytics-admin/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index 77dd14f..d77768e 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
 google-analytics-admin==0.8.0
-google-auth-oauthlib==0.5.0
\ No newline at end of file
+google-auth-oauthlib==0.5.1
\ No newline at end of file

From ce7b1b042a156e32cd0db81d19deb5b050270a84 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Tue, 15 Mar 2022 20:46:59 +0100
Subject: [PATCH 075/213] chore(deps): update dependency google-auth-oauthlib
 to v0.5.1 (#209)

---
 google-analytics-data/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index cec3a6b..bb610a6 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
 google-analytics-data==0.11.1
-google-auth-oauthlib==0.5.0
\ No newline at end of file
+google-auth-oauthlib==0.5.1
\ No newline at end of file

From dae846b84fc28b8bd13079f039299bdd5175158d Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Sat, 19 Mar 2022 11:17:15 +0100
Subject: [PATCH 076/213] chore(deps): update dependency pytest to v7.1.1
 (#210)

---
 google-analytics-data/requirements-test.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements-test.txt b/google-analytics-data/requirements-test.txt
index 824a8a7..4f6bf64 100644
--- a/google-analytics-data/requirements-test.txt
+++ b/google-analytics-data/requirements-test.txt
@@ -1 +1 @@
-pytest==7.1.0
+pytest==7.1.1

From caa3ed371b84970ca4cc95b0146f0fb2ce10d22e Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Sat, 19 Mar 2022 11:18:44 +0100
Subject: [PATCH 077/213] chore(deps): update dependency pytest to v7.1.1
 (#202)

---
 google-analytics-admin/requirements-test.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements-test.txt b/google-analytics-admin/requirements-test.txt
index 90f614f..49435c9 100644
--- a/google-analytics-admin/requirements-test.txt
+++ b/google-analytics-admin/requirements-test.txt
@@ -1 +1 @@
-pytest==7.1.0
\ No newline at end of file
+pytest==7.1.1
\ No newline at end of file

From 5f63724cb861685f50a63b603298277cb6449395 Mon Sep 17 00:00:00 2001
From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com>
Date: Mon, 28 Mar 2022 23:54:48 +0000
Subject: [PATCH 078/213] chore(python): use black==22.3.0 (#203)

Source-Link: https://github.com/googleapis/synthtool/commit/6fab84af09f2cf89a031fd8671d1def6b2931b11
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:7cffbc10910c3ab1b852c05114a08d374c195a81cdec1d4a67a1d129331d0bfe
---
 .../accounts_search_change_history_events.py                  | 2 +-
 google-analytics-admin/noxfile.py                             | 4 ++--
 google-analytics-admin/properties_data_streams_create.py      | 3 ++-
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/google-analytics-admin/accounts_search_change_history_events.py b/google-analytics-admin/accounts_search_change_history_events.py
index a9639fc..6cb84f7 100644
--- a/google-analytics-admin/accounts_search_change_history_events.py
+++ b/google-analytics-admin/accounts_search_change_history_events.py
@@ -46,7 +46,7 @@ def run_sample():
 
 def search_change_history_events(account_id: str, property_id: str):
     """Lists the change history events for the Google Analytics 4 property
-  within the specified date range."""
+    within the specified date range."""
     client = AnalyticsAdminServiceClient()
     # Create a timestamp object and subtract 7 days from the current date/time.
     earliest_change_time = Timestamp()
diff --git a/google-analytics-admin/noxfile.py b/google-analytics-admin/noxfile.py
index 85f5836..25f87a2 100644
--- a/google-analytics-admin/noxfile.py
+++ b/google-analytics-admin/noxfile.py
@@ -29,7 +29,7 @@
 # WARNING - WARNING - WARNING - WARNING - WARNING
 # WARNING - WARNING - WARNING - WARNING - WARNING
 
-BLACK_VERSION = "black==19.10b0"
+BLACK_VERSION = "black==22.3.0"
 
 # Copy `noxfile_config.py` to your directory and modify it instead.
 
@@ -253,7 +253,7 @@ def py(session: nox.sessions.Session) -> None:
 
 
 def _get_repo_root() -> Optional[str]:
-    """ Returns the root folder of the project. """
+    """Returns the root folder of the project."""
     # Get root of this repository. Assume we don't have directories nested deeper than 10 items.
     p = Path(os.getcwd())
     for i in range(10):
diff --git a/google-analytics-admin/properties_data_streams_create.py b/google-analytics-admin/properties_data_streams_create.py
index 4caa801..1679e5d 100644
--- a/google-analytics-admin/properties_data_streams_create.py
+++ b/google-analytics-admin/properties_data_streams_create.py
@@ -48,7 +48,8 @@ def create_data_stream(property_id):
     )
     data_stream.type_ = "WEB_DATA_STREAM"
     result = client.create_data_stream(
-        parent=f"properties/{property_id}", data_stream=data_stream,
+        parent=f"properties/{property_id}",
+        data_stream=data_stream,
     )
 
     print("Result:")

From e4cabdc6596ee1e6d675c7939873769663d042fc Mon Sep 17 00:00:00 2001
From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com>
Date: Tue, 29 Mar 2022 00:00:14 +0000
Subject: [PATCH 079/213] chore(python): use black==22.3.0 (#211)

Source-Link: https://github.com/googleapis/synthtool/commit/6fab84af09f2cf89a031fd8671d1def6b2931b11
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:7cffbc10910c3ab1b852c05114a08d374c195a81cdec1d4a67a1d129331d0bfe
---
 google-analytics-data/noxfile.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/noxfile.py b/google-analytics-data/noxfile.py
index 4c808af..949e0fd 100644
--- a/google-analytics-data/noxfile.py
+++ b/google-analytics-data/noxfile.py
@@ -29,7 +29,7 @@
 # WARNING - WARNING - WARNING - WARNING - WARNING
 # WARNING - WARNING - WARNING - WARNING - WARNING
 
-BLACK_VERSION = "black==19.10b0"
+BLACK_VERSION = "black==22.3.0"
 
 # Copy `noxfile_config.py` to your directory and modify it instead.
 

From 47bf5752078c3484663109a74fb030312d2a0378 Mon Sep 17 00:00:00 2001
From: Anwesha <anweshanaskar@gmail.com>
Date: Thu, 31 Mar 2022 10:24:36 -0700
Subject: [PATCH 080/213] docs: fixes typo in python sample (#214)

---
 google-analytics-data/run_report_with_cohorts.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/run_report_with_cohorts.py b/google-analytics-data/run_report_with_cohorts.py
index 4bf15a5..ef0e263 100644
--- a/google-analytics-data/run_report_with_cohorts.py
+++ b/google-analytics-data/run_report_with_cohorts.py
@@ -14,7 +14,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-"""Google Analytics Data API sample application demonstratinf the usage of
+"""Google Analytics Data API sample application demonstrating the usage of
 cohort specification in a report.
 
 See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/runReport#body.request_body.FIELDS.cohort_spec

From 37656aec4e23c895a68837f778ae5605f1c2d4d8 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Mon, 4 Apr 2022 19:40:29 +0200
Subject: [PATCH 081/213] chore(deps): update dependency google-analytics-data
 to v0.11.2 (#219)

---
 google-analytics-data/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index bb610a6..4e7ba82 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-data==0.11.1
+google-analytics-data==0.11.2
 google-auth-oauthlib==0.5.1
\ No newline at end of file

From ea8264b150ba13037f74fb9413ef1f9b1f73a9e0 Mon Sep 17 00:00:00 2001
From: Anwesha <anweshanaskar@gmail.com>
Date: Tue, 5 Apr 2022 13:28:38 -0700
Subject: [PATCH 082/213] docs: fixes incorrect comment in python sample (#220)

The sample comment tag refers to the incorrect name of sample
---
 google-analytics-data/run_report_with_named_date_ranges.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/google-analytics-data/run_report_with_named_date_ranges.py b/google-analytics-data/run_report_with_named_date_ranges.py
index a4f0d17..c5bbae4 100644
--- a/google-analytics-data/run_report_with_named_date_ranges.py
+++ b/google-analytics-data/run_report_with_named_date_ranges.py
@@ -20,7 +20,7 @@
 See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/DateRange#FIELDS.name
 for more information.
 """
-# [START analyticsdata_run_report_with_date_ranges]
+# [START analyticsdata_run_report_with_named_date_ranges]
 from google.analytics.data_v1beta import BetaAnalyticsDataClient
 from google.analytics.data_v1beta.types import DateRange
 from google.analytics.data_v1beta.types import Dimension
@@ -57,7 +57,7 @@ def run_report_with_named_date_ranges(property_id="YOUR-GA4-PROPERTY-ID"):
     print_run_report_response(response)
 
 
-# [END analyticsdata_run_report_with_date_ranges]
+# [END analyticsdata_run_report_with_named_date_ranges]
 
 
 if __name__ == "__main__":

From 682c2561f965529ad1cfd14734a089637902cf49 Mon Sep 17 00:00:00 2001
From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com>
Date: Wed, 20 Apr 2022 19:56:37 -0400
Subject: [PATCH 083/213] chore(python): add nox session to sort python imports
 (#230)

Source-Link: https://github.com/googleapis/synthtool/commit/1b71c10e20de7ed3f97f692f99a0e3399b67049f
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:00c9d764fd1cd56265f12a5ef4b99a0c9e87cf261018099141e2ca5158890416

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
---
 google-analytics-data/noxfile.py | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/google-analytics-data/noxfile.py b/google-analytics-data/noxfile.py
index 949e0fd..38bb0a5 100644
--- a/google-analytics-data/noxfile.py
+++ b/google-analytics-data/noxfile.py
@@ -30,6 +30,7 @@
 # WARNING - WARNING - WARNING - WARNING - WARNING
 
 BLACK_VERSION = "black==22.3.0"
+ISORT_VERSION = "isort==5.10.1"
 
 # Copy `noxfile_config.py` to your directory and modify it instead.
 
@@ -168,12 +169,32 @@ def lint(session: nox.sessions.Session) -> None:
 
 @nox.session
 def blacken(session: nox.sessions.Session) -> None:
+    """Run black. Format code to uniform standard."""
     session.install(BLACK_VERSION)
     python_files = [path for path in os.listdir(".") if path.endswith(".py")]
 
     session.run("black", *python_files)
 
 
+#
+# format = isort + black
+#
+
+@nox.session
+def format(session: nox.sessions.Session) -> None:
+    """
+    Run isort to sort imports. Then run black
+    to format code to uniform standard.
+    """
+    session.install(BLACK_VERSION, ISORT_VERSION)
+    python_files = [path for path in os.listdir(".") if path.endswith(".py")]
+
+    # Use the --fss option to sort imports using strict alphabetical order.
+    # See https://pycqa.github.io/isort/docs/configuration/options.html#force-sort-within-sections
+    session.run("isort", "--fss", *python_files)
+    session.run("black", *python_files)
+
+
 #
 # Sample Tests
 #

From 0c4f35c224ec5b8ba41c77b5ea0c9961a76da7ce Mon Sep 17 00:00:00 2001
From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com>
Date: Wed, 20 Apr 2022 19:59:39 -0400
Subject: [PATCH 084/213] chore(python): add nox session to sort python imports
 (#214)

Source-Link: https://github.com/googleapis/synthtool/commit/1b71c10e20de7ed3f97f692f99a0e3399b67049f
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:00c9d764fd1cd56265f12a5ef4b99a0c9e87cf261018099141e2ca5158890416

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
---
 .../accounts_delete_test.py                   |  1 -
 .../accounts_provision_account_ticket.py      |  3 +--
 .../accounts_provision_account_ticket_test.py |  1 -
 .../accounts_search_change_history_events.py  | 13 +++++------
 .../accounts_update_test.py                   |  1 -
 .../accounts_user_links_audit_test.py         |  1 -
 .../accounts_user_links_batch_create.py       |  8 ++++---
 .../accounts_user_links_batch_create_test.py  |  1 -
 .../accounts_user_links_batch_delete.py       |  6 +++--
 .../accounts_user_links_batch_delete_test.py  |  1 -
 .../accounts_user_links_batch_update.py       |  8 ++++---
 .../accounts_user_links_batch_update_test.py  |  1 -
 .../accounts_user_links_create.py             |  3 +--
 .../accounts_user_links_create_test.py        |  1 -
 .../accounts_user_links_delete_test.py        |  1 -
 .../accounts_user_links_update_test.py        |  1 -
 google-analytics-admin/noxfile.py             | 23 ++++++++++++++++++-
 .../properties_create_test.py                 |  1 -
 ...s_data_streams_get_global_site_tag_test.py |  1 -
 .../properties_data_streams_get_test.py       |  1 -
 ...easurement_protocol_secrets_create_test.py |  1 -
 ...easurement_protocol_secrets_delete_test.py |  1 -
 ..._measurement_protocol_secrets_list_test.py |  1 -
 .../properties_data_streams_update_test.py    |  1 -
 .../properties_delete_test.py                 |  1 -
 .../properties_firebase_links_create_test.py  |  1 -
 .../properties_firebase_links_delete_test.py  |  1 -
 ...properties_google_ads_links_create_test.py |  1 -
 ...properties_google_ads_links_delete_test.py |  1 -
 ...properties_google_ads_links_update_test.py |  1 -
 .../properties_update_test.py                 |  1 -
 .../properties_user_links_audit_test.py       |  1 -
 .../properties_user_links_batch_create.py     |  8 ++++---
 ...properties_user_links_batch_create_test.py |  1 -
 .../properties_user_links_batch_delete.py     |  6 +++--
 ...properties_user_links_batch_delete_test.py |  1 -
 .../properties_user_links_batch_update.py     |  8 ++++---
 ...properties_user_links_batch_update_test.py |  1 -
 .../properties_user_links_create.py           |  3 +--
 .../properties_user_links_create_test.py      |  1 -
 .../properties_user_links_delete_test.py      |  1 -
 .../properties_user_links_update_test.py      |  1 -
 42 files changed, 59 insertions(+), 61 deletions(-)

diff --git a/google-analytics-admin/accounts_delete_test.py b/google-analytics-admin/accounts_delete_test.py
index 0458fef..74ffac3 100644
--- a/google-analytics-admin/accounts_delete_test.py
+++ b/google-analytics-admin/accounts_delete_test.py
@@ -16,7 +16,6 @@
 
 import accounts_delete
 
-
 FAKE_ACCOUNT_ID = "1"
 
 
diff --git a/google-analytics-admin/accounts_provision_account_ticket.py b/google-analytics-admin/accounts_provision_account_ticket.py
index 3a57422..a963641 100644
--- a/google-analytics-admin/accounts_provision_account_ticket.py
+++ b/google-analytics-admin/accounts_provision_account_ticket.py
@@ -39,8 +39,7 @@
 """
 # [START analyticsadmin_accounts_provision_account_ticket]
 from google.analytics.admin import AnalyticsAdminServiceClient
-from google.analytics.admin_v1alpha.types import Account
-from google.analytics.admin_v1alpha.types import ProvisionAccountTicketRequest
+from google.analytics.admin_v1alpha.types import Account, ProvisionAccountTicketRequest
 
 
 def run_sample():
diff --git a/google-analytics-admin/accounts_provision_account_ticket_test.py b/google-analytics-admin/accounts_provision_account_ticket_test.py
index e08f940..b8dac59 100644
--- a/google-analytics-admin/accounts_provision_account_ticket_test.py
+++ b/google-analytics-admin/accounts_provision_account_ticket_test.py
@@ -14,7 +14,6 @@
 
 import accounts_provision_account_ticket
 
-
 TEST_REDIRECT_URL = "https://www.google.com"
 
 
diff --git a/google-analytics-admin/accounts_search_change_history_events.py b/google-analytics-admin/accounts_search_change_history_events.py
index 6cb84f7..4d29d36 100644
--- a/google-analytics-admin/accounts_search_change_history_events.py
+++ b/google-analytics-admin/accounts_search_change_history_events.py
@@ -21,14 +21,13 @@
 for more information.
 """
 # [START analyticsadmin_properties_conversion_events_create]
-from datetime import datetime
-from datetime import timedelta
-
-from google.analytics.admin import AnalyticsAdminServiceClient
-from google.analytics.admin import SearchChangeHistoryEventsRequest
-from google.analytics.admin_v1alpha.types import ActionType
-from google.analytics.admin_v1alpha.types import ActorType
+from datetime import datetime, timedelta
 
+from google.analytics.admin import (
+    AnalyticsAdminServiceClient,
+    SearchChangeHistoryEventsRequest,
+)
+from google.analytics.admin_v1alpha.types import ActionType, ActorType
 from google.protobuf.timestamp_pb2 import Timestamp
 
 
diff --git a/google-analytics-admin/accounts_update_test.py b/google-analytics-admin/accounts_update_test.py
index 18c5f55..efcc6ab 100644
--- a/google-analytics-admin/accounts_update_test.py
+++ b/google-analytics-admin/accounts_update_test.py
@@ -16,7 +16,6 @@
 
 import accounts_update
 
-
 FAKE_ACCOUNT_ID = "1"
 
 
diff --git a/google-analytics-admin/accounts_user_links_audit_test.py b/google-analytics-admin/accounts_user_links_audit_test.py
index d717c6c..78a2175 100644
--- a/google-analytics-admin/accounts_user_links_audit_test.py
+++ b/google-analytics-admin/accounts_user_links_audit_test.py
@@ -16,7 +16,6 @@
 
 import accounts_user_links_audit
 
-
 TEST_ACCOUNT_ID = os.getenv("GA_TEST_ACCOUNT_ID")
 
 
diff --git a/google-analytics-admin/accounts_user_links_batch_create.py b/google-analytics-admin/accounts_user_links_batch_create.py
index 56d619e..8ec390d 100644
--- a/google-analytics-admin/accounts_user_links_batch_create.py
+++ b/google-analytics-admin/accounts_user_links_batch_create.py
@@ -22,9 +22,11 @@
 """
 # [START analyticsadmin_accounts_user_links_batch_create]
 from google.analytics.admin import AnalyticsAdminServiceClient
-from google.analytics.admin_v1alpha.types import BatchCreateUserLinksRequest
-from google.analytics.admin_v1alpha.types import CreateUserLinkRequest
-from google.analytics.admin_v1alpha.types import UserLink
+from google.analytics.admin_v1alpha.types import (
+    BatchCreateUserLinksRequest,
+    CreateUserLinkRequest,
+    UserLink,
+)
 
 
 def run_sample():
diff --git a/google-analytics-admin/accounts_user_links_batch_create_test.py b/google-analytics-admin/accounts_user_links_batch_create_test.py
index 5141c17..cf4241d 100644
--- a/google-analytics-admin/accounts_user_links_batch_create_test.py
+++ b/google-analytics-admin/accounts_user_links_batch_create_test.py
@@ -18,7 +18,6 @@
 
 import accounts_user_links_batch_create
 
-
 FAKE_ACCOUNT_ID = "1"
 TEST_EMAIL_ADDRESS = os.getenv("GA_TEST_EMAIL_ADDRESS")
 
diff --git a/google-analytics-admin/accounts_user_links_batch_delete.py b/google-analytics-admin/accounts_user_links_batch_delete.py
index 102ad9e..12fd558 100644
--- a/google-analytics-admin/accounts_user_links_batch_delete.py
+++ b/google-analytics-admin/accounts_user_links_batch_delete.py
@@ -22,8 +22,10 @@
 """
 # [START analyticsadmin_accounts_user_links_batch_delete]
 from google.analytics.admin import AnalyticsAdminServiceClient
-from google.analytics.admin_v1alpha.types import BatchDeleteUserLinksRequest
-from google.analytics.admin_v1alpha.types import DeleteUserLinkRequest
+from google.analytics.admin_v1alpha.types import (
+    BatchDeleteUserLinksRequest,
+    DeleteUserLinkRequest,
+)
 
 
 def run_sample():
diff --git a/google-analytics-admin/accounts_user_links_batch_delete_test.py b/google-analytics-admin/accounts_user_links_batch_delete_test.py
index 3b9eac2..8edadc5 100644
--- a/google-analytics-admin/accounts_user_links_batch_delete_test.py
+++ b/google-analytics-admin/accounts_user_links_batch_delete_test.py
@@ -16,7 +16,6 @@
 
 import accounts_user_links_batch_delete
 
-
 FAKE_ACCOUNT_ID = "1"
 FAKE_ACCOUNT_USER_LINK_ID = "1"
 
diff --git a/google-analytics-admin/accounts_user_links_batch_update.py b/google-analytics-admin/accounts_user_links_batch_update.py
index 9778a50..a0bcfc4 100644
--- a/google-analytics-admin/accounts_user_links_batch_update.py
+++ b/google-analytics-admin/accounts_user_links_batch_update.py
@@ -22,9 +22,11 @@
 """
 # [START analyticsadmin_accounts_user_links_batch_update]
 from google.analytics.admin import AnalyticsAdminServiceClient
-from google.analytics.admin_v1alpha.types import BatchUpdateUserLinksRequest
-from google.analytics.admin_v1alpha.types import UpdateUserLinkRequest
-from google.analytics.admin_v1alpha.types import UserLink
+from google.analytics.admin_v1alpha.types import (
+    BatchUpdateUserLinksRequest,
+    UpdateUserLinkRequest,
+    UserLink,
+)
 
 
 def run_sample():
diff --git a/google-analytics-admin/accounts_user_links_batch_update_test.py b/google-analytics-admin/accounts_user_links_batch_update_test.py
index b709c4f..1975b39 100644
--- a/google-analytics-admin/accounts_user_links_batch_update_test.py
+++ b/google-analytics-admin/accounts_user_links_batch_update_test.py
@@ -16,7 +16,6 @@
 
 import accounts_user_links_batch_update
 
-
 FAKE_ACCOUNT_ID = "1"
 FAKE_ACCOUNT_USER_LINK_ID = "1"
 
diff --git a/google-analytics-admin/accounts_user_links_create.py b/google-analytics-admin/accounts_user_links_create.py
index 5fe6ac3..6aba6ab 100644
--- a/google-analytics-admin/accounts_user_links_create.py
+++ b/google-analytics-admin/accounts_user_links_create.py
@@ -22,8 +22,7 @@
 """
 # [START analyticsadmin_accounts_user_links_create]
 from google.analytics.admin import AnalyticsAdminServiceClient
-from google.analytics.admin_v1alpha.types import CreateUserLinkRequest
-from google.analytics.admin_v1alpha.types import UserLink
+from google.analytics.admin_v1alpha.types import CreateUserLinkRequest, UserLink
 
 
 def run_sample():
diff --git a/google-analytics-admin/accounts_user_links_create_test.py b/google-analytics-admin/accounts_user_links_create_test.py
index 13c7212..3a25123 100644
--- a/google-analytics-admin/accounts_user_links_create_test.py
+++ b/google-analytics-admin/accounts_user_links_create_test.py
@@ -18,7 +18,6 @@
 
 import accounts_user_links_create
 
-
 FAKE_ACCOUNT_ID = "1"
 TEST_EMAIL_ADDRESS = os.getenv("GA_TEST_EMAIL_ADDRESS")
 
diff --git a/google-analytics-admin/accounts_user_links_delete_test.py b/google-analytics-admin/accounts_user_links_delete_test.py
index e8bd0a5..f717e88 100644
--- a/google-analytics-admin/accounts_user_links_delete_test.py
+++ b/google-analytics-admin/accounts_user_links_delete_test.py
@@ -16,7 +16,6 @@
 
 import accounts_user_links_delete
 
-
 FAKE_ACCOUNT_ID = "1"
 FAKE_ACCOUNT_USER_LINK_ID = "1"
 
diff --git a/google-analytics-admin/accounts_user_links_update_test.py b/google-analytics-admin/accounts_user_links_update_test.py
index a722930..52ac425 100644
--- a/google-analytics-admin/accounts_user_links_update_test.py
+++ b/google-analytics-admin/accounts_user_links_update_test.py
@@ -16,7 +16,6 @@
 
 import accounts_user_links_update
 
-
 FAKE_ACCOUNT_ID = "1"
 FAKE_ACCOUNT_USER_LINK_ID = "1"
 
diff --git a/google-analytics-admin/noxfile.py b/google-analytics-admin/noxfile.py
index 25f87a2..3b3ffa5 100644
--- a/google-analytics-admin/noxfile.py
+++ b/google-analytics-admin/noxfile.py
@@ -22,7 +22,6 @@
 
 import nox
 
-
 # WARNING - WARNING - WARNING - WARNING - WARNING
 # WARNING - WARNING - WARNING - WARNING - WARNING
 #           DO NOT EDIT THIS FILE EVER!
@@ -30,6 +29,7 @@
 # WARNING - WARNING - WARNING - WARNING - WARNING
 
 BLACK_VERSION = "black==22.3.0"
+ISORT_VERSION = "isort==5.10.1"
 
 # Copy `noxfile_config.py` to your directory and modify it instead.
 
@@ -168,12 +168,33 @@ def lint(session: nox.sessions.Session) -> None:
 
 @nox.session
 def blacken(session: nox.sessions.Session) -> None:
+    """Run black. Format code to uniform standard."""
     session.install(BLACK_VERSION)
     python_files = [path for path in os.listdir(".") if path.endswith(".py")]
 
     session.run("black", *python_files)
 
 
+#
+# format = isort + black
+#
+
+
+@nox.session
+def format(session: nox.sessions.Session) -> None:
+    """
+    Run isort to sort imports. Then run black
+    to format code to uniform standard.
+    """
+    session.install(BLACK_VERSION, ISORT_VERSION)
+    python_files = [path for path in os.listdir(".") if path.endswith(".py")]
+
+    # Use the --fss option to sort imports using strict alphabetical order.
+    # See https://pycqa.github.io/isort/docs/configuration/options.html#force-sort-within-sections
+    session.run("isort", "--fss", *python_files)
+    session.run("black", *python_files)
+
+
 #
 # Sample Tests
 #
diff --git a/google-analytics-admin/properties_create_test.py b/google-analytics-admin/properties_create_test.py
index 43b0b10..276a052 100644
--- a/google-analytics-admin/properties_create_test.py
+++ b/google-analytics-admin/properties_create_test.py
@@ -16,7 +16,6 @@
 
 import properties_create
 
-
 FAKE_ACCOUNT_ID = "1"
 
 
diff --git a/google-analytics-admin/properties_data_streams_get_global_site_tag_test.py b/google-analytics-admin/properties_data_streams_get_global_site_tag_test.py
index 7e0d649..b877dad 100644
--- a/google-analytics-admin/properties_data_streams_get_global_site_tag_test.py
+++ b/google-analytics-admin/properties_data_streams_get_global_site_tag_test.py
@@ -16,7 +16,6 @@
 
 import properties_data_streams_get_global_site_tag
 
-
 TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
 TEST_DATA_STREAM_ID = os.getenv("GA_TEST_WEB_DATA_STREAM_ID")
 
diff --git a/google-analytics-admin/properties_data_streams_get_test.py b/google-analytics-admin/properties_data_streams_get_test.py
index d05cf19..695ece1 100644
--- a/google-analytics-admin/properties_data_streams_get_test.py
+++ b/google-analytics-admin/properties_data_streams_get_test.py
@@ -16,7 +16,6 @@
 
 import properties_data_streams_get
 
-
 TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
 TEST_DATA_STREAM_ID = os.getenv("GA_TEST_WEB_DATA_STREAM_ID")
 
diff --git a/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_create_test.py b/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_create_test.py
index 424579a..d792d3e 100644
--- a/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_create_test.py
+++ b/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_create_test.py
@@ -16,7 +16,6 @@
 
 import properties_data_streams_measurement_protocol_secrets_create
 
-
 FAKE_PROPERTY_ID = "1"
 FAKE_STREAM_ID = "1"
 
diff --git a/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_delete_test.py b/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_delete_test.py
index e34c33f..d5dce84 100644
--- a/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_delete_test.py
+++ b/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_delete_test.py
@@ -16,7 +16,6 @@
 
 import properties_data_streams_measurement_protocol_secrets_delete
 
-
 FAKE_PROPERTY_ID = "1"
 FAKE_STREAM_ID = "1"
 FAKE_SECRET_ID = "1"
diff --git a/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_list_test.py b/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_list_test.py
index c8c4137..f686768 100644
--- a/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_list_test.py
+++ b/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_list_test.py
@@ -16,7 +16,6 @@
 
 import properties_data_streams_measurement_protocol_secrets_list
 
-
 TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
 TEST_DATA_STREAM_ID = os.getenv("GA_TEST_WEB_DATA_STREAM_ID")
 
diff --git a/google-analytics-admin/properties_data_streams_update_test.py b/google-analytics-admin/properties_data_streams_update_test.py
index e95a8dc..2509bcf 100644
--- a/google-analytics-admin/properties_data_streams_update_test.py
+++ b/google-analytics-admin/properties_data_streams_update_test.py
@@ -16,7 +16,6 @@
 
 import properties_data_streams_update
 
-
 FAKE_PROPERTY_ID = "1"
 FAKE_STREAM_ID = "1"
 
diff --git a/google-analytics-admin/properties_delete_test.py b/google-analytics-admin/properties_delete_test.py
index 5d3cf74..307d935 100644
--- a/google-analytics-admin/properties_delete_test.py
+++ b/google-analytics-admin/properties_delete_test.py
@@ -16,7 +16,6 @@
 
 import properties_delete
 
-
 FAKE_PROPERTY_ID = "1"
 
 
diff --git a/google-analytics-admin/properties_firebase_links_create_test.py b/google-analytics-admin/properties_firebase_links_create_test.py
index 85f468a..0f57951 100644
--- a/google-analytics-admin/properties_firebase_links_create_test.py
+++ b/google-analytics-admin/properties_firebase_links_create_test.py
@@ -16,7 +16,6 @@
 
 import properties_firebase_links_create
 
-
 FAKE_PROPERTY_ID = "1"
 FAKE_FIREBASE_PROJECT_ID = "1"
 
diff --git a/google-analytics-admin/properties_firebase_links_delete_test.py b/google-analytics-admin/properties_firebase_links_delete_test.py
index e55860e..1efcfd2 100644
--- a/google-analytics-admin/properties_firebase_links_delete_test.py
+++ b/google-analytics-admin/properties_firebase_links_delete_test.py
@@ -16,7 +16,6 @@
 
 import properties_firebase_links_delete
 
-
 FAKE_PROPERTY_ID = "1"
 FAKE_FIREBASE_LINK_ID = "1"
 
diff --git a/google-analytics-admin/properties_google_ads_links_create_test.py b/google-analytics-admin/properties_google_ads_links_create_test.py
index 07ae5dd..e0e8d73 100644
--- a/google-analytics-admin/properties_google_ads_links_create_test.py
+++ b/google-analytics-admin/properties_google_ads_links_create_test.py
@@ -16,7 +16,6 @@
 
 import properties_google_ads_links_create
 
-
 FAKE_PROPERTY_ID = "1"
 FAKE_ADS_CUSTOMER_ID = "1234567890"
 
diff --git a/google-analytics-admin/properties_google_ads_links_delete_test.py b/google-analytics-admin/properties_google_ads_links_delete_test.py
index 25c2768..fd64482 100644
--- a/google-analytics-admin/properties_google_ads_links_delete_test.py
+++ b/google-analytics-admin/properties_google_ads_links_delete_test.py
@@ -16,7 +16,6 @@
 
 import properties_google_ads_links_delete
 
-
 FAKE_PROPERTY_ID = "1"
 FAKE_GOOGLE_ADS_LINK_ID = "1"
 
diff --git a/google-analytics-admin/properties_google_ads_links_update_test.py b/google-analytics-admin/properties_google_ads_links_update_test.py
index b734c37..a60ad3d 100644
--- a/google-analytics-admin/properties_google_ads_links_update_test.py
+++ b/google-analytics-admin/properties_google_ads_links_update_test.py
@@ -16,7 +16,6 @@
 
 import properties_google_ads_links_update
 
-
 FAKE_PROPERTY_ID = "1"
 FAKE_GOOGLE_ADS_LINK_ID = "1"
 
diff --git a/google-analytics-admin/properties_update_test.py b/google-analytics-admin/properties_update_test.py
index 9d94bb0..5e7ea4d 100644
--- a/google-analytics-admin/properties_update_test.py
+++ b/google-analytics-admin/properties_update_test.py
@@ -16,7 +16,6 @@
 
 import properties_update
 
-
 FAKE_PROPERTY_ID = "1"
 
 
diff --git a/google-analytics-admin/properties_user_links_audit_test.py b/google-analytics-admin/properties_user_links_audit_test.py
index be35193..10c521f 100644
--- a/google-analytics-admin/properties_user_links_audit_test.py
+++ b/google-analytics-admin/properties_user_links_audit_test.py
@@ -16,7 +16,6 @@
 
 import properties_user_links_audit
 
-
 TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
 
 
diff --git a/google-analytics-admin/properties_user_links_batch_create.py b/google-analytics-admin/properties_user_links_batch_create.py
index b75b3fe..1c8cba7 100644
--- a/google-analytics-admin/properties_user_links_batch_create.py
+++ b/google-analytics-admin/properties_user_links_batch_create.py
@@ -22,9 +22,11 @@
 """
 # [START analyticsadmin_properties_user_links_batch_create]
 from google.analytics.admin import AnalyticsAdminServiceClient
-from google.analytics.admin_v1alpha.types import BatchCreateUserLinksRequest
-from google.analytics.admin_v1alpha.types import CreateUserLinkRequest
-from google.analytics.admin_v1alpha.types import UserLink
+from google.analytics.admin_v1alpha.types import (
+    BatchCreateUserLinksRequest,
+    CreateUserLinkRequest,
+    UserLink,
+)
 
 
 def run_sample():
diff --git a/google-analytics-admin/properties_user_links_batch_create_test.py b/google-analytics-admin/properties_user_links_batch_create_test.py
index 11637f7..f732b48 100644
--- a/google-analytics-admin/properties_user_links_batch_create_test.py
+++ b/google-analytics-admin/properties_user_links_batch_create_test.py
@@ -16,7 +16,6 @@
 
 import properties_user_links_batch_create
 
-
 FAKE_PROPERTY_ID = "1"
 FAKE_EMAIL_ADDRESS = "test@google.com"
 
diff --git a/google-analytics-admin/properties_user_links_batch_delete.py b/google-analytics-admin/properties_user_links_batch_delete.py
index b678b0d..2384b49 100644
--- a/google-analytics-admin/properties_user_links_batch_delete.py
+++ b/google-analytics-admin/properties_user_links_batch_delete.py
@@ -22,8 +22,10 @@
 """
 # [START analyticsadmin_properties_user_links_batch_delete]
 from google.analytics.admin import AnalyticsAdminServiceClient
-from google.analytics.admin_v1alpha.types import BatchDeleteUserLinksRequest
-from google.analytics.admin_v1alpha.types import DeleteUserLinkRequest
+from google.analytics.admin_v1alpha.types import (
+    BatchDeleteUserLinksRequest,
+    DeleteUserLinkRequest,
+)
 
 
 def run_sample():
diff --git a/google-analytics-admin/properties_user_links_batch_delete_test.py b/google-analytics-admin/properties_user_links_batch_delete_test.py
index eb086bf..49e58c9 100644
--- a/google-analytics-admin/properties_user_links_batch_delete_test.py
+++ b/google-analytics-admin/properties_user_links_batch_delete_test.py
@@ -16,7 +16,6 @@
 
 import properties_user_links_batch_delete
 
-
 FAKE_PROPERTY_ID = "1"
 FAKE_USER_LINK_ID = "1"
 
diff --git a/google-analytics-admin/properties_user_links_batch_update.py b/google-analytics-admin/properties_user_links_batch_update.py
index 9c8e08b..d89aa9a 100644
--- a/google-analytics-admin/properties_user_links_batch_update.py
+++ b/google-analytics-admin/properties_user_links_batch_update.py
@@ -22,9 +22,11 @@
 """
 # [START analyticsadmin_properties_user_links_batch_update]
 from google.analytics.admin import AnalyticsAdminServiceClient
-from google.analytics.admin_v1alpha.types import BatchUpdateUserLinksRequest
-from google.analytics.admin_v1alpha.types import UpdateUserLinkRequest
-from google.analytics.admin_v1alpha.types import UserLink
+from google.analytics.admin_v1alpha.types import (
+    BatchUpdateUserLinksRequest,
+    UpdateUserLinkRequest,
+    UserLink,
+)
 
 
 def run_sample():
diff --git a/google-analytics-admin/properties_user_links_batch_update_test.py b/google-analytics-admin/properties_user_links_batch_update_test.py
index 70b5cc4..27450f4 100644
--- a/google-analytics-admin/properties_user_links_batch_update_test.py
+++ b/google-analytics-admin/properties_user_links_batch_update_test.py
@@ -16,7 +16,6 @@
 
 import properties_user_links_batch_update
 
-
 FAKE_PROPERTY_ID = "1"
 FAKE_USER_LINK_ID = "1"
 
diff --git a/google-analytics-admin/properties_user_links_create.py b/google-analytics-admin/properties_user_links_create.py
index 0658648..7037161 100644
--- a/google-analytics-admin/properties_user_links_create.py
+++ b/google-analytics-admin/properties_user_links_create.py
@@ -22,8 +22,7 @@
 """
 # [START analyticsadmin_properties_user_links_create]
 from google.analytics.admin import AnalyticsAdminServiceClient
-from google.analytics.admin_v1alpha.types import CreateUserLinkRequest
-from google.analytics.admin_v1alpha.types import UserLink
+from google.analytics.admin_v1alpha.types import CreateUserLinkRequest, UserLink
 
 
 def run_sample():
diff --git a/google-analytics-admin/properties_user_links_create_test.py b/google-analytics-admin/properties_user_links_create_test.py
index c072554..e3f9eb5 100644
--- a/google-analytics-admin/properties_user_links_create_test.py
+++ b/google-analytics-admin/properties_user_links_create_test.py
@@ -16,7 +16,6 @@
 
 import properties_user_links_create
 
-
 FAKE_PROPERTY_ID = "1"
 FAKE_EMAIL_ADDRESS = "test@google.com"
 
diff --git a/google-analytics-admin/properties_user_links_delete_test.py b/google-analytics-admin/properties_user_links_delete_test.py
index 34bc956..4ef4976 100644
--- a/google-analytics-admin/properties_user_links_delete_test.py
+++ b/google-analytics-admin/properties_user_links_delete_test.py
@@ -16,7 +16,6 @@
 
 import properties_user_links_delete
 
-
 FAKE_PROPERTY_ID = "1"
 FAKE_USER_LINK_ID = "1"
 
diff --git a/google-analytics-admin/properties_user_links_update_test.py b/google-analytics-admin/properties_user_links_update_test.py
index 157e70f..fffc967 100644
--- a/google-analytics-admin/properties_user_links_update_test.py
+++ b/google-analytics-admin/properties_user_links_update_test.py
@@ -16,7 +16,6 @@
 
 import properties_user_links_update
 
-
 FAKE_PROPERTY_ID = "1"
 FAKE_USER_LINK_ID = "1"
 

From 594d01fb4f5924642032ffc11182485d92dc3c08 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Mon, 25 Apr 2022 16:57:03 +0200
Subject: [PATCH 085/213] chore(deps): update dependency pytest to v7.1.2
 (#233)

---
 google-analytics-data/requirements-test.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements-test.txt b/google-analytics-data/requirements-test.txt
index 4f6bf64..d00689e 100644
--- a/google-analytics-data/requirements-test.txt
+++ b/google-analytics-data/requirements-test.txt
@@ -1 +1 @@
-pytest==7.1.1
+pytest==7.1.2

From b827bec8bb760537f16fd9f445f5ac1be8023776 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Mon, 25 Apr 2022 17:09:10 +0200
Subject: [PATCH 086/213] chore(deps): update dependency pytest to v7.1.2
 (#217)

---
 google-analytics-admin/requirements-test.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements-test.txt b/google-analytics-admin/requirements-test.txt
index 49435c9..6a3d7bc 100644
--- a/google-analytics-admin/requirements-test.txt
+++ b/google-analytics-admin/requirements-test.txt
@@ -1 +1 @@
-pytest==7.1.1
\ No newline at end of file
+pytest==7.1.2
\ No newline at end of file

From 74fbd523770e8a80deeb35850a7245b07c075679 Mon Sep 17 00:00:00 2001
From: Anwesha <anweshanaskar@gmail.com>
Date: Thu, 5 May 2022 19:52:28 -0400
Subject: [PATCH 087/213] docs: fix typo in get_common_metadata.py sample
 (#224)

The print statement in the print_get_metadata_response was printing the custom definition status of a dimension when it was supposed to be printing information about the custom definition status of a metric

Co-authored-by: Anthonios Partheniou <partheniou@google.com>
---
 google-analytics-data/get_common_metadata.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/get_common_metadata.py b/google-analytics-data/get_common_metadata.py
index 731da0d..19a1964 100644
--- a/google-analytics-data/get_common_metadata.py
+++ b/google-analytics-data/get_common_metadata.py
@@ -61,7 +61,7 @@ def print_get_metadata_response(response):
     for metric in response.metrics:
         print("METRIC")
         print(f"{metric.api_name} ({metric.ui_name}): {metric.description}")
-        print(f"custom_definition: {dimension.custom_definition}")
+        print(f"custom_definition: {metric.custom_definition}")
         if metric.expression:
             print(f"Expression: {metric.expression}")
 

From dad43f0940ec8bdf65cea7056d40704f13a9266c Mon Sep 17 00:00:00 2001
From: Anwesha <anweshanaskar@gmail.com>
Date: Thu, 5 May 2022 20:01:33 -0400
Subject: [PATCH 088/213] docs: removes unnecessary period in python sample
 description (#225)

Co-authored-by: Anthonios Partheniou <partheniou@google.com>
---
 google-analytics-data/run_pivot_report.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/run_pivot_report.py b/google-analytics-data/run_pivot_report.py
index 3400870..1b620b3 100644
--- a/google-analytics-data/run_pivot_report.py
+++ b/google-analytics-data/run_pivot_report.py
@@ -40,7 +40,7 @@ def run_sample():
 
 def run_pivot_report(property_id="YOUR-GA4-PROPERTY-ID"):
     """Runs a pivot query to build a report of session counts by country,
-    pivoted by the browser dimension.."""
+    pivoted by the browser dimension."""
     client = BetaAnalyticsDataClient()
 
     request = RunPivotReportRequest(

From edefcaf119af63a259a83df585d0697598e7e7d1 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Thu, 19 May 2022 16:23:23 +0200
Subject: [PATCH 089/213] chore(deps): update dependency google-analytics-admin
 to v0.8.1 (#224)

---
 google-analytics-admin/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index d77768e..beafa97 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-admin==0.8.0
+google-analytics-admin==0.8.1
 google-auth-oauthlib==0.5.1
\ No newline at end of file

From b81be8cb0021d85e1ae2b17508bb9fb31e3935c5 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Thu, 19 May 2022 16:24:17 +0200
Subject: [PATCH 090/213] chore(deps): update dependency google-analytics-data
 to v0.12.0 (#240)

---
 google-analytics-data/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index 4e7ba82..8e50bc8 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-data==0.11.2
+google-analytics-data==0.12.0
 google-auth-oauthlib==0.5.1
\ No newline at end of file

From 6f13f3331a206108e12e709dfee64e4d05709c88 Mon Sep 17 00:00:00 2001
From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com>
Date: Sat, 16 Jul 2022 14:34:00 -0400
Subject: [PATCH 091/213] fix: require python 3.7+ (#255)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* chore(python): drop python 3.6

Source-Link: https://github.com/googleapis/synthtool/commit/4f89b13af10d086458f9b379e56a614f9d6dab7b
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:e7bb19d47c13839fe8c147e50e02e8b6cf5da8edd1af8b82208cd6f66cc2829c

* add api_description to .repo-metadata.json

* require python 3.7+ in setup.py

* remove python 3.6 sample configs

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* update post processor image

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* fix typo

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
---
 google-analytics-data/noxfile.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/noxfile.py b/google-analytics-data/noxfile.py
index 38bb0a5..5fcb9d7 100644
--- a/google-analytics-data/noxfile.py
+++ b/google-analytics-data/noxfile.py
@@ -89,7 +89,7 @@ def get_pytest_env_vars() -> Dict[str, str]:
 
 # DO NOT EDIT - automatically generated.
 # All versions used to test samples.
-ALL_VERSIONS = ["3.6", "3.7", "3.8", "3.9", "3.10"]
+ALL_VERSIONS = ["3.7", "3.8", "3.9", "3.10"]
 
 # Any default versions that should be ignored.
 IGNORED_VERSIONS = TEST_CONFIG["ignored_versions"]

From a6c58baf21c44389e84c2905705f8db8a44b27e6 Mon Sep 17 00:00:00 2001
From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com>
Date: Sun, 17 Jul 2022 08:07:44 -0400
Subject: [PATCH 092/213] fix: require python 3.7+ (#239)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* chore(python): drop python 3.6

Source-Link: https://github.com/googleapis/synthtool/commit/4f89b13af10d086458f9b379e56a614f9d6dab7b
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:e7bb19d47c13839fe8c147e50e02e8b6cf5da8edd1af8b82208cd6f66cc2829c

* add api_description to .repo-metadata.json

* require python 3.7+ in setup.py

* remove python 3.6 sample configs

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* update post processor

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* update client_documentation link

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
---
 google-analytics-admin/noxfile.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/noxfile.py b/google-analytics-admin/noxfile.py
index 3b3ffa5..e9eb1cb 100644
--- a/google-analytics-admin/noxfile.py
+++ b/google-analytics-admin/noxfile.py
@@ -88,7 +88,7 @@ def get_pytest_env_vars() -> Dict[str, str]:
 
 # DO NOT EDIT - automatically generated.
 # All versions used to test samples.
-ALL_VERSIONS = ["3.6", "3.7", "3.8", "3.9", "3.10"]
+ALL_VERSIONS = ["3.7", "3.8", "3.9", "3.10"]
 
 # Any default versions that should be ignored.
 IGNORED_VERSIONS = TEST_CONFIG["ignored_versions"]

From 68f16727d226ca2ad3750a169fa5f343d3788955 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Tue, 19 Jul 2022 14:19:41 +0200
Subject: [PATCH 093/213] chore(deps): update all dependencies (#248)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* chore(deps): update all dependencies

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* revert

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
---
 google-analytics-data/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index 8e50bc8..edda3d8 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-data==0.12.0
+google-analytics-data==0.12.1
 google-auth-oauthlib==0.5.1
\ No newline at end of file

From 7c54d88dc88830bbdb7065854a36c1af34e9b31b Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Tue, 19 Jul 2022 14:39:03 +0200
Subject: [PATCH 094/213] chore(deps): update all dependencies (#233)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* chore(deps): update all dependencies

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* revert

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
---
 google-analytics-admin/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index beafa97..aded108 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-admin==0.8.1
+google-analytics-admin==0.8.2
 google-auth-oauthlib==0.5.1
\ No newline at end of file

From 78120fb413a7fe14704af3e4cf66a1415689f64f Mon Sep 17 00:00:00 2001
From: ikuleshov <ikuleshov@google.com>
Date: Tue, 19 Jul 2022 15:08:04 +0200
Subject: [PATCH 095/213] docs(samples): add runFunnelReport sample (#258)

* docs(samples): add runFunnelReport sample

* docs(samples): add runFunnelReport sample

* Merge remote-tracking branch 'origin/funnel' into funnel

# Conflicts:
#	samples/snippets/run_funnel_report.py

* docs(samples): add runFunnelReport sample

* docs(samples): add runFunnelReport sample

Co-authored-by: Anthonios Partheniou <partheniou@google.com>
---
 google-analytics-data/requirements.txt        |   2 +-
 google-analytics-data/run_funnel_report.py    | 205 ++++++++++++++++++
 .../run_funnel_report_test.py                 |  25 +++
 3 files changed, 231 insertions(+), 1 deletion(-)
 create mode 100644 google-analytics-data/run_funnel_report.py
 create mode 100644 google-analytics-data/run_funnel_report_test.py

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index edda3d8..17cfb3f 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-data==0.12.1
+google-analytics-data==0.13.0
 google-auth-oauthlib==0.5.1
\ No newline at end of file
diff --git a/google-analytics-data/run_funnel_report.py b/google-analytics-data/run_funnel_report.py
new file mode 100644
index 0000000..446a7a0
--- /dev/null
+++ b/google-analytics-data/run_funnel_report.py
@@ -0,0 +1,205 @@
+#!/usr/bin/env python
+
+# Copyright 2022 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Data API sample application demonstrating the creation of
+a funnel report.
+
+See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1alpha/properties/runFunnelReport
+for more information.
+"""
+# [START analyticsdata_run_funnel_report]
+from google.analytics.data_v1alpha import AlphaAnalyticsDataClient
+from google.analytics.data_v1alpha.types import DateRange
+from google.analytics.data_v1alpha.types import Dimension
+from google.analytics.data_v1alpha.types import Funnel
+from google.analytics.data_v1alpha.types import FunnelBreakdown
+from google.analytics.data_v1alpha.types import FunnelEventFilter
+from google.analytics.data_v1alpha.types import FunnelFieldFilter
+from google.analytics.data_v1alpha.types import FunnelFilterExpression
+from google.analytics.data_v1alpha.types import FunnelFilterExpressionList
+from google.analytics.data_v1alpha.types import FunnelStep
+from google.analytics.data_v1alpha.types import RunFunnelReportRequest
+from google.analytics.data_v1alpha.types import StringFilter
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+    run_funnel_report(property_id)
+
+
+def run_funnel_report(property_id="YOUR-GA4-PROPERTY-ID"):
+    """Runs a funnel query to build a report with 5 funnel steps.
+      Step 1: First open/visit (event name is `first_open` or `first_visit`).
+      Step 2: Organic visitors (`firstUserMedium` dimension contains the term
+      "organic").
+      Step 3: Session start (event name is `session_start`).
+      Step 4: Screen/Page view (event name is `screen_view` or `page_view`).
+      Step 5: Purchase (event name is `purchase` or `in_app_purchase`).
+
+    The report configuration reproduces the default funnel report provided in
+    the Funnel Exploration template of the Google Analytics UI.
+    See more at https://support.google.com/analytics/answer/9327974
+    """
+    client = AlphaAnalyticsDataClient()
+
+    request = RunFunnelReportRequest(
+        property=f"properties/{property_id}",
+        date_ranges=[DateRange(start_date="30daysAgo", end_date="today")],
+        funnel_breakdown=FunnelBreakdown(
+            breakdown_dimension=Dimension(name="deviceCategory")
+        ),
+        funnel=Funnel(
+            steps=[
+                FunnelStep(
+                    name="First open/visit",
+                    filter_expression=FunnelFilterExpression(
+                        or_group=FunnelFilterExpressionList(
+                            expressions=[
+                                FunnelFilterExpression(
+                                    funnel_event_filter=FunnelEventFilter(
+                                        event_name="first_open"
+                                    )
+                                ),
+                                FunnelFilterExpression(
+                                    funnel_event_filter=FunnelEventFilter(
+                                        event_name="first_visit"
+                                    )
+                                ),
+                            ]
+                        )
+                    ),
+                ),
+                FunnelStep(
+                    name="Organic visitors",
+                    filter_expression=FunnelFilterExpression(
+                        funnel_field_filter=FunnelFieldFilter(
+                            field_name="firstUserMedium",
+                            string_filter=StringFilter(
+                                match_type=StringFilter.MatchType.CONTAINS,
+                                case_sensitive=False,
+                                value="organic",
+                            ),
+                        )
+                    ),
+                ),
+                FunnelStep(
+                    name="Session start",
+                    filter_expression=FunnelFilterExpression(
+                        funnel_event_filter=FunnelEventFilter(
+                            event_name="session_start"
+                        )
+                    ),
+                ),
+                FunnelStep(
+                    name="Screen/Page view",
+                    filter_expression=FunnelFilterExpression(
+                        or_group=FunnelFilterExpressionList(
+                            expressions=[
+                                FunnelFilterExpression(
+                                    funnel_event_filter=FunnelEventFilter(
+                                        event_name="screen_view"
+                                    )
+                                ),
+                                FunnelFilterExpression(
+                                    funnel_event_filter=FunnelEventFilter(
+                                        event_name="page_view"
+                                    )
+                                ),
+                            ]
+                        )
+                    ),
+                ),
+                FunnelStep(
+                    name="Purchase",
+                    filter_expression=FunnelFilterExpression(
+                        or_group=FunnelFilterExpressionList(
+                            expressions=[
+                                FunnelFilterExpression(
+                                    funnel_event_filter=FunnelEventFilter(
+                                        event_name="purchase"
+                                    )
+                                ),
+                                FunnelFilterExpression(
+                                    funnel_event_filter=FunnelEventFilter(
+                                        event_name="in_app_purchase"
+                                    )
+                                ),
+                            ]
+                        )
+                    ),
+                ),
+            ]
+        ),
+    )
+    response = client.run_funnel_report(request)
+    print_run_funnel_report_response(response)
+
+
+# [START analyticsdata_print_run_funnel_report_response]
+def print_funnel_sub_report(funnel_sub_report):
+    """Prints the contents of a FunnelSubReport object."""
+    print("Dimension headers:")
+    for dimension_header in funnel_sub_report.dimension_headers:
+        print(dimension_header.name)
+
+    print("\nMetric headers:")
+    for metric_header in funnel_sub_report.metric_headers:
+        print(metric_header.name)
+
+    print("\nDimensions and metric values for each row in the report:")
+    for row_idx, row in enumerate(funnel_sub_report.rows):
+        print("\nRow #{}".format(row_idx))
+        for field_idx, dimension_value in enumerate(row.dimension_values):
+            dimension_name = funnel_sub_report.dimension_headers[field_idx].name
+            print("{}: '{}'".format(dimension_name, dimension_value.value))
+
+        for field_idx, metric_value in enumerate(row.metric_values):
+            metric_name = funnel_sub_report.metric_headers[field_idx].name
+            print("{}: '{}'".format(metric_name, metric_value.value))
+
+    print("\nSampling metadata for each date range:")
+    for metadata_idx, metadata in enumerate(
+        funnel_sub_report.metadata.sampling_metadatas
+    ):
+        print(
+            "Sampling metadata for date range #{}: samplesReadCount={}, "
+            "samplingSpaceSize={}".format(
+                metadata_idx, metadata.samples_read_count, metadata.sampling_space_size
+            )
+        )
+
+
+def print_run_funnel_report_response(response):
+    """Prints results of a runFunnelReport call."""
+    print("Report result:")
+    print("=== FUNNEL VISUALIZATION ===")
+    print_funnel_sub_report(response.funnel_visualization)
+
+    print("=== FUNNEL TABLE ===")
+    print_funnel_sub_report(response.funnel_table)
+
+
+# [END analyticsdata_print_run_funnel_report_response]
+
+
+# [END analyticsdata_run_funnel_report]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-data/run_funnel_report_test.py b/google-analytics-data/run_funnel_report_test.py
new file mode 100644
index 0000000..e8b2aaa
--- /dev/null
+++ b/google-analytics-data/run_funnel_report_test.py
@@ -0,0 +1,25 @@
+# Copyright 2021 Google Inc. All Rights Reserved.
+#
+# 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.
+
+import os
+
+import run_funnel_report
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+
+
+def test_run_funnel_report(capsys):
+    run_funnel_report.run_funnel_report(TEST_PROPERTY_ID)
+    out, _ = capsys.readouterr()
+    assert "Report result" in out

From e52fe38e4585c4f0f3c4f1c28ed43b21d6373332 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Tue, 2 Aug 2022 16:07:47 +0200
Subject: [PATCH 096/213] chore(deps): update all dependencies (#244)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* chore(deps): update all dependencies

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* revert

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
---
 google-analytics-admin/requirements.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index aded108..2e12988 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-admin==0.8.2
-google-auth-oauthlib==0.5.1
\ No newline at end of file
+google-analytics-admin==0.9.0
+google-auth-oauthlib==0.5.2
\ No newline at end of file

From e9157494ccf5cb9714972a42d367930340543d87 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Tue, 2 Aug 2022 17:07:15 +0200
Subject: [PATCH 097/213] chore(deps): update all dependencies (#263)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* chore(deps): update all dependencies

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* revert

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
---
 google-analytics-data/requirements.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index 17cfb3f..c6eda36 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-data==0.13.0
-google-auth-oauthlib==0.5.1
\ No newline at end of file
+google-analytics-data==0.13.1
+google-auth-oauthlib==0.5.2
\ No newline at end of file

From 47c976bbae8b8b23e3e48494cb9e28205da993f5 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Tue, 9 Aug 2022 17:13:45 +0200
Subject: [PATCH 098/213] chore(deps): update all dependencies (#248)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* chore(deps): update all dependencies

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* revert

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
---
 google-analytics-admin/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index 2e12988..5ab6794 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-admin==0.9.0
+google-analytics-admin==0.10.0
 google-auth-oauthlib==0.5.2
\ No newline at end of file

From 194fc668d643459a9828da6d5a823e19a8a7b390 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Tue, 16 Aug 2022 16:39:07 +0200
Subject: [PATCH 099/213] chore(deps): update dependency google-analytics-admin
 to v0.10.1 (#253)

---
 google-analytics-admin/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index 5ab6794..513b7a1 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-admin==0.10.0
+google-analytics-admin==0.10.1
 google-auth-oauthlib==0.5.2
\ No newline at end of file

From efdb6f50aed4bf99fd58d0eae9bbd451d4c1e689 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Tue, 16 Aug 2022 16:43:44 +0200
Subject: [PATCH 100/213] chore(deps): update dependency google-analytics-data
 to v0.13.2 (#269)

---
 google-analytics-data/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index c6eda36..6643059 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-data==0.13.1
+google-analytics-data==0.13.2
 google-auth-oauthlib==0.5.2
\ No newline at end of file

From d89b61adf0139ed5ebc7c0c18dc35052fe34c29b Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Tue, 6 Sep 2022 17:42:35 +0200
Subject: [PATCH 101/213] chore(deps): update dependency pytest to v7.1.3
 (#282)

---
 google-analytics-data/requirements-test.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements-test.txt b/google-analytics-data/requirements-test.txt
index d00689e..e071685 100644
--- a/google-analytics-data/requirements-test.txt
+++ b/google-analytics-data/requirements-test.txt
@@ -1 +1 @@
-pytest==7.1.2
+pytest==7.1.3

From d7c9fc5306542a1dbed75c8cc554dd7f6dc505e8 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Tue, 6 Sep 2022 17:48:52 +0200
Subject: [PATCH 102/213] chore(deps): update dependency pytest to v7.1.3
 (#262)

---
 google-analytics-admin/requirements-test.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements-test.txt b/google-analytics-admin/requirements-test.txt
index 6a3d7bc..f97bae6 100644
--- a/google-analytics-admin/requirements-test.txt
+++ b/google-analytics-admin/requirements-test.txt
@@ -1 +1 @@
-pytest==7.1.2
\ No newline at end of file
+pytest==7.1.3
\ No newline at end of file

From 229391738cbb7512d2d5b5bd4c149b1f104dab15 Mon Sep 17 00:00:00 2001
From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com>
Date: Fri, 9 Sep 2022 15:48:17 +0000
Subject: [PATCH 103/213] feat: Enable REST transport support (#265)

- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 473076638

Source-Link: https://github.com/googleapis/googleapis/commit/f0e2be46a5602ad903800811c9583f9e4458de3c

Source-Link: https://github.com/googleapis/googleapis-gen/commit/c62423e00d8999a1febd54e7d8e224cdc7e29e5f
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYzYyNDIzZTAwZDg5OTlhMWZlYmQ1NGU3ZDhlMjI0Y2RjN2UyOWU1ZiJ9


fix(deps): require google-api-core>=1.33.0,>=2.8.0
fix(deps): require protobuf >= 3.20.1
---
 .../account_summaries_list.py                 | 12 +++++++---
 .../account_summaries_list_test.py            |  8 ++++---
 google-analytics-admin/accounts_delete.py     | 13 ++++++++---
 .../accounts_delete_test.py                   | 12 ++++++----
 google-analytics-admin/accounts_get.py        | 12 +++++++---
 .../accounts_get_data_sharing_settings.py     | 12 +++++++---
 ...accounts_get_data_sharing_settings_test.py | 10 +++++---
 google-analytics-admin/accounts_get_test.py   |  8 ++++---
 google-analytics-admin/accounts_list.py       | 12 +++++++---
 google-analytics-admin/accounts_list_test.py  |  8 ++++---
 .../accounts_provision_account_ticket.py      | 15 +++++++++---
 .../accounts_provision_account_ticket_test.py | 10 +++++---
 .../accounts_search_change_history_events.py  | 18 +++++++++++----
 ...ounts_search_change_history_events_test.py | 12 ++++++----
 google-analytics-admin/accounts_update.py     | 13 ++++++++---
 .../accounts_update_test.py                   | 10 ++++----
 .../accounts_user_links_audit.py              | 15 ++++++++----
 .../accounts_user_links_audit_test.py         | 10 +++++---
 .../accounts_user_links_batch_create.py       | 16 ++++++++++---
 .../accounts_user_links_batch_create_test.py  | 14 ++++++-----
 .../accounts_user_links_batch_delete.py       | 16 ++++++++++---
 .../accounts_user_links_batch_delete_test.py  | 14 ++++++-----
 .../accounts_user_links_batch_get.py          | 16 ++++++++++---
 .../accounts_user_links_batch_get_test.py     | 12 ++++++----
 .../accounts_user_links_batch_update.py       | 16 ++++++++++---
 .../accounts_user_links_batch_update_test.py  | 14 ++++++-----
 .../accounts_user_links_create.py             | 16 ++++++++++---
 .../accounts_user_links_create_test.py        | 14 ++++++-----
 .../accounts_user_links_delete.py             | 16 ++++++++++---
 .../accounts_user_links_delete_test.py        | 14 ++++++-----
 .../accounts_user_links_get.py                | 16 ++++++++++---
 .../accounts_user_links_get_test.py           | 10 +++++---
 .../accounts_user_links_list.py               | 13 ++++++++---
 .../accounts_user_links_list_test.py          | 10 +++++---
 .../accounts_user_links_update.py             | 16 ++++++++++---
 .../accounts_user_links_update_test.py        | 14 ++++++-----
 google-analytics-admin/noxfile_config_test.py |  0
 .../properties_conversion_events_create.py    | 13 ++++++++---
 ...roperties_conversion_events_create_test.py | 12 ++++++----
 .../properties_conversion_events_delete.py    | 16 ++++++++++---
 ...roperties_conversion_events_delete_test.py | 14 ++++++-----
 .../properties_conversion_events_get.py       | 15 +++++++++---
 .../properties_conversion_events_get_test.py  | 12 ++++++----
 .../properties_conversion_events_list.py      | 13 ++++++++---
 .../properties_conversion_events_list_test.py | 10 +++++---
 google-analytics-admin/properties_create.py   | 13 ++++++++---
 .../properties_create_test.py                 | 10 ++++----
 .../properties_data_streams_create.py         | 13 ++++++++---
 .../properties_data_streams_create_test.py    | 12 ++++++----
 .../properties_data_streams_delete.py         | 14 ++++++++---
 .../properties_data_streams_delete_test.py    | 14 ++++++-----
 .../properties_data_streams_get.py            | 14 ++++++++---
 ...erties_data_streams_get_global_site_tag.py | 14 ++++++++---
 ...s_data_streams_get_global_site_tag_test.py | 12 ++++++----
 .../properties_data_streams_get_test.py       | 10 +++++---
 .../properties_data_streams_list.py           | 13 ++++++++---
 .../properties_data_streams_list_test.py      | 10 +++++---
 ...ams_measurement_protocol_secrets_create.py | 16 ++++++++++---
 ...easurement_protocol_secrets_create_test.py | 14 ++++++-----
 ...ams_measurement_protocol_secrets_delete.py | 17 +++++++++++---
 ...easurement_protocol_secrets_delete_test.py | 14 ++++++-----
 ...treams_measurement_protocol_secrets_get.py | 17 +++++++++++---
 ...s_measurement_protocol_secrets_get_test.py | 12 ++++++----
 ...reams_measurement_protocol_secrets_list.py | 16 ++++++++++---
 ..._measurement_protocol_secrets_list_test.py | 12 ++++++----
 ...ams_measurement_protocol_secrets_update.py | 17 +++++++++++---
 ...easurement_protocol_secrets_update_test.py | 14 ++++++-----
 .../properties_data_streams_update.py         | 14 ++++++++---
 .../properties_data_streams_update_test.py    | 14 ++++++-----
 google-analytics-admin/properties_delete.py   | 13 ++++++++---
 .../properties_delete_test.py                 | 10 ++++----
 .../properties_firebase_links_create.py       | 16 ++++++++++---
 .../properties_firebase_links_create_test.py  | 14 ++++++-----
 .../properties_firebase_links_delete.py       | 16 ++++++++++---
 .../properties_firebase_links_delete_test.py  | 14 ++++++-----
 .../properties_firebase_links_list.py         | 15 ++++++++----
 .../properties_firebase_links_list_test.py    | 10 +++++---
 google-analytics-admin/properties_get.py      | 13 ++++++++---
 google-analytics-admin/properties_get_test.py |  8 ++++---
 .../properties_google_ads_links_create.py     | 16 ++++++++++---
 ...properties_google_ads_links_create_test.py | 14 ++++++-----
 .../properties_google_ads_links_delete.py     | 16 ++++++++++---
 ...properties_google_ads_links_delete_test.py | 14 ++++++-----
 .../properties_google_ads_links_list.py       | 15 ++++++++----
 .../properties_google_ads_links_list_test.py  | 10 +++++---
 .../properties_google_ads_links_update.py     | 16 ++++++++++---
 ...properties_google_ads_links_update_test.py | 14 ++++++-----
 google-analytics-admin/properties_list.py     | 15 ++++++++----
 .../properties_list_test.py                   |  8 ++++---
 google-analytics-admin/properties_update.py   | 13 ++++++++---
 .../properties_update_test.py                 | 10 ++++----
 .../properties_user_links_audit.py            | 15 ++++++++----
 .../properties_user_links_audit_test.py       | 10 +++++---
 .../properties_user_links_batch_create.py     | 18 +++++++++++----
 ...properties_user_links_batch_create_test.py | 14 ++++++-----
 .../properties_user_links_batch_delete.py     | 16 ++++++++++---
 ...properties_user_links_batch_delete_test.py | 14 ++++++-----
 .../properties_user_links_batch_get.py        | 18 +++++++++++----
 .../properties_user_links_batch_get_test.py   | 12 ++++++----
 .../properties_user_links_batch_update.py     | 16 ++++++++++---
 ...properties_user_links_batch_update_test.py | 14 ++++++-----
 .../properties_user_links_create.py           | 16 ++++++++++---
 .../properties_user_links_create_test.py      | 14 ++++++-----
 .../properties_user_links_delete.py           | 16 ++++++++++---
 .../properties_user_links_delete_test.py      | 14 ++++++-----
 .../properties_user_links_get.py              | 16 ++++++++++---
 .../properties_user_links_get_test.py         | 12 ++++++----
 .../properties_user_links_list.py             | 15 ++++++++----
 .../properties_user_links_list_test.py        | 10 +++++---
 .../properties_user_links_update.py           | 16 ++++++++++---
 .../properties_user_links_update_test.py      | 14 ++++++-----
 google-analytics-admin/quickstart.py          | 17 ++++++++++----
 google-analytics-admin/quickstart_test.py     | 23 +++++++++++++++++++
 113 files changed, 1082 insertions(+), 436 deletions(-)
 delete mode 100644 google-analytics-admin/noxfile_config_test.py
 create mode 100644 google-analytics-admin/quickstart_test.py

diff --git a/google-analytics-admin/account_summaries_list.py b/google-analytics-admin/account_summaries_list.py
index cb60816..9efd7ca 100644
--- a/google-analytics-admin/account_summaries_list.py
+++ b/google-analytics-admin/account_summaries_list.py
@@ -24,9 +24,15 @@
 from google.analytics.admin import AnalyticsAdminServiceClient
 
 
-def list_account_summaries():
-    """Returns summaries of all accounts accessible by the caller."""
-    client = AnalyticsAdminServiceClient()
+def list_account_summaries(transport: str = None) -> None:
+    """
+    Prints summaries of all accounts accessible by the caller.
+
+    Args:
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     results = client.list_account_summaries()
 
     print("Result:")
diff --git a/google-analytics-admin/account_summaries_list_test.py b/google-analytics-admin/account_summaries_list_test.py
index d97ef6d..c132782 100644
--- a/google-analytics-admin/account_summaries_list_test.py
+++ b/google-analytics-admin/account_summaries_list_test.py
@@ -16,6 +16,8 @@
 
 
 def test_account_summaries_list(capsys):
-    account_summaries_list.list_account_summaries()
-    out, _ = capsys.readouterr()
-    assert "Result" in out
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        account_summaries_list.list_account_summaries(transport=transport)
+        out, _ = capsys.readouterr()
+        assert "Result" in out
diff --git a/google-analytics-admin/accounts_delete.py b/google-analytics-admin/accounts_delete.py
index 7c6f7af..44b6aba 100644
--- a/google-analytics-admin/accounts_delete.py
+++ b/google-analytics-admin/accounts_delete.py
@@ -38,9 +38,16 @@ def run_sample():
     delete_account(account_id)
 
 
-def delete_account(account_id: str):
-    """Deletes the Google Analytics account."""
-    client = AnalyticsAdminServiceClient()
+def delete_account(account_id: str, transport: str = None):
+    """
+    Deletes the Google Analytics account.
+
+    Args:
+        account_id(str): The id of the account to be deleted.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     client.delete_account(name=f"accounts/{account_id}")
     print("Account deleted")
 
diff --git a/google-analytics-admin/accounts_delete_test.py b/google-analytics-admin/accounts_delete_test.py
index 74ffac3..76f8dd7 100644
--- a/google-analytics-admin/accounts_delete_test.py
+++ b/google-analytics-admin/accounts_delete_test.py
@@ -20,8 +20,10 @@
 
 
 def test_accounts_delete():
-    # This test ensures that the call is valid and reaches the server. No
-    # account is being deleted during the test as it is not trivial to
-    # provision a new account for testing.
-    with pytest.raises(Exception, match="403 The caller does not have permission"):
-        accounts_delete.delete_account(FAKE_ACCOUNT_ID)
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        # This test ensures that the call is valid and reaches the server. No
+        # account is being deleted during the test as it is not trivial to
+        # provision a new account for testing.
+        with pytest.raises(Exception, match="The caller does not have permission"):
+            accounts_delete.delete_account(FAKE_ACCOUNT_ID, transport=transport)
diff --git a/google-analytics-admin/accounts_get.py b/google-analytics-admin/accounts_get.py
index d7cbf92..221cf18 100644
--- a/google-analytics-admin/accounts_get.py
+++ b/google-analytics-admin/accounts_get.py
@@ -32,9 +32,15 @@ def run_sample():
     get_account(account_id)
 
 
-def get_account(account_id: str):
-    """Retrieves the Google Analytics account data."""
-    client = AnalyticsAdminServiceClient()
+def get_account(account_id: str, transport: str = None):
+    """
+    Retrieves the Google Analytics account data.
+    Args:
+        account_id(str): The id of the account.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     account = client.get_account(name=f"accounts/{account_id}")
 
     print("Result:")
diff --git a/google-analytics-admin/accounts_get_data_sharing_settings.py b/google-analytics-admin/accounts_get_data_sharing_settings.py
index 66a8ef2..be43a00 100644
--- a/google-analytics-admin/accounts_get_data_sharing_settings.py
+++ b/google-analytics-admin/accounts_get_data_sharing_settings.py
@@ -33,9 +33,15 @@ def run_sample():
     get_data_sharing_settings(account_id)
 
 
-def get_data_sharing_settings(account_id: str):
-    """Gets data sharing settings on an account."""
-    client = AnalyticsAdminServiceClient()
+def get_data_sharing_settings(account_id: str, transport=None):
+    """
+    Gets data sharing settings on an account.
+    Args:
+        account_id(str): The id of the account.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     data_sharing_settings = client.get_data_sharing_settings(
         name=f"accounts/{account_id}/dataSharingSettings"
     )
diff --git a/google-analytics-admin/accounts_get_data_sharing_settings_test.py b/google-analytics-admin/accounts_get_data_sharing_settings_test.py
index 6232fc7..2ac0cac 100644
--- a/google-analytics-admin/accounts_get_data_sharing_settings_test.py
+++ b/google-analytics-admin/accounts_get_data_sharing_settings_test.py
@@ -20,6 +20,10 @@
 
 
 def test_accounts_get_data_sharing_settings(capsys):
-    accounts_get_data_sharing_settings.get_data_sharing_settings(TEST_ACCOUNT_ID)
-    out, _ = capsys.readouterr()
-    assert "Result" in out
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        accounts_get_data_sharing_settings.get_data_sharing_settings(
+            TEST_ACCOUNT_ID, transport=transport
+        )
+        out, _ = capsys.readouterr()
+        assert "Result" in out
diff --git a/google-analytics-admin/accounts_get_test.py b/google-analytics-admin/accounts_get_test.py
index 5c0c131..c982c47 100644
--- a/google-analytics-admin/accounts_get_test.py
+++ b/google-analytics-admin/accounts_get_test.py
@@ -20,6 +20,8 @@
 
 
 def test_accounts_get(capsys):
-    accounts_get.get_account(TEST_ACCOUNT_ID)
-    out, _ = capsys.readouterr()
-    assert "Result" in out
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        accounts_get.get_account(TEST_ACCOUNT_ID, transport=transport)
+        out, _ = capsys.readouterr()
+        assert "Result" in out
diff --git a/google-analytics-admin/accounts_list.py b/google-analytics-admin/accounts_list.py
index f69869e..87a2c5e 100644
--- a/google-analytics-admin/accounts_list.py
+++ b/google-analytics-admin/accounts_list.py
@@ -26,9 +26,15 @@
 from accounts_get import print_account
 
 
-def list_accounts():
-    """Lists the Google Analytics accounts available to the current user."""
-    client = AnalyticsAdminServiceClient()
+def list_accounts(transport: str = None):
+    """
+    Lists the Google Analytics accounts available to the current user.
+
+    Args:
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     results = client.list_accounts()
 
     print("Result:")
diff --git a/google-analytics-admin/accounts_list_test.py b/google-analytics-admin/accounts_list_test.py
index 379c73b..d8c2f0f 100644
--- a/google-analytics-admin/accounts_list_test.py
+++ b/google-analytics-admin/accounts_list_test.py
@@ -16,6 +16,8 @@
 
 
 def test_accounts_list(capsys):
-    accounts_list.list_accounts()
-    out, _ = capsys.readouterr()
-    assert "Result" in out
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        accounts_list.list_accounts(transport=transport)
+        out, _ = capsys.readouterr()
+        assert "Result" in out
diff --git a/google-analytics-admin/accounts_provision_account_ticket.py b/google-analytics-admin/accounts_provision_account_ticket.py
index a963641..977c74c 100644
--- a/google-analytics-admin/accounts_provision_account_ticket.py
+++ b/google-analytics-admin/accounts_provision_account_ticket.py
@@ -58,9 +58,18 @@ def run_sample():
     provision_account_ticket(redirect_uri)
 
 
-def provision_account_ticket(redirect_uri: str):
-    """Provisions the Google Analytics account creation ticket."""
-    client = AnalyticsAdminServiceClient()
+def provision_account_ticket(redirect_uri: str, transport: str = None):
+    """
+    Provisions the Google Analytics account creation ticket.
+
+    Args:
+        redirect_uri(str): Redirect URI where the user will be sent
+            after accepting Terms of Service. Must be configured in
+            Developers Console as a Redirect URI.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     response = client.provision_account_ticket(
         ProvisionAccountTicketRequest(
             account=Account(display_name="Test Account", region_code="US"),
diff --git a/google-analytics-admin/accounts_provision_account_ticket_test.py b/google-analytics-admin/accounts_provision_account_ticket_test.py
index b8dac59..ca1f069 100644
--- a/google-analytics-admin/accounts_provision_account_ticket_test.py
+++ b/google-analytics-admin/accounts_provision_account_ticket_test.py
@@ -18,6 +18,10 @@
 
 
 def test_accounts_provision_account_ticket(capsys):
-    accounts_provision_account_ticket.provision_account_ticket(TEST_REDIRECT_URL)
-    out, _ = capsys.readouterr()
-    assert "Result" in out
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        accounts_provision_account_ticket.provision_account_ticket(
+            TEST_REDIRECT_URL, transport=transport
+        )
+        out, _ = capsys.readouterr()
+        assert "Result" in out
diff --git a/google-analytics-admin/accounts_search_change_history_events.py b/google-analytics-admin/accounts_search_change_history_events.py
index 4d29d36..1fb57dc 100644
--- a/google-analytics-admin/accounts_search_change_history_events.py
+++ b/google-analytics-admin/accounts_search_change_history_events.py
@@ -43,10 +43,20 @@ def run_sample():
     search_change_history_events(account_id, property_id)
 
 
-def search_change_history_events(account_id: str, property_id: str):
-    """Lists the change history events for the Google Analytics 4 property
-    within the specified date range."""
-    client = AnalyticsAdminServiceClient()
+def search_change_history_events(
+    account_id: str, property_id: str, transport: str = None
+):
+    """
+    Lists the change history events for the Google Analytics 4 property
+    within the specified date range.
+
+    Args:
+        account_id(str): The Google Analytics Account ID.
+        property_id(str): The Google Analytics Property ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     # Create a timestamp object and subtract 7 days from the current date/time.
     earliest_change_time = Timestamp()
     earliest_change_time.FromDatetime(datetime.now() - timedelta(days=7))
diff --git a/google-analytics-admin/accounts_search_change_history_events_test.py b/google-analytics-admin/accounts_search_change_history_events_test.py
index 9a3e63c..8bc148f 100644
--- a/google-analytics-admin/accounts_search_change_history_events_test.py
+++ b/google-analytics-admin/accounts_search_change_history_events_test.py
@@ -21,8 +21,10 @@
 
 
 def test_accounts_search_change_history_events(capsys):
-    accounts_search_change_history_events.search_change_history_events(
-        TEST_ACCOUNT_ID, TEST_PROPERTY_ID
-    )
-    out, _ = capsys.readouterr()
-    assert "Result" in out
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        accounts_search_change_history_events.search_change_history_events(
+            TEST_ACCOUNT_ID, TEST_PROPERTY_ID, transport=transport
+        )
+        out, _ = capsys.readouterr()
+        assert "Result" in out
diff --git a/google-analytics-admin/accounts_update.py b/google-analytics-admin/accounts_update.py
index b87142c..602ff63 100644
--- a/google-analytics-admin/accounts_update.py
+++ b/google-analytics-admin/accounts_update.py
@@ -42,9 +42,16 @@ def run_sample():
     update_account(account_id)
 
 
-def update_account(account_id: str):
-    """Updates the Google Analytics account."""
-    client = AnalyticsAdminServiceClient()
+def update_account(account_id: str, transport: str = None):
+    """
+    Updates the Google Analytics account.
+
+    Args:
+        account_id(str): The Google Analytics Account ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     # This call updates the display name and region code of the account, as
     # indicated by the value of the `update_mask` field.
     # The account to update is specified in the `name` field of the `Account`
diff --git a/google-analytics-admin/accounts_update_test.py b/google-analytics-admin/accounts_update_test.py
index efcc6ab..9481acc 100644
--- a/google-analytics-admin/accounts_update_test.py
+++ b/google-analytics-admin/accounts_update_test.py
@@ -20,7 +20,9 @@
 
 
 def test_accounts_update():
-    # This test ensures that the call is valid and reaches the server, even
-    # though the operation does not succeed due to permission error.
-    with pytest.raises(Exception, match="403 The caller does not have permission"):
-        accounts_update.update_account(FAKE_ACCOUNT_ID)
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        # This test ensures that the call is valid and reaches the server, even
+        # though the operation does not succeed due to permission error.
+        with pytest.raises(Exception, match="The caller does not have permission"):
+            accounts_update.update_account(FAKE_ACCOUNT_ID, transport=transport)
diff --git a/google-analytics-admin/accounts_user_links_audit.py b/google-analytics-admin/accounts_user_links_audit.py
index 106906a..bc58353 100644
--- a/google-analytics-admin/accounts_user_links_audit.py
+++ b/google-analytics-admin/accounts_user_links_audit.py
@@ -33,10 +33,17 @@ def run_sample():
     audit_account_user_links(account_id)
 
 
-def audit_account_user_links(account_id):
-    """Lists all user links on an account, including implicit ones that come
-    from effective permissions granted by groups or organization admin roles."""
-    client = AnalyticsAdminServiceClient()
+def audit_account_user_links(account_id: str, transport: str = None):
+    """
+    Lists all user links on an account, including implicit ones that come
+    from effective permissions granted by groups or organization admin roles.
+
+    Args:
+        account_id(str): The Google Analytics Account ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
 
     print("Result:")
     for user_link in client.audit_user_links(
diff --git a/google-analytics-admin/accounts_user_links_audit_test.py b/google-analytics-admin/accounts_user_links_audit_test.py
index 78a2175..d272477 100644
--- a/google-analytics-admin/accounts_user_links_audit_test.py
+++ b/google-analytics-admin/accounts_user_links_audit_test.py
@@ -20,6 +20,10 @@
 
 
 def test_accounts_user_links_audit(capsys):
-    accounts_user_links_audit.audit_account_user_links(TEST_ACCOUNT_ID)
-    out, _ = capsys.readouterr()
-    assert "Result" in out
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        accounts_user_links_audit.audit_account_user_links(
+            TEST_ACCOUNT_ID, transport=transport
+        )
+        out, _ = capsys.readouterr()
+        assert "Result" in out
diff --git a/google-analytics-admin/accounts_user_links_batch_create.py b/google-analytics-admin/accounts_user_links_batch_create.py
index 8ec390d..ca4d455 100644
--- a/google-analytics-admin/accounts_user_links_batch_create.py
+++ b/google-analytics-admin/accounts_user_links_batch_create.py
@@ -49,9 +49,19 @@ def run_sample():
     batch_create_account_user_link(account_id, email_address)
 
 
-def batch_create_account_user_link(account_id, email_address):
-    """Creates a user link for the account using a batch call."""
-    client = AnalyticsAdminServiceClient()
+def batch_create_account_user_link(
+    account_id: str, email_address: str, transport: str = None
+):
+    """
+    Creates a user link for the account using a batch call.
+
+    Args:
+        account_id(str): The Google Analytics Account ID.
+        email_address(str): Email address of the user to link.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     response = client.batch_create_user_links(
         BatchCreateUserLinksRequest(
             parent=f"accounts/{account_id}",
diff --git a/google-analytics-admin/accounts_user_links_batch_create_test.py b/google-analytics-admin/accounts_user_links_batch_create_test.py
index cf4241d..ea51ee2 100644
--- a/google-analytics-admin/accounts_user_links_batch_create_test.py
+++ b/google-analytics-admin/accounts_user_links_batch_create_test.py
@@ -23,9 +23,11 @@
 
 
 def test_accounts_user_links_batch_create():
-    # This test ensures that the call is valid and reaches the server, even
-    # though the operation does not succeed due to permission error.
-    with pytest.raises(Exception, match="403 The caller does not have permission"):
-        accounts_user_links_batch_create.batch_create_account_user_link(
-            FAKE_ACCOUNT_ID, TEST_EMAIL_ADDRESS
-        )
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        # This test ensures that the call is valid and reaches the server, even
+        # though the operation does not succeed due to permission error.
+        with pytest.raises(Exception, match="The caller does not have permission"):
+            accounts_user_links_batch_create.batch_create_account_user_link(
+                FAKE_ACCOUNT_ID, TEST_EMAIL_ADDRESS, transport=transport
+            )
diff --git a/google-analytics-admin/accounts_user_links_batch_delete.py b/google-analytics-admin/accounts_user_links_batch_delete.py
index 12fd558..0b7ba16 100644
--- a/google-analytics-admin/accounts_user_links_batch_delete.py
+++ b/google-analytics-admin/accounts_user_links_batch_delete.py
@@ -47,9 +47,19 @@ def run_sample():
     batch_delete_account_user_link(account_id, account_user_link_id)
 
 
-def batch_delete_account_user_link(account_id, account_user_link_id):
-    """Deletes the user link using a batch call."""
-    client = AnalyticsAdminServiceClient()
+def batch_delete_account_user_link(
+    account_id: str, account_user_link_id: str, transport: str = None
+):
+    """
+    Deletes the user link using a batch call.
+
+    Args:
+        account_id(str): The Google Analytics Account ID.
+        account_user_link_id(str): Google Analytics account user link ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     client.batch_delete_user_links(
         BatchDeleteUserLinksRequest(
             parent=f"accounts/{account_id}",
diff --git a/google-analytics-admin/accounts_user_links_batch_delete_test.py b/google-analytics-admin/accounts_user_links_batch_delete_test.py
index 8edadc5..e26e7bb 100644
--- a/google-analytics-admin/accounts_user_links_batch_delete_test.py
+++ b/google-analytics-admin/accounts_user_links_batch_delete_test.py
@@ -21,9 +21,11 @@
 
 
 def test_accounts_user_links_batch_delete():
-    # This test ensures that the call is valid and reaches the server, even
-    # though the operation does not succeed due to permission error.
-    with pytest.raises(Exception, match="403 The caller does not have permission"):
-        accounts_user_links_batch_delete.batch_delete_account_user_link(
-            FAKE_ACCOUNT_ID, FAKE_ACCOUNT_USER_LINK_ID
-        )
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        # This test ensures that the call is valid and reaches the server, even
+        # though the operation does not succeed due to permission error.
+        with pytest.raises(Exception, match="The caller does not have permission"):
+            accounts_user_links_batch_delete.batch_delete_account_user_link(
+                FAKE_ACCOUNT_ID, FAKE_ACCOUNT_USER_LINK_ID, transport=transport
+            )
diff --git a/google-analytics-admin/accounts_user_links_batch_get.py b/google-analytics-admin/accounts_user_links_batch_get.py
index d5506d3..baf989d 100644
--- a/google-analytics-admin/accounts_user_links_batch_get.py
+++ b/google-analytics-admin/accounts_user_links_batch_get.py
@@ -38,9 +38,19 @@ def run_sample():
     batch_get_account_user_link(account_id, account_user_link_id)
 
 
-def batch_get_account_user_link(account_id, account_user_link_id):
-    """Retrieves details for the account user link using a batch call."""
-    client = AnalyticsAdminServiceClient()
+def batch_get_account_user_link(
+    account_id: str, account_user_link_id: str, transport: str = None
+):
+    """
+    Retrieves details for the account user link using a batch call.
+
+    Args:
+        account_id(str): The Google Analytics Account ID.
+        account_user_link_id(str): Google Analytics account user link ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     response = client.batch_get_user_links(
         BatchGetUserLinksRequest(
             parent=f"accounts/{account_id}",
diff --git a/google-analytics-admin/accounts_user_links_batch_get_test.py b/google-analytics-admin/accounts_user_links_batch_get_test.py
index 29775cb..02aa796 100644
--- a/google-analytics-admin/accounts_user_links_batch_get_test.py
+++ b/google-analytics-admin/accounts_user_links_batch_get_test.py
@@ -21,8 +21,10 @@
 
 
 def test_accounts_user_links_batch_get(capsys):
-    accounts_user_links_batch_get.batch_get_account_user_link(
-        TEST_ACCOUNT_ID, TEST_USER_LINK_ID
-    )
-    out, _ = capsys.readouterr()
-    assert "Result" in out
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        accounts_user_links_batch_get.batch_get_account_user_link(
+            TEST_ACCOUNT_ID, TEST_USER_LINK_ID, transport=transport
+        )
+        out, _ = capsys.readouterr()
+        assert "Result" in out
diff --git a/google-analytics-admin/accounts_user_links_batch_update.py b/google-analytics-admin/accounts_user_links_batch_update.py
index a0bcfc4..3b401fc 100644
--- a/google-analytics-admin/accounts_user_links_batch_update.py
+++ b/google-analytics-admin/accounts_user_links_batch_update.py
@@ -48,9 +48,19 @@ def run_sample():
     batch_update_account_user_link(account_id, account_user_link_id)
 
 
-def batch_update_account_user_link(account_id, account_user_link_id):
-    """Updates the account user link using a batch call."""
-    client = AnalyticsAdminServiceClient()
+def batch_update_account_user_link(
+    account_id: str, account_user_link_id: str, transport: str = None
+):
+    """
+    Updates the account user link using a batch call.
+
+    Args:
+        account_id(str): The Google Analytics Account ID.
+        account_user_link_id(str): Google Analytics account user link ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     # This call updates the email address and direct roles of the user link.
     # The user link to update is specified in the `name` field of the `UserLink`
     # instance.
diff --git a/google-analytics-admin/accounts_user_links_batch_update_test.py b/google-analytics-admin/accounts_user_links_batch_update_test.py
index 1975b39..7fda9a6 100644
--- a/google-analytics-admin/accounts_user_links_batch_update_test.py
+++ b/google-analytics-admin/accounts_user_links_batch_update_test.py
@@ -21,9 +21,11 @@
 
 
 def test_accounts_user_links_batch_update():
-    # This test ensures that the call is valid and reaches the server, even
-    # though the operation does not succeed due to permission error.
-    with pytest.raises(Exception, match="403 The caller does not have permission"):
-        accounts_user_links_batch_update.batch_update_account_user_link(
-            FAKE_ACCOUNT_ID, FAKE_ACCOUNT_USER_LINK_ID
-        )
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        # This test ensures that the call is valid and reaches the server, even
+        # though the operation does not succeed due to permission error.
+        with pytest.raises(Exception, match="The caller does not have permission"):
+            accounts_user_links_batch_update.batch_update_account_user_link(
+                FAKE_ACCOUNT_ID, FAKE_ACCOUNT_USER_LINK_ID, transport=transport
+            )
diff --git a/google-analytics-admin/accounts_user_links_create.py b/google-analytics-admin/accounts_user_links_create.py
index 6aba6ab..4b05540 100644
--- a/google-analytics-admin/accounts_user_links_create.py
+++ b/google-analytics-admin/accounts_user_links_create.py
@@ -45,9 +45,19 @@ def run_sample():
     create_account_user_link(account_id, email_address)
 
 
-def create_account_user_link(account_id, email_address):
-    """Creates a user link for the account."""
-    client = AnalyticsAdminServiceClient()
+def create_account_user_link(
+    account_id: str, email_address: str, transport: str = None
+):
+    """
+    Creates a user link for the account.
+
+    Args:
+        account_id(str): The Google Analytics Account ID.
+        email_address(str): Email address of the user to link.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     user_link = client.create_user_link(
         CreateUserLinkRequest(
             parent=f"accounts/{account_id}",
diff --git a/google-analytics-admin/accounts_user_links_create_test.py b/google-analytics-admin/accounts_user_links_create_test.py
index 3a25123..720d21f 100644
--- a/google-analytics-admin/accounts_user_links_create_test.py
+++ b/google-analytics-admin/accounts_user_links_create_test.py
@@ -23,9 +23,11 @@
 
 
 def test_accounts_user_links_create():
-    # This test ensures that the call is valid and reaches the server, even
-    # though the operation does not succeed due to permission error.
-    with pytest.raises(Exception, match="403 The caller does not have permission"):
-        accounts_user_links_create.create_account_user_link(
-            FAKE_ACCOUNT_ID, TEST_EMAIL_ADDRESS
-        )
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        # This test ensures that the call is valid and reaches the server, even
+        # though the operation does not succeed due to permission error.
+        with pytest.raises(Exception, match="The caller does not have permission"):
+            accounts_user_links_create.create_account_user_link(
+                FAKE_ACCOUNT_ID, TEST_EMAIL_ADDRESS, transport=transport
+            )
diff --git a/google-analytics-admin/accounts_user_links_delete.py b/google-analytics-admin/accounts_user_links_delete.py
index 1263d96..03dab71 100644
--- a/google-analytics-admin/accounts_user_links_delete.py
+++ b/google-analytics-admin/accounts_user_links_delete.py
@@ -44,9 +44,19 @@ def run_sample():
     delete_account_user_link(account_id, account_user_link_id)
 
 
-def delete_account_user_link(account_id, account_user_link_id):
-    """Deletes the user link for the account."""
-    client = AnalyticsAdminServiceClient()
+def delete_account_user_link(
+    account_id: str, account_user_link_id: str, transport: str = None
+):
+    """
+    Deletes the user link for the account.
+
+    Args:
+        account_id(str): The Google Analytics Account ID.
+        account_user_link_id(str): Google Analytics account user link ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     client.delete_user_link(
         DeleteUserLinkRequest(
             name=f"accounts/{account_id}/userLinks/{account_user_link_id}"
diff --git a/google-analytics-admin/accounts_user_links_delete_test.py b/google-analytics-admin/accounts_user_links_delete_test.py
index f717e88..449a137 100644
--- a/google-analytics-admin/accounts_user_links_delete_test.py
+++ b/google-analytics-admin/accounts_user_links_delete_test.py
@@ -21,9 +21,11 @@
 
 
 def test_accounts_user_links_delete():
-    # This test ensures that the call is valid and reaches the server, even
-    # though the operation does not succeed due to permission error.
-    with pytest.raises(Exception, match="403 The caller does not have permission"):
-        accounts_user_links_delete.delete_account_user_link(
-            FAKE_ACCOUNT_ID, FAKE_ACCOUNT_USER_LINK_ID
-        )
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        # This test ensures that the call is valid and reaches the server, even
+        # though the operation does not succeed due to permission error.
+        with pytest.raises(Exception, match="The caller does not have permission"):
+            accounts_user_links_delete.delete_account_user_link(
+                FAKE_ACCOUNT_ID, FAKE_ACCOUNT_USER_LINK_ID, transport=transport
+            )
diff --git a/google-analytics-admin/accounts_user_links_get.py b/google-analytics-admin/accounts_user_links_get.py
index a9fc8b3..8c6688c 100644
--- a/google-analytics-admin/accounts_user_links_get.py
+++ b/google-analytics-admin/accounts_user_links_get.py
@@ -37,9 +37,19 @@ def run_sample():
     get_account_user_link(account_id, account_user_link_id)
 
 
-def get_account_user_link(account_id, account_user_link_id):
-    """Retrieves the account user link details."""
-    client = AnalyticsAdminServiceClient()
+def get_account_user_link(
+    account_id: str, account_user_link_id: str, transport: str = None
+):
+    """
+    Retrieves the account user link details.
+
+    Args:
+        account_id(str): The Google Analytics Account ID.
+        account_user_link_id(str): Google Analytics account user link ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     user_link = client.get_user_link(
         name=f"accounts/{account_id}/userLinks/{account_user_link_id}"
     )
diff --git a/google-analytics-admin/accounts_user_links_get_test.py b/google-analytics-admin/accounts_user_links_get_test.py
index 0e717d3..0026edb 100644
--- a/google-analytics-admin/accounts_user_links_get_test.py
+++ b/google-analytics-admin/accounts_user_links_get_test.py
@@ -21,6 +21,10 @@
 
 
 def test_accounts_user_links_get(capsys):
-    accounts_user_links_get.get_account_user_link(TEST_ACCOUNT_ID, TEST_USER_LINK_ID)
-    out, _ = capsys.readouterr()
-    assert "Result" in out
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        accounts_user_links_get.get_account_user_link(
+            TEST_ACCOUNT_ID, TEST_USER_LINK_ID, transport=transport
+        )
+        out, _ = capsys.readouterr()
+        assert "Result" in out
diff --git a/google-analytics-admin/accounts_user_links_list.py b/google-analytics-admin/accounts_user_links_list.py
index f42f8ff..5241157 100644
--- a/google-analytics-admin/accounts_user_links_list.py
+++ b/google-analytics-admin/accounts_user_links_list.py
@@ -32,9 +32,16 @@ def run_sample():
     list_account_user_links(account_id)
 
 
-def list_account_user_links(account_id):
-    """Lists user links under the specified parent account."""
-    client = AnalyticsAdminServiceClient()
+def list_account_user_links(account_id: str, transport: str = None):
+    """
+    Lists user links under the specified parent account.
+
+    Args:
+        account_id(str): The id of the account.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     results = client.list_user_links(parent=f"accounts/{account_id}")
 
     print("Result:")
diff --git a/google-analytics-admin/accounts_user_links_list_test.py b/google-analytics-admin/accounts_user_links_list_test.py
index 6eb0806..0ae5730 100644
--- a/google-analytics-admin/accounts_user_links_list_test.py
+++ b/google-analytics-admin/accounts_user_links_list_test.py
@@ -20,6 +20,10 @@
 
 
 def test_accounts_user_links_list(capsys):
-    accounts_user_links_list.list_account_user_links(TEST_ACCOUNT_ID)
-    out, _ = capsys.readouterr()
-    assert "Result" in out
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        accounts_user_links_list.list_account_user_links(
+            TEST_ACCOUNT_ID, transport=transport
+        )
+        out, _ = capsys.readouterr()
+        assert "Result" in out
diff --git a/google-analytics-admin/accounts_user_links_update.py b/google-analytics-admin/accounts_user_links_update.py
index 868403f..dcb16fb 100644
--- a/google-analytics-admin/accounts_user_links_update.py
+++ b/google-analytics-admin/accounts_user_links_update.py
@@ -44,9 +44,19 @@ def run_sample():
     update_account_user_link(account_id, account_user_link_id)
 
 
-def update_account_user_link(account_id, account_user_link_id):
-    """Updates the account user link."""
-    client = AnalyticsAdminServiceClient()
+def update_account_user_link(
+    account_id: str, account_user_link_id: str, transport: str = None
+):
+    """
+    Updates the account user link.
+
+    Args:
+        account_id(str): The Google Analytics Account ID.
+        account_user_link_id(str): Google Analytics account user link ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     # This call updates the email address and direct roles of the user link.
     # The user link to update is specified in the `name` field of the `UserLink`
     # instance.
diff --git a/google-analytics-admin/accounts_user_links_update_test.py b/google-analytics-admin/accounts_user_links_update_test.py
index 52ac425..0083ad5 100644
--- a/google-analytics-admin/accounts_user_links_update_test.py
+++ b/google-analytics-admin/accounts_user_links_update_test.py
@@ -21,9 +21,11 @@
 
 
 def test_accounts_user_links_update():
-    # This test ensures that the call is valid and reaches the server, even
-    # though the operation does not succeed due to permission error.
-    with pytest.raises(Exception, match="403 The caller does not have permission"):
-        accounts_user_links_update.update_account_user_link(
-            FAKE_ACCOUNT_ID, FAKE_ACCOUNT_USER_LINK_ID
-        )
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        # This test ensures that the call is valid and reaches the server, even
+        # though the operation does not succeed due to permission error.
+        with pytest.raises(Exception, match="The caller does not have permission"):
+            accounts_user_links_update.update_account_user_link(
+                FAKE_ACCOUNT_ID, FAKE_ACCOUNT_USER_LINK_ID, transport=transport
+            )
diff --git a/google-analytics-admin/noxfile_config_test.py b/google-analytics-admin/noxfile_config_test.py
deleted file mode 100644
index e69de29..0000000
diff --git a/google-analytics-admin/properties_conversion_events_create.py b/google-analytics-admin/properties_conversion_events_create.py
index 4c00dd1..528ae83 100644
--- a/google-analytics-admin/properties_conversion_events_create.py
+++ b/google-analytics-admin/properties_conversion_events_create.py
@@ -40,9 +40,16 @@ def run_sample():
     create_conversion_event(property_id)
 
 
-def create_conversion_event(property_id):
-    """Creates a conversion event for the Google Analytics 4 property."""
-    client = AnalyticsAdminServiceClient()
+def create_conversion_event(property_id: str, transport: str = None):
+    """
+    Creates a conversion event for the Google Analytics 4 property.
+
+    Args:
+        property_id(str): The Google Analytics Property ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     conversion_event = client.create_conversion_event(
         parent=f"properties/{property_id}",
         conversion_event=ConversionEvent(event_name="test_purchase"),
diff --git a/google-analytics-admin/properties_conversion_events_create_test.py b/google-analytics-admin/properties_conversion_events_create_test.py
index 7e2c1ad..5012bdc 100644
--- a/google-analytics-admin/properties_conversion_events_create_test.py
+++ b/google-analytics-admin/properties_conversion_events_create_test.py
@@ -20,7 +20,11 @@
 
 
 def test_properties_conversion_events_create():
-    # This test ensures that the call is valid and reaches the server, even
-    # though the operation does not succeed due to permission error.
-    with pytest.raises(Exception, match="403 The caller does not have permission"):
-        properties_conversion_events_create.create_conversion_event(FAKE_PROPERTY_ID)
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        # This test ensures that the call is valid and reaches the server, even
+        # though the operation does not succeed due to permission error.
+        with pytest.raises(Exception, match="The caller does not have permission"):
+            properties_conversion_events_create.create_conversion_event(
+                FAKE_PROPERTY_ID, transport=transport
+            )
diff --git a/google-analytics-admin/properties_conversion_events_delete.py b/google-analytics-admin/properties_conversion_events_delete.py
index 19d2fc3..da46342 100644
--- a/google-analytics-admin/properties_conversion_events_delete.py
+++ b/google-analytics-admin/properties_conversion_events_delete.py
@@ -44,9 +44,19 @@ def run_sample():
     delete_conversion_event(property_id, conversion_event_id)
 
 
-def delete_conversion_event(property_id, conversion_event_id):
-    """Deletes the conversion event for the Google Analytics 4 property."""
-    client = AnalyticsAdminServiceClient()
+def delete_conversion_event(
+    property_id: str, conversion_event_id: str, transport: str = None
+):
+    """
+    Deletes the conversion event for the Google Analytics 4 property.
+
+    Args:
+        property_id(str): The Google Analytics Property ID.
+        conversion_event_id(str): The conversion event ID
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     client.delete_conversion_event(
         name=f"properties/{property_id}/conversionEvents/{conversion_event_id}"
     )
diff --git a/google-analytics-admin/properties_conversion_events_delete_test.py b/google-analytics-admin/properties_conversion_events_delete_test.py
index ba42e4e..2a85c81 100644
--- a/google-analytics-admin/properties_conversion_events_delete_test.py
+++ b/google-analytics-admin/properties_conversion_events_delete_test.py
@@ -21,9 +21,11 @@
 
 
 def test_properties_conversion_events_delete():
-    # This test ensures that the call is valid and reaches the server, even
-    # though the operation does not succeed due to permission error.
-    with pytest.raises(Exception, match="403 The caller does not have permission"):
-        properties_conversion_events_delete.delete_conversion_event(
-            FAKE_PROPERTY_ID, FAKE_CONVERSION_EVENT_ID
-        )
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        # This test ensures that the call is valid and reaches the server, even
+        # though the operation does not succeed due to permission error.
+        with pytest.raises(Exception, match="The caller does not have permission"):
+            properties_conversion_events_delete.delete_conversion_event(
+                FAKE_PROPERTY_ID, FAKE_CONVERSION_EVENT_ID, transport=transport
+            )
diff --git a/google-analytics-admin/properties_conversion_events_get.py b/google-analytics-admin/properties_conversion_events_get.py
index 0c74a39..6a8a435 100644
--- a/google-analytics-admin/properties_conversion_events_get.py
+++ b/google-analytics-admin/properties_conversion_events_get.py
@@ -37,9 +37,18 @@ def run_sample():
     get_conversion_event(property_id, conversion_event_id)
 
 
-def get_conversion_event(property_id, conversion_event_id):
-    """Retrieves the details for the conversion event."""
-    client = AnalyticsAdminServiceClient()
+def get_conversion_event(
+    property_id: str, conversion_event_id: str, transport: str = None
+):
+    """
+    Retrieves the details for the conversion event.
+    Args:
+        property_id(str): The Google Analytics Property ID.
+        conversion_event_id(str): The conversion event ID
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     conversion_event = client.get_conversion_event(
         name=f"properties/{property_id}/conversionEvents/{conversion_event_id}"
     )
diff --git a/google-analytics-admin/properties_conversion_events_get_test.py b/google-analytics-admin/properties_conversion_events_get_test.py
index 5faac8d..719c95d 100644
--- a/google-analytics-admin/properties_conversion_events_get_test.py
+++ b/google-analytics-admin/properties_conversion_events_get_test.py
@@ -21,8 +21,10 @@
 
 
 def test_properties_conversion_events_get(capsys):
-    properties_conversion_events_get.get_conversion_event(
-        TEST_PROPERTY_ID, TEST_CONVERSION_EVENT_ID
-    )
-    out, _ = capsys.readouterr()
-    assert "Result" in out
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        properties_conversion_events_get.get_conversion_event(
+            TEST_PROPERTY_ID, TEST_CONVERSION_EVENT_ID, transport=transport
+        )
+        out, _ = capsys.readouterr()
+        assert "Result" in out
diff --git a/google-analytics-admin/properties_conversion_events_list.py b/google-analytics-admin/properties_conversion_events_list.py
index 71a82af..41c7a43 100644
--- a/google-analytics-admin/properties_conversion_events_list.py
+++ b/google-analytics-admin/properties_conversion_events_list.py
@@ -33,9 +33,16 @@ def run_sample():
     list_conversion_events(property_id)
 
 
-def list_conversion_events(property_id):
-    """Lists conversion events for the Google Analytics 4 property."""
-    client = AnalyticsAdminServiceClient()
+def list_conversion_events(property_id: str, transport: str = None):
+    """
+    Lists conversion events for the Google Analytics 4 property.
+
+    Args:
+        property_id(str): The Google Analytics Property ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     results = client.list_conversion_events(parent=f"properties/{property_id}")
 
     print("Result:")
diff --git a/google-analytics-admin/properties_conversion_events_list_test.py b/google-analytics-admin/properties_conversion_events_list_test.py
index e93405a..8687599 100644
--- a/google-analytics-admin/properties_conversion_events_list_test.py
+++ b/google-analytics-admin/properties_conversion_events_list_test.py
@@ -20,6 +20,10 @@
 
 
 def test_properties_conversion_events_list(capsys):
-    properties_conversion_events_list.list_conversion_events(TEST_PROPERTY_ID)
-    out, _ = capsys.readouterr()
-    assert "Result" in out
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        properties_conversion_events_list.list_conversion_events(
+            TEST_PROPERTY_ID, transport=transport
+        )
+        out, _ = capsys.readouterr()
+        assert "Result" in out
diff --git a/google-analytics-admin/properties_create.py b/google-analytics-admin/properties_create.py
index a7bbd79..4b5cf8b 100644
--- a/google-analytics-admin/properties_create.py
+++ b/google-analytics-admin/properties_create.py
@@ -39,9 +39,16 @@ def run_sample():
     create_property(account_id)
 
 
-def create_property(account_id):
-    """Creates a Google Analytics 4 property."""
-    client = AnalyticsAdminServiceClient()
+def create_property(account_id: str, transport: str = None):
+    """
+    Creates a Google Analytics 4 property.
+
+    Args:
+        account_id(str): The Google Analytics Account ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     property_ = client.create_property(
         property=Property(
             parent=f"accounts/{account_id}",
diff --git a/google-analytics-admin/properties_create_test.py b/google-analytics-admin/properties_create_test.py
index 276a052..e935ad3 100644
--- a/google-analytics-admin/properties_create_test.py
+++ b/google-analytics-admin/properties_create_test.py
@@ -20,7 +20,9 @@
 
 
 def test_properties_create():
-    # This test ensures that the call is valid and reaches the server, even
-    # though the operation does not succeed due to permission error.
-    with pytest.raises(Exception, match="403 The caller does not have permission"):
-        properties_create.create_property(FAKE_ACCOUNT_ID)
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        # This test ensures that the call is valid and reaches the server, even
+        # though the operation does not succeed due to permission error.
+        with pytest.raises(Exception, match="The caller does not have permission"):
+            properties_create.create_property(FAKE_ACCOUNT_ID, transport=transport)
diff --git a/google-analytics-admin/properties_data_streams_create.py b/google-analytics-admin/properties_data_streams_create.py
index 1679e5d..a819447 100644
--- a/google-analytics-admin/properties_data_streams_create.py
+++ b/google-analytics-admin/properties_data_streams_create.py
@@ -39,9 +39,16 @@ def run_sample():
     create_data_stream(property_id)
 
 
-def create_data_stream(property_id):
-    """Creates a data stream for the Google Analytics 4 property."""
-    client = AnalyticsAdminServiceClient()
+def create_data_stream(property_id: str, transport: str = None):
+    """
+    Creates a data stream for the Google Analytics 4 property.
+
+    Args:
+        property_id(str): The Google Analytics Property ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     data_stream = DataStream(
         display_name="Test web data stream",
         web_stream_data=DataStream.WebStreamData(default_uri="https://www.google.com"),
diff --git a/google-analytics-admin/properties_data_streams_create_test.py b/google-analytics-admin/properties_data_streams_create_test.py
index 2ba1de7..b6f7d69 100644
--- a/google-analytics-admin/properties_data_streams_create_test.py
+++ b/google-analytics-admin/properties_data_streams_create_test.py
@@ -20,7 +20,11 @@
 
 
 def test_properties_data_streams_create():
-    # This test ensures that the call is valid and reaches the server, even
-    # though the operation does not succeed due to permission error.
-    with pytest.raises(Exception, match="403 The caller does not have permission"):
-        properties_data_streams_create.create_data_stream(FAKE_PROPERTY_ID)
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        # This test ensures that the call is valid and reaches the server, even
+        # though the operation does not succeed due to permission error.
+        with pytest.raises(Exception, match="The caller does not have permission"):
+            properties_data_streams_create.create_data_stream(
+                FAKE_PROPERTY_ID, transport=transport
+            )
diff --git a/google-analytics-admin/properties_data_streams_delete.py b/google-analytics-admin/properties_data_streams_delete.py
index 18d1749..7fe37fa 100644
--- a/google-analytics-admin/properties_data_streams_delete.py
+++ b/google-analytics-admin/properties_data_streams_delete.py
@@ -43,9 +43,17 @@ def run_sample():
     delete_data_stream(property_id, stream_id)
 
 
-def delete_data_stream(property_id, stream_id):
-    """Deletes the data stream from the Google Analytics 4 property."""
-    client = AnalyticsAdminServiceClient()
+def delete_data_stream(property_id: str, stream_id: str, transport: str = None):
+    """
+    Deletes the data stream from the Google Analytics 4 property.
+
+    Args:
+        property_id(str): The Google Analytics Property ID.
+        stream_id(str): The data stream ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     client.delete_data_stream(name=f"properties/{property_id}/dataStreams/{stream_id}")
     print("Data stream deleted")
 
diff --git a/google-analytics-admin/properties_data_streams_delete_test.py b/google-analytics-admin/properties_data_streams_delete_test.py
index 58c846e..75ec1a8 100644
--- a/google-analytics-admin/properties_data_streams_delete_test.py
+++ b/google-analytics-admin/properties_data_streams_delete_test.py
@@ -21,9 +21,11 @@
 
 
 def test_properties_data_streams_delete():
-    # This test ensures that the call is valid and reaches the server, even
-    # though the operation does not succeed due to permission error.
-    with pytest.raises(Exception, match="403 The caller does not have permission"):
-        properties_data_streams_delete.delete_data_stream(
-            FAKE_PROPERTY_ID, FAKE_STREAM_ID
-        )
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        # This test ensures that the call is valid and reaches the server, even
+        # though the operation does not succeed due to permission error.
+        with pytest.raises(Exception, match="The caller does not have permission"):
+            properties_data_streams_delete.delete_data_stream(
+                FAKE_PROPERTY_ID, FAKE_STREAM_ID, transport=transport
+            )
diff --git a/google-analytics-admin/properties_data_streams_get.py b/google-analytics-admin/properties_data_streams_get.py
index 6d53d46..789fb19 100644
--- a/google-analytics-admin/properties_data_streams_get.py
+++ b/google-analytics-admin/properties_data_streams_get.py
@@ -37,9 +37,17 @@ def run_sample():
     get_data_stream(property_id, stream_id)
 
 
-def get_data_stream(property_id, stream_id):
-    """Retrieves the details for the data stream."""
-    client = AnalyticsAdminServiceClient()
+def get_data_stream(property_id: str, stream_id: str, transport: str = None):
+    """
+    Retrieves the details for the data stream.
+
+    Args:
+        property_id(str): The Google Analytics Property ID.
+        stream_id(str): The data stream ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     data_stream = client.get_data_stream(
         name=f"properties/{property_id}/dataStreams/{stream_id}"
     )
diff --git a/google-analytics-admin/properties_data_streams_get_global_site_tag.py b/google-analytics-admin/properties_data_streams_get_global_site_tag.py
index 0d26970..9bffcaa 100644
--- a/google-analytics-admin/properties_data_streams_get_global_site_tag.py
+++ b/google-analytics-admin/properties_data_streams_get_global_site_tag.py
@@ -34,9 +34,17 @@ def run_sample():
     get_global_site_tag(property_id, stream_id)
 
 
-def get_global_site_tag(property_id, stream_id):
-    """Retrieves the Site Tag for the specified data stream."""
-    client = AnalyticsAdminServiceClient()
+def get_global_site_tag(property_id: str, stream_id: str, transport: str = None):
+    """
+    Retrieves the Site Tag for the specified data stream.
+
+    Args:
+        property_id(str): The Google Analytics Property ID.
+        stream_id(str): The data stream ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     global_site_tag = client.get_global_site_tag(
         name=f"properties/{property_id}/dataStreams/{stream_id}/globalSiteTag"
     )
diff --git a/google-analytics-admin/properties_data_streams_get_global_site_tag_test.py b/google-analytics-admin/properties_data_streams_get_global_site_tag_test.py
index b877dad..05d4b36 100644
--- a/google-analytics-admin/properties_data_streams_get_global_site_tag_test.py
+++ b/google-analytics-admin/properties_data_streams_get_global_site_tag_test.py
@@ -21,8 +21,10 @@
 
 
 def test_properties_data_streams_get_global_site_tag(capsys):
-    properties_data_streams_get_global_site_tag.get_global_site_tag(
-        TEST_PROPERTY_ID, TEST_DATA_STREAM_ID
-    )
-    out, _ = capsys.readouterr()
-    assert "Result" in out
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        properties_data_streams_get_global_site_tag.get_global_site_tag(
+            TEST_PROPERTY_ID, TEST_DATA_STREAM_ID, transport=transport
+        )
+        out, _ = capsys.readouterr()
+        assert "Result" in out
diff --git a/google-analytics-admin/properties_data_streams_get_test.py b/google-analytics-admin/properties_data_streams_get_test.py
index 695ece1..c56e696 100644
--- a/google-analytics-admin/properties_data_streams_get_test.py
+++ b/google-analytics-admin/properties_data_streams_get_test.py
@@ -21,6 +21,10 @@
 
 
 def test_properties_data_streams_get(capsys):
-    properties_data_streams_get.get_data_stream(TEST_PROPERTY_ID, TEST_DATA_STREAM_ID)
-    out, _ = capsys.readouterr()
-    assert "Result" in out
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        properties_data_streams_get.get_data_stream(
+            TEST_PROPERTY_ID, TEST_DATA_STREAM_ID, transport=transport
+        )
+        out, _ = capsys.readouterr()
+        assert "Result" in out
diff --git a/google-analytics-admin/properties_data_streams_list.py b/google-analytics-admin/properties_data_streams_list.py
index 73a9bd2..18c64ff 100644
--- a/google-analytics-admin/properties_data_streams_list.py
+++ b/google-analytics-admin/properties_data_streams_list.py
@@ -33,9 +33,16 @@ def run_sample():
     list_data_streams(property_id)
 
 
-def list_data_streams(property_id):
-    """Lists data streams for the Google Analytics 4 property."""
-    client = AnalyticsAdminServiceClient()
+def list_data_streams(property_id: str, transport: str = None):
+    """
+    Lists data streams for the Google Analytics 4 property.
+
+    Args:
+        property_id(str): The Google Analytics Property ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     results = client.list_data_streams(parent=f"properties/{property_id}")
 
     print("Result:")
diff --git a/google-analytics-admin/properties_data_streams_list_test.py b/google-analytics-admin/properties_data_streams_list_test.py
index fb8594e..b988595 100644
--- a/google-analytics-admin/properties_data_streams_list_test.py
+++ b/google-analytics-admin/properties_data_streams_list_test.py
@@ -20,6 +20,10 @@
 
 
 def test_properties_data_streams_list(capsys):
-    properties_data_streams_list.list_data_streams(TEST_PROPERTY_ID)
-    out, _ = capsys.readouterr()
-    assert "Result" in out
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        properties_data_streams_list.list_data_streams(
+            TEST_PROPERTY_ID, transport=transport
+        )
+        out, _ = capsys.readouterr()
+        assert "Result" in out
diff --git a/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_create.py b/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_create.py
index c7b8717..a7926d7 100644
--- a/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_create.py
+++ b/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_create.py
@@ -42,9 +42,19 @@ def run_sample():
     create_measurement_protocol_secret(property_id, stream_id)
 
 
-def create_measurement_protocol_secret(property_id, stream_id):
-    """Creates a measurement protocol secret for the data stream."""
-    client = AnalyticsAdminServiceClient()
+def create_measurement_protocol_secret(
+    property_id: str, stream_id: str, transport: str = None
+):
+    """
+    Creates a measurement protocol secret for the data stream.
+
+    Args:
+        property_id(str): The Google Analytics Property ID.
+        stream_id(str): The data stream ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     measurement_protocol_secret = client.create_measurement_protocol_secret(
         parent=f"properties/{property_id}/dataStreams/{stream_id}",
         measurement_protocol_secret=MeasurementProtocolSecret(
diff --git a/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_create_test.py b/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_create_test.py
index d792d3e..298d0dc 100644
--- a/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_create_test.py
+++ b/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_create_test.py
@@ -21,9 +21,11 @@
 
 
 def test_properties_data_streams_measurement_protocol_secrets_create():
-    # This test ensures that the call is valid and reaches the server, even
-    # though the operation does not succeed due to permission error.
-    with pytest.raises(Exception, match="403 The caller does not have permission"):
-        properties_data_streams_measurement_protocol_secrets_create.create_measurement_protocol_secret(
-            FAKE_PROPERTY_ID, FAKE_STREAM_ID
-        )
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        # This test ensures that the call is valid and reaches the server, even
+        # though the operation does not succeed due to permission error.
+        with pytest.raises(Exception, match="The caller does not have permission"):
+            properties_data_streams_measurement_protocol_secrets_create.create_measurement_protocol_secret(
+                FAKE_PROPERTY_ID, FAKE_STREAM_ID, transport=transport
+            )
diff --git a/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_delete.py b/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_delete.py
index a398c35..81b1918 100644
--- a/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_delete.py
+++ b/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_delete.py
@@ -45,9 +45,20 @@ def run_sample():
     delete_measurement_protocol_secret(property_id, stream_id, secret_id)
 
 
-def delete_measurement_protocol_secret(property_id, stream_id, secret_id):
-    """Deletes a measurement protocol secret for the data stream."""
-    client = AnalyticsAdminServiceClient()
+def delete_measurement_protocol_secret(
+    property_id: str, stream_id: str, secret_id: str, transport: str = None
+):
+    """
+    Deletes a measurement protocol secret for the data stream.
+
+    Args:
+        property_id(str): The Google Analytics Property ID.
+        stream_id(str): The data stream ID.
+        secret_id(str): The measurement protocol secret ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     client.delete_measurement_protocol_secret(
         name=f"properties/{property_id}/dataStreams/{stream_id}/measurementProtocolSecrets/{secret_id}"
     )
diff --git a/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_delete_test.py b/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_delete_test.py
index d5dce84..d892c89 100644
--- a/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_delete_test.py
+++ b/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_delete_test.py
@@ -22,9 +22,11 @@
 
 
 def test_properties_data_streams_measurement_protocol_secrets_delete():
-    # This test ensures that the call is valid and reaches the server, even
-    # though the operation does not succeed due to permission error.
-    with pytest.raises(Exception, match="403 The caller does not have permission"):
-        properties_data_streams_measurement_protocol_secrets_delete.delete_measurement_protocol_secret(
-            FAKE_PROPERTY_ID, FAKE_STREAM_ID, FAKE_SECRET_ID
-        )
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        # This test ensures that the call is valid and reaches the server, even
+        # though the operation does not succeed due to permission error.
+        with pytest.raises(Exception, match="The caller does not have permission"):
+            properties_data_streams_measurement_protocol_secrets_delete.delete_measurement_protocol_secret(
+                FAKE_PROPERTY_ID, FAKE_STREAM_ID, FAKE_SECRET_ID, transport=transport
+            )
diff --git a/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_get.py b/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_get.py
index 2df88aa..15720f8 100644
--- a/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_get.py
+++ b/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_get.py
@@ -41,9 +41,20 @@ def run_sample():
     get_measurement_protocol_secret(property_id, stream_id, secret_id)
 
 
-def get_measurement_protocol_secret(property_id, stream_id, secret_id):
-    """Retrieves the details for the measurement protocol secret."""
-    client = AnalyticsAdminServiceClient()
+def get_measurement_protocol_secret(
+    property_id: str, stream_id: str, secret_id: str, transport: str = None
+):
+    """
+    Retrieves the details for the measurement protocol secret.
+
+    Args:
+        property_id(str): The Google Analytics Property ID.
+        stream_id(str): The data stream ID.
+        secret_id(str): The measurement protocol secret ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     measurement_protocol_secret = client.get_measurement_protocol_secret(
         name=f"properties/{property_id}/dataStreams/{stream_id}/measurementProtocolSecrets/{secret_id}"
     )
diff --git a/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_get_test.py b/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_get_test.py
index 8d280e6..1e55aba 100644
--- a/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_get_test.py
+++ b/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_get_test.py
@@ -22,8 +22,10 @@
 
 
 def test_properties_data_streams_measurement_protocol_secrets_get(capsys):
-    properties_data_streams_measurement_protocol_secrets_get.get_measurement_protocol_secret(
-        TEST_PROPERTY_ID, TEST_STREAM_ID, TEST_SECRET_ID
-    )
-    out, _ = capsys.readouterr()
-    assert "Result" in out
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        properties_data_streams_measurement_protocol_secrets_get.get_measurement_protocol_secret(
+            TEST_PROPERTY_ID, TEST_STREAM_ID, TEST_SECRET_ID, transport=transport
+        )
+        out, _ = capsys.readouterr()
+        assert "Result" in out
diff --git a/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_list.py b/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_list.py
index 5abdc93..beeea20 100644
--- a/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_list.py
+++ b/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_list.py
@@ -34,9 +34,19 @@ def run_sample():
     list_measurement_protocol_secrets(property_id, stream_id)
 
 
-def list_measurement_protocol_secrets(property_id, stream_id):
-    """Lists measurement protocol secrets for the data stream."""
-    client = AnalyticsAdminServiceClient()
+def list_measurement_protocol_secrets(
+    property_id: str, stream_id: str, transport: str = None
+):
+    """
+    Lists measurement protocol secrets for the data stream.
+
+    Args:
+        property_id(str): The Google Analytics Property ID.
+        stream_id(str): The data stream ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     results = client.list_measurement_protocol_secrets(
         parent=f"properties/{property_id}/dataStreams/{stream_id}"
     )
diff --git a/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_list_test.py b/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_list_test.py
index f686768..7b0238f 100644
--- a/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_list_test.py
+++ b/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_list_test.py
@@ -21,8 +21,10 @@
 
 
 def test_properties_data_streams_measurement_protocol_secrets_list(capsys):
-    properties_data_streams_measurement_protocol_secrets_list.list_measurement_protocol_secrets(
-        TEST_PROPERTY_ID, TEST_DATA_STREAM_ID
-    )
-    out, _ = capsys.readouterr()
-    assert "Result" in out
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        properties_data_streams_measurement_protocol_secrets_list.list_measurement_protocol_secrets(
+            TEST_PROPERTY_ID, TEST_DATA_STREAM_ID, transport=transport
+        )
+        out, _ = capsys.readouterr()
+        assert "Result" in out
diff --git a/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_update.py b/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_update.py
index 0db2dcd..b37335d 100644
--- a/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_update.py
+++ b/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_update.py
@@ -47,9 +47,20 @@ def run_sample():
     update_measurement_protocol_secret(property_id, stream_id, secret_id)
 
 
-def update_measurement_protocol_secret(property_id, stream_id, secret_id):
-    """Updates the measurement protocol secret."""
-    client = AnalyticsAdminServiceClient()
+def update_measurement_protocol_secret(
+    property_id: str, stream_id: str, secret_id: str, transport: str = None
+):
+    """
+    Updates the measurement protocol secret.
+
+    Args:
+        property_id(str): The Google Analytics Property ID.
+        stream_id(str): The data stream ID.
+        secret_id(str): The measurement protocol secret ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     # This call updates the display name of the measurement protocol secret, as
     # indicated by the value of the `update_mask` field. The measurement
     # protocol secret to update is specified in the `name` field of the
diff --git a/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_update_test.py b/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_update_test.py
index 697e794..5a6455c 100644
--- a/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_update_test.py
+++ b/google-analytics-admin/properties_data_streams_measurement_protocol_secrets_update_test.py
@@ -22,9 +22,11 @@
 
 
 def test_properties_data_streams_measurement_protocol_secrets_update():
-    # This test ensures that the call is valid and reaches the server, even
-    # though the operation does not succeed due to permission error.
-    with pytest.raises(Exception, match="403 The caller does not have permission"):
-        properties_data_streams_measurement_protocol_secrets_update.update_measurement_protocol_secret(
-            FAKE_PROPERTY_ID, FAKE_STREAM_ID, FAKE_SECRET_ID
-        )
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        # This test ensures that the call is valid and reaches the server, even
+        # though the operation does not succeed due to permission error.
+        with pytest.raises(Exception, match="The caller does not have permission"):
+            properties_data_streams_measurement_protocol_secrets_update.update_measurement_protocol_secret(
+                FAKE_PROPERTY_ID, FAKE_STREAM_ID, FAKE_SECRET_ID, transport=transport
+            )
diff --git a/google-analytics-admin/properties_data_streams_update.py b/google-analytics-admin/properties_data_streams_update.py
index b573fa1..e3de375 100644
--- a/google-analytics-admin/properties_data_streams_update.py
+++ b/google-analytics-admin/properties_data_streams_update.py
@@ -45,9 +45,17 @@ def run_sample():
     update_data_stream(property_id, stream_id)
 
 
-def update_data_stream(property_id, stream_id):
-    """Updates the data stream."""
-    client = AnalyticsAdminServiceClient()
+def update_data_stream(property_id: str, stream_id: str, transport: str = None):
+    """
+    Updates the data stream.
+
+    Args:
+        property_id(str): The Google Analytics Property ID.
+        stream_id(str): The data stream ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     # This call updates the display name of the data stream, as indicated by
     # the value of the `update_mask` field. The data stream to update is
     # specified in the `name` field of the `dataStream` instance.
diff --git a/google-analytics-admin/properties_data_streams_update_test.py b/google-analytics-admin/properties_data_streams_update_test.py
index 2509bcf..0cae934 100644
--- a/google-analytics-admin/properties_data_streams_update_test.py
+++ b/google-analytics-admin/properties_data_streams_update_test.py
@@ -21,9 +21,11 @@
 
 
 def test_properties_data_streams_update():
-    # This test ensures that the call is valid and reaches the server, even
-    # though the operation does not succeed due to permission error.
-    with pytest.raises(Exception, match="403 The caller does not have permission"):
-        properties_data_streams_update.update_data_stream(
-            FAKE_PROPERTY_ID, FAKE_STREAM_ID
-        )
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        # This test ensures that the call is valid and reaches the server, even
+        # though the operation does not succeed due to permission error.
+        with pytest.raises(Exception, match="The caller does not have permission"):
+            properties_data_streams_update.update_data_stream(
+                FAKE_PROPERTY_ID, FAKE_STREAM_ID, transport=transport
+            )
diff --git a/google-analytics-admin/properties_delete.py b/google-analytics-admin/properties_delete.py
index e6defc6..2e05f3c 100644
--- a/google-analytics-admin/properties_delete.py
+++ b/google-analytics-admin/properties_delete.py
@@ -38,9 +38,16 @@ def run_sample():
     delete_property(property_id)
 
 
-def delete_property(property_id):
-    """Deletes the Google Analytics 4 property."""
-    client = AnalyticsAdminServiceClient()
+def delete_property(property_id: str, transport: str = None):
+    """
+    Deletes the Google Analytics 4 property.
+
+    Args:
+        property_id(str): The Google Analytics Property ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     client.delete_property(name=f"properties/{property_id}")
     print("Property deleted")
 
diff --git a/google-analytics-admin/properties_delete_test.py b/google-analytics-admin/properties_delete_test.py
index 307d935..7b929ea 100644
--- a/google-analytics-admin/properties_delete_test.py
+++ b/google-analytics-admin/properties_delete_test.py
@@ -20,7 +20,9 @@
 
 
 def test_properties_delete():
-    # This test ensures that the call is valid and reaches the server, even
-    # though the operation does not succeed due to permission error.
-    with pytest.raises(Exception, match="403 The caller does not have permission"):
-        properties_delete.delete_property(FAKE_PROPERTY_ID)
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        # This test ensures that the call is valid and reaches the server, even
+        # though the operation does not succeed due to permission error.
+        with pytest.raises(Exception, match="The caller does not have permission"):
+            properties_delete.delete_property(FAKE_PROPERTY_ID, transport=transport)
diff --git a/google-analytics-admin/properties_firebase_links_create.py b/google-analytics-admin/properties_firebase_links_create.py
index 843179e..34ea83a 100644
--- a/google-analytics-admin/properties_firebase_links_create.py
+++ b/google-analytics-admin/properties_firebase_links_create.py
@@ -44,9 +44,19 @@ def run_sample():
     create_firebase_link(property_id, firebase_project_id)
 
 
-def create_firebase_link(property_id, firebase_project_id):
-    """Creates a Firebase link for the Google Analytics 4 property."""
-    client = AnalyticsAdminServiceClient()
+def create_firebase_link(
+    property_id: str, firebase_project_id: str, transport: str = None
+):
+    """
+    Creates a Firebase link for the Google Analytics 4 property.
+
+    Args:
+        property_id(str): The Google Analytics Property ID.
+        firebase_project_id: Firebase project ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     firebase_link = client.create_firebase_link(
         parent=f"properties/{property_id}",
         firebase_link=FirebaseLink(project=f"projects/{firebase_project_id}"),
diff --git a/google-analytics-admin/properties_firebase_links_create_test.py b/google-analytics-admin/properties_firebase_links_create_test.py
index 0f57951..d19702a 100644
--- a/google-analytics-admin/properties_firebase_links_create_test.py
+++ b/google-analytics-admin/properties_firebase_links_create_test.py
@@ -21,9 +21,11 @@
 
 
 def test_properties_firebase_links_create():
-    # This test ensures that the call is valid and reaches the server, even
-    # though the operation does not succeed due to permission error.
-    with pytest.raises(Exception, match="403 The caller does not have permission"):
-        properties_firebase_links_create.create_firebase_link(
-            FAKE_PROPERTY_ID, FAKE_FIREBASE_PROJECT_ID
-        )
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        # This test ensures that the call is valid and reaches the server, even
+        # though the operation does not succeed due to permission error.
+        with pytest.raises(Exception, match="The caller does not have permission"):
+            properties_firebase_links_create.create_firebase_link(
+                FAKE_PROPERTY_ID, FAKE_FIREBASE_PROJECT_ID, transport=transport
+            )
diff --git a/google-analytics-admin/properties_firebase_links_delete.py b/google-analytics-admin/properties_firebase_links_delete.py
index 9ef1edd..a6a76f7 100644
--- a/google-analytics-admin/properties_firebase_links_delete.py
+++ b/google-analytics-admin/properties_firebase_links_delete.py
@@ -43,9 +43,19 @@ def run_sample():
     delete_firebase_link(property_id, firebase_link_id)
 
 
-def delete_firebase_link(property_id, firebase_link_id):
-    """Deletes the Firebase link."""
-    client = AnalyticsAdminServiceClient()
+def delete_firebase_link(
+    property_id: str, firebase_link_id: str, transport: str = None
+):
+    """
+    Deletes the Firebase link.
+
+    Args:
+        property_id(str): The Google Analytics Property ID.
+        firebase_link_id: The Firebase link ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     client.delete_firebase_link(
         name=f"properties/{property_id}/firebaseLinks/{firebase_link_id}"
     )
diff --git a/google-analytics-admin/properties_firebase_links_delete_test.py b/google-analytics-admin/properties_firebase_links_delete_test.py
index 1efcfd2..c8b1db3 100644
--- a/google-analytics-admin/properties_firebase_links_delete_test.py
+++ b/google-analytics-admin/properties_firebase_links_delete_test.py
@@ -21,9 +21,11 @@
 
 
 def test_properties_firebase_links_delete():
-    # This test ensures that the call is valid and reaches the server, even
-    # though the operation does not succeed due to permission error.
-    with pytest.raises(Exception, match="403 The caller does not have permission"):
-        properties_firebase_links_delete.delete_firebase_link(
-            FAKE_PROPERTY_ID, FAKE_FIREBASE_LINK_ID
-        )
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        # This test ensures that the call is valid and reaches the server, even
+        # though the operation does not succeed due to permission error.
+        with pytest.raises(Exception, match="The caller does not have permission"):
+            properties_firebase_links_delete.delete_firebase_link(
+                FAKE_PROPERTY_ID, FAKE_FIREBASE_LINK_ID, transport=transport
+            )
diff --git a/google-analytics-admin/properties_firebase_links_list.py b/google-analytics-admin/properties_firebase_links_list.py
index 560363c..6c27b75 100644
--- a/google-analytics-admin/properties_firebase_links_list.py
+++ b/google-analytics-admin/properties_firebase_links_list.py
@@ -32,10 +32,17 @@ def run_sample():
     list_firebase_links(property_id)
 
 
-def list_firebase_links(property_id):
-    """Lists Firebase links under the specified parent Google Analytics 4
-    property."""
-    client = AnalyticsAdminServiceClient()
+def list_firebase_links(property_id: str, transport: str = None):
+    """
+    Lists Firebase links under the specified parent Google Analytics 4
+    property.
+
+    Args:
+        property_id(str): The Google Analytics Property ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     results = client.list_firebase_links(parent=f"properties/{property_id}")
 
     print("Result:")
diff --git a/google-analytics-admin/properties_firebase_links_list_test.py b/google-analytics-admin/properties_firebase_links_list_test.py
index b3e1f0a..936bd62 100644
--- a/google-analytics-admin/properties_firebase_links_list_test.py
+++ b/google-analytics-admin/properties_firebase_links_list_test.py
@@ -20,6 +20,10 @@
 
 
 def test_properties_firebase_links_list(capsys):
-    properties_firebase_links_list.list_firebase_links(TEST_PROPERTY_ID)
-    out, _ = capsys.readouterr()
-    assert "Result" in out
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        properties_firebase_links_list.list_firebase_links(
+            TEST_PROPERTY_ID, transport=transport
+        )
+        out, _ = capsys.readouterr()
+        assert "Result" in out
diff --git a/google-analytics-admin/properties_get.py b/google-analytics-admin/properties_get.py
index e63ec3a..ccbee42 100644
--- a/google-analytics-admin/properties_get.py
+++ b/google-analytics-admin/properties_get.py
@@ -33,9 +33,16 @@ def run_sample():
     get_property(property_id)
 
 
-def get_property(property_id):
-    """Retrieves the Google Analytics 4 property details."""
-    client = AnalyticsAdminServiceClient()
+def get_property(property_id: str, transport: str = None):
+    """
+    Retrieves the Google Analytics 4 property details.
+
+    Args:
+        property_id(str): The Google Analytics Property ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     property_ = client.get_property(name=f"properties/{property_id}")
 
     print("Result:")
diff --git a/google-analytics-admin/properties_get_test.py b/google-analytics-admin/properties_get_test.py
index 9035055..db07183 100644
--- a/google-analytics-admin/properties_get_test.py
+++ b/google-analytics-admin/properties_get_test.py
@@ -21,6 +21,8 @@
 
 
 def test_properties_get(capsys):
-    properties_get.get_property(TEST_PROPERTY_ID)
-    out, _ = capsys.readouterr()
-    assert "Result" in out
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        properties_get.get_property(TEST_PROPERTY_ID, transport=transport)
+        out, _ = capsys.readouterr()
+        assert "Result" in out
diff --git a/google-analytics-admin/properties_google_ads_links_create.py b/google-analytics-admin/properties_google_ads_links_create.py
index 443b151..9abf575 100644
--- a/google-analytics-admin/properties_google_ads_links_create.py
+++ b/google-analytics-admin/properties_google_ads_links_create.py
@@ -45,9 +45,19 @@ def run_sample():
     create_google_ads_link(property_id, google_ads_customer_id)
 
 
-def create_google_ads_link(property_id, google_ads_customer_id):
-    """Creates a Google Ads link for the Google Analytics 4 property."""
-    client = AnalyticsAdminServiceClient()
+def create_google_ads_link(
+    property_id: str, google_ads_customer_id: str, transport: str = None
+):
+    """
+    Creates a Google Ads link for the Google Analytics 4 property.
+
+    Args:
+        property_id(str): The Google Analytics Property ID.
+        google_ads_customer_id(str): The Google Analytics Ads Customer Id.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     google_ads_link = client.create_google_ads_link(
         parent=f"properties/{property_id}",
         google_ads_link=GoogleAdsLink(customer_id=f"{google_ads_customer_id}"),
diff --git a/google-analytics-admin/properties_google_ads_links_create_test.py b/google-analytics-admin/properties_google_ads_links_create_test.py
index e0e8d73..1e19e5c 100644
--- a/google-analytics-admin/properties_google_ads_links_create_test.py
+++ b/google-analytics-admin/properties_google_ads_links_create_test.py
@@ -21,9 +21,11 @@
 
 
 def test_properties_google_ads_links_create():
-    # This test ensures that the call is valid and reaches the server, even
-    # though the operation does not succeed due to permission error.
-    with pytest.raises(Exception, match="403 The caller does not have permission"):
-        properties_google_ads_links_create.create_google_ads_link(
-            FAKE_PROPERTY_ID, FAKE_ADS_CUSTOMER_ID
-        )
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        # This test ensures that the call is valid and reaches the server, even
+        # though the operation does not succeed due to permission error.
+        with pytest.raises(Exception, match="The caller does not have permission"):
+            properties_google_ads_links_create.create_google_ads_link(
+                FAKE_PROPERTY_ID, FAKE_ADS_CUSTOMER_ID, transport=transport
+            )
diff --git a/google-analytics-admin/properties_google_ads_links_delete.py b/google-analytics-admin/properties_google_ads_links_delete.py
index 74dd3ba..b3451c1 100644
--- a/google-analytics-admin/properties_google_ads_links_delete.py
+++ b/google-analytics-admin/properties_google_ads_links_delete.py
@@ -43,9 +43,19 @@ def run_sample():
     delete_google_ads_link(property_id, google_ads_link_id)
 
 
-def delete_google_ads_link(property_id, google_ads_link_id):
-    """Deletes the Google Ads link."""
-    client = AnalyticsAdminServiceClient()
+def delete_google_ads_link(
+    property_id: str, google_ads_link_id: str, transport: str = None
+):
+    """
+    Deletes the Google Ads link.
+
+    Args:
+        property_id(str): The Google Analytics Property ID.
+        google_ads_link_id(str): The Google Analytics Ads Link Id.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     client.delete_google_ads_link(
         name=f"properties/{property_id}/googleAdsLinks/{google_ads_link_id}"
     )
diff --git a/google-analytics-admin/properties_google_ads_links_delete_test.py b/google-analytics-admin/properties_google_ads_links_delete_test.py
index fd64482..527e29b 100644
--- a/google-analytics-admin/properties_google_ads_links_delete_test.py
+++ b/google-analytics-admin/properties_google_ads_links_delete_test.py
@@ -21,9 +21,11 @@
 
 
 def test_properties_google_ads_links_delete():
-    # This test ensures that the call is valid and reaches the server, even
-    # though the operation does not succeed due to permission error.
-    with pytest.raises(Exception, match="403 The caller does not have permission"):
-        properties_google_ads_links_delete.delete_google_ads_link(
-            FAKE_PROPERTY_ID, FAKE_GOOGLE_ADS_LINK_ID
-        )
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        # This test ensures that the call is valid and reaches the server, even
+        # though the operation does not succeed due to permission error.
+        with pytest.raises(Exception, match="The caller does not have permission"):
+            properties_google_ads_links_delete.delete_google_ads_link(
+                FAKE_PROPERTY_ID, FAKE_GOOGLE_ADS_LINK_ID, transport=transport
+            )
diff --git a/google-analytics-admin/properties_google_ads_links_list.py b/google-analytics-admin/properties_google_ads_links_list.py
index 7109f1e..c23f041 100644
--- a/google-analytics-admin/properties_google_ads_links_list.py
+++ b/google-analytics-admin/properties_google_ads_links_list.py
@@ -32,10 +32,17 @@ def run_sample():
     list_google_ads_links(property_id)
 
 
-def list_google_ads_links(property_id):
-    """Lists Google Ads links under the specified parent Google Analytics 4
-    property."""
-    client = AnalyticsAdminServiceClient()
+def list_google_ads_links(property_id: str, transport: str = None):
+    """
+    Lists Google Ads links under the specified parent Google Analytics 4
+    property.
+
+    Args:
+        property_id(str): The Google Analytics Property ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     results = client.list_google_ads_links(parent=f"properties/{property_id}")
 
     print("Result:")
diff --git a/google-analytics-admin/properties_google_ads_links_list_test.py b/google-analytics-admin/properties_google_ads_links_list_test.py
index 5396da0..e8252b9 100644
--- a/google-analytics-admin/properties_google_ads_links_list_test.py
+++ b/google-analytics-admin/properties_google_ads_links_list_test.py
@@ -20,6 +20,10 @@
 
 
 def test_properties_google_ads_links_list(capsys):
-    properties_google_ads_links_list.list_google_ads_links(TEST_PROPERTY_ID)
-    out, _ = capsys.readouterr()
-    assert "Result" in out
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        properties_google_ads_links_list.list_google_ads_links(
+            TEST_PROPERTY_ID, transport=transport
+        )
+        out, _ = capsys.readouterr()
+        assert "Result" in out
diff --git a/google-analytics-admin/properties_google_ads_links_update.py b/google-analytics-admin/properties_google_ads_links_update.py
index 8959cfc..b5e1395 100644
--- a/google-analytics-admin/properties_google_ads_links_update.py
+++ b/google-analytics-admin/properties_google_ads_links_update.py
@@ -44,9 +44,19 @@ def run_sample():
     update_google_ads_link(property_id, google_ads_link_id)
 
 
-def update_google_ads_link(property_id, google_ads_link_id):
-    """Updates the Google Ads link."""
-    client = AnalyticsAdminServiceClient()
+def update_google_ads_link(
+    property_id: str, google_ads_link_id: str, transport: str = None
+):
+    """
+    Updates the Google Ads link.
+
+    Args:
+        property_id(str): The Google Analytics Property ID.
+        google_ads_link_id(str): The Google Analytics Ads Link Id.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     # This call updates the adsPersonalizationEnabled setting of the
     # Google Ads link as indicated by the value of the `update_mask` field.
     # The Google Ads link to update is specified in the `name` field of the
diff --git a/google-analytics-admin/properties_google_ads_links_update_test.py b/google-analytics-admin/properties_google_ads_links_update_test.py
index a60ad3d..1cc4b2d 100644
--- a/google-analytics-admin/properties_google_ads_links_update_test.py
+++ b/google-analytics-admin/properties_google_ads_links_update_test.py
@@ -21,9 +21,11 @@
 
 
 def test_properties_google_ads_links_update():
-    # This test ensures that the call is valid and reaches the server, even
-    # though the operation does not succeed due to permission error.
-    with pytest.raises(Exception, match="403 The caller does not have permission"):
-        properties_google_ads_links_update.update_google_ads_link(
-            FAKE_PROPERTY_ID, FAKE_GOOGLE_ADS_LINK_ID
-        )
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        # This test ensures that the call is valid and reaches the server, even
+        # though the operation does not succeed due to permission error.
+        with pytest.raises(Exception, match="The caller does not have permission"):
+            properties_google_ads_links_update.update_google_ads_link(
+                FAKE_PROPERTY_ID, FAKE_GOOGLE_ADS_LINK_ID, transport=transport
+            )
diff --git a/google-analytics-admin/properties_list.py b/google-analytics-admin/properties_list.py
index 19bfcef..e467fbc 100644
--- a/google-analytics-admin/properties_list.py
+++ b/google-analytics-admin/properties_list.py
@@ -34,10 +34,17 @@ def run_sample():
     list_properties(account_id)
 
 
-def list_properties(account_id):
-    """Lists Google Analytics 4 properties under the specified parent account
-    that are available to the current user."""
-    client = AnalyticsAdminServiceClient()
+def list_properties(account_id: str, transport: str = None):
+    """
+    Lists Google Analytics 4 properties under the specified parent account
+    that are available to the current user.
+
+    Args:
+        account_id(str): The Google Analytics account ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     results = client.list_properties(
         ListPropertiesRequest(filter=f"parent:accounts/{account_id}", show_deleted=True)
     )
diff --git a/google-analytics-admin/properties_list_test.py b/google-analytics-admin/properties_list_test.py
index 97bf47d..e9f4667 100644
--- a/google-analytics-admin/properties_list_test.py
+++ b/google-analytics-admin/properties_list_test.py
@@ -20,6 +20,8 @@
 
 
 def test_properties_get(capsys):
-    properties_list.list_properties(TEST_ACCOUNT_ID)
-    out, _ = capsys.readouterr()
-    assert "Result" in out
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        properties_list.list_properties(TEST_ACCOUNT_ID, transport=transport)
+        out, _ = capsys.readouterr()
+        assert "Result" in out
diff --git a/google-analytics-admin/properties_update.py b/google-analytics-admin/properties_update.py
index 8700440..e6c3264 100644
--- a/google-analytics-admin/properties_update.py
+++ b/google-analytics-admin/properties_update.py
@@ -39,9 +39,16 @@ def run_sample():
     update_property(property_id)
 
 
-def update_property(property_id):
-    """Updates the Google Analytics 4 property."""
-    client = AnalyticsAdminServiceClient()
+def update_property(property_id: str, transport: str = None):
+    """
+    Updates the Google Analytics 4 property.
+
+    Args:
+        property_id(str): The Google Analytics Property ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     # This call updates the display name, industry category and time zone of the
     # property, as indicated by the value of the `update_mask` field.
     # The property to update is specified in the `name` field of the `Property`
diff --git a/google-analytics-admin/properties_update_test.py b/google-analytics-admin/properties_update_test.py
index 5e7ea4d..b55e5d4 100644
--- a/google-analytics-admin/properties_update_test.py
+++ b/google-analytics-admin/properties_update_test.py
@@ -20,7 +20,9 @@
 
 
 def test_properties_update():
-    # This test ensures that the call is valid and reaches the server, even
-    # though the operation does not succeed due to permission error.
-    with pytest.raises(Exception, match="403 The caller does not have permission"):
-        properties_update.update_property(FAKE_PROPERTY_ID)
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        # This test ensures that the call is valid and reaches the server, even
+        # though the operation does not succeed due to permission error.
+        with pytest.raises(Exception, match="The caller does not have permission"):
+            properties_update.update_property(FAKE_PROPERTY_ID, transport=transport)
diff --git a/google-analytics-admin/properties_user_links_audit.py b/google-analytics-admin/properties_user_links_audit.py
index 366eb7e..e02b9ba 100644
--- a/google-analytics-admin/properties_user_links_audit.py
+++ b/google-analytics-admin/properties_user_links_audit.py
@@ -33,11 +33,18 @@ def run_sample():
     audit_property_user_links(property_id)
 
 
-def audit_property_user_links(property_id):
-    """Lists all user links on the Google Analytics 4 property, including
+def audit_property_user_links(property_id: str, transport: str = None):
+    """
+    Lists all user links on the Google Analytics 4 property, including
     implicit ones that come from effective permissions granted by groups or
-    organization admin roles."""
-    client = AnalyticsAdminServiceClient()
+    organization admin roles.
+
+    Args:
+        property_id(str): The Google Analytics Property ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     results = client.audit_user_links(
         AuditUserLinksRequest(parent=f"properties/{property_id}")
     )
diff --git a/google-analytics-admin/properties_user_links_audit_test.py b/google-analytics-admin/properties_user_links_audit_test.py
index 10c521f..5236cdb 100644
--- a/google-analytics-admin/properties_user_links_audit_test.py
+++ b/google-analytics-admin/properties_user_links_audit_test.py
@@ -20,6 +20,10 @@
 
 
 def test_properties_user_links_audit(capsys):
-    properties_user_links_audit.audit_property_user_links(TEST_PROPERTY_ID)
-    out, _ = capsys.readouterr()
-    assert "Result" in out
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        properties_user_links_audit.audit_property_user_links(
+            TEST_PROPERTY_ID, transport=transport
+        )
+        out, _ = capsys.readouterr()
+        assert "Result" in out
diff --git a/google-analytics-admin/properties_user_links_batch_create.py b/google-analytics-admin/properties_user_links_batch_create.py
index 1c8cba7..5ee4cc1 100644
--- a/google-analytics-admin/properties_user_links_batch_create.py
+++ b/google-analytics-admin/properties_user_links_batch_create.py
@@ -49,10 +49,20 @@ def run_sample():
     batch_create_property_user_link(property_id, email_address)
 
 
-def batch_create_property_user_link(property_id, email_address):
-    """Creates a user link for the Google Analytics 4 property using a batch
-    call."""
-    client = AnalyticsAdminServiceClient()
+def batch_create_property_user_link(
+    property_id: str, email_address: str, transport: str = None
+):
+    """
+    Creates a user link for the Google Analytics 4 property using a batch
+    call.
+
+    Args:
+        property_id(str): The Google Analytics Property ID.
+        email_address(str): Email address of the user to link.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     response = client.batch_create_user_links(
         BatchCreateUserLinksRequest(
             parent=f"properties/{property_id}",
diff --git a/google-analytics-admin/properties_user_links_batch_create_test.py b/google-analytics-admin/properties_user_links_batch_create_test.py
index f732b48..b463cbb 100644
--- a/google-analytics-admin/properties_user_links_batch_create_test.py
+++ b/google-analytics-admin/properties_user_links_batch_create_test.py
@@ -21,9 +21,11 @@
 
 
 def test_properties_user_links_batch_create():
-    # This test ensures that the call is valid and reaches the server, even
-    # though the operation does not succeed due to permission error.
-    with pytest.raises(Exception, match="403 The caller does not have permission"):
-        properties_user_links_batch_create.batch_create_property_user_link(
-            FAKE_PROPERTY_ID, FAKE_EMAIL_ADDRESS
-        )
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        # This test ensures that the call is valid and reaches the server, even
+        # though the operation does not succeed due to permission error.
+        with pytest.raises(Exception, match="The caller does not have permission"):
+            properties_user_links_batch_create.batch_create_property_user_link(
+                FAKE_PROPERTY_ID, FAKE_EMAIL_ADDRESS, transport=transport
+            )
diff --git a/google-analytics-admin/properties_user_links_batch_delete.py b/google-analytics-admin/properties_user_links_batch_delete.py
index 2384b49..3e277cd 100644
--- a/google-analytics-admin/properties_user_links_batch_delete.py
+++ b/google-analytics-admin/properties_user_links_batch_delete.py
@@ -47,9 +47,19 @@ def run_sample():
     batch_delete_property_user_link(property_id, property_user_link_id)
 
 
-def batch_delete_property_user_link(property_id, property_user_link_id):
-    """Deletes the GA4 property user link using a batch call."""
-    client = AnalyticsAdminServiceClient()
+def batch_delete_property_user_link(
+    property_id: str, property_user_link_id: str, transport: str = None
+):
+    """
+    Deletes the GA4 property user link using a batch call.
+
+    Args:
+        property_id(str): The Google Analytics Property ID.
+        property_user_link_id(str): Google Analytics account user link ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     client.batch_delete_user_links(
         BatchDeleteUserLinksRequest(
             parent=f"properties/{property_id}",
diff --git a/google-analytics-admin/properties_user_links_batch_delete_test.py b/google-analytics-admin/properties_user_links_batch_delete_test.py
index 49e58c9..5aee6f4 100644
--- a/google-analytics-admin/properties_user_links_batch_delete_test.py
+++ b/google-analytics-admin/properties_user_links_batch_delete_test.py
@@ -21,9 +21,11 @@
 
 
 def test_properties_user_links_batch_delete():
-    # This test ensures that the call is valid and reaches the server, even
-    # though the operation does not succeed due to permission error.
-    with pytest.raises(Exception, match="403 The caller does not have permission"):
-        properties_user_links_batch_delete.batch_delete_property_user_link(
-            FAKE_PROPERTY_ID, FAKE_USER_LINK_ID
-        )
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        # This test ensures that the call is valid and reaches the server, even
+        # though the operation does not succeed due to permission error.
+        with pytest.raises(Exception, match="The caller does not have permission"):
+            properties_user_links_batch_delete.batch_delete_property_user_link(
+                FAKE_PROPERTY_ID, FAKE_USER_LINK_ID, transport=transport
+            )
diff --git a/google-analytics-admin/properties_user_links_batch_get.py b/google-analytics-admin/properties_user_links_batch_get.py
index b7b3434..5c40e7e 100644
--- a/google-analytics-admin/properties_user_links_batch_get.py
+++ b/google-analytics-admin/properties_user_links_batch_get.py
@@ -38,10 +38,20 @@ def run_sample():
     batch_get_property_user_link(property_id, property_user_link_id)
 
 
-def batch_get_property_user_link(property_id, property_user_link_id):
-    """Retrieves details for the Google Analytics 4 property user link using a
-    batch call."""
-    client = AnalyticsAdminServiceClient()
+def batch_get_property_user_link(
+    property_id: str, property_user_link_id: str, transport: str = None
+):
+    """
+    Retrieves details for the Google Analytics 4 property user link using a
+    batch call.
+
+    Args:
+        property_id(str): The Google Analytics Property ID.
+        property_user_link_id(str): Google Analytics account user link ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     response = client.batch_get_user_links(
         BatchGetUserLinksRequest(
             parent=f"properties/{property_id}",
diff --git a/google-analytics-admin/properties_user_links_batch_get_test.py b/google-analytics-admin/properties_user_links_batch_get_test.py
index 4c8c4bb..9fb31a4 100644
--- a/google-analytics-admin/properties_user_links_batch_get_test.py
+++ b/google-analytics-admin/properties_user_links_batch_get_test.py
@@ -21,8 +21,10 @@
 
 
 def test_properties_user_links_batch_get(capsys):
-    properties_user_links_batch_get.batch_get_property_user_link(
-        TEST_PROPERTY_ID, TEST_USER_LINK_ID
-    )
-    out, _ = capsys.readouterr()
-    assert "Result" in out
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        properties_user_links_batch_get.batch_get_property_user_link(
+            TEST_PROPERTY_ID, TEST_USER_LINK_ID, transport=transport
+        )
+        out, _ = capsys.readouterr()
+        assert "Result" in out
diff --git a/google-analytics-admin/properties_user_links_batch_update.py b/google-analytics-admin/properties_user_links_batch_update.py
index d89aa9a..c1a4d2e 100644
--- a/google-analytics-admin/properties_user_links_batch_update.py
+++ b/google-analytics-admin/properties_user_links_batch_update.py
@@ -48,9 +48,19 @@ def run_sample():
     batch_update_property_user_link(property_id, property_user_link_id)
 
 
-def batch_update_property_user_link(property_id, property_user_link_id):
-    """Updates the Google Analytics 4 property user link using a batch call."""
-    client = AnalyticsAdminServiceClient()
+def batch_update_property_user_link(
+    property_id: str, property_user_link_id: str, transport: str = None
+):
+    """
+    Updates the Google Analytics 4 property user link using a batch call.
+
+    Args:
+        property_id(str): The Google Analytics Property ID.
+        property_user_link_id(str): Google Analytics account user link ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     # This call updates the email address and direct roles of the user link.
     # The user link to update is specified in the `name` field of the `UserLink`
     # instance.
diff --git a/google-analytics-admin/properties_user_links_batch_update_test.py b/google-analytics-admin/properties_user_links_batch_update_test.py
index 27450f4..08b64b7 100644
--- a/google-analytics-admin/properties_user_links_batch_update_test.py
+++ b/google-analytics-admin/properties_user_links_batch_update_test.py
@@ -21,9 +21,11 @@
 
 
 def test_properties_user_links_batch_update():
-    # This test ensures that the call is valid and reaches the server, even
-    # though the operation does not succeed due to permission error.
-    with pytest.raises(Exception, match="403 The caller does not have permission"):
-        properties_user_links_batch_update.batch_update_property_user_link(
-            FAKE_PROPERTY_ID, FAKE_USER_LINK_ID
-        )
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        # This test ensures that the call is valid and reaches the server, even
+        # though the operation does not succeed due to permission error.
+        with pytest.raises(Exception, match="The caller does not have permission"):
+            properties_user_links_batch_update.batch_update_property_user_link(
+                FAKE_PROPERTY_ID, FAKE_USER_LINK_ID, transport=transport
+            )
diff --git a/google-analytics-admin/properties_user_links_create.py b/google-analytics-admin/properties_user_links_create.py
index 7037161..24627b6 100644
--- a/google-analytics-admin/properties_user_links_create.py
+++ b/google-analytics-admin/properties_user_links_create.py
@@ -45,9 +45,19 @@ def run_sample():
     create_property_user_link(property_id, email_address)
 
 
-def create_property_user_link(property_id, email_address):
-    """Creates a user link for the Google Analytics 4 property."""
-    client = AnalyticsAdminServiceClient()
+def create_property_user_link(
+    property_id: str, email_address: str, transport: str = None
+):
+    """
+    Creates a user link for the Google Analytics 4 property.
+
+    Args:
+        property_id(str): The Google Analytics Property ID.
+        email_address(str): Email address of the user to link.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     user_link = client.create_user_link(
         CreateUserLinkRequest(
             parent=f"properties/{property_id}",
diff --git a/google-analytics-admin/properties_user_links_create_test.py b/google-analytics-admin/properties_user_links_create_test.py
index e3f9eb5..3f79d85 100644
--- a/google-analytics-admin/properties_user_links_create_test.py
+++ b/google-analytics-admin/properties_user_links_create_test.py
@@ -21,9 +21,11 @@
 
 
 def test_properties_user_links_create():
-    # This test ensures that the call is valid and reaches the server, even
-    # though the operation does not succeed due to permission error.
-    with pytest.raises(Exception, match="403 The caller does not have permission"):
-        properties_user_links_create.create_property_user_link(
-            FAKE_PROPERTY_ID, FAKE_EMAIL_ADDRESS
-        )
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        # This test ensures that the call is valid and reaches the server, even
+        # though the operation does not succeed due to permission error.
+        with pytest.raises(Exception, match="The caller does not have permission"):
+            properties_user_links_create.create_property_user_link(
+                FAKE_PROPERTY_ID, FAKE_EMAIL_ADDRESS, transport=transport
+            )
diff --git a/google-analytics-admin/properties_user_links_delete.py b/google-analytics-admin/properties_user_links_delete.py
index 3aeaa6b..b70b75c 100644
--- a/google-analytics-admin/properties_user_links_delete.py
+++ b/google-analytics-admin/properties_user_links_delete.py
@@ -44,9 +44,19 @@ def run_sample():
     delete_property_user_link(property_id, property_user_link_id)
 
 
-def delete_property_user_link(property_id, property_user_link_id):
-    """Deletes the user link from the Google Analytics 4 property."""
-    client = AnalyticsAdminServiceClient()
+def delete_property_user_link(
+    property_id: str, property_user_link_id: str, transport: str = None
+):
+    """
+    Deletes the user link from the Google Analytics 4 property.
+
+    Args:
+        property_id(str): The Google Analytics Property ID.
+        property_user_link_id(str): Google Analytics account user link ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     client.delete_user_link(
         DeleteUserLinkRequest(
             name=f"properties/{property_id}/userLinks/{property_user_link_id}"
diff --git a/google-analytics-admin/properties_user_links_delete_test.py b/google-analytics-admin/properties_user_links_delete_test.py
index 4ef4976..c5f4dd6 100644
--- a/google-analytics-admin/properties_user_links_delete_test.py
+++ b/google-analytics-admin/properties_user_links_delete_test.py
@@ -21,9 +21,11 @@
 
 
 def test_properties_user_links_delete():
-    # This test ensures that the call is valid and reaches the server, even
-    # though the operation does not succeed due to permission error.
-    with pytest.raises(Exception, match="403 The caller does not have permission"):
-        properties_user_links_delete.delete_property_user_link(
-            FAKE_PROPERTY_ID, FAKE_USER_LINK_ID
-        )
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        # This test ensures that the call is valid and reaches the server, even
+        # though the operation does not succeed due to permission error.
+        with pytest.raises(Exception, match="The caller does not have permission"):
+            properties_user_links_delete.delete_property_user_link(
+                FAKE_PROPERTY_ID, FAKE_USER_LINK_ID, transport=transport
+            )
diff --git a/google-analytics-admin/properties_user_links_get.py b/google-analytics-admin/properties_user_links_get.py
index ba9bacb..9aa97e5 100644
--- a/google-analytics-admin/properties_user_links_get.py
+++ b/google-analytics-admin/properties_user_links_get.py
@@ -37,9 +37,19 @@ def run_sample():
     get_property_user_link(property_id, property_user_link_id)
 
 
-def get_property_user_link(property_id, property_user_link_id):
-    """Retrieves the Google Analytics 4 property user link details."""
-    client = AnalyticsAdminServiceClient()
+def get_property_user_link(
+    property_id: str, property_user_link_id: str, transport: str = None
+):
+    """
+    Retrieves the Google Analytics 4 property user link details.
+
+    Args:
+        property_id(str): The Google Analytics Property ID.
+        property_user_link_id(str): Google Analytics account user link ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     user_link = client.get_user_link(
         name=f"properties/{property_id}/userLinks/{property_user_link_id}"
     )
diff --git a/google-analytics-admin/properties_user_links_get_test.py b/google-analytics-admin/properties_user_links_get_test.py
index 14c9970..b05b19f 100644
--- a/google-analytics-admin/properties_user_links_get_test.py
+++ b/google-analytics-admin/properties_user_links_get_test.py
@@ -21,8 +21,10 @@
 
 
 def test_properties_user_links_get(capsys):
-    properties_user_links_get.get_property_user_link(
-        TEST_PROPERTY_ID, TEST_USER_LINK_ID
-    )
-    out, _ = capsys.readouterr()
-    assert "Result" in out
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        properties_user_links_get.get_property_user_link(
+            TEST_PROPERTY_ID, TEST_USER_LINK_ID, transport=transport
+        )
+        out, _ = capsys.readouterr()
+        assert "Result" in out
diff --git a/google-analytics-admin/properties_user_links_list.py b/google-analytics-admin/properties_user_links_list.py
index 0a0dcba..ef6e877 100644
--- a/google-analytics-admin/properties_user_links_list.py
+++ b/google-analytics-admin/properties_user_links_list.py
@@ -32,10 +32,17 @@ def run_sample():
     list_property_user_links(property_id)
 
 
-def list_property_user_links(property_id):
-    """Lists user links under the specified parent Google Analytics 4
-    property."""
-    client = AnalyticsAdminServiceClient()
+def list_property_user_links(property_id: str, transport: str = None):
+    """
+    Lists user links under the specified parent Google Analytics 4
+    property.
+
+    Args:
+        property_id(str): The Google Analytics Property ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     results = client.list_user_links(parent=f"properties/{property_id}")
 
     print("Result:")
diff --git a/google-analytics-admin/properties_user_links_list_test.py b/google-analytics-admin/properties_user_links_list_test.py
index a814ed2..a47d712 100644
--- a/google-analytics-admin/properties_user_links_list_test.py
+++ b/google-analytics-admin/properties_user_links_list_test.py
@@ -20,6 +20,10 @@
 
 
 def test_properties_user_links_list(capsys):
-    properties_user_links_list.list_property_user_links(TEST_PROPERTY_ID)
-    out, _ = capsys.readouterr()
-    assert "Result" in out
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        properties_user_links_list.list_property_user_links(
+            TEST_PROPERTY_ID, transport=transport
+        )
+        out, _ = capsys.readouterr()
+        assert "Result" in out
diff --git a/google-analytics-admin/properties_user_links_update.py b/google-analytics-admin/properties_user_links_update.py
index 8b53f6b..f20b04f 100644
--- a/google-analytics-admin/properties_user_links_update.py
+++ b/google-analytics-admin/properties_user_links_update.py
@@ -44,9 +44,19 @@ def run_sample():
     update_property_user_link(property_id, property_user_link_id)
 
 
-def update_property_user_link(property_id, property_user_link_id):
-    """Updates the Google Analytics 4 property user link."""
-    client = AnalyticsAdminServiceClient()
+def update_property_user_link(
+    property_id: str, property_user_link_id: str, transport: str = None
+):
+    """
+    Updates the Google Analytics 4 property user link.
+
+    Args:
+        property_id(str): The Google Analytics Property ID.
+        property_user_link_id(str): Google Analytics account user link ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
     # This call updates the email address and direct roles of the user link.
     # The user link to update is specified in the `name` field of the `UserLink`
     # instance.
diff --git a/google-analytics-admin/properties_user_links_update_test.py b/google-analytics-admin/properties_user_links_update_test.py
index fffc967..bd471b7 100644
--- a/google-analytics-admin/properties_user_links_update_test.py
+++ b/google-analytics-admin/properties_user_links_update_test.py
@@ -21,9 +21,11 @@
 
 
 def test_properties_user_links_update():
-    # This test ensures that the call is valid and reaches the server, even
-    # though the operation does not succeed due to permission error.
-    with pytest.raises(Exception, match="403 The caller does not have permission"):
-        properties_user_links_update.update_property_user_link(
-            FAKE_PROPERTY_ID, FAKE_USER_LINK_ID
-        )
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        # This test ensures that the call is valid and reaches the server, even
+        # though the operation does not succeed due to permission error.
+        with pytest.raises(Exception, match="The caller does not have permission"):
+            properties_user_links_update.update_property_user_link(
+                FAKE_PROPERTY_ID, FAKE_USER_LINK_ID, transport=transport
+            )
diff --git a/google-analytics-admin/quickstart.py b/google-analytics-admin/quickstart.py
index 0e22289..8cdca97 100644
--- a/google-analytics-admin/quickstart.py
+++ b/google-analytics-admin/quickstart.py
@@ -51,17 +51,26 @@
 
 
 # [START ga_admin_list_accounts]
-def list_accounts():
-    """Lists the available Google Analytics accounts."""
+def list_accounts(transport: str = None):
+    """
+    Lists the available Google Analytics accounts.
+
+    Args:
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
     from google.analytics.admin import AnalyticsAdminServiceClient
 
     # Using a default constructor instructs the client to use the credentials
     # specified in GOOGLE_APPLICATION_CREDENTIALS environment variable.
-    client = AnalyticsAdminServiceClient()
+    client = AnalyticsAdminServiceClient(transport=transport)
+
+    results = client.list_accounts()
 
     # Displays the configuration information for all Google Analytics accounts
     # available to the authenticated user.
-    for account in client.list_accounts():
+    print("Result:")
+    for account in results:
         print(account)
 
 
diff --git a/google-analytics-admin/quickstart_test.py b/google-analytics-admin/quickstart_test.py
new file mode 100644
index 0000000..0b703c2
--- /dev/null
+++ b/google-analytics-admin/quickstart_test.py
@@ -0,0 +1,23 @@
+# Copyright 2022 Google LLC All Rights Reserved.
+#
+# 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.
+
+import quickstart
+
+
+def test_accounts_list(capsys):
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        quickstart.list_accounts(transport=transport)
+        out, _ = capsys.readouterr()
+        assert "Result" in out

From abde6d0965b5e5dfc6e710a7ed4e8009bda4cbef Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Mon, 12 Sep 2022 20:00:44 +0200
Subject: [PATCH 104/213] chore(deps): update dependency google-analytics-admin
 to v0.11.0 (#268)

---
 google-analytics-admin/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index 513b7a1..1041ec1 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-admin==0.10.1
+google-analytics-admin==0.11.0
 google-auth-oauthlib==0.5.2
\ No newline at end of file

From 4ceb686dd5c7881f35b9e9936297ec470533b848 Mon Sep 17 00:00:00 2001
From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com>
Date: Tue, 13 Sep 2022 16:18:17 +0000
Subject: [PATCH 105/213] chore: detect samples tests in nested directories
 (#270)

Source-Link: https://github.com/googleapis/synthtool/commit/50db768f450a50d7c1fd62513c113c9bb96fd434
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:e09366bdf0fd9c8976592988390b24d53583dd9f002d476934da43725adbb978
---
 google-analytics-admin/noxfile.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/google-analytics-admin/noxfile.py b/google-analytics-admin/noxfile.py
index e9eb1cb..c171513 100644
--- a/google-analytics-admin/noxfile.py
+++ b/google-analytics-admin/noxfile.py
@@ -207,8 +207,10 @@ def _session_tests(
     session: nox.sessions.Session, post_install: Callable = None
 ) -> None:
     # check for presence of tests
-    test_list = glob.glob("*_test.py") + glob.glob("test_*.py")
-    test_list.extend(glob.glob("tests"))
+    test_list = glob.glob("**/*_test.py", recursive=True) + glob.glob(
+        "**/test_*.py", recursive=True
+    )
+    test_list.extend(glob.glob("**/tests", recursive=True))
 
     if len(test_list) == 0:
         print("No tests found, skipping directory.")

From a041148ddab8fa98ee4e84eb7ff15e2b4c6095b0 Mon Sep 17 00:00:00 2001
From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com>
Date: Tue, 13 Sep 2022 14:26:46 -0400
Subject: [PATCH 106/213] docs(nodejs_mono_repo): update broken links in README
 (#287)

Source-Link: https://github.com/googleapis/synthtool/commit/50db768f450a50d7c1fd62513c113c9bb96fd434
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:a31c2fd2f28e994254f6367b44e112722f3263247798ae222d7986bb12328ec3

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
---
 google-analytics-data/noxfile.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/google-analytics-data/noxfile.py b/google-analytics-data/noxfile.py
index 5fcb9d7..0398d72 100644
--- a/google-analytics-data/noxfile.py
+++ b/google-analytics-data/noxfile.py
@@ -207,8 +207,8 @@ def _session_tests(
     session: nox.sessions.Session, post_install: Callable = None
 ) -> None:
     # check for presence of tests
-    test_list = glob.glob("*_test.py") + glob.glob("test_*.py")
-    test_list.extend(glob.glob("tests"))
+    test_list = glob.glob("**/*_test.py", recursive=True) + glob.glob("**/test_*.py", recursive=True)
+    test_list.extend(glob.glob("**/tests", recursive=True))
 
     if len(test_list) == 0:
         print("No tests found, skipping directory.")

From 12659dd79e2b95f635cdc86f668925fade09e41d Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Thu, 15 Sep 2022 15:24:59 +0200
Subject: [PATCH 107/213] chore(deps): update dependency google-auth-oauthlib
 to v0.5.3 (#289)

---
 google-analytics-data/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index 6643059..d54edad 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
 google-analytics-data==0.13.2
-google-auth-oauthlib==0.5.2
\ No newline at end of file
+google-auth-oauthlib==0.5.3
\ No newline at end of file

From 4444a9771418d4c607db2a86549a68348f5b698c Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Thu, 15 Sep 2022 15:38:44 +0200
Subject: [PATCH 108/213] chore(deps): update dependency google-auth-oauthlib
 to v0.5.3 (#272)

Co-authored-by: Anthonios Partheniou <partheniou@google.com>
---
 google-analytics-admin/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index 1041ec1..9f0a3b0 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
 google-analytics-admin==0.11.0
-google-auth-oauthlib==0.5.2
\ No newline at end of file
+google-auth-oauthlib==0.5.3
\ No newline at end of file

From e5cdeddd6364558b7aeb85edcf78d43481f9ea9a Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Tue, 20 Sep 2022 02:50:31 +0200
Subject: [PATCH 109/213] chore(deps): update dependency google-analytics-data
 to v0.14.0 (#292)

---
 google-analytics-data/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index d54edad..7654485 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-data==0.13.2
+google-analytics-data==0.14.0
 google-auth-oauthlib==0.5.3
\ No newline at end of file

From 4e64bba728f8a79e24100d374b7e6a1620606e25 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Tue, 4 Oct 2022 15:43:20 +0200
Subject: [PATCH 110/213] chore(deps): update dependency google-analytics-data
 to v0.14.1 (#301)

---
 google-analytics-data/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index 7654485..04c3e8f 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-data==0.14.0
+google-analytics-data==0.14.1
 google-auth-oauthlib==0.5.3
\ No newline at end of file

From a8015428dc9947b4d62630cc93295d78c583f707 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Tue, 4 Oct 2022 15:45:05 +0200
Subject: [PATCH 111/213] chore(deps): update dependency google-analytics-admin
 to v0.11.1 (#282)

---
 google-analytics-admin/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index 9f0a3b0..58e7e29 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-admin==0.11.0
+google-analytics-admin==0.11.1
 google-auth-oauthlib==0.5.3
\ No newline at end of file

From cd9c11c8b68cecec5c43bf88544d990c7f684a6f Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Tue, 18 Oct 2022 15:26:10 +0200
Subject: [PATCH 112/213] chore(deps): update dependency google-analytics-admin
 to v0.11.2 (#285)

---
 google-analytics-admin/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index 58e7e29..ea5a4de 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-admin==0.11.1
+google-analytics-admin==0.11.2
 google-auth-oauthlib==0.5.3
\ No newline at end of file

From b77f722feee92d2998bbc57b6ff81a973c15b8bc Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Tue, 18 Oct 2022 15:34:24 +0200
Subject: [PATCH 113/213] chore(deps): update dependency google-analytics-data
 to v0.14.2 (#305)

Co-authored-by: Anthonios Partheniou <partheniou@google.com>
---
 google-analytics-data/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index 04c3e8f..7374c01 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-data==0.14.1
+google-analytics-data==0.14.2
 google-auth-oauthlib==0.5.3
\ No newline at end of file

From af4455b188f264de96cae8b2aafb38a3a4652063 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Tue, 25 Oct 2022 02:42:38 +0200
Subject: [PATCH 114/213] chore(deps): update dependency google-auth-oauthlib
 to v0.6.0 (#309)

---
 google-analytics-data/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index 7374c01..f04ea25 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
 google-analytics-data==0.14.2
-google-auth-oauthlib==0.5.3
\ No newline at end of file
+google-auth-oauthlib==0.6.0
\ No newline at end of file

From cd562db6db8f64a136ac754157097d527ed7ed83 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Tue, 25 Oct 2022 02:42:51 +0200
Subject: [PATCH 115/213] chore(deps): update dependency google-auth-oauthlib
 to v0.6.0 (#288)

---
 google-analytics-admin/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index ea5a4de..ec909e4 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
 google-analytics-admin==0.11.2
-google-auth-oauthlib==0.5.3
\ No newline at end of file
+google-auth-oauthlib==0.6.0
\ No newline at end of file

From c7003e9383e53a3709ba2cd76209e12d026f80d0 Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Wed, 26 Oct 2022 12:46:16 +0200
Subject: [PATCH 116/213] chore(deps): update all dependencies (#290)

---
 google-analytics-admin/requirements-test.txt | 2 +-
 google-analytics-admin/requirements.txt      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/google-analytics-admin/requirements-test.txt b/google-analytics-admin/requirements-test.txt
index f97bae6..89cb815 100644
--- a/google-analytics-admin/requirements-test.txt
+++ b/google-analytics-admin/requirements-test.txt
@@ -1 +1 @@
-pytest==7.1.3
\ No newline at end of file
+pytest==7.2.0
\ No newline at end of file
diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index ec909e4..50db855 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
 google-analytics-admin==0.11.2
-google-auth-oauthlib==0.6.0
\ No newline at end of file
+google-auth-oauthlib==0.7.0
\ No newline at end of file

From 7fc9a53f779c02979f9809f7c088869dec677b4b Mon Sep 17 00:00:00 2001
From: WhiteSource Renovate <bot@renovateapp.com>
Date: Wed, 26 Oct 2022 12:48:23 +0200
Subject: [PATCH 117/213] chore(deps): update all dependencies (#310)

---
 google-analytics-data/requirements-test.txt | 2 +-
 google-analytics-data/requirements.txt      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/google-analytics-data/requirements-test.txt b/google-analytics-data/requirements-test.txt
index e071685..49780e0 100644
--- a/google-analytics-data/requirements-test.txt
+++ b/google-analytics-data/requirements-test.txt
@@ -1 +1 @@
-pytest==7.1.3
+pytest==7.2.0
diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index f04ea25..0e1fb30 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
 google-analytics-data==0.14.2
-google-auth-oauthlib==0.6.0
\ No newline at end of file
+google-auth-oauthlib==0.7.0
\ No newline at end of file

From 0a7715ee97e5cd732dbd3cb914f57e304a7e2c99 Mon Sep 17 00:00:00 2001
From: ikuleshov <ikuleshov@google.com>
Date: Sat, 29 Oct 2022 09:53:25 +0200
Subject: [PATCH 118/213] docs: add a sample for runAccessReport method (#289)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* update test configuration

* remove custom noxfile configs for now

* remove MaximumUserAccess rom sample

* add comment in noxfile_config.py

* run blacken session

* lint

* add pytest

* Update noxfile_config.py

* Update noxfile_config.py

* delete enhanced measurement settings samples as this functionality is no longer supported in v1alpha

* fix the samples tests

* do not use the `maximum_user_access` field and `update` operation in properties.firebase_links tests as this is no longer supported in v1alpha

* use `creator_email_address` instead of `email_address` field in properties.google_ads_links_list() test as the field has been renamed in v1alpha

* fix the samples test

* add a sample for runAccessReport method

* add a sample for runAccessReport method

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* fix the test

* fix the test

Co-authored-by: Anthonios Partheniou <partheniou@google.com>
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
---
 .../properties_run_access_report.py           | 105 ++++++++++++++++++
 .../properties_run_access_report_test.py      |  35 ++++++
 2 files changed, 140 insertions(+)
 create mode 100644 google-analytics-admin/properties_run_access_report.py
 create mode 100644 google-analytics-admin/properties_run_access_report_test.py

diff --git a/google-analytics-admin/properties_run_access_report.py b/google-analytics-admin/properties_run_access_report.py
new file mode 100644
index 0000000..0664c10
--- /dev/null
+++ b/google-analytics-admin/properties_run_access_report.py
@@ -0,0 +1,105 @@
+#!/usr/bin/env python
+
+# Copyright 2022 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which runs an access report
+on a property.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties/runAccessReport
+for more information.
+"""
+# [START analyticsadmin_properties_run_access_report]
+from datetime import datetime
+
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha.types import (
+    AccessDateRange,
+    AccessDimension,
+    AccessMetric,
+    RunAccessReportRequest,
+)
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+    run_access_report(property_id)
+
+
+def run_access_report(property_id: str, transport: str = None):
+    """
+    Runs an access report for a Google Analytics property.
+    Args:
+        property_id(str): The Google Analytics Property ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
+    request = RunAccessReportRequest(
+        entity=f"properties/{property_id}",
+        dimensions=[
+            AccessDimension(dimension_name="userEmail"),
+            AccessDimension(dimension_name="accessedPropertyId"),
+            AccessDimension(dimension_name="propertyUserLink"),
+            AccessDimension(dimension_name="reportType"),
+            AccessDimension(dimension_name="revenueDataReturned"),
+            AccessDimension(dimension_name="costDataReturned"),
+            AccessDimension(dimension_name="userIP"),
+            AccessDimension(dimension_name="epochTimeMicros"),
+            AccessDimension(dimension_name="mostRecentAccessEpochTimeMicros"),
+        ],
+        metrics=[AccessMetric(metric_name="accessCount")],
+        date_ranges=[AccessDateRange(start_date="yesterday", end_date="today")],
+    )
+
+    access_report = client.run_access_report(request)
+
+    print("Result:")
+    print_access_report(access_report)
+
+
+def print_access_report(response):
+    """Prints the access report."""
+    print(f"{response.row_count} rows received")
+    for dimensionHeader in response.dimension_headers:
+        print(f"Dimension header name: {dimensionHeader.dimension_name}")
+    for metricHeader in response.metric_headers:
+        print(f"Metric header name: {metricHeader.metric_name})")
+
+    for rowIdx, row in enumerate(response.rows):
+        print(f"\nRow {rowIdx}")
+        for i, dimension_value in enumerate(row.dimension_values):
+            dimension_name = response.dimension_headers[i].dimension_name
+            if dimension_name.endswith("Micros"):
+                # Convert microseconds since Unix Epoch to datetime object.
+                dimension_value_formatted = datetime.utcfromtimestamp(
+                    int(dimension_value.value) / 1000000
+                )
+            else:
+                dimension_value_formatted = dimension_value.value
+            print(f"{dimension_name}: {dimension_value_formatted}")
+
+        for i, metric_value in enumerate(row.metric_values):
+            metric_name = response.metric_headers[i].metric_name
+            print(f"{metric_name}: {metric_value.value}")
+
+
+# [END analyticsadmin_properties_run_access_report]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_run_access_report_test.py b/google-analytics-admin/properties_run_access_report_test.py
new file mode 100644
index 0000000..a7d3c8d
--- /dev/null
+++ b/google-analytics-admin/properties_run_access_report_test.py
@@ -0,0 +1,35 @@
+# Copyright 2022 Google LLC All Rights Reserved.
+#
+# 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.
+
+import os
+
+import pytest
+
+import properties_run_access_report
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+
+
+def test_properties_run_access_report(capsys):
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        # This test ensures that the call is valid and reaches the server, even
+        # though the operation does not succeed due to permission error.
+        with pytest.raises(
+            Exception,
+            match="Access record reports are only allowed on Google Analytics 360 properties.",
+        ):
+            properties_run_access_report.run_access_report(
+                TEST_PROPERTY_ID, transport=transport
+            )

From 3ae514c07593203ee8e89c97a307da699c40b791 Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Mon, 7 Nov 2022 17:13:09 +0100
Subject: [PATCH 119/213] chore(deps): update dependency google-auth-oauthlib
 to v0.7.1 (#294)

---
 google-analytics-admin/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index 50db855..2e8c661 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
 google-analytics-admin==0.11.2
-google-auth-oauthlib==0.7.0
\ No newline at end of file
+google-auth-oauthlib==0.7.1
\ No newline at end of file

From ce12e197b26d54cf62278338d9a83adad1329da9 Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Mon, 7 Nov 2022 19:31:41 +0100
Subject: [PATCH 120/213] chore(deps): update dependency google-auth-oauthlib
 to v0.7.1 (#312)

---
 google-analytics-data/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index 0e1fb30..ad14784 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
 google-analytics-data==0.14.2
-google-auth-oauthlib==0.7.0
\ No newline at end of file
+google-auth-oauthlib==0.7.1
\ No newline at end of file

From 66b37a04372c75c33586e93ec52889dfb330b2f8 Mon Sep 17 00:00:00 2001
From: ikuleshov <ikuleshov@google.com>
Date: Tue, 8 Nov 2022 16:41:40 +0100
Subject: [PATCH 121/213] docs: add a sample for using minute ranges in
 realtime reports (#314)

---
 .../run_realtime_report_with_minute_ranges.py | 68 +++++++++++++++++++
 ...realtime_report_with_minute_ranges_test.py | 27 ++++++++
 google-analytics-data/run_report.py           | 15 ++--
 3 files changed, 104 insertions(+), 6 deletions(-)
 create mode 100644 google-analytics-data/run_realtime_report_with_minute_ranges.py
 create mode 100644 google-analytics-data/run_realtime_report_with_minute_ranges_test.py

diff --git a/google-analytics-data/run_realtime_report_with_minute_ranges.py b/google-analytics-data/run_realtime_report_with_minute_ranges.py
new file mode 100644
index 0000000..4365ff1
--- /dev/null
+++ b/google-analytics-data/run_realtime_report_with_minute_ranges.py
@@ -0,0 +1,68 @@
+#!/usr/bin/env python
+
+# Copyright 2022 Google Inc. All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Data API sample application demonstrating the creation of
+a realtime report using minute ranges.
+
+See https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/properties/runRealtimeReport#body.request_body.FIELDS.minute_ranges
+for more information.
+"""
+# [START analyticsdata_run_realtime_report_with_minute_ranges]
+from google.analytics.data_v1beta import BetaAnalyticsDataClient
+from google.analytics.data_v1beta.types import Metric
+from google.analytics.data_v1beta.types import MinuteRange
+from google.analytics.data_v1beta.types import RunRealtimeReportRequest
+
+from run_report import print_run_report_response
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+    run_realtime_report_with_minute_ranges(property_id)
+
+
+def run_realtime_report_with_minute_ranges(property_id="YOUR-GA4-PROPERTY-ID"):
+    """Runs a realtime report on a Google Analytics 4 property. Dimensions
+    field is omitted in the query, which results in total values of active users
+    returned for each minute range in the report.
+
+    Note the `dateRange` dimension added to the report response automatically
+    as a result of querying multiple minute ranges.
+    """
+    client = BetaAnalyticsDataClient()
+
+    request = RunRealtimeReportRequest(
+        property=f"properties/{property_id}",
+        metrics=[Metric(name="activeUsers")],
+        minute_ranges=[
+            MinuteRange(name="0-4 minutes ago", start_minutes_ago=4),
+            MinuteRange(
+                name="25-29 minutes ago", start_minutes_ago=29, end_minutes_ago=25
+            ),
+        ],
+    )
+    response = client.run_realtime_report(request)
+    print_run_report_response(response)
+
+
+# [END analyticsdata_run_realtime_report_with_minute_ranges]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-data/run_realtime_report_with_minute_ranges_test.py b/google-analytics-data/run_realtime_report_with_minute_ranges_test.py
new file mode 100644
index 0000000..f428820
--- /dev/null
+++ b/google-analytics-data/run_realtime_report_with_minute_ranges_test.py
@@ -0,0 +1,27 @@
+# Copyright 2022 Google Inc. All Rights Reserved.
+#
+# 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.
+
+import os
+
+import run_realtime_report_with_minute_ranges
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+
+
+def test_run_report_with_multiple_metrics(capsys):
+    run_realtime_report_with_minute_ranges.run_realtime_report_with_minute_ranges(
+        TEST_PROPERTY_ID
+    )
+    out, _ = capsys.readouterr()
+    assert "Report result" in out
diff --git a/google-analytics-data/run_report.py b/google-analytics-data/run_report.py
index c76f5ea..5929a2e 100644
--- a/google-analytics-data/run_report.py
+++ b/google-analytics-data/run_report.py
@@ -64,12 +64,15 @@ def print_run_report_response(response):
 
     # [START analyticsdata_print_run_report_response_rows]
     print("Report result:")
-    for row in response.rows:
-        for dimension_value in row.dimension_values:
-            print(dimension_value.value)
-
-        for metric_value in row.metric_values:
-            print(metric_value.value)
+    for rowIdx, row in enumerate(response.rows):
+        print(f"\nRow {rowIdx}")
+        for i, dimension_value in enumerate(row.dimension_values):
+            dimension_name = response.dimension_headers[i].name
+            print(f"{dimension_name}: {dimension_value.value}")
+
+        for i, metric_value in enumerate(row.metric_values):
+            metric_name = response.metric_headers[i].name
+            print(f"{metric_name}: {metric_value.value}")
     # [END analyticsdata_print_run_report_response_rows]
 
 

From 81bf6ada6034241de484929b0fb196698ef6c5b6 Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Tue, 8 Nov 2022 17:03:44 +0100
Subject: [PATCH 122/213] chore(deps): update dependency google-analytics-admin
 to v0.12.0 (#297)

---
 google-analytics-admin/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index 2e8c661..518670c 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-admin==0.11.2
+google-analytics-admin==0.12.0
 google-auth-oauthlib==0.7.1
\ No newline at end of file

From 01fea03db3aafdeeceb9177797c486b17b93dd24 Mon Sep 17 00:00:00 2001
From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com>
Date: Tue, 8 Nov 2022 15:28:37 -0500
Subject: [PATCH 123/213] feat: add support for
 `google.analytics.data.__version__` (#311)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* chore: update to gapic-generator-python 1.5.0

feat: add support for `google.cloud.<api>.__version__`
PiperOrigin-RevId: 484665853

Source-Link: https://github.com/googleapis/googleapis/commit/8eb249a19db926c2fbc4ecf1dc09c0e521a88b22

Source-Link: https://github.com/googleapis/googleapis-gen/commit/c8aa327b5f478865fc3fd91e3c2768e54e26ad44
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYzhhYTMyN2I1ZjQ3ODg2NWZjM2ZkOTFlM2MyNzY4ZTU0ZTI2YWQ0NCJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* update version in gapic_version.py

* add .release-please-manifest.json with correct version

* add release-please-config.json

* configure release please to use manifest

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* regenerate code using standard owlbot.py and autogenerated setup.py

* configure release-please to use manifest

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
---
 google-analytics-data/get_common_metadata.py  |  3 +--
 google-analytics-data/noxfile.py              | 16 ++++++-------
 google-analytics-data/quickstart.py           | 10 ++++----
 .../quickstart_json_credentials.py            | 10 ++++----
 google-analytics-data/quickstart_oauth2.py    | 10 ++++----
 google-analytics-data/run_batch_report.py     | 12 ++++++----
 google-analytics-data/run_funnel_report.py    | 24 ++++++++++---------
 google-analytics-data/run_pivot_report.py     | 14 ++++++-----
 google-analytics-data/run_realtime_report.py  |  8 ++++---
 .../run_realtime_report_with_minute_ranges.py |  8 ++++---
 ...ealtime_report_with_multiple_dimensions.py |  8 ++++---
 ...n_realtime_report_with_multiple_metrics.py |  8 ++++---
 google-analytics-data/run_report.py           | 12 ++++++----
 .../run_report_with_aggregations.py           | 12 ++++++----
 .../run_report_with_cohorts.py                | 16 +++++++------
 .../run_report_with_date_ranges.py            | 10 ++++----
 ...eport_with_dimension_and_metric_filters.py | 18 +++++++-------
 ...un_report_with_dimension_exclude_filter.py | 14 ++++++-----
 .../run_report_with_dimension_filter.py       | 14 ++++++-----
 ...un_report_with_dimension_in_list_filter.py | 14 ++++++-----
 ..._report_with_multiple_dimension_filters.py | 16 +++++++------
 .../run_report_with_multiple_dimensions.py    | 10 ++++----
 .../run_report_with_multiple_metrics.py       | 10 ++++----
 .../run_report_with_named_date_ranges.py      | 10 ++++----
 .../run_report_with_ordering.py               | 12 ++++++----
 .../run_report_with_pagination.py             | 10 ++++----
 .../run_report_with_property_quota.py         | 10 ++++----
 27 files changed, 184 insertions(+), 135 deletions(-)

diff --git a/google-analytics-data/get_common_metadata.py b/google-analytics-data/get_common_metadata.py
index 19a1964..643cf55 100644
--- a/google-analytics-data/get_common_metadata.py
+++ b/google-analytics-data/get_common_metadata.py
@@ -22,8 +22,7 @@
 """
 # [START analyticsdata_get_common_metadata]
 from google.analytics.data_v1beta import BetaAnalyticsDataClient
-from google.analytics.data_v1beta.types import GetMetadataRequest
-from google.analytics.data_v1beta.types import MetricType
+from google.analytics.data_v1beta.types import GetMetadataRequest, MetricType
 
 
 def run_sample():
diff --git a/google-analytics-data/noxfile.py b/google-analytics-data/noxfile.py
index 0398d72..c171513 100644
--- a/google-analytics-data/noxfile.py
+++ b/google-analytics-data/noxfile.py
@@ -22,7 +22,6 @@
 
 import nox
 
-
 # WARNING - WARNING - WARNING - WARNING - WARNING
 # WARNING - WARNING - WARNING - WARNING - WARNING
 #           DO NOT EDIT THIS FILE EVER!
@@ -180,6 +179,7 @@ def blacken(session: nox.sessions.Session) -> None:
 # format = isort + black
 #
 
+
 @nox.session
 def format(session: nox.sessions.Session) -> None:
     """
@@ -207,7 +207,9 @@ def _session_tests(
     session: nox.sessions.Session, post_install: Callable = None
 ) -> None:
     # check for presence of tests
-    test_list = glob.glob("**/*_test.py", recursive=True) + glob.glob("**/test_*.py", recursive=True)
+    test_list = glob.glob("**/*_test.py", recursive=True) + glob.glob(
+        "**/test_*.py", recursive=True
+    )
     test_list.extend(glob.glob("**/tests", recursive=True))
 
     if len(test_list) == 0:
@@ -229,9 +231,7 @@ def _session_tests(
 
     if os.path.exists("requirements-test.txt"):
         if os.path.exists("constraints-test.txt"):
-            session.install(
-                "-r", "requirements-test.txt", "-c", "constraints-test.txt"
-            )
+            session.install("-r", "requirements-test.txt", "-c", "constraints-test.txt")
         else:
             session.install("-r", "requirements-test.txt")
         with open("requirements-test.txt") as rtfile:
@@ -244,9 +244,9 @@ def _session_tests(
         post_install(session)
 
     if "pytest-parallel" in packages:
-        concurrent_args.extend(['--workers', 'auto', '--tests-per-worker', 'auto'])
+        concurrent_args.extend(["--workers", "auto", "--tests-per-worker", "auto"])
     elif "pytest-xdist" in packages:
-        concurrent_args.extend(['-n', 'auto'])
+        concurrent_args.extend(["-n", "auto"])
 
     session.run(
         "pytest",
@@ -276,7 +276,7 @@ def py(session: nox.sessions.Session) -> None:
 
 
 def _get_repo_root() -> Optional[str]:
-    """ Returns the root folder of the project. """
+    """Returns the root folder of the project."""
     # Get root of this repository. Assume we don't have directories nested deeper than 10 items.
     p = Path(os.getcwd())
     for i in range(10):
diff --git a/google-analytics-data/quickstart.py b/google-analytics-data/quickstart.py
index ea1d771..f1e3538 100644
--- a/google-analytics-data/quickstart.py
+++ b/google-analytics-data/quickstart.py
@@ -25,10 +25,12 @@
 """
 # [START analyticsdata_quickstart]
 from google.analytics.data_v1beta import BetaAnalyticsDataClient
-from google.analytics.data_v1beta.types import DateRange
-from google.analytics.data_v1beta.types import Dimension
-from google.analytics.data_v1beta.types import Metric
-from google.analytics.data_v1beta.types import RunReportRequest
+from google.analytics.data_v1beta.types import (
+    DateRange,
+    Dimension,
+    Metric,
+    RunReportRequest,
+)
 
 
 def sample_run_report(property_id="YOUR-GA4-PROPERTY-ID"):
diff --git a/google-analytics-data/quickstart_json_credentials.py b/google-analytics-data/quickstart_json_credentials.py
index 97c2889..1b5723e 100644
--- a/google-analytics-data/quickstart_json_credentials.py
+++ b/google-analytics-data/quickstart_json_credentials.py
@@ -29,10 +29,12 @@
 """
 # [START analyticsdata_json_credentials_quickstart]
 from google.analytics.data_v1beta import BetaAnalyticsDataClient
-from google.analytics.data_v1beta.types import DateRange
-from google.analytics.data_v1beta.types import Dimension
-from google.analytics.data_v1beta.types import Metric
-from google.analytics.data_v1beta.types import RunReportRequest
+from google.analytics.data_v1beta.types import (
+    DateRange,
+    Dimension,
+    Metric,
+    RunReportRequest,
+)
 
 
 def sample_run_report(property_id="YOUR-GA4-PROPERTY-ID", credentials_json_path=""):
diff --git a/google-analytics-data/quickstart_oauth2.py b/google-analytics-data/quickstart_oauth2.py
index aa488ee..e8282cc 100644
--- a/google-analytics-data/quickstart_oauth2.py
+++ b/google-analytics-data/quickstart_oauth2.py
@@ -26,10 +26,12 @@
 """
 # [START analyticsdata_oauth2_quickstart]
 from google.analytics.data import BetaAnalyticsDataClient
-from google.analytics.data_v1beta.types import DateRange
-from google.analytics.data_v1beta.types import Dimension
-from google.analytics.data_v1beta.types import Metric
-from google.analytics.data_v1beta.types import RunReportRequest
+from google.analytics.data_v1beta.types import (
+    DateRange,
+    Dimension,
+    Metric,
+    RunReportRequest,
+)
 from google_auth_oauthlib import flow
 
 
diff --git a/google-analytics-data/run_batch_report.py b/google-analytics-data/run_batch_report.py
index 1915dbc..07cdf40 100644
--- a/google-analytics-data/run_batch_report.py
+++ b/google-analytics-data/run_batch_report.py
@@ -22,11 +22,13 @@
 """
 # [START analyticsdata_run_batch_report]
 from google.analytics.data_v1beta import BetaAnalyticsDataClient
-from google.analytics.data_v1beta.types import BatchRunReportsRequest
-from google.analytics.data_v1beta.types import DateRange
-from google.analytics.data_v1beta.types import Dimension
-from google.analytics.data_v1beta.types import Metric
-from google.analytics.data_v1beta.types import RunReportRequest
+from google.analytics.data_v1beta.types import (
+    BatchRunReportsRequest,
+    DateRange,
+    Dimension,
+    Metric,
+    RunReportRequest,
+)
 
 from run_report import print_run_report_response
 
diff --git a/google-analytics-data/run_funnel_report.py b/google-analytics-data/run_funnel_report.py
index 446a7a0..937e3e8 100644
--- a/google-analytics-data/run_funnel_report.py
+++ b/google-analytics-data/run_funnel_report.py
@@ -22,17 +22,19 @@
 """
 # [START analyticsdata_run_funnel_report]
 from google.analytics.data_v1alpha import AlphaAnalyticsDataClient
-from google.analytics.data_v1alpha.types import DateRange
-from google.analytics.data_v1alpha.types import Dimension
-from google.analytics.data_v1alpha.types import Funnel
-from google.analytics.data_v1alpha.types import FunnelBreakdown
-from google.analytics.data_v1alpha.types import FunnelEventFilter
-from google.analytics.data_v1alpha.types import FunnelFieldFilter
-from google.analytics.data_v1alpha.types import FunnelFilterExpression
-from google.analytics.data_v1alpha.types import FunnelFilterExpressionList
-from google.analytics.data_v1alpha.types import FunnelStep
-from google.analytics.data_v1alpha.types import RunFunnelReportRequest
-from google.analytics.data_v1alpha.types import StringFilter
+from google.analytics.data_v1alpha.types import (
+    DateRange,
+    Dimension,
+    Funnel,
+    FunnelBreakdown,
+    FunnelEventFilter,
+    FunnelFieldFilter,
+    FunnelFilterExpression,
+    FunnelFilterExpressionList,
+    FunnelStep,
+    RunFunnelReportRequest,
+    StringFilter,
+)
 
 
 def run_sample():
diff --git a/google-analytics-data/run_pivot_report.py b/google-analytics-data/run_pivot_report.py
index 1b620b3..699780c 100644
--- a/google-analytics-data/run_pivot_report.py
+++ b/google-analytics-data/run_pivot_report.py
@@ -22,12 +22,14 @@
 """
 # [START analyticsdata_run_pivot_report]
 from google.analytics.data_v1beta import BetaAnalyticsDataClient
-from google.analytics.data_v1beta.types import DateRange
-from google.analytics.data_v1beta.types import Dimension
-from google.analytics.data_v1beta.types import Metric
-from google.analytics.data_v1beta.types import OrderBy
-from google.analytics.data_v1beta.types import Pivot
-from google.analytics.data_v1beta.types import RunPivotReportRequest
+from google.analytics.data_v1beta.types import (
+    DateRange,
+    Dimension,
+    Metric,
+    OrderBy,
+    Pivot,
+    RunPivotReportRequest,
+)
 
 
 def run_sample():
diff --git a/google-analytics-data/run_realtime_report.py b/google-analytics-data/run_realtime_report.py
index f106a16..5efd627 100644
--- a/google-analytics-data/run_realtime_report.py
+++ b/google-analytics-data/run_realtime_report.py
@@ -22,9 +22,11 @@
 """
 # [START analyticsdata_run_realtime_report]
 from google.analytics.data_v1beta import BetaAnalyticsDataClient
-from google.analytics.data_v1beta.types import Dimension
-from google.analytics.data_v1beta.types import Metric
-from google.analytics.data_v1beta.types import RunRealtimeReportRequest
+from google.analytics.data_v1beta.types import (
+    Dimension,
+    Metric,
+    RunRealtimeReportRequest,
+)
 
 from run_report import print_run_report_response
 
diff --git a/google-analytics-data/run_realtime_report_with_minute_ranges.py b/google-analytics-data/run_realtime_report_with_minute_ranges.py
index 4365ff1..2db3772 100644
--- a/google-analytics-data/run_realtime_report_with_minute_ranges.py
+++ b/google-analytics-data/run_realtime_report_with_minute_ranges.py
@@ -22,9 +22,11 @@
 """
 # [START analyticsdata_run_realtime_report_with_minute_ranges]
 from google.analytics.data_v1beta import BetaAnalyticsDataClient
-from google.analytics.data_v1beta.types import Metric
-from google.analytics.data_v1beta.types import MinuteRange
-from google.analytics.data_v1beta.types import RunRealtimeReportRequest
+from google.analytics.data_v1beta.types import (
+    Metric,
+    MinuteRange,
+    RunRealtimeReportRequest,
+)
 
 from run_report import print_run_report_response
 
diff --git a/google-analytics-data/run_realtime_report_with_multiple_dimensions.py b/google-analytics-data/run_realtime_report_with_multiple_dimensions.py
index 3726681..e4c1fe0 100644
--- a/google-analytics-data/run_realtime_report_with_multiple_dimensions.py
+++ b/google-analytics-data/run_realtime_report_with_multiple_dimensions.py
@@ -22,9 +22,11 @@
 """
 # [START analyticsdata_run_realtime_report_with_multiple_dimensions]
 from google.analytics.data_v1beta import BetaAnalyticsDataClient
-from google.analytics.data_v1beta.types import Dimension
-from google.analytics.data_v1beta.types import Metric
-from google.analytics.data_v1beta.types import RunRealtimeReportRequest
+from google.analytics.data_v1beta.types import (
+    Dimension,
+    Metric,
+    RunRealtimeReportRequest,
+)
 
 from run_report import print_run_report_response
 
diff --git a/google-analytics-data/run_realtime_report_with_multiple_metrics.py b/google-analytics-data/run_realtime_report_with_multiple_metrics.py
index c87731d..831b32b 100644
--- a/google-analytics-data/run_realtime_report_with_multiple_metrics.py
+++ b/google-analytics-data/run_realtime_report_with_multiple_metrics.py
@@ -22,9 +22,11 @@
 """
 # [START analyticsdata_run_realtime_report_with_multiple_metrics]
 from google.analytics.data_v1beta import BetaAnalyticsDataClient
-from google.analytics.data_v1beta.types import Dimension
-from google.analytics.data_v1beta.types import Metric
-from google.analytics.data_v1beta.types import RunRealtimeReportRequest
+from google.analytics.data_v1beta.types import (
+    Dimension,
+    Metric,
+    RunRealtimeReportRequest,
+)
 
 from run_report import print_run_report_response
 
diff --git a/google-analytics-data/run_report.py b/google-analytics-data/run_report.py
index 5929a2e..d3c19ca 100644
--- a/google-analytics-data/run_report.py
+++ b/google-analytics-data/run_report.py
@@ -22,11 +22,13 @@
 """
 # [START analyticsdata_run_report]
 from google.analytics.data_v1beta import BetaAnalyticsDataClient
-from google.analytics.data_v1beta.types import DateRange
-from google.analytics.data_v1beta.types import Dimension
-from google.analytics.data_v1beta.types import Metric
-from google.analytics.data_v1beta.types import MetricType
-from google.analytics.data_v1beta.types import RunReportRequest
+from google.analytics.data_v1beta.types import (
+    DateRange,
+    Dimension,
+    Metric,
+    MetricType,
+    RunReportRequest,
+)
 
 
 def run_sample():
diff --git a/google-analytics-data/run_report_with_aggregations.py b/google-analytics-data/run_report_with_aggregations.py
index 3b77fd8..9cee325 100644
--- a/google-analytics-data/run_report_with_aggregations.py
+++ b/google-analytics-data/run_report_with_aggregations.py
@@ -22,11 +22,13 @@
 """
 # [START analyticsdata_run_report_with_aggregations]
 from google.analytics.data_v1beta import BetaAnalyticsDataClient
-from google.analytics.data_v1beta.types import DateRange
-from google.analytics.data_v1beta.types import Dimension
-from google.analytics.data_v1beta.types import Metric
-from google.analytics.data_v1beta.types import MetricAggregation
-from google.analytics.data_v1beta.types import RunReportRequest
+from google.analytics.data_v1beta.types import (
+    DateRange,
+    Dimension,
+    Metric,
+    MetricAggregation,
+    RunReportRequest,
+)
 
 from run_report import print_run_report_response
 
diff --git a/google-analytics-data/run_report_with_cohorts.py b/google-analytics-data/run_report_with_cohorts.py
index ef0e263..38442a1 100644
--- a/google-analytics-data/run_report_with_cohorts.py
+++ b/google-analytics-data/run_report_with_cohorts.py
@@ -22,13 +22,15 @@
 """
 # [START analyticsdata_run_report_with_cohorts]
 from google.analytics.data_v1beta import BetaAnalyticsDataClient
-from google.analytics.data_v1beta.types import Cohort
-from google.analytics.data_v1beta.types import CohortSpec
-from google.analytics.data_v1beta.types import CohortsRange
-from google.analytics.data_v1beta.types import DateRange
-from google.analytics.data_v1beta.types import Dimension
-from google.analytics.data_v1beta.types import Metric
-from google.analytics.data_v1beta.types import RunReportRequest
+from google.analytics.data_v1beta.types import (
+    Cohort,
+    CohortSpec,
+    CohortsRange,
+    DateRange,
+    Dimension,
+    Metric,
+    RunReportRequest,
+)
 
 from run_report import print_run_report_response
 
diff --git a/google-analytics-data/run_report_with_date_ranges.py b/google-analytics-data/run_report_with_date_ranges.py
index 73fae80..b228425 100644
--- a/google-analytics-data/run_report_with_date_ranges.py
+++ b/google-analytics-data/run_report_with_date_ranges.py
@@ -22,10 +22,12 @@
 """
 # [START analyticsdata_run_report_with_date_ranges]
 from google.analytics.data_v1beta import BetaAnalyticsDataClient
-from google.analytics.data_v1beta.types import DateRange
-from google.analytics.data_v1beta.types import Dimension
-from google.analytics.data_v1beta.types import Metric
-from google.analytics.data_v1beta.types import RunReportRequest
+from google.analytics.data_v1beta.types import (
+    DateRange,
+    Dimension,
+    Metric,
+    RunReportRequest,
+)
 
 from run_report import print_run_report_response
 
diff --git a/google-analytics-data/run_report_with_dimension_and_metric_filters.py b/google-analytics-data/run_report_with_dimension_and_metric_filters.py
index 8935e32..cc013a5 100644
--- a/google-analytics-data/run_report_with_dimension_and_metric_filters.py
+++ b/google-analytics-data/run_report_with_dimension_and_metric_filters.py
@@ -22,14 +22,16 @@
 """
 # [START analyticsdata_run_report_with_dimension_and_metric_filters]
 from google.analytics.data_v1beta import BetaAnalyticsDataClient
-from google.analytics.data_v1beta.types import DateRange
-from google.analytics.data_v1beta.types import Dimension
-from google.analytics.data_v1beta.types import Filter
-from google.analytics.data_v1beta.types import FilterExpression
-from google.analytics.data_v1beta.types import FilterExpressionList
-from google.analytics.data_v1beta.types import Metric
-from google.analytics.data_v1beta.types import NumericValue
-from google.analytics.data_v1beta.types import RunReportRequest
+from google.analytics.data_v1beta.types import (
+    DateRange,
+    Dimension,
+    Filter,
+    FilterExpression,
+    FilterExpressionList,
+    Metric,
+    NumericValue,
+    RunReportRequest,
+)
 
 from run_report import print_run_report_response
 
diff --git a/google-analytics-data/run_report_with_dimension_exclude_filter.py b/google-analytics-data/run_report_with_dimension_exclude_filter.py
index 938cee9..532e17f 100644
--- a/google-analytics-data/run_report_with_dimension_exclude_filter.py
+++ b/google-analytics-data/run_report_with_dimension_exclude_filter.py
@@ -22,12 +22,14 @@
 """
 # [START analyticsdata_run_report_with_dimension_exclude_filter]
 from google.analytics.data_v1beta import BetaAnalyticsDataClient
-from google.analytics.data_v1beta.types import DateRange
-from google.analytics.data_v1beta.types import Dimension
-from google.analytics.data_v1beta.types import Filter
-from google.analytics.data_v1beta.types import FilterExpression
-from google.analytics.data_v1beta.types import Metric
-from google.analytics.data_v1beta.types import RunReportRequest
+from google.analytics.data_v1beta.types import (
+    DateRange,
+    Dimension,
+    Filter,
+    FilterExpression,
+    Metric,
+    RunReportRequest,
+)
 
 from run_report import print_run_report_response
 
diff --git a/google-analytics-data/run_report_with_dimension_filter.py b/google-analytics-data/run_report_with_dimension_filter.py
index d9568a7..64e899f 100644
--- a/google-analytics-data/run_report_with_dimension_filter.py
+++ b/google-analytics-data/run_report_with_dimension_filter.py
@@ -22,12 +22,14 @@
 """
 # [START analyticsdata_run_report_with_dimension_filter]
 from google.analytics.data_v1beta import BetaAnalyticsDataClient
-from google.analytics.data_v1beta.types import DateRange
-from google.analytics.data_v1beta.types import Dimension
-from google.analytics.data_v1beta.types import Filter
-from google.analytics.data_v1beta.types import FilterExpression
-from google.analytics.data_v1beta.types import Metric
-from google.analytics.data_v1beta.types import RunReportRequest
+from google.analytics.data_v1beta.types import (
+    DateRange,
+    Dimension,
+    Filter,
+    FilterExpression,
+    Metric,
+    RunReportRequest,
+)
 
 from run_report import print_run_report_response
 
diff --git a/google-analytics-data/run_report_with_dimension_in_list_filter.py b/google-analytics-data/run_report_with_dimension_in_list_filter.py
index e4bd7e3..14c5b49 100644
--- a/google-analytics-data/run_report_with_dimension_in_list_filter.py
+++ b/google-analytics-data/run_report_with_dimension_in_list_filter.py
@@ -22,12 +22,14 @@
 """
 # [START analyticsdata_run_report_with_dimension_in_list_filter]
 from google.analytics.data_v1beta import BetaAnalyticsDataClient
-from google.analytics.data_v1beta.types import DateRange
-from google.analytics.data_v1beta.types import Dimension
-from google.analytics.data_v1beta.types import Filter
-from google.analytics.data_v1beta.types import FilterExpression
-from google.analytics.data_v1beta.types import Metric
-from google.analytics.data_v1beta.types import RunReportRequest
+from google.analytics.data_v1beta.types import (
+    DateRange,
+    Dimension,
+    Filter,
+    FilterExpression,
+    Metric,
+    RunReportRequest,
+)
 
 from run_report import print_run_report_response
 
diff --git a/google-analytics-data/run_report_with_multiple_dimension_filters.py b/google-analytics-data/run_report_with_multiple_dimension_filters.py
index e1002af..0fe0608 100644
--- a/google-analytics-data/run_report_with_multiple_dimension_filters.py
+++ b/google-analytics-data/run_report_with_multiple_dimension_filters.py
@@ -22,13 +22,15 @@
 """
 # [START analyticsdata_run_report_with_multiple_dimension_filters]
 from google.analytics.data_v1beta import BetaAnalyticsDataClient
-from google.analytics.data_v1beta.types import DateRange
-from google.analytics.data_v1beta.types import Dimension
-from google.analytics.data_v1beta.types import Filter
-from google.analytics.data_v1beta.types import FilterExpression
-from google.analytics.data_v1beta.types import FilterExpressionList
-from google.analytics.data_v1beta.types import Metric
-from google.analytics.data_v1beta.types import RunReportRequest
+from google.analytics.data_v1beta.types import (
+    DateRange,
+    Dimension,
+    Filter,
+    FilterExpression,
+    FilterExpressionList,
+    Metric,
+    RunReportRequest,
+)
 
 from run_report import print_run_report_response
 
diff --git a/google-analytics-data/run_report_with_multiple_dimensions.py b/google-analytics-data/run_report_with_multiple_dimensions.py
index 78a4a1c..4b0e6ba 100644
--- a/google-analytics-data/run_report_with_multiple_dimensions.py
+++ b/google-analytics-data/run_report_with_multiple_dimensions.py
@@ -22,10 +22,12 @@
 """
 # [START analyticsdata_run_report_with_multiple_dimensions]
 from google.analytics.data_v1beta import BetaAnalyticsDataClient
-from google.analytics.data_v1beta.types import DateRange
-from google.analytics.data_v1beta.types import Dimension
-from google.analytics.data_v1beta.types import Metric
-from google.analytics.data_v1beta.types import RunReportRequest
+from google.analytics.data_v1beta.types import (
+    DateRange,
+    Dimension,
+    Metric,
+    RunReportRequest,
+)
 
 from run_report import print_run_report_response
 
diff --git a/google-analytics-data/run_report_with_multiple_metrics.py b/google-analytics-data/run_report_with_multiple_metrics.py
index d3546df..279ed40 100644
--- a/google-analytics-data/run_report_with_multiple_metrics.py
+++ b/google-analytics-data/run_report_with_multiple_metrics.py
@@ -22,10 +22,12 @@
 """
 # [START analyticsdata_run_report_with_multiple_metrics]
 from google.analytics.data_v1beta import BetaAnalyticsDataClient
-from google.analytics.data_v1beta.types import DateRange
-from google.analytics.data_v1beta.types import Dimension
-from google.analytics.data_v1beta.types import Metric
-from google.analytics.data_v1beta.types import RunReportRequest
+from google.analytics.data_v1beta.types import (
+    DateRange,
+    Dimension,
+    Metric,
+    RunReportRequest,
+)
 
 from run_report import print_run_report_response
 
diff --git a/google-analytics-data/run_report_with_named_date_ranges.py b/google-analytics-data/run_report_with_named_date_ranges.py
index c5bbae4..41aee5b 100644
--- a/google-analytics-data/run_report_with_named_date_ranges.py
+++ b/google-analytics-data/run_report_with_named_date_ranges.py
@@ -22,10 +22,12 @@
 """
 # [START analyticsdata_run_report_with_named_date_ranges]
 from google.analytics.data_v1beta import BetaAnalyticsDataClient
-from google.analytics.data_v1beta.types import DateRange
-from google.analytics.data_v1beta.types import Dimension
-from google.analytics.data_v1beta.types import Metric
-from google.analytics.data_v1beta.types import RunReportRequest
+from google.analytics.data_v1beta.types import (
+    DateRange,
+    Dimension,
+    Metric,
+    RunReportRequest,
+)
 
 from run_report import print_run_report_response
 
diff --git a/google-analytics-data/run_report_with_ordering.py b/google-analytics-data/run_report_with_ordering.py
index f55bf5c..fad333a 100644
--- a/google-analytics-data/run_report_with_ordering.py
+++ b/google-analytics-data/run_report_with_ordering.py
@@ -22,11 +22,13 @@
 """
 # [START analyticsdata_run_report_with_ordering]
 from google.analytics.data_v1beta import BetaAnalyticsDataClient
-from google.analytics.data_v1beta.types import DateRange
-from google.analytics.data_v1beta.types import Dimension
-from google.analytics.data_v1beta.types import Metric
-from google.analytics.data_v1beta.types import OrderBy
-from google.analytics.data_v1beta.types import RunReportRequest
+from google.analytics.data_v1beta.types import (
+    DateRange,
+    Dimension,
+    Metric,
+    OrderBy,
+    RunReportRequest,
+)
 
 from run_report import print_run_report_response
 
diff --git a/google-analytics-data/run_report_with_pagination.py b/google-analytics-data/run_report_with_pagination.py
index 487f325..9211993 100644
--- a/google-analytics-data/run_report_with_pagination.py
+++ b/google-analytics-data/run_report_with_pagination.py
@@ -22,10 +22,12 @@
 """
 # [START analyticsdata_run_report_with_pagination]
 from google.analytics.data_v1beta import BetaAnalyticsDataClient
-from google.analytics.data_v1beta.types import DateRange
-from google.analytics.data_v1beta.types import Dimension
-from google.analytics.data_v1beta.types import Metric
-from google.analytics.data_v1beta.types import RunReportRequest
+from google.analytics.data_v1beta.types import (
+    DateRange,
+    Dimension,
+    Metric,
+    RunReportRequest,
+)
 
 from run_report import print_run_report_response
 
diff --git a/google-analytics-data/run_report_with_property_quota.py b/google-analytics-data/run_report_with_property_quota.py
index 76bc3d3..cd87336 100644
--- a/google-analytics-data/run_report_with_property_quota.py
+++ b/google-analytics-data/run_report_with_property_quota.py
@@ -22,10 +22,12 @@
 """
 # [START analyticsdata_run_report_with_property_quota]
 from google.analytics.data_v1beta import BetaAnalyticsDataClient
-from google.analytics.data_v1beta.types import DateRange
-from google.analytics.data_v1beta.types import Dimension
-from google.analytics.data_v1beta.types import Metric
-from google.analytics.data_v1beta.types import RunReportRequest
+from google.analytics.data_v1beta.types import (
+    DateRange,
+    Dimension,
+    Metric,
+    RunReportRequest,
+)
 
 
 def run_sample():

From d1ac74d22254e97e37b3fc626f343e8ed1b860fc Mon Sep 17 00:00:00 2001
From: ikuleshov <ikuleshov@google.com>
Date: Fri, 11 Nov 2022 20:21:58 +0100
Subject: [PATCH 124/213] docs: updates the `properties_run_access_report`
 sample to return aggregated data instead of individual data access records
 (#298)

* update test configuration

* remove custom noxfile configs for now

* remove MaximumUserAccess rom sample

* add comment in noxfile_config.py

* run blacken session

* lint

* add pytest

* Update noxfile_config.py

* Update noxfile_config.py

* delete enhanced measurement settings samples as this functionality is no longer supported in v1alpha

* fix the samples tests

* do not use the `maximum_user_access` field and `update` operation in properties.firebase_links tests as this is no longer supported in v1alpha

* use `creator_email_address` instead of `email_address` field in properties.google_ads_links_list() test as the field has been renamed in v1alpha

* fix the samples test

* docs: updates the `properties_run_access_report` sample to return aggregated data instead of individual data access records

* docs: updates the `properties_run_access_report` sample to return aggregated data instead of individual data access records

Co-authored-by: Anthonios Partheniou <partheniou@google.com>
---
 google-analytics-admin/properties_run_access_report.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/google-analytics-admin/properties_run_access_report.py b/google-analytics-admin/properties_run_access_report.py
index 0664c10..6cad3fe 100644
--- a/google-analytics-admin/properties_run_access_report.py
+++ b/google-analytics-admin/properties_run_access_report.py
@@ -16,7 +16,6 @@
 
 """Google Analytics Admin API sample application which runs an access report
 on a property.
-
 See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties/runAccessReport
 for more information.
 """
@@ -42,7 +41,13 @@ def run_sample():
 
 def run_access_report(property_id: str, transport: str = None):
     """
-    Runs an access report for a Google Analytics property.
+    Runs an access report for a Google Analytics property. The report will
+    aggregate over dimensions `userEmail`, `accessedPropertyId`,
+    `propertyUserLink`, `reportType`, `revenueDataReturned`, `costDataReturned`,
+    `userIP`, and return the access count, as well as the most recent access
+    time for each combination.
+    See https://developers.google.com/analytics/devguides/config/admin/v1/access-api-schema
+    for the description of each field used in a data access report query.
     Args:
         property_id(str): The Google Analytics Property ID.
         transport(str): The transport to use. For example, "grpc"
@@ -59,7 +64,6 @@ def run_access_report(property_id: str, transport: str = None):
             AccessDimension(dimension_name="revenueDataReturned"),
             AccessDimension(dimension_name="costDataReturned"),
             AccessDimension(dimension_name="userIP"),
-            AccessDimension(dimension_name="epochTimeMicros"),
             AccessDimension(dimension_name="mostRecentAccessEpochTimeMicros"),
         ],
         metrics=[AccessMetric(metric_name="accessCount")],

From c52b43d7702da8b84d55ac34674258d941821889 Mon Sep 17 00:00:00 2001
From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com>
Date: Sat, 26 Nov 2022 19:15:04 -0500
Subject: [PATCH 125/213] chore(python): drop flake8-import-order in samples
 noxfile (#306)

Source-Link: https://github.com/googleapis/synthtool/commit/6ed3a831cb9ff69ef8a504c353e098ec0192ad93
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:3abfa0f1886adaf0b83f07cb117b24a639ea1cb9cffe56d43280b977033563eb

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
---
 google-analytics-admin/noxfile.py | 26 +++-----------------------
 1 file changed, 3 insertions(+), 23 deletions(-)

diff --git a/google-analytics-admin/noxfile.py b/google-analytics-admin/noxfile.py
index c171513..0577084 100644
--- a/google-analytics-admin/noxfile.py
+++ b/google-analytics-admin/noxfile.py
@@ -18,7 +18,7 @@
 import os
 from pathlib import Path
 import sys
-from typing import Callable, Dict, List, Optional
+from typing import Callable, Dict, Optional
 
 import nox
 
@@ -108,22 +108,6 @@ def get_pytest_env_vars() -> Dict[str, str]:
 #
 
 
-def _determine_local_import_names(start_dir: str) -> List[str]:
-    """Determines all import names that should be considered "local".
-
-    This is used when running the linter to insure that import order is
-    properly checked.
-    """
-    file_ext_pairs = [os.path.splitext(path) for path in os.listdir(start_dir)]
-    return [
-        basename
-        for basename, extension in file_ext_pairs
-        if extension == ".py"
-        or os.path.isdir(os.path.join(start_dir, basename))
-        and basename not in ("__pycache__")
-    ]
-
-
 # Linting with flake8.
 #
 # We ignore the following rules:
@@ -138,7 +122,6 @@ def _determine_local_import_names(start_dir: str) -> List[str]:
     "--show-source",
     "--builtin=gettext",
     "--max-complexity=20",
-    "--import-order-style=google",
     "--exclude=.nox,.cache,env,lib,generated_pb2,*_pb2.py,*_pb2_grpc.py",
     "--ignore=E121,E123,E126,E203,E226,E24,E266,E501,E704,W503,W504,I202",
     "--max-line-length=88",
@@ -148,14 +131,11 @@ def _determine_local_import_names(start_dir: str) -> List[str]:
 @nox.session
 def lint(session: nox.sessions.Session) -> None:
     if not TEST_CONFIG["enforce_type_hints"]:
-        session.install("flake8", "flake8-import-order")
+        session.install("flake8")
     else:
-        session.install("flake8", "flake8-import-order", "flake8-annotations")
+        session.install("flake8", "flake8-annotations")
 
-    local_names = _determine_local_import_names(".")
     args = FLAKE8_COMMON_ARGS + [
-        "--application-import-names",
-        ",".join(local_names),
         ".",
     ]
     session.run("flake8", *args)

From 314eaeb11765b5810397762535dc63f740688bf0 Mon Sep 17 00:00:00 2001
From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com>
Date: Sat, 26 Nov 2022 19:16:49 -0500
Subject: [PATCH 126/213] chore(python): drop flake8-import-order in samples
 noxfile (#319)

Source-Link: https://github.com/googleapis/synthtool/commit/6ed3a831cb9ff69ef8a504c353e098ec0192ad93
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:3abfa0f1886adaf0b83f07cb117b24a639ea1cb9cffe56d43280b977033563eb

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
---
 google-analytics-data/noxfile.py | 26 +++-----------------------
 1 file changed, 3 insertions(+), 23 deletions(-)

diff --git a/google-analytics-data/noxfile.py b/google-analytics-data/noxfile.py
index c171513..0577084 100644
--- a/google-analytics-data/noxfile.py
+++ b/google-analytics-data/noxfile.py
@@ -18,7 +18,7 @@
 import os
 from pathlib import Path
 import sys
-from typing import Callable, Dict, List, Optional
+from typing import Callable, Dict, Optional
 
 import nox
 
@@ -108,22 +108,6 @@ def get_pytest_env_vars() -> Dict[str, str]:
 #
 
 
-def _determine_local_import_names(start_dir: str) -> List[str]:
-    """Determines all import names that should be considered "local".
-
-    This is used when running the linter to insure that import order is
-    properly checked.
-    """
-    file_ext_pairs = [os.path.splitext(path) for path in os.listdir(start_dir)]
-    return [
-        basename
-        for basename, extension in file_ext_pairs
-        if extension == ".py"
-        or os.path.isdir(os.path.join(start_dir, basename))
-        and basename not in ("__pycache__")
-    ]
-
-
 # Linting with flake8.
 #
 # We ignore the following rules:
@@ -138,7 +122,6 @@ def _determine_local_import_names(start_dir: str) -> List[str]:
     "--show-source",
     "--builtin=gettext",
     "--max-complexity=20",
-    "--import-order-style=google",
     "--exclude=.nox,.cache,env,lib,generated_pb2,*_pb2.py,*_pb2_grpc.py",
     "--ignore=E121,E123,E126,E203,E226,E24,E266,E501,E704,W503,W504,I202",
     "--max-line-length=88",
@@ -148,14 +131,11 @@ def _determine_local_import_names(start_dir: str) -> List[str]:
 @nox.session
 def lint(session: nox.sessions.Session) -> None:
     if not TEST_CONFIG["enforce_type_hints"]:
-        session.install("flake8", "flake8-import-order")
+        session.install("flake8")
     else:
-        session.install("flake8", "flake8-import-order", "flake8-annotations")
+        session.install("flake8", "flake8-annotations")
 
-    local_names = _determine_local_import_names(".")
     args = FLAKE8_COMMON_ARGS + [
-        "--application-import-names",
-        ",".join(local_names),
         ".",
     ]
     session.run("flake8", *args)

From bb9005c1286d4db813a374a348f7a29805b41a30 Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Wed, 14 Dec 2022 16:41:26 +0100
Subject: [PATCH 127/213] chore(deps): update dependency google-auth-oauthlib
 to v0.8.0 (#323)

---
 google-analytics-data/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index ad14784..78ba6a0 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
 google-analytics-data==0.14.2
-google-auth-oauthlib==0.7.1
\ No newline at end of file
+google-auth-oauthlib==0.8.0
\ No newline at end of file

From 736fdd30acc0693b18de4e47f707fd3abd499402 Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Wed, 14 Dec 2022 20:52:27 +0100
Subject: [PATCH 128/213] chore(deps): update dependency google-auth-oauthlib
 to v0.8.0 (#310)

Co-authored-by: Anthonios Partheniou <partheniou@google.com>
---
 google-analytics-admin/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index 518670c..2e500ee 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
 google-analytics-admin==0.12.0
-google-auth-oauthlib==0.7.1
\ No newline at end of file
+google-auth-oauthlib==0.8.0
\ No newline at end of file

From 208c946e66345e7bf8e7d0afeadc61e60b45bd64 Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Thu, 15 Dec 2022 00:33:48 +0100
Subject: [PATCH 129/213] chore(deps): update dependency google-analytics-admin
 to v0.13.0 (#311)

---
 google-analytics-admin/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index 2e500ee..9ad0fe5 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-admin==0.12.0
+google-analytics-admin==0.13.0
 google-auth-oauthlib==0.8.0
\ No newline at end of file

From 8ee4370ae5ccd9f6aa4577f1dfb7810d069c172f Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Thu, 15 Dec 2022 20:05:29 +0100
Subject: [PATCH 130/213] chore(deps): update dependency google-analytics-data
 to v0.15.0 (#324)

---
 google-analytics-data/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index 78ba6a0..967134b 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-data==0.14.2
+google-analytics-data==0.15.0
 google-auth-oauthlib==0.8.0
\ No newline at end of file

From ce411a66eb699dc1794de37361354ff23ec191db Mon Sep 17 00:00:00 2001
From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com>
Date: Fri, 6 Jan 2023 12:29:30 -0500
Subject: [PATCH 131/213] chore(python): add support for python 3.11 (#312)

Source-Link: https://github.com/googleapis/synthtool/commit/7197a001ffb6d8ce7b0b9b11c280f0c536c1033a
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:c43f1d918bcf817d337aa29ff833439494a158a0831508fda4ec75dc4c0d0320

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
---
 google-analytics-admin/noxfile.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/noxfile.py b/google-analytics-admin/noxfile.py
index 0577084..de104db 100644
--- a/google-analytics-admin/noxfile.py
+++ b/google-analytics-admin/noxfile.py
@@ -88,7 +88,7 @@ def get_pytest_env_vars() -> Dict[str, str]:
 
 # DO NOT EDIT - automatically generated.
 # All versions used to test samples.
-ALL_VERSIONS = ["3.7", "3.8", "3.9", "3.10"]
+ALL_VERSIONS = ["3.7", "3.8", "3.9", "3.10", "3.11"]
 
 # Any default versions that should be ignored.
 IGNORED_VERSIONS = TEST_CONFIG["ignored_versions"]

From 5bdd4b75c99828af2ef136121bf96d0b08219169 Mon Sep 17 00:00:00 2001
From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com>
Date: Fri, 6 Jan 2023 12:31:04 -0500
Subject: [PATCH 132/213] chore(python): add support for python 3.11 (#325)

Source-Link: https://github.com/googleapis/synthtool/commit/7197a001ffb6d8ce7b0b9b11c280f0c536c1033a
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:c43f1d918bcf817d337aa29ff833439494a158a0831508fda4ec75dc4c0d0320

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
---
 google-analytics-data/noxfile.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/noxfile.py b/google-analytics-data/noxfile.py
index 0577084..de104db 100644
--- a/google-analytics-data/noxfile.py
+++ b/google-analytics-data/noxfile.py
@@ -88,7 +88,7 @@ def get_pytest_env_vars() -> Dict[str, str]:
 
 # DO NOT EDIT - automatically generated.
 # All versions used to test samples.
-ALL_VERSIONS = ["3.7", "3.8", "3.9", "3.10"]
+ALL_VERSIONS = ["3.7", "3.8", "3.9", "3.10", "3.11"]
 
 # Any default versions that should be ignored.
 IGNORED_VERSIONS = TEST_CONFIG["ignored_versions"]

From 0d236972820c3b05bd4e726b7dafb7b9939ff625 Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Wed, 11 Jan 2023 17:10:53 +0000
Subject: [PATCH 133/213] chore(deps): update dependency google-analytics-admin
 to v0.14.0 (#315)

---
 google-analytics-admin/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index 9ad0fe5..6fa28ae 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-admin==0.13.0
+google-analytics-admin==0.14.0
 google-auth-oauthlib==0.8.0
\ No newline at end of file

From 2a3369419916007c80a3610e2036f0e4de502c1c Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Wed, 11 Jan 2023 17:51:47 +0000
Subject: [PATCH 134/213] chore(deps): update dependency google-analytics-data
 to v0.16.0 (#329)

---
 google-analytics-data/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index 967134b..047a303 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-data==0.15.0
+google-analytics-data==0.16.0
 google-auth-oauthlib==0.8.0
\ No newline at end of file

From 066f49c21ac5a15de1b36afc028ab97320ce1a22 Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Sat, 14 Jan 2023 18:10:06 +0000
Subject: [PATCH 135/213] chore(deps): update dependency pytest to v7.2.1
 (#330)

---
 google-analytics-data/requirements-test.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements-test.txt b/google-analytics-data/requirements-test.txt
index 49780e0..805eb2a 100644
--- a/google-analytics-data/requirements-test.txt
+++ b/google-analytics-data/requirements-test.txt
@@ -1 +1 @@
-pytest==7.2.0
+pytest==7.2.1

From d97af3d5b0ba67aa05268676f84727abdbab09e7 Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Sat, 14 Jan 2023 18:13:21 +0000
Subject: [PATCH 136/213] chore(deps): update dependency pytest to v7.2.1
 (#316)

---
 google-analytics-admin/requirements-test.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements-test.txt b/google-analytics-admin/requirements-test.txt
index 89cb815..dd3c733 100644
--- a/google-analytics-admin/requirements-test.txt
+++ b/google-analytics-admin/requirements-test.txt
@@ -1 +1 @@
-pytest==7.2.0
\ No newline at end of file
+pytest==7.2.1
\ No newline at end of file

From c9088cd40eda8b93fff4e199babe4a03415e0e9b Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Tue, 24 Jan 2023 15:05:12 +0000
Subject: [PATCH 137/213] chore(deps): update dependency google-analytics-admin
 to v0.14.1 (#319)

---
 google-analytics-admin/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index 6fa28ae..42fbce1 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-admin==0.14.0
+google-analytics-admin==0.14.1
 google-auth-oauthlib==0.8.0
\ No newline at end of file

From ea335b58b5a1a7f644820ad94671c0d3c40262be Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Tue, 24 Jan 2023 15:13:52 +0000
Subject: [PATCH 138/213] chore(deps): update dependency google-analytics-data
 to v0.16.1 (#333)

---
 google-analytics-data/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index 047a303..da3e0c6 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-data==0.16.0
+google-analytics-data==0.16.1
 google-auth-oauthlib==0.8.0
\ No newline at end of file

From f2e2b12ff939481d54b0a153700fd0f438b007b3 Mon Sep 17 00:00:00 2001
From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com>
Date: Wed, 8 Feb 2023 12:11:46 -0500
Subject: [PATCH 139/213] build(deps): bump cryptography from 38.0.3 to 39.0.1
 in /synthtool/gcp/templates/python_library/.kokoro (#339)

* build(deps): bump cryptography from 38.0.3 to 39.0.1 in /synthtool/gcp/templates/python_library/.kokoro

Source-Link: https://github.com/googleapis/synthtool/commit/bb171351c3946d3c3c32e60f5f18cee8c464ec51
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:f62c53736eccb0c4934a3ea9316e0d57696bb49c1a7c86c726e9bb8a2f87dadf

* fix typo

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
---
 google-analytics-data/quickstart_json_credentials.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/quickstart_json_credentials.py b/google-analytics-data/quickstart_json_credentials.py
index 1b5723e..fb93cbd 100644
--- a/google-analytics-data/quickstart_json_credentials.py
+++ b/google-analytics-data/quickstart_json_credentials.py
@@ -51,7 +51,7 @@ def sample_run_report(property_id="YOUR-GA4-PROPERTY-ID", credentials_json_path=
 
     # Explicitly use service account credentials by specifying
     # the private key file.
-    client = BetaAnalyticsDataClient().from_service_account_json(credentials_json_path)
+    client = BetaAnalyticsDataClient.from_service_account_json(credentials_json_path)
     # [END analyticsdata_json_credentials_initialize]
 
     # [START analyticsdata_json_credentials_run_report]

From f969f8078e6863c893c756bc4dfb9cdc57502cfc Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Wed, 15 Feb 2023 22:44:02 +0000
Subject: [PATCH 140/213] chore(deps): update dependency google-auth-oauthlib
 to v1 (#337)

Co-authored-by: Anthonios Partheniou <partheniou@google.com>
---
 google-analytics-data/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index da3e0c6..631ca28 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
 google-analytics-data==0.16.1
-google-auth-oauthlib==0.8.0
\ No newline at end of file
+google-auth-oauthlib==1.0.0
\ No newline at end of file

From e2ccb8da4806152cc5153d452e8ff4b89da95ad3 Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Wed, 15 Feb 2023 22:44:03 +0000
Subject: [PATCH 141/213] chore(deps): update dependency google-auth-oauthlib
 to v1 (#322)

Co-authored-by: Anthonios Partheniou <partheniou@google.com>
---
 google-analytics-admin/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index 42fbce1..5d21746 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
 google-analytics-admin==0.14.1
-google-auth-oauthlib==0.8.0
\ No newline at end of file
+google-auth-oauthlib==1.0.0
\ No newline at end of file

From 89171b81d1860500632d65d147eea51fb949ab1b Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Wed, 1 Mar 2023 10:06:10 +0000
Subject: [PATCH 142/213] chore(deps): update dependency google-analytics-admin
 to v0.15.0 (#330)

---
 google-analytics-admin/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index 5d21746..47faf42 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-admin==0.14.1
+google-analytics-admin==0.15.0
 google-auth-oauthlib==1.0.0
\ No newline at end of file

From 15133192d33aa157283e8706bddafa70874869f8 Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Sat, 4 Mar 2023 11:29:16 +0000
Subject: [PATCH 143/213] chore(deps): update dependency pytest to v7.2.2
 (#345)

---
 google-analytics-data/requirements-test.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements-test.txt b/google-analytics-data/requirements-test.txt
index 805eb2a..c021c5b 100644
--- a/google-analytics-data/requirements-test.txt
+++ b/google-analytics-data/requirements-test.txt
@@ -1 +1 @@
-pytest==7.2.1
+pytest==7.2.2

From a32e4bac8fd168d218c4b5167f259692d0579454 Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Sat, 4 Mar 2023 11:30:11 +0000
Subject: [PATCH 144/213] chore(deps): update dependency pytest to v7.2.2
 (#331)

---
 google-analytics-admin/requirements-test.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements-test.txt b/google-analytics-admin/requirements-test.txt
index dd3c733..b705adb 100644
--- a/google-analytics-admin/requirements-test.txt
+++ b/google-analytics-admin/requirements-test.txt
@@ -1 +1 @@
-pytest==7.2.1
\ No newline at end of file
+pytest==7.2.2
\ No newline at end of file

From 17fcf6077b53cd4af4ea92886ef33ab122b476ef Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Thu, 6 Apr 2023 17:12:34 +0100
Subject: [PATCH 145/213] chore(deps): update dependency google-analytics-data
 to v0.16.2 (#350)

---
 google-analytics-data/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index 631ca28..286b4cb 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-data==0.16.1
+google-analytics-data==0.16.2
 google-auth-oauthlib==1.0.0
\ No newline at end of file

From 02e4400e6f5f2586567302b03edd67a303f82276 Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Thu, 6 Apr 2023 17:16:26 +0100
Subject: [PATCH 146/213] chore(deps): update dependency google-analytics-admin
 to v0.16.0 (#337)

---
 google-analytics-admin/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index 47faf42..900f671 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-admin==0.15.0
+google-analytics-admin==0.16.0
 google-auth-oauthlib==1.0.0
\ No newline at end of file

From 34b6d7629685269a1506f5eb9ac6b4f4eb3452d1 Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Mon, 17 Apr 2023 23:56:14 +0100
Subject: [PATCH 147/213] chore(deps): update dependency pytest to v7.3.1
 (#338)

---
 google-analytics-admin/requirements-test.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements-test.txt b/google-analytics-admin/requirements-test.txt
index b705adb..a6510db 100644
--- a/google-analytics-admin/requirements-test.txt
+++ b/google-analytics-admin/requirements-test.txt
@@ -1 +1 @@
-pytest==7.2.2
\ No newline at end of file
+pytest==7.3.1
\ No newline at end of file

From 9454b388fd2052796784a8624b707d452bd7b864 Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Tue, 18 Apr 2023 18:01:29 +0200
Subject: [PATCH 148/213] chore(deps): update dependency pytest to v7.3.0
 (#351)

---
 google-analytics-data/requirements-test.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements-test.txt b/google-analytics-data/requirements-test.txt
index c021c5b..e75a2e0 100644
--- a/google-analytics-data/requirements-test.txt
+++ b/google-analytics-data/requirements-test.txt
@@ -1 +1 @@
-pytest==7.2.2
+pytest==7.3.0

From afc7081af939de122309707b17cb03d92c098e6f Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Tue, 18 Apr 2023 18:59:39 +0200
Subject: [PATCH 149/213] chore(deps): update dependency pytest to v7.3.1
 (#352)

---
 google-analytics-data/requirements-test.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements-test.txt b/google-analytics-data/requirements-test.txt
index e75a2e0..c4d04a0 100644
--- a/google-analytics-data/requirements-test.txt
+++ b/google-analytics-data/requirements-test.txt
@@ -1 +1 @@
-pytest==7.3.0
+pytest==7.3.1

From 6e11953dce2a6ef6fc43b6df8464c1be0ccaec6d Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Mon, 12 Jun 2023 23:08:11 +0200
Subject: [PATCH 150/213] chore(deps): update dependency google-analytics-admin
 to v0.17.0 (#346)

Co-authored-by: Anthonios Partheniou <partheniou@google.com>
---
 google-analytics-admin/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index 900f671..1846bf4 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-admin==0.16.0
+google-analytics-admin==0.17.0
 google-auth-oauthlib==1.0.0
\ No newline at end of file

From 2d454ba93ed562cd0cfd014b263f5c83e271c619 Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Tue, 13 Jun 2023 16:47:16 +0200
Subject: [PATCH 151/213] chore(deps): update dependency pytest to v7.3.2
 (#357)

---
 google-analytics-data/requirements-test.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements-test.txt b/google-analytics-data/requirements-test.txt
index c4d04a0..5662849 100644
--- a/google-analytics-data/requirements-test.txt
+++ b/google-analytics-data/requirements-test.txt
@@ -1 +1 @@
-pytest==7.3.1
+pytest==7.3.2

From 6794b6e5b4570be9858ffa0acadbffeed5bb8b5b Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Tue, 13 Jun 2023 16:49:10 +0200
Subject: [PATCH 152/213] chore(deps): update dependency pytest to v7.3.2
 (#349)

---
 google-analytics-admin/requirements-test.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements-test.txt b/google-analytics-admin/requirements-test.txt
index a6510db..28706be 100644
--- a/google-analytics-admin/requirements-test.txt
+++ b/google-analytics-admin/requirements-test.txt
@@ -1 +1 @@
-pytest==7.3.1
\ No newline at end of file
+pytest==7.3.2
\ No newline at end of file

From 414e13f8fd3b08d2ab6808ffe76b5b5978f1a7d2 Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Wed, 5 Jul 2023 17:22:12 +0200
Subject: [PATCH 153/213] chore(deps): update dependency pytest to v7.4.0
 (#358)

Co-authored-by: Anthonios Partheniou <partheniou@google.com>
---
 google-analytics-data/requirements-test.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements-test.txt b/google-analytics-data/requirements-test.txt
index 5662849..70613be 100644
--- a/google-analytics-data/requirements-test.txt
+++ b/google-analytics-data/requirements-test.txt
@@ -1 +1 @@
-pytest==7.3.2
+pytest==7.4.0

From 63895bf99eb4d5c49f89626f21c60a50d1d63a59 Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Wed, 5 Jul 2023 17:22:52 +0200
Subject: [PATCH 154/213] chore(deps): update all dependencies (#352)

Co-authored-by: Anthonios Partheniou <partheniou@google.com>
---
 google-analytics-admin/requirements-test.txt | 2 +-
 google-analytics-admin/requirements.txt      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/google-analytics-admin/requirements-test.txt b/google-analytics-admin/requirements-test.txt
index 28706be..6950eb5 100644
--- a/google-analytics-admin/requirements-test.txt
+++ b/google-analytics-admin/requirements-test.txt
@@ -1 +1 @@
-pytest==7.3.2
\ No newline at end of file
+pytest==7.4.0
\ No newline at end of file
diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index 1846bf4..cb72774 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-admin==0.17.0
+google-analytics-admin==0.18.0
 google-auth-oauthlib==1.0.0
\ No newline at end of file

From 9568023716fd3a9073715d8d45e1b79fb9c5b9ec Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Wed, 5 Jul 2023 17:41:17 +0200
Subject: [PATCH 155/213] chore(deps): update dependency google-analytics-data
 to v0.16.3 (#364)

---
 google-analytics-data/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index 286b4cb..cac9d0e 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-data==0.16.2
+google-analytics-data==0.16.3
 google-auth-oauthlib==1.0.0
\ No newline at end of file

From 87b026c31d982260f00bc441a975e58c996d16df Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Wed, 5 Jul 2023 21:22:33 +0200
Subject: [PATCH 156/213] chore(deps): update dependency google-analytics-admin
 to v0.18.1 (#357)

---
 google-analytics-admin/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index cb72774..4c8c7a0 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-admin==0.18.0
+google-analytics-admin==0.18.1
 google-auth-oauthlib==1.0.0
\ No newline at end of file

From 0551aa4bffe78ed1bc8140bf16a7d5647a355adf Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Wed, 12 Jul 2023 17:33:07 +0200
Subject: [PATCH 157/213] chore(deps): update dependency google-analytics-data
 to v0.17.0 (#369)

---
 google-analytics-data/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index cac9d0e..a3048c4 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-data==0.16.3
+google-analytics-data==0.17.0
 google-auth-oauthlib==1.0.0
\ No newline at end of file

From 3c85c5c9d66e62a7abb183541d3c794db0ec361a Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Wed, 9 Aug 2023 15:34:23 +0200
Subject: [PATCH 158/213] chore(deps): update dependency google-analytics-admin
 to v0.19.0 (#368)

Co-authored-by: Anthonios Partheniou <partheniou@google.com>
---
 google-analytics-admin/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index 4c8c7a0..2930d6c 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-admin==0.18.1
+google-analytics-admin==0.19.0
 google-auth-oauthlib==1.0.0
\ No newline at end of file

From 27a7be973be1107d76a4b75543d263ab5be758b4 Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Wed, 9 Aug 2023 18:34:46 +0200
Subject: [PATCH 159/213] chore(deps): update dependency google-analytics-data
 to v0.17.1 (#377)

---
 google-analytics-data/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index a3048c4..d04edde 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-data==0.17.0
+google-analytics-data==0.17.1
 google-auth-oauthlib==1.0.0
\ No newline at end of file

From 235f08f088f9b2c1362debd690b40cdf6d8fa9ad Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Fri, 11 Aug 2023 01:49:02 +0200
Subject: [PATCH 160/213] chore(deps): update dependency google-analytics-admin
 to v0.20.0 (#374)

---
 google-analytics-admin/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index 2930d6c..ae0fc99 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-admin==0.19.0
+google-analytics-admin==0.20.0
 google-auth-oauthlib==1.0.0
\ No newline at end of file

From ac360909d9fca84bb41a3c4f557cf3d3188e8430 Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Tue, 10 Oct 2023 16:37:41 +0200
Subject: [PATCH 161/213] chore(deps): update all dependencies (#378)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* chore(deps): update all dependencies

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
---
 google-analytics-admin/requirements-test.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements-test.txt b/google-analytics-admin/requirements-test.txt
index 6950eb5..bd5fef9 100644
--- a/google-analytics-admin/requirements-test.txt
+++ b/google-analytics-admin/requirements-test.txt
@@ -1 +1 @@
-pytest==7.4.0
\ No newline at end of file
+pytest==7.4.1
\ No newline at end of file

From ac75cdd2f1316a5175ae9f2d9749a5a7efc5c13f Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Thu, 12 Oct 2023 18:45:21 +0200
Subject: [PATCH 162/213] chore(deps): update all dependencies (#380)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* chore(deps): update all dependencies

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
---
 google-analytics-data/requirements-test.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements-test.txt b/google-analytics-data/requirements-test.txt
index 70613be..8e716e0 100644
--- a/google-analytics-data/requirements-test.txt
+++ b/google-analytics-data/requirements-test.txt
@@ -1 +1 @@
-pytest==7.4.0
+pytest==7.4.1

From cc9406e2bf8ba3f0beadbf4d34b6531a954b2f46 Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Thu, 12 Oct 2023 19:00:15 +0200
Subject: [PATCH 163/213] chore(deps): update all dependencies (#385)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* chore(deps): update all dependencies

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
---
 google-analytics-admin/requirements-test.txt | 2 +-
 google-analytics-admin/requirements.txt      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/google-analytics-admin/requirements-test.txt b/google-analytics-admin/requirements-test.txt
index bd5fef9..de1887b 100644
--- a/google-analytics-admin/requirements-test.txt
+++ b/google-analytics-admin/requirements-test.txt
@@ -1 +1 @@
-pytest==7.4.1
\ No newline at end of file
+pytest==7.4.2
\ No newline at end of file
diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index ae0fc99..df63006 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
 google-analytics-admin==0.20.0
-google-auth-oauthlib==1.0.0
\ No newline at end of file
+google-auth-oauthlib==1.1.0
\ No newline at end of file

From 4fe87fcec7b05d42cdbb8c7093f54afec47c0f1a Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Thu, 12 Oct 2023 21:13:51 +0200
Subject: [PATCH 164/213] chore(deps): update all dependencies (#387)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* chore(deps): update all dependencies

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
---
 google-analytics-admin/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index df63006..fa07523 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-admin==0.20.0
+google-analytics-admin==0.21.0
 google-auth-oauthlib==1.1.0
\ No newline at end of file

From 4959150349d5a595cfa42b2b24dd28bb07131b50 Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Thu, 12 Oct 2023 21:15:26 +0200
Subject: [PATCH 165/213] chore(deps): update all dependencies (#389)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* chore(deps): update all dependencies

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
---
 google-analytics-data/requirements-test.txt | 2 +-
 google-analytics-data/requirements.txt      | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/google-analytics-data/requirements-test.txt b/google-analytics-data/requirements-test.txt
index 8e716e0..2a929ed 100644
--- a/google-analytics-data/requirements-test.txt
+++ b/google-analytics-data/requirements-test.txt
@@ -1 +1 @@
-pytest==7.4.1
+pytest==7.4.2
diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index d04edde..64b78d2 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
 google-analytics-data==0.17.1
-google-auth-oauthlib==1.0.0
\ No newline at end of file
+google-auth-oauthlib==1.1.0
\ No newline at end of file

From c474ea86f440f1b407debab0636a834192da1e00 Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Thu, 12 Oct 2023 21:29:09 +0200
Subject: [PATCH 166/213] chore(deps): update all dependencies (#390)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* chore(deps): update all dependencies

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
---
 google-analytics-data/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index 64b78d2..ecbbd50 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-data==0.17.1
+google-analytics-data==0.17.2
 google-auth-oauthlib==1.1.0
\ No newline at end of file

From 884e437b2de3a530e6015eb01d1ecb16ee134d6c Mon Sep 17 00:00:00 2001
From: Josh Radcliff <jradcliff@users.noreply.github.com>
Date: Mon, 16 Oct 2023 16:49:04 -0400
Subject: [PATCH 167/213] Add LICENSE

---
 LICENSE | 201 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 201 insertions(+)
 create mode 100644 LICENSE

diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..261eeb9
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,201 @@
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   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 6be198a5d8130d9d766aa79faad6a9a9024079cb Mon Sep 17 00:00:00 2001
From: Anthonios Partheniou <partheniou@google.com>
Date: Mon, 16 Oct 2023 17:18:27 -0400
Subject: [PATCH 168/213] Update README.md with correct links

---
 google-analytics-data/README.md | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/google-analytics-data/README.md b/google-analytics-data/README.md
index f390224..709a34b 100644
--- a/google-analytics-data/README.md
+++ b/google-analytics-data/README.md
@@ -3,7 +3,7 @@
 [![Open in Cloud Shell][shell_img]][shell_link]
 
 [shell_img]: http://gstatic.com/cloudssh/images/open-btn.png
-[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/python-analytics-data&page=editor&working_dir=samples/snippets
+[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=googleanalytics/python-docs-samples&page=editor&working_dir=google-analytics-data
 
 These samples show how to use the
 [Google Analytics Data API](https://developers.google.com/analytics/devguides/reporting/data/v1) from Python.
@@ -20,8 +20,8 @@ These samples show how to use the
 ```
 3.  **Clone the repo** and cd into this directory
 ```sh
-    $ git clone https://github.com/googleapis/python-analytics-data
-    $ cd python-analytics-data/samples/snippets
+    $ git clone https://github.com/googleanalytics/python-docs-samples
+    $ cd google-analytics-admin
 ```
 4.  **Install dependencies** via [pip3](https://pip.pypa.io/en/stable).
     Run `pip3 install --upgrade google-analytics-data`.

From 44b4bab1d4ed224da681a1c43cf4a042cad1c726 Mon Sep 17 00:00:00 2001
From: Anthonios Partheniou <partheniou@google.com>
Date: Mon, 16 Oct 2023 17:19:10 -0400
Subject: [PATCH 169/213] fix typo

---
 google-analytics-data/README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/README.md b/google-analytics-data/README.md
index 709a34b..2496e3d 100644
--- a/google-analytics-data/README.md
+++ b/google-analytics-data/README.md
@@ -3,7 +3,7 @@
 [![Open in Cloud Shell][shell_img]][shell_link]
 
 [shell_img]: http://gstatic.com/cloudssh/images/open-btn.png
-[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=googleanalytics/python-docs-samples&page=editor&working_dir=google-analytics-data
+[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleanalytics/python-docs-samples&page=editor&working_dir=google-analytics-data
 
 These samples show how to use the
 [Google Analytics Data API](https://developers.google.com/analytics/devguides/reporting/data/v1) from Python.

From 2e743b0bcd15419c2a395a93d4ab2d5e944b5748 Mon Sep 17 00:00:00 2001
From: Anthonios Partheniou <partheniou@google.com>
Date: Mon, 16 Oct 2023 17:23:32 -0400
Subject: [PATCH 170/213] fix cloud shell link

---
 google-analytics-data/README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/README.md b/google-analytics-data/README.md
index 2496e3d..209aaf5 100644
--- a/google-analytics-data/README.md
+++ b/google-analytics-data/README.md
@@ -3,7 +3,7 @@
 [![Open in Cloud Shell][shell_img]][shell_link]
 
 [shell_img]: http://gstatic.com/cloudssh/images/open-btn.png
-[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleanalytics/python-docs-samples&page=editor&working_dir=google-analytics-data
+[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleanalytics/python-docs-samples&page=editor&open_in_editor=/README.md
 
 These samples show how to use the
 [Google Analytics Data API](https://developers.google.com/analytics/devguides/reporting/data/v1) from Python.

From 7f40dbac9bfb0f01e2e6e8c84d719665137ec42f Mon Sep 17 00:00:00 2001
From: Josh Radcliff <jradcliff@users.noreply.github.com>
Date: Wed, 25 Oct 2023 16:01:04 -0400
Subject: [PATCH 171/213] Add contributor, code of conduct, code owners, and
 license information (#4)

* Create CODEOWNERS

* Create CODE_OF_CONDUCT.md

* Add CONTRIBUTING.md

* Add missing license info to nox files
---
 CODEOWNERS                               |  1 +
 CODE_OF_CONDUCT.md                       | 43 ++++++++++++++++++++++++
 CONTRIBUTING.md                          | 29 ++++++++++++++++
 google-analytics-admin/noxfile_config.py | 14 ++++++++
 google-analytics-data/noxfile_config.py  | 14 ++++++++
 5 files changed, 101 insertions(+)
 create mode 100644 CODEOWNERS
 create mode 100644 CODE_OF_CONDUCT.md
 create mode 100644 CONTRIBUTING.md

diff --git a/CODEOWNERS b/CODEOWNERS
new file mode 100644
index 0000000..45720a9
--- /dev/null
+++ b/CODEOWNERS
@@ -0,0 +1 @@
+@googleanalytics/google-analytics
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
new file mode 100644
index 0000000..46b2a08
--- /dev/null
+++ b/CODE_OF_CONDUCT.md
@@ -0,0 +1,43 @@
+# Contributor Code of Conduct
+
+As contributors and maintainers of this project,
+and in the interest of fostering an open and welcoming community,
+we pledge to respect all people who contribute through reporting issues,
+posting feature requests, updating documentation,
+submitting pull requests or patches, and other activities.
+
+We are committed to making participation in this project
+a harassment-free experience for everyone,
+regardless of level of experience, gender, gender identity and expression,
+sexual orientation, disability, personal appearance,
+body size, race, ethnicity, age, religion, or nationality.
+
+Examples of unacceptable behavior by participants include:
+
+* The use of sexualized language or imagery
+* Personal attacks
+* Trolling or insulting/derogatory comments
+* Public or private harassment
+* Publishing other's private information,
+such as physical or electronic
+addresses, without explicit permission
+* Other unethical or unprofessional conduct.
+
+Project maintainers have the right and responsibility to remove, edit, or reject
+comments, commits, code, wiki edits, issues, and other contributions
+that are not aligned to this Code of Conduct.
+By adopting this Code of Conduct,
+project maintainers commit themselves to fairly and consistently
+applying these principles to every aspect of managing this project.
+Project maintainers who do not follow or enforce the Code of Conduct
+may be permanently removed from the project team.
+
+This code of conduct applies both within project spaces and in public spaces
+when an individual is representing the project or its community.
+
+Instances of abusive, harassing, or otherwise unacceptable behavior
+may be reported by opening an issue
+or contacting one or more of the project maintainers.
+
+This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0,
+available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/)
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..f6f482e
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,29 @@
+# How to Contribute
+
+We'd love to accept your patches and contributions to this project. There are
+just a few small guidelines you need to follow.
+
+## Contributor License Agreement
+
+Contributions to this project must be accompanied by a Contributor License
+Agreement. You (or your employer) retain the copyright to your contribution;
+this simply gives us permission to use and redistribute your contributions as
+part of the project. Head over to <https://cla.developers.google.com/> to see
+your current agreements on file or to sign a new one.
+
+You generally only need to submit a CLA once, so if you've already submitted one
+(even if it was for a different project), you probably don't need to do it
+again.
+
+## Code reviews
+
+All submissions, including submissions by project members, require review. We
+use GitHub pull requests for this purpose. Consult
+[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
+information on using pull requests.
+
+## Community Guidelines
+
+This project follows [Google's Open Source Community
+Guidelines](https://opensource.google.com/conduct/).
+
diff --git a/google-analytics-admin/noxfile_config.py b/google-analytics-admin/noxfile_config.py
index 03ab539..bcb670f 100644
--- a/google-analytics-admin/noxfile_config.py
+++ b/google-analytics-admin/noxfile_config.py
@@ -1,3 +1,17 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
 TEST_CONFIG_OVERRIDE = {
     # An envvar key for determining the project id to use. Change it
     # to 'BUILD_SPECIFIC_GCLOUD_PROJECT' if you want to opt in using a
diff --git a/google-analytics-data/noxfile_config.py b/google-analytics-data/noxfile_config.py
index b6dddd6..f350bcf 100644
--- a/google-analytics-data/noxfile_config.py
+++ b/google-analytics-data/noxfile_config.py
@@ -1,3 +1,17 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
 TEST_CONFIG_OVERRIDE = {
     # You can opt out from the test for specific Python versions.
     "ignored_versions": ["2.7"],

From e6a2b1b1d937b49589f8edca168ec872ba2af694 Mon Sep 17 00:00:00 2001
From: Josh Radcliff <jradcliff@users.noreply.github.com>
Date: Thu, 26 Oct 2023 11:08:24 -0400
Subject: [PATCH 172/213] Update READMEs and add .gitignore

---
 .gitignore                       | 64 ++++++++++++++++++++++++++++++++
 README.md                        | 16 +++++++-
 google-analytics-admin/README.md | 33 ++++++++++++++++
 google-analytics-data/README.md  |  4 +-
 4 files changed, 114 insertions(+), 3 deletions(-)
 create mode 100644 .gitignore
 create mode 100644 google-analytics-admin/README.md

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..63ee85d
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,64 @@
+*.py[cod]
+*.sw[op]
+
+# C extensions
+*.so
+
+# Packages
+*.egg
+*.egg-info
+dist
+build
+eggs
+.eggs
+parts
+bin
+var
+sdist
+develop-eggs
+.installed.cfg
+lib
+lib64
+__pycache__
+
+# Installer logs
+pip-log.txt
+
+# Unit test / coverage reports
+.coverage
+.nox
+.cache
+.pytest_cache
+
+
+# Mac
+.DS_Store
+
+# JetBrains
+.idea
+
+# VS Code
+.vscode
+
+# emacs
+*~
+
+# Built documentation
+docs/_build
+docs.metadata
+
+# Virtual environment
+env/
+venv/
+
+# Test logs
+coverage.xml
+*sponge_log.xml
+
+# System test environment variables.
+system_tests/local_test_setup
+
+# Make sure a generated file isn't accidentally committed.
+pylintrc
+pylintrc.test
+
diff --git a/README.md b/README.md
index 349092b..a832a39 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,15 @@
-# python-docs-samples
\ No newline at end of file
+# Google Analytics Python Samples
+
+Python samples for [Google Analytics APIs][ga].
+
+Check out the `README.md` in one of the following directories to get started:
+
+- Admin API: [README.md](google-analytics-admin/README.md)
+- Data API: [README.md](google-analytics-data/README.md)
+
+## Contributing
+
+Contributions welcome! See the [Contributing Guide](CONTRIBUTING.md).
+
+[ga]: https://developers.google.com/analytics
+
diff --git a/google-analytics-admin/README.md b/google-analytics-admin/README.md
new file mode 100644
index 0000000..0329571
--- /dev/null
+++ b/google-analytics-admin/README.md
@@ -0,0 +1,33 @@
+# Google Analytics Admin API examples
+
+[![Open in Cloud Shell][shell_img]][shell_link]
+
+[shell_img]: http://gstatic.com/cloudssh/images/open-btn.png
+[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleanalytics/python-docs-samples&page=editor&open_in_editor=/google-analytics-admin/README.md
+
+These samples show how to use the
+[Google Analytics Data API](https://developers.google.com/analytics/devguides/reporting/data/v1) from Python.
+
+## Build and Run
+1.  **Enable APIs** - [Enable the Analytics Data API](https://console.cloud.google.com/flows/enableapi?apiid=analyticsdata.googleapis.com)
+    and create a new project or select an existing project.
+2.  **Download The Credentials** - Configure your project using [Application Default Credentials][adc].
+    Click "Go to credentials" after enabling the APIs. Click "Create Credentials"
+    and select "Service Account Credentials" and download the credentials file. Then set the path to
+    this file to the environment variable `GOOGLE_APPLICATION_CREDENTIALS`:
+```sh
+    $ export GOOGLE_APPLICATION_CREDENTIALS=/path/to/credentials.json
+```
+3.  **Clone the repo** and cd into this directory
+```sh
+    $ git clone https://github.com/googleanalytics/python-docs-samples
+    $ cd google-analytics-admin
+```
+4.  **Install dependencies** via [pip3](https://pip.pypa.io/en/stable).
+    Run `pip3 install --upgrade google-analytics-data`.
+5.  **Review the comments starting with `TODO(developer)` and update the code
+to use correct values.**
+6.  **Run** with the command `python3 SNIPPET_NAME.py`. For example:
+```sh
+    $ python3 quickstart.py
+```
diff --git a/google-analytics-data/README.md b/google-analytics-data/README.md
index 209aaf5..08439b4 100644
--- a/google-analytics-data/README.md
+++ b/google-analytics-data/README.md
@@ -3,7 +3,7 @@
 [![Open in Cloud Shell][shell_img]][shell_link]
 
 [shell_img]: http://gstatic.com/cloudssh/images/open-btn.png
-[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleanalytics/python-docs-samples&page=editor&open_in_editor=/README.md
+[shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleanalytics/python-docs-samples&page=editor&open_in_editor=/google-analytics-data/README.md
 
 These samples show how to use the
 [Google Analytics Data API](https://developers.google.com/analytics/devguides/reporting/data/v1) from Python.
@@ -26,7 +26,7 @@ These samples show how to use the
 4.  **Install dependencies** via [pip3](https://pip.pypa.io/en/stable).
     Run `pip3 install --upgrade google-analytics-data`.
 5.  **Review the comments starting with `TODO(developer)` and update the code
-to use correct values.
+to use correct values.**
 6.  **Run** with the command `python3 SNIPPET_NAME.py`. For example:
 ```sh
     $ python3 quickstart.py

From bb384f6dda15ae8a4840088081f41d26bcad0b64 Mon Sep 17 00:00:00 2001
From: Josh Radcliff <jradcliff@users.noreply.github.com>
Date: Thu, 26 Oct 2023 11:12:41 -0400
Subject: [PATCH 173/213] Formatting fix

---
 google-analytics-admin/README.md | 20 ++++++++++----------
 google-analytics-data/README.md  | 19 ++++++++++---------
 2 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/google-analytics-admin/README.md b/google-analytics-admin/README.md
index 0329571..af4184c 100644
--- a/google-analytics-admin/README.md
+++ b/google-analytics-admin/README.md
@@ -15,19 +15,19 @@ These samples show how to use the
     Click "Go to credentials" after enabling the APIs. Click "Create Credentials"
     and select "Service Account Credentials" and download the credentials file. Then set the path to
     this file to the environment variable `GOOGLE_APPLICATION_CREDENTIALS`:
-```sh
-    $ export GOOGLE_APPLICATION_CREDENTIALS=/path/to/credentials.json
-```
+    ```sh
+    export GOOGLE_APPLICATION_CREDENTIALS=/path/to/credentials.json
+    ```
 3.  **Clone the repo** and cd into this directory
-```sh
-    $ git clone https://github.com/googleanalytics/python-docs-samples
-    $ cd google-analytics-admin
-```
+    ```sh
+    git clone https://github.com/googleanalytics/python-docs-samples
+    cd python-docs-samples/google-analytics-admin
+    ```
 4.  **Install dependencies** via [pip3](https://pip.pypa.io/en/stable).
     Run `pip3 install --upgrade google-analytics-data`.
 5.  **Review the comments starting with `TODO(developer)` and update the code
 to use correct values.**
 6.  **Run** with the command `python3 SNIPPET_NAME.py`. For example:
-```sh
-    $ python3 quickstart.py
-```
+    ```sh
+    python3 quickstart.py
+    ```
diff --git a/google-analytics-data/README.md b/google-analytics-data/README.md
index 08439b4..74fbc27 100644
--- a/google-analytics-data/README.md
+++ b/google-analytics-data/README.md
@@ -15,19 +15,20 @@ These samples show how to use the
     Click "Go to credentials" after enabling the APIs. Click "Create Credentials"
     and select "Service Account Credentials" and download the credentials file. Then set the path to
     this file to the environment variable `GOOGLE_APPLICATION_CREDENTIALS`:
-```sh
-    $ export GOOGLE_APPLICATION_CREDENTIALS=/path/to/credentials.json
-```
+
+    ```sh
+    export GOOGLE_APPLICATION_CREDENTIALS=/path/to/credentials.json
+    ```
 3.  **Clone the repo** and cd into this directory
-```sh
-    $ git clone https://github.com/googleanalytics/python-docs-samples
-    $ cd google-analytics-admin
-```
+    ```sh
+    git clone https://github.com/googleanalytics/python-docs-samples
+    cd python-docs-samples/google-analytics-admin
+    ```
 4.  **Install dependencies** via [pip3](https://pip.pypa.io/en/stable).
     Run `pip3 install --upgrade google-analytics-data`.
 5.  **Review the comments starting with `TODO(developer)` and update the code
 to use correct values.**
 6.  **Run** with the command `python3 SNIPPET_NAME.py`. For example:
-```sh
+    ```sh
     $ python3 quickstart.py
-```
+    ```

From 8a8072d72c708505a378f7bd9dbea48484b5a570 Mon Sep 17 00:00:00 2001
From: Josh Radcliff <jradcliff@users.noreply.github.com>
Date: Thu, 26 Oct 2023 11:18:21 -0400
Subject: [PATCH 174/213] Correct pip commands

---
 google-analytics-admin/README.md | 2 +-
 google-analytics-data/README.md  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/google-analytics-admin/README.md b/google-analytics-admin/README.md
index af4184c..2aeb19c 100644
--- a/google-analytics-admin/README.md
+++ b/google-analytics-admin/README.md
@@ -24,7 +24,7 @@ These samples show how to use the
     cd python-docs-samples/google-analytics-admin
     ```
 4.  **Install dependencies** via [pip3](https://pip.pypa.io/en/stable).
-    Run `pip3 install --upgrade google-analytics-data`.
+    Run `pip3 install --upgrade -r requirements.txt`.
 5.  **Review the comments starting with `TODO(developer)` and update the code
 to use correct values.**
 6.  **Run** with the command `python3 SNIPPET_NAME.py`. For example:
diff --git a/google-analytics-data/README.md b/google-analytics-data/README.md
index 74fbc27..a714d27 100644
--- a/google-analytics-data/README.md
+++ b/google-analytics-data/README.md
@@ -25,7 +25,7 @@ These samples show how to use the
     cd python-docs-samples/google-analytics-admin
     ```
 4.  **Install dependencies** via [pip3](https://pip.pypa.io/en/stable).
-    Run `pip3 install --upgrade google-analytics-data`.
+    Run `pip3 install --upgrade -r requirements.txt`.
 5.  **Review the comments starting with `TODO(developer)` and update the code
 to use correct values.**
 6.  **Run** with the command `python3 SNIPPET_NAME.py`. For example:

From e8bb96b9bc100f0af8a8f01e3a73b5b3c2ebf2c7 Mon Sep 17 00:00:00 2001
From: Josh Radcliff <jradcliff@users.noreply.github.com>
Date: Thu, 26 Oct 2023 11:20:23 -0400
Subject: [PATCH 175/213] Make pip commands formatting consistent

---
 google-analytics-admin/README.md | 4 +++-
 google-analytics-data/README.md  | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/google-analytics-admin/README.md b/google-analytics-admin/README.md
index 2aeb19c..7717064 100644
--- a/google-analytics-admin/README.md
+++ b/google-analytics-admin/README.md
@@ -24,7 +24,9 @@ These samples show how to use the
     cd python-docs-samples/google-analytics-admin
     ```
 4.  **Install dependencies** via [pip3](https://pip.pypa.io/en/stable).
-    Run `pip3 install --upgrade -r requirements.txt`.
+    ```sh
+    pip3 install --upgrade -r requirements.txt
+    ```
 5.  **Review the comments starting with `TODO(developer)` and update the code
 to use correct values.**
 6.  **Run** with the command `python3 SNIPPET_NAME.py`. For example:
diff --git a/google-analytics-data/README.md b/google-analytics-data/README.md
index a714d27..500c89c 100644
--- a/google-analytics-data/README.md
+++ b/google-analytics-data/README.md
@@ -25,7 +25,9 @@ These samples show how to use the
     cd python-docs-samples/google-analytics-admin
     ```
 4.  **Install dependencies** via [pip3](https://pip.pypa.io/en/stable).
-    Run `pip3 install --upgrade -r requirements.txt`.
+    ```sh
+    pip3 install --upgrade -r requirements.txt
+    ```
 5.  **Review the comments starting with `TODO(developer)` and update the code
 to use correct values.**
 6.  **Run** with the command `python3 SNIPPET_NAME.py`. For example:

From 5004440622626bc076512ab2b4e85298364e245a Mon Sep 17 00:00:00 2001
From: Josh Radcliff <jradcliff@users.noreply.github.com>
Date: Wed, 8 Nov 2023 17:16:36 -0500
Subject: [PATCH 176/213] Fix links in READMEs

---
 google-analytics-admin/README.md | 4 ++--
 google-analytics-data/README.md  | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/google-analytics-admin/README.md b/google-analytics-admin/README.md
index 7717064..ff4471b 100644
--- a/google-analytics-admin/README.md
+++ b/google-analytics-admin/README.md
@@ -6,10 +6,10 @@
 [shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleanalytics/python-docs-samples&page=editor&open_in_editor=/google-analytics-admin/README.md
 
 These samples show how to use the
-[Google Analytics Data API](https://developers.google.com/analytics/devguides/reporting/data/v1) from Python.
+[Google Analytics Admin API](https://developers.google.com/analytics/devguides/config/admin/v1) from Python.
 
 ## Build and Run
-1.  **Enable APIs** - [Enable the Analytics Data API](https://console.cloud.google.com/flows/enableapi?apiid=analyticsdata.googleapis.com)
+1.  **Enable APIs** - [Enable the Analytics Admin API](https://console.cloud.google.com/flows/enableapi?apiid=analyticsadmin.googleapis.com)
     and create a new project or select an existing project.
 2.  **Download The Credentials** - Configure your project using [Application Default Credentials][adc].
     Click "Go to credentials" after enabling the APIs. Click "Create Credentials"
diff --git a/google-analytics-data/README.md b/google-analytics-data/README.md
index 500c89c..d0bf5fc 100644
--- a/google-analytics-data/README.md
+++ b/google-analytics-data/README.md
@@ -22,7 +22,7 @@ These samples show how to use the
 3.  **Clone the repo** and cd into this directory
     ```sh
     git clone https://github.com/googleanalytics/python-docs-samples
-    cd python-docs-samples/google-analytics-admin
+    cd python-docs-samples/google-analytics-data
     ```
 4.  **Install dependencies** via [pip3](https://pip.pypa.io/en/stable).
     ```sh

From f63a77c6d7b355c5168c0a68f256c49b2ad01b7d Mon Sep 17 00:00:00 2001
From: Josh Radcliff <jradcliff@users.noreply.github.com>
Date: Mon, 13 Nov 2023 17:01:14 -0500
Subject: [PATCH 177/213] Remove run_report_with_custom_parameters.py

This sample is incomplete
---
 .../run_report_with_custom_parameters.py      | 41 -------------------
 1 file changed, 41 deletions(-)
 delete mode 100644 google-analytics-data/run_report_with_custom_parameters.py

diff --git a/google-analytics-data/run_report_with_custom_parameters.py b/google-analytics-data/run_report_with_custom_parameters.py
deleted file mode 100644
index e0a3191..0000000
--- a/google-analytics-data/run_report_with_custom_parameters.py
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2021 Google Inc. All Rights Reserved.
-#
-# 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.
-
-"""Google Analytics Data API sample application.
-"""
-from google.analytics.data_v1beta import BetaAnalyticsDataClient
-from google.analytics.data_v1beta.types import RunReportRequest
-
-
-def run_report_with_custom_parameters(property_id="YOUR-GA4-PROPERTY-ID"):
-    """Runs a simple report on a Google Analytics 4 property."""
-    client = BetaAnalyticsDataClient()
-
-    # [START run_report_with_custom_parameters]
-    request = RunReportRequest()
-    response = client.run_report(request)
-    # [END run_report_with_custom_parameters]
-
-    print("Report result:")
-    for row in response.rows:
-        print(row.dimension_values[0].value, row.metric_values[0].value)
-
-
-if __name__ == "__main__":
-    # TODO(developer): Replace this variable with your Google Analytics 4
-    #  property ID before running the sample.
-    property_id = "YOUR-GA4-PROPERTY-ID"
-    run_report_with_custom_parameters(property_id)

From 68ddd6cfdd0225c1637514125297ff38b4f66096 Mon Sep 17 00:00:00 2001
From: Josh Radcliff <jradcliff@users.noreply.github.com>
Date: Thu, 14 Dec 2023 16:00:33 -0500
Subject: [PATCH 178/213] Fix link to application default credentials in README
 files

---
 google-analytics-admin/README.md | 3 +++
 google-analytics-data/README.md  | 7 +++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/google-analytics-admin/README.md b/google-analytics-admin/README.md
index ff4471b..7cd267c 100644
--- a/google-analytics-admin/README.md
+++ b/google-analytics-admin/README.md
@@ -9,6 +9,7 @@ These samples show how to use the
 [Google Analytics Admin API](https://developers.google.com/analytics/devguides/config/admin/v1) from Python.
 
 ## Build and Run
+
 1.  **Enable APIs** - [Enable the Analytics Admin API](https://console.cloud.google.com/flows/enableapi?apiid=analyticsadmin.googleapis.com)
     and create a new project or select an existing project.
 2.  **Download The Credentials** - Configure your project using [Application Default Credentials][adc].
@@ -33,3 +34,5 @@ to use correct values.**
     ```sh
     python3 quickstart.py
     ```
+
+[adc]: https://cloud.google.com/docs/authentication#adc
diff --git a/google-analytics-data/README.md b/google-analytics-data/README.md
index d0bf5fc..b61aec0 100644
--- a/google-analytics-data/README.md
+++ b/google-analytics-data/README.md
@@ -9,6 +9,7 @@ These samples show how to use the
 [Google Analytics Data API](https://developers.google.com/analytics/devguides/reporting/data/v1) from Python.
 
 ## Build and Run
+
 1.  **Enable APIs** - [Enable the Analytics Data API](https://console.cloud.google.com/flows/enableapi?apiid=analyticsdata.googleapis.com)
     and create a new project or select an existing project.
 2.  **Download The Credentials** - Configure your project using [Application Default Credentials][adc].
@@ -28,9 +29,11 @@ These samples show how to use the
     ```sh
     pip3 install --upgrade -r requirements.txt
     ```
-5.  **Review the comments starting with `TODO(developer)` and update the code
-to use correct values.**
+5.  **Review the comments starting with `TODO(developer)` and update the code to
+    use correct values.**
 6.  **Run** with the command `python3 SNIPPET_NAME.py`. For example:
     ```sh
     $ python3 quickstart.py
     ```
+
+[adc]: https://cloud.google.com/docs/authentication#adc

From 3a18cd0be2860cc1a277774e2e405cb7b357832c Mon Sep 17 00:00:00 2001
From: Josh Radcliff <jradcliff@users.noreply.github.com>
Date: Mon, 18 Dec 2023 14:27:59 -0500
Subject: [PATCH 179/213] Use GA_TEST_PROPERTY_ID in tests, if set

---
 google-analytics-data/noxfile_config.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/google-analytics-data/noxfile_config.py b/google-analytics-data/noxfile_config.py
index f350bcf..ffae361 100644
--- a/google-analytics-data/noxfile_config.py
+++ b/google-analytics-data/noxfile_config.py
@@ -12,6 +12,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+import os
+
 TEST_CONFIG_OVERRIDE = {
     # You can opt out from the test for specific Python versions.
     "ignored_versions": ["2.7"],
@@ -23,5 +25,10 @@
     # 'gcloud_project_env': 'BUILD_SPECIFIC_GCLOUD_PROJECT',
     # A dictionary you want to inject into your test. Don't put any
     # secrets here. These values will override predefined values.
-    "envs": {"GA_TEST_PROPERTY_ID": "222596558"},
+    #
+    # Adds the GA_TEST_PROPERTY_ID required by tests for Google Analytics
+    # Data samples. Uses a specific test property by default, but can
+    # be overridden by setting this environment variable before running
+    # nox.
+    "envs": {"GA_TEST_PROPERTY_ID": os.getenv("GA_TEST_PROPERTY_ID", "222596558")},
 }

From 1465aced14bbc92d268e64ed9e3b373097dae990 Mon Sep 17 00:00:00 2001
From: Josh Radcliff <jradcliff@users.noreply.github.com>
Date: Mon, 18 Dec 2023 14:37:38 -0500
Subject: [PATCH 180/213] Updated data noxfile.py using latest version of
 noxfile-template.py

See: https://github.com/GoogleCloudPlatform/python-docs-samples/blob/main/noxfile-template.py
---
 google-analytics-data/noxfile.py | 126 +++++++++++++++++--------------
 1 file changed, 68 insertions(+), 58 deletions(-)

diff --git a/google-analytics-data/noxfile.py b/google-analytics-data/noxfile.py
index de104db..7832fa2 100644
--- a/google-analytics-data/noxfile.py
+++ b/google-analytics-data/noxfile.py
@@ -12,27 +12,27 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+from __future__ import annotations
 from __future__ import print_function
 
+from collections.abc import Callable
 import glob
 import os
 from pathlib import Path
 import sys
-from typing import Callable, Dict, Optional
 
 import nox
 
+
 # WARNING - WARNING - WARNING - WARNING - WARNING
 # WARNING - WARNING - WARNING - WARNING - WARNING
-#           DO NOT EDIT THIS FILE EVER!
+#       BE CAREFUL WHEN EDITING THIS FILE!
 # WARNING - WARNING - WARNING - WARNING - WARNING
 # WARNING - WARNING - WARNING - WARNING - WARNING
 
-BLACK_VERSION = "black==22.3.0"
-ISORT_VERSION = "isort==5.10.1"
-
 # Copy `noxfile_config.py` to your directory and modify it instead.
 
+
 # `TEST_CONFIG` dict is a configuration hook that allows users to
 # modify the test configurations. The values here should be in sync
 # with `noxfile_config.py`. Users will copy `noxfile_config.py` into
@@ -40,7 +40,7 @@
 
 TEST_CONFIG = {
     # You can opt out from the test for specific Python versions.
-    "ignored_versions": [],
+    "ignored_versions": ["2.7", "3.7", "3.9", "3.10", "3.11"],
     # Old samples are opted out of enforcing Python type hints
     # All new samples should feature them
     "enforce_type_hints": False,
@@ -72,7 +72,7 @@
 TEST_CONFIG.update(TEST_CONFIG_OVERRIDE)
 
 
-def get_pytest_env_vars() -> Dict[str, str]:
+def get_pytest_env_vars() -> dict[str, str]:
     """Returns a dict for pytest invocation."""
     ret = {}
 
@@ -80,25 +80,22 @@ def get_pytest_env_vars() -> Dict[str, str]:
     env_key = TEST_CONFIG["gcloud_project_env"]
     # This should error out if not set.
     ret["GOOGLE_CLOUD_PROJECT"] = os.environ[env_key]
+    ret["GCLOUD_PROJECT"] = os.environ[env_key]  # deprecated
 
     # Apply user supplied envs.
     ret.update(TEST_CONFIG["envs"])
     return ret
 
 
-# DO NOT EDIT - automatically generated.
-# All versions used to test samples.
-ALL_VERSIONS = ["3.7", "3.8", "3.9", "3.10", "3.11"]
+# All versions used to tested samples.
+ALL_VERSIONS = ["2.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
 
 # Any default versions that should be ignored.
 IGNORED_VERSIONS = TEST_CONFIG["ignored_versions"]
 
 TESTED_VERSIONS = sorted([v for v in ALL_VERSIONS if v not in IGNORED_VERSIONS])
 
-INSTALL_LIBRARY_FROM_SOURCE = os.environ.get("INSTALL_LIBRARY_FROM_SOURCE", False) in (
-    "True",
-    "true",
-)
+INSTALL_LIBRARY_FROM_SOURCE = bool(os.environ.get("INSTALL_LIBRARY_FROM_SOURCE", False))
 
 # Error if a python version is missing
 nox.options.error_on_missing_interpreters = True
@@ -108,9 +105,26 @@ def get_pytest_env_vars() -> Dict[str, str]:
 #
 
 
+def _determine_local_import_names(start_dir: str) -> list[str]:
+    """Determines all import names that should be considered "local".
+
+    This is used when running the linter to ensure that import order is
+    properly checked.
+    """
+    file_ext_pairs = [os.path.splitext(path) for path in os.listdir(start_dir)]
+    return [
+        basename
+        for basename, extension in file_ext_pairs
+        if extension == ".py"
+        or os.path.isdir(os.path.join(start_dir, basename))
+        and basename not in ("__pycache__")
+    ]
+
+
 # Linting with flake8.
 #
 # We ignore the following rules:
+#   ANN101: missing type annotation for self in method
 #   E203: whitespace before ‘:’
 #   E266: too many leading ‘#’ for block comment
 #   E501: line too long
@@ -122,8 +136,9 @@ def get_pytest_env_vars() -> Dict[str, str]:
     "--show-source",
     "--builtin=gettext",
     "--max-complexity=20",
+    "--import-order-style=google",
     "--exclude=.nox,.cache,env,lib,generated_pb2,*_pb2.py,*_pb2_grpc.py",
-    "--ignore=E121,E123,E126,E203,E226,E24,E266,E501,E704,W503,W504,I202",
+    "--ignore=ANN101,E121,E123,E126,E203,E226,E24,E266,E501,E704,W503,W504,I202",
     "--max-line-length=88",
 ]
 
@@ -131,11 +146,14 @@ def get_pytest_env_vars() -> Dict[str, str]:
 @nox.session
 def lint(session: nox.sessions.Session) -> None:
     if not TEST_CONFIG["enforce_type_hints"]:
-        session.install("flake8")
+        session.install("flake8", "flake8-import-order")
     else:
-        session.install("flake8", "flake8-annotations")
+        session.install("flake8", "flake8-import-order", "flake8-annotations")
 
+    local_names = _determine_local_import_names(".")
     args = FLAKE8_COMMON_ARGS + [
+        "--application-import-names",
+        ",".join(local_names),
         ".",
     ]
     session.run("flake8", *args)
@@ -148,30 +166,9 @@ def lint(session: nox.sessions.Session) -> None:
 
 @nox.session
 def blacken(session: nox.sessions.Session) -> None:
-    """Run black. Format code to uniform standard."""
-    session.install(BLACK_VERSION)
-    python_files = [path for path in os.listdir(".") if path.endswith(".py")]
-
-    session.run("black", *python_files)
-
-
-#
-# format = isort + black
-#
-
-
-@nox.session
-def format(session: nox.sessions.Session) -> None:
-    """
-    Run isort to sort imports. Then run black
-    to format code to uniform standard.
-    """
-    session.install(BLACK_VERSION, ISORT_VERSION)
+    session.install("black")
     python_files = [path for path in os.listdir(".") if path.endswith(".py")]
 
-    # Use the --fss option to sort imports using strict alphabetical order.
-    # See https://pycqa.github.io/isort/docs/configuration/options.html#force-sort-within-sections
-    session.run("isort", "--fss", *python_files)
     session.run("black", *python_files)
 
 
@@ -187,10 +184,8 @@ def _session_tests(
     session: nox.sessions.Session, post_install: Callable = None
 ) -> None:
     # check for presence of tests
-    test_list = glob.glob("**/*_test.py", recursive=True) + glob.glob(
-        "**/test_*.py", recursive=True
-    )
-    test_list.extend(glob.glob("**/tests", recursive=True))
+    test_list = glob.glob("*_test.py") + glob.glob("test_*.py")
+    test_list.extend(glob.glob("tests"))
 
     if len(test_list) == 0:
         print("No tests found, skipping directory.")
@@ -199,23 +194,42 @@ def _session_tests(
     if TEST_CONFIG["pip_version_override"]:
         pip_version = TEST_CONFIG["pip_version_override"]
         session.install(f"pip=={pip_version}")
+    else:
+        session.install("--upgrade", "pip")
+
     """Runs py.test for a particular project."""
     concurrent_args = []
     if os.path.exists("requirements.txt"):
-        if os.path.exists("constraints.txt"):
-            session.install("-r", "requirements.txt", "-c", "constraints.txt")
-        else:
-            session.install("-r", "requirements.txt")
         with open("requirements.txt") as rfile:
             packages = rfile.read()
+        if os.path.exists("constraints.txt"):
+            session.install(
+                "-r",
+                "requirements.txt",
+                "-c",
+                "constraints.txt",
+                "--only-binary",
+                ":all",
+            )
+        elif "pyspark" in packages:
+            session.install("-r", "requirements.txt", "--use-pep517")
+        else:
+            session.install("-r", "requirements.txt", "--only-binary", ":all")
 
     if os.path.exists("requirements-test.txt"):
-        if os.path.exists("constraints-test.txt"):
-            session.install("-r", "requirements-test.txt", "-c", "constraints-test.txt")
-        else:
-            session.install("-r", "requirements-test.txt")
         with open("requirements-test.txt") as rtfile:
             packages += rtfile.read()
+        if os.path.exists("constraints-test.txt"):
+            session.install(
+                "-r",
+                "requirements-test.txt",
+                "-c",
+                "constraints-test.txt",
+                "--only-binary",
+                ":all",
+            )
+        else:
+            session.install("-r", "requirements-test.txt", "--only-binary", ":all")
 
     if INSTALL_LIBRARY_FROM_SOURCE:
         session.install("-e", _get_repo_root())
@@ -255,20 +269,16 @@ def py(session: nox.sessions.Session) -> None:
 #
 
 
-def _get_repo_root() -> Optional[str]:
+def _get_repo_root() -> str | None:
     """Returns the root folder of the project."""
-    # Get root of this repository. Assume we don't have directories nested deeper than 10 items.
+    # Get root of this repository.
+    # Assume we don't have directories nested deeper than 10 items.
     p = Path(os.getcwd())
     for i in range(10):
         if p is None:
             break
         if Path(p / ".git").exists():
             return str(p)
-        # .git is not available in repos cloned via Cloud Build
-        # setup.py is always in the library's root, so use that instead
-        # https://github.com/googleapis/synthtool/issues/792
-        if Path(p / "setup.py").exists():
-            return str(p)
         p = p.parent
     raise Exception("Unable to detect repository root.")
 

From 365301e611892aafc2138ef041e69b860241d5e7 Mon Sep 17 00:00:00 2001
From: Josh Radcliff <jradcliff@users.noreply.github.com>
Date: Mon, 18 Dec 2023 15:44:16 -0500
Subject: [PATCH 181/213] Deleted all samples for the user_link resource
 (removed from the API)

---
 .../accounts_user_links_audit.py              | 66 --------------
 .../accounts_user_links_audit_test.py         | 29 ------
 .../accounts_user_links_batch_create.py       | 89 ------------------
 .../accounts_user_links_batch_create_test.py  | 33 -------
 .../accounts_user_links_batch_delete.py       | 80 ----------------
 .../accounts_user_links_batch_delete_test.py  | 31 -------
 .../accounts_user_links_batch_get.py          | 71 ---------------
 .../accounts_user_links_batch_get_test.py     | 30 ------
 .../accounts_user_links_batch_update.py       | 91 -------------------
 .../accounts_user_links_batch_update_test.py  | 31 -------
 .../accounts_user_links_create.py             | 78 ----------------
 .../accounts_user_links_create_test.py        | 33 -------
 .../accounts_user_links_delete.py             | 72 ---------------
 .../accounts_user_links_delete_test.py        | 31 -------
 .../accounts_user_links_get.py                | 73 ---------------
 .../accounts_user_links_get_test.py           | 30 ------
 .../accounts_user_links_list.py               | 57 ------------
 .../accounts_user_links_list_test.py          | 29 ------
 .../accounts_user_links_update.py             | 78 ----------------
 .../accounts_user_links_update_test.py        | 31 -------
 .../properties_user_links_audit.py            | 68 --------------
 .../properties_user_links_audit_test.py       | 29 ------
 .../properties_user_links_batch_create.py     | 90 ------------------
 ...properties_user_links_batch_create_test.py | 31 -------
 .../properties_user_links_batch_delete.py     | 80 ----------------
 ...properties_user_links_batch_delete_test.py | 31 -------
 .../properties_user_links_batch_get.py        | 72 ---------------
 .../properties_user_links_batch_get_test.py   | 30 ------
 .../properties_user_links_batch_update.py     | 91 -------------------
 ...properties_user_links_batch_update_test.py | 31 -------
 .../properties_user_links_create.py           | 78 ----------------
 .../properties_user_links_create_test.py      | 31 -------
 .../properties_user_links_delete.py           | 72 ---------------
 .../properties_user_links_delete_test.py      | 31 -------
 .../properties_user_links_get.py              | 73 ---------------
 .../properties_user_links_get_test.py         | 30 ------
 .../properties_user_links_list.py             | 58 ------------
 .../properties_user_links_list_test.py        | 29 ------
 .../properties_user_links_update.py           | 78 ----------------
 .../properties_user_links_update_test.py      | 31 -------
 40 files changed, 2127 deletions(-)
 delete mode 100644 google-analytics-admin/accounts_user_links_audit.py
 delete mode 100644 google-analytics-admin/accounts_user_links_audit_test.py
 delete mode 100644 google-analytics-admin/accounts_user_links_batch_create.py
 delete mode 100644 google-analytics-admin/accounts_user_links_batch_create_test.py
 delete mode 100644 google-analytics-admin/accounts_user_links_batch_delete.py
 delete mode 100644 google-analytics-admin/accounts_user_links_batch_delete_test.py
 delete mode 100644 google-analytics-admin/accounts_user_links_batch_get.py
 delete mode 100644 google-analytics-admin/accounts_user_links_batch_get_test.py
 delete mode 100644 google-analytics-admin/accounts_user_links_batch_update.py
 delete mode 100644 google-analytics-admin/accounts_user_links_batch_update_test.py
 delete mode 100644 google-analytics-admin/accounts_user_links_create.py
 delete mode 100644 google-analytics-admin/accounts_user_links_create_test.py
 delete mode 100644 google-analytics-admin/accounts_user_links_delete.py
 delete mode 100644 google-analytics-admin/accounts_user_links_delete_test.py
 delete mode 100644 google-analytics-admin/accounts_user_links_get.py
 delete mode 100644 google-analytics-admin/accounts_user_links_get_test.py
 delete mode 100644 google-analytics-admin/accounts_user_links_list.py
 delete mode 100644 google-analytics-admin/accounts_user_links_list_test.py
 delete mode 100644 google-analytics-admin/accounts_user_links_update.py
 delete mode 100644 google-analytics-admin/accounts_user_links_update_test.py
 delete mode 100644 google-analytics-admin/properties_user_links_audit.py
 delete mode 100644 google-analytics-admin/properties_user_links_audit_test.py
 delete mode 100644 google-analytics-admin/properties_user_links_batch_create.py
 delete mode 100644 google-analytics-admin/properties_user_links_batch_create_test.py
 delete mode 100644 google-analytics-admin/properties_user_links_batch_delete.py
 delete mode 100644 google-analytics-admin/properties_user_links_batch_delete_test.py
 delete mode 100644 google-analytics-admin/properties_user_links_batch_get.py
 delete mode 100644 google-analytics-admin/properties_user_links_batch_get_test.py
 delete mode 100644 google-analytics-admin/properties_user_links_batch_update.py
 delete mode 100644 google-analytics-admin/properties_user_links_batch_update_test.py
 delete mode 100644 google-analytics-admin/properties_user_links_create.py
 delete mode 100644 google-analytics-admin/properties_user_links_create_test.py
 delete mode 100644 google-analytics-admin/properties_user_links_delete.py
 delete mode 100644 google-analytics-admin/properties_user_links_delete_test.py
 delete mode 100644 google-analytics-admin/properties_user_links_get.py
 delete mode 100644 google-analytics-admin/properties_user_links_get_test.py
 delete mode 100644 google-analytics-admin/properties_user_links_list.py
 delete mode 100644 google-analytics-admin/properties_user_links_list_test.py
 delete mode 100644 google-analytics-admin/properties_user_links_update.py
 delete mode 100644 google-analytics-admin/properties_user_links_update_test.py

diff --git a/google-analytics-admin/accounts_user_links_audit.py b/google-analytics-admin/accounts_user_links_audit.py
deleted file mode 100644
index bc58353..0000000
--- a/google-analytics-admin/accounts_user_links_audit.py
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-"""Google Analytics Admin API sample application which prints all user links on
-an account.
-
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts.userLinks/audit
-for more information.
-"""
-# [START analyticsadmin_accounts_user_links_audit]
-from google.analytics.admin import AnalyticsAdminServiceClient
-from google.analytics.admin_v1alpha.types import AuditUserLinksRequest
-
-
-def run_sample():
-    """Runs the sample."""
-    # TODO(developer): Replace this variable with your Google Analytics
-    #  account ID (e.g. "123456") before running the sample.
-    account_id = "YOUR-GA-ACCOUNT-ID"
-    audit_account_user_links(account_id)
-
-
-def audit_account_user_links(account_id: str, transport: str = None):
-    """
-    Lists all user links on an account, including implicit ones that come
-    from effective permissions granted by groups or organization admin roles.
-
-    Args:
-        account_id(str): The Google Analytics Account ID.
-        transport(str): The transport to use. For example, "grpc"
-            or "rest". If set to None, a transport is chosen automatically.
-    """
-    client = AnalyticsAdminServiceClient(transport=transport)
-
-    print("Result:")
-    for user_link in client.audit_user_links(
-        AuditUserLinksRequest(parent=f"accounts/{account_id}")
-    ):
-        print(f"Resource name: {user_link.name}")
-        print(f"Email address: {user_link.email_address}")
-        for direct_role in user_link.direct_roles:
-            print(f"Direct role: {direct_role}")
-
-        for effective_role in user_link.effective_roles:
-            print(f"Effective role: {effective_role}")
-        print()
-
-
-# [END analyticsadmin_accounts_user_links_audit]
-
-
-if __name__ == "__main__":
-    run_sample()
diff --git a/google-analytics-admin/accounts_user_links_audit_test.py b/google-analytics-admin/accounts_user_links_audit_test.py
deleted file mode 100644
index d272477..0000000
--- a/google-analytics-admin/accounts_user_links_audit_test.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-import os
-
-import accounts_user_links_audit
-
-TEST_ACCOUNT_ID = os.getenv("GA_TEST_ACCOUNT_ID")
-
-
-def test_accounts_user_links_audit(capsys):
-    transports = ["grpc", "rest"]
-    for transport in transports:
-        accounts_user_links_audit.audit_account_user_links(
-            TEST_ACCOUNT_ID, transport=transport
-        )
-        out, _ = capsys.readouterr()
-        assert "Result" in out
diff --git a/google-analytics-admin/accounts_user_links_batch_create.py b/google-analytics-admin/accounts_user_links_batch_create.py
deleted file mode 100644
index ca4d455..0000000
--- a/google-analytics-admin/accounts_user_links_batch_create.py
+++ /dev/null
@@ -1,89 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-"""Google Analytics Admin API sample application which creates a user link for
-the account using a batch call.
-
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts.userLinks/batchCreate
-for more information.
-"""
-# [START analyticsadmin_accounts_user_links_batch_create]
-from google.analytics.admin import AnalyticsAdminServiceClient
-from google.analytics.admin_v1alpha.types import (
-    BatchCreateUserLinksRequest,
-    CreateUserLinkRequest,
-    UserLink,
-)
-
-
-def run_sample():
-    """Runs the sample."""
-
-    # !!! ATTENTION !!!
-    #  Running this sample may change/delete your Google Analytics account
-    #  configuration. Make sure to not use the Google Analytics account ID from
-    #  your production environment below.
-
-    # TODO(developer): Replace this variable with your Google Analytics
-    #  account ID (e.g. "123456") before running the sample.
-    account_id = "YOUR-GA-ACCOUNT-ID"
-
-    # TODO(developer): Replace this variable with an email address of the user to
-    #  link. This user will be given access to your account after running the
-    #  sample.
-    email_address = "TEST-EMAIL-ADDRESS"
-
-    batch_create_account_user_link(account_id, email_address)
-
-
-def batch_create_account_user_link(
-    account_id: str, email_address: str, transport: str = None
-):
-    """
-    Creates a user link for the account using a batch call.
-
-    Args:
-        account_id(str): The Google Analytics Account ID.
-        email_address(str): Email address of the user to link.
-        transport(str): The transport to use. For example, "grpc"
-            or "rest". If set to None, a transport is chosen automatically.
-    """
-    client = AnalyticsAdminServiceClient(transport=transport)
-    response = client.batch_create_user_links(
-        BatchCreateUserLinksRequest(
-            parent=f"accounts/{account_id}",
-            requests=[
-                CreateUserLinkRequest(
-                    user_link=UserLink(
-                        email_address=email_address,
-                        direct_roles=["predefinedRoles/read"],
-                    )
-                )
-            ],
-            notify_new_users=True,
-        )
-    )
-
-    print("Result:")
-    for user_link in response.user_links:
-        print(user_link)
-        print()
-
-
-# [END analyticsadmin_accounts_user_links_batch_create]
-
-if __name__ == "__main__":
-    run_sample()
diff --git a/google-analytics-admin/accounts_user_links_batch_create_test.py b/google-analytics-admin/accounts_user_links_batch_create_test.py
deleted file mode 100644
index ea51ee2..0000000
--- a/google-analytics-admin/accounts_user_links_batch_create_test.py
+++ /dev/null
@@ -1,33 +0,0 @@
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-import os
-
-import pytest
-
-import accounts_user_links_batch_create
-
-FAKE_ACCOUNT_ID = "1"
-TEST_EMAIL_ADDRESS = os.getenv("GA_TEST_EMAIL_ADDRESS")
-
-
-def test_accounts_user_links_batch_create():
-    transports = ["grpc", "rest"]
-    for transport in transports:
-        # This test ensures that the call is valid and reaches the server, even
-        # though the operation does not succeed due to permission error.
-        with pytest.raises(Exception, match="The caller does not have permission"):
-            accounts_user_links_batch_create.batch_create_account_user_link(
-                FAKE_ACCOUNT_ID, TEST_EMAIL_ADDRESS, transport=transport
-            )
diff --git a/google-analytics-admin/accounts_user_links_batch_delete.py b/google-analytics-admin/accounts_user_links_batch_delete.py
deleted file mode 100644
index 0b7ba16..0000000
--- a/google-analytics-admin/accounts_user_links_batch_delete.py
+++ /dev/null
@@ -1,80 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-"""Google Analytics Admin API sample application which deletes the user link
-using a batch call.
-
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts.userLinks/batchDelete
-for more information.
-"""
-# [START analyticsadmin_accounts_user_links_batch_delete]
-from google.analytics.admin import AnalyticsAdminServiceClient
-from google.analytics.admin_v1alpha.types import (
-    BatchDeleteUserLinksRequest,
-    DeleteUserLinkRequest,
-)
-
-
-def run_sample():
-    """Runs the sample."""
-
-    # !!! ATTENTION !!!
-    #  Running this sample may change/delete your Google Analytics account
-    #  configuration. Make sure to not use the Google Analytics property ID from
-    #  your production environment below.
-
-    # TODO(developer): Replace this variable with your Google Analytics
-    #  account ID (e.g. "123456") before running the sample.
-    account_id = "YOUR-GA-ACCOUNT-ID"
-
-    # TODO(developer): Replace this variable with your Google Analytics
-    #  account user link ID (e.g. "123456") before running the sample.
-    account_user_link_id = "YOUR-ACCOUNT-USER-LINK-ID"
-
-    batch_delete_account_user_link(account_id, account_user_link_id)
-
-
-def batch_delete_account_user_link(
-    account_id: str, account_user_link_id: str, transport: str = None
-):
-    """
-    Deletes the user link using a batch call.
-
-    Args:
-        account_id(str): The Google Analytics Account ID.
-        account_user_link_id(str): Google Analytics account user link ID.
-        transport(str): The transport to use. For example, "grpc"
-            or "rest". If set to None, a transport is chosen automatically.
-    """
-    client = AnalyticsAdminServiceClient(transport=transport)
-    client.batch_delete_user_links(
-        BatchDeleteUserLinksRequest(
-            parent=f"accounts/{account_id}",
-            requests=[
-                DeleteUserLinkRequest(
-                    name=f"accounts/{account_id}/userLinks/{account_user_link_id}"
-                )
-            ],
-        )
-    )
-    print("User link deleted")
-
-
-# [END analyticsadmin_accounts_user_links_batch_delete]
-
-
-if __name__ == "__main__":
-    run_sample()
diff --git a/google-analytics-admin/accounts_user_links_batch_delete_test.py b/google-analytics-admin/accounts_user_links_batch_delete_test.py
deleted file mode 100644
index e26e7bb..0000000
--- a/google-analytics-admin/accounts_user_links_batch_delete_test.py
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-import pytest
-
-import accounts_user_links_batch_delete
-
-FAKE_ACCOUNT_ID = "1"
-FAKE_ACCOUNT_USER_LINK_ID = "1"
-
-
-def test_accounts_user_links_batch_delete():
-    transports = ["grpc", "rest"]
-    for transport in transports:
-        # This test ensures that the call is valid and reaches the server, even
-        # though the operation does not succeed due to permission error.
-        with pytest.raises(Exception, match="The caller does not have permission"):
-            accounts_user_links_batch_delete.batch_delete_account_user_link(
-                FAKE_ACCOUNT_ID, FAKE_ACCOUNT_USER_LINK_ID, transport=transport
-            )
diff --git a/google-analytics-admin/accounts_user_links_batch_get.py b/google-analytics-admin/accounts_user_links_batch_get.py
deleted file mode 100644
index baf989d..0000000
--- a/google-analytics-admin/accounts_user_links_batch_get.py
+++ /dev/null
@@ -1,71 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-"""Google Analytics Admin API sample application which prints the details for
-the account user link using a batch call.
-
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts.userLinks/batchGet
-for more information.
-"""
-# [START analyticsadmin_accounts_user_links_batch_get]
-from google.analytics.admin import AnalyticsAdminServiceClient
-from google.analytics.admin_v1alpha.types import BatchGetUserLinksRequest
-
-
-def run_sample():
-    """Runs the sample."""
-    # TODO(developer): Replace this variable with your Google Analytics
-    #  account ID (e.g. "123456") before running the sample.
-    account_id = "YOUR-GA-ACCOUNT-ID"
-
-    # TODO(developer): Replace this variable with your Google Analytics
-    #  account user link ID (e.g. "123456") before running the sample.
-    account_user_link_id = "YOUR-ACCOUNT-USER-LINK-ID"
-
-    batch_get_account_user_link(account_id, account_user_link_id)
-
-
-def batch_get_account_user_link(
-    account_id: str, account_user_link_id: str, transport: str = None
-):
-    """
-    Retrieves details for the account user link using a batch call.
-
-    Args:
-        account_id(str): The Google Analytics Account ID.
-        account_user_link_id(str): Google Analytics account user link ID.
-        transport(str): The transport to use. For example, "grpc"
-            or "rest". If set to None, a transport is chosen automatically.
-    """
-    client = AnalyticsAdminServiceClient(transport=transport)
-    response = client.batch_get_user_links(
-        BatchGetUserLinksRequest(
-            parent=f"accounts/{account_id}",
-            names=[f"accounts/{account_id}/userLinks/{account_user_link_id}"],
-        )
-    )
-
-    print("Result:")
-    for user_link in response.user_links:
-        print(user_link)
-        print()
-
-
-# [END analyticsadmin_accounts_user_links_batch_get]
-
-
-if __name__ == "__main__":
-    run_sample()
diff --git a/google-analytics-admin/accounts_user_links_batch_get_test.py b/google-analytics-admin/accounts_user_links_batch_get_test.py
deleted file mode 100644
index 02aa796..0000000
--- a/google-analytics-admin/accounts_user_links_batch_get_test.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-import os
-
-import accounts_user_links_batch_get
-
-TEST_ACCOUNT_ID = os.getenv("GA_TEST_ACCOUNT_ID")
-TEST_USER_LINK_ID = os.getenv("GA_TEST_USER_LINK_ID")
-
-
-def test_accounts_user_links_batch_get(capsys):
-    transports = ["grpc", "rest"]
-    for transport in transports:
-        accounts_user_links_batch_get.batch_get_account_user_link(
-            TEST_ACCOUNT_ID, TEST_USER_LINK_ID, transport=transport
-        )
-        out, _ = capsys.readouterr()
-        assert "Result" in out
diff --git a/google-analytics-admin/accounts_user_links_batch_update.py b/google-analytics-admin/accounts_user_links_batch_update.py
deleted file mode 100644
index 3b401fc..0000000
--- a/google-analytics-admin/accounts_user_links_batch_update.py
+++ /dev/null
@@ -1,91 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-"""Google Analytics Admin API sample application which updates the account
-user link using a batch call.
-
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts.userLinks/batchUpdate
-for more information.
-"""
-# [START analyticsadmin_accounts_user_links_batch_update]
-from google.analytics.admin import AnalyticsAdminServiceClient
-from google.analytics.admin_v1alpha.types import (
-    BatchUpdateUserLinksRequest,
-    UpdateUserLinkRequest,
-    UserLink,
-)
-
-
-def run_sample():
-    """Runs the sample."""
-
-    # !!! ATTENTION !!!
-    #  Running this sample may change/delete your Google Analytics account
-    #  configuration. Make sure to not use the Google Analytics property ID from
-    #  your production environment below.
-
-    # TODO(developer): Replace this variable with your Google Analytics
-    #  account ID (e.g. "123456") before running the sample.
-    account_id = "YOUR-GA-ACCOUNT-ID"
-
-    # TODO(developer): Replace this variable with your Google Analytics
-    #  account user link ID (e.g. "123456") before running the sample.
-    account_user_link_id = "YOUR-ACCOUNT-USER-LINK-ID"
-
-    batch_update_account_user_link(account_id, account_user_link_id)
-
-
-def batch_update_account_user_link(
-    account_id: str, account_user_link_id: str, transport: str = None
-):
-    """
-    Updates the account user link using a batch call.
-
-    Args:
-        account_id(str): The Google Analytics Account ID.
-        account_user_link_id(str): Google Analytics account user link ID.
-        transport(str): The transport to use. For example, "grpc"
-            or "rest". If set to None, a transport is chosen automatically.
-    """
-    client = AnalyticsAdminServiceClient(transport=transport)
-    # This call updates the email address and direct roles of the user link.
-    # The user link to update is specified in the `name` field of the `UserLink`
-    # instance.
-    response = client.batch_update_user_links(
-        BatchUpdateUserLinksRequest(
-            parent=f"accounts/{account_id}",
-            requests=[
-                UpdateUserLinkRequest(
-                    user_link=UserLink(
-                        name=f"accounts/{account_id}/userLinks/{account_user_link_id}",
-                        direct_roles=["predefinedRoles/collaborate"],
-                    ),
-                )
-            ],
-        )
-    )
-
-    print("Result:")
-    for user_link in response.user_links:
-        print(user_link)
-        print()
-
-
-# [END analyticsadmin_accounts_user_links_batch_update]
-
-
-if __name__ == "__main__":
-    run_sample()
diff --git a/google-analytics-admin/accounts_user_links_batch_update_test.py b/google-analytics-admin/accounts_user_links_batch_update_test.py
deleted file mode 100644
index 7fda9a6..0000000
--- a/google-analytics-admin/accounts_user_links_batch_update_test.py
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-import pytest
-
-import accounts_user_links_batch_update
-
-FAKE_ACCOUNT_ID = "1"
-FAKE_ACCOUNT_USER_LINK_ID = "1"
-
-
-def test_accounts_user_links_batch_update():
-    transports = ["grpc", "rest"]
-    for transport in transports:
-        # This test ensures that the call is valid and reaches the server, even
-        # though the operation does not succeed due to permission error.
-        with pytest.raises(Exception, match="The caller does not have permission"):
-            accounts_user_links_batch_update.batch_update_account_user_link(
-                FAKE_ACCOUNT_ID, FAKE_ACCOUNT_USER_LINK_ID, transport=transport
-            )
diff --git a/google-analytics-admin/accounts_user_links_create.py b/google-analytics-admin/accounts_user_links_create.py
deleted file mode 100644
index 4b05540..0000000
--- a/google-analytics-admin/accounts_user_links_create.py
+++ /dev/null
@@ -1,78 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-"""Google Analytics Admin API sample application which creates a user link
-for the account.
-
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts.userLinks/create
-for more information.
-"""
-# [START analyticsadmin_accounts_user_links_create]
-from google.analytics.admin import AnalyticsAdminServiceClient
-from google.analytics.admin_v1alpha.types import CreateUserLinkRequest, UserLink
-
-
-def run_sample():
-    """Runs the sample."""
-
-    # !!! ATTENTION !!!
-    #  Running this sample may change/delete your Google Analytics account
-    #  configuration. Make sure to not use the Google Analytics account ID from
-    #  your production environment below.
-
-    # TODO(developer): Replace this variable with your Google Analytics
-    #  account ID (e.g. "123456") before running the sample.
-    account_id = "YOUR-GA-ACCOUNT-ID"
-
-    # TODO(developer): Replace this variable with an email address of the user to
-    #  link. This user will be given access to your account after running the
-    #  sample.
-    email_address = "TEST-EMAIL-ADDRESS"
-
-    create_account_user_link(account_id, email_address)
-
-
-def create_account_user_link(
-    account_id: str, email_address: str, transport: str = None
-):
-    """
-    Creates a user link for the account.
-
-    Args:
-        account_id(str): The Google Analytics Account ID.
-        email_address(str): Email address of the user to link.
-        transport(str): The transport to use. For example, "grpc"
-            or "rest". If set to None, a transport is chosen automatically.
-    """
-    client = AnalyticsAdminServiceClient(transport=transport)
-    user_link = client.create_user_link(
-        CreateUserLinkRequest(
-            parent=f"accounts/{account_id}",
-            user_link=UserLink(
-                email_address=email_address, direct_roles=["predefinedRoles/read"]
-            ),
-            notify_new_user=True,
-        )
-    )
-
-    print("Result:")
-    print(user_link)
-
-
-# [END analyticsadmin_accounts_user_links_create]
-
-if __name__ == "__main__":
-    run_sample()
diff --git a/google-analytics-admin/accounts_user_links_create_test.py b/google-analytics-admin/accounts_user_links_create_test.py
deleted file mode 100644
index 720d21f..0000000
--- a/google-analytics-admin/accounts_user_links_create_test.py
+++ /dev/null
@@ -1,33 +0,0 @@
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-import os
-
-import pytest
-
-import accounts_user_links_create
-
-FAKE_ACCOUNT_ID = "1"
-TEST_EMAIL_ADDRESS = os.getenv("GA_TEST_EMAIL_ADDRESS")
-
-
-def test_accounts_user_links_create():
-    transports = ["grpc", "rest"]
-    for transport in transports:
-        # This test ensures that the call is valid and reaches the server, even
-        # though the operation does not succeed due to permission error.
-        with pytest.raises(Exception, match="The caller does not have permission"):
-            accounts_user_links_create.create_account_user_link(
-                FAKE_ACCOUNT_ID, TEST_EMAIL_ADDRESS, transport=transport
-            )
diff --git a/google-analytics-admin/accounts_user_links_delete.py b/google-analytics-admin/accounts_user_links_delete.py
deleted file mode 100644
index 03dab71..0000000
--- a/google-analytics-admin/accounts_user_links_delete.py
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-"""Google Analytics Admin API sample application which deletes the user link
-for the account.
-
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts.userLinks/delete
-for more information.
-"""
-# [START analyticsadmin_accounts_user_links_delete]
-from google.analytics.admin import AnalyticsAdminServiceClient
-from google.analytics.admin_v1alpha.types import DeleteUserLinkRequest
-
-
-def run_sample():
-    """Runs the sample."""
-
-    # !!! ATTENTION !!!
-    #  Running this sample may change/delete your Google Analytics account
-    #  configuration. Make sure to not use the Google Analytics property ID from
-    #  your production environment below.
-
-    # TODO(developer): Replace this variable with your Google Analytics
-    #  account ID (e.g. "123456") before running the sample.
-    account_id = "YOUR-GA-ACCOUNT-ID"
-
-    # TODO(developer): Replace this variable with your Google Analytics
-    #  account user link ID (e.g. "123456") before running the sample.
-    account_user_link_id = "YOUR-ACCOUNT-USER-LINK-ID"
-
-    delete_account_user_link(account_id, account_user_link_id)
-
-
-def delete_account_user_link(
-    account_id: str, account_user_link_id: str, transport: str = None
-):
-    """
-    Deletes the user link for the account.
-
-    Args:
-        account_id(str): The Google Analytics Account ID.
-        account_user_link_id(str): Google Analytics account user link ID.
-        transport(str): The transport to use. For example, "grpc"
-            or "rest". If set to None, a transport is chosen automatically.
-    """
-    client = AnalyticsAdminServiceClient(transport=transport)
-    client.delete_user_link(
-        DeleteUserLinkRequest(
-            name=f"accounts/{account_id}/userLinks/{account_user_link_id}"
-        )
-    )
-    print("User link deleted")
-
-
-# [END analyticsadmin_accounts_user_links_delete]
-
-
-if __name__ == "__main__":
-    run_sample()
diff --git a/google-analytics-admin/accounts_user_links_delete_test.py b/google-analytics-admin/accounts_user_links_delete_test.py
deleted file mode 100644
index 449a137..0000000
--- a/google-analytics-admin/accounts_user_links_delete_test.py
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-import pytest
-
-import accounts_user_links_delete
-
-FAKE_ACCOUNT_ID = "1"
-FAKE_ACCOUNT_USER_LINK_ID = "1"
-
-
-def test_accounts_user_links_delete():
-    transports = ["grpc", "rest"]
-    for transport in transports:
-        # This test ensures that the call is valid and reaches the server, even
-        # though the operation does not succeed due to permission error.
-        with pytest.raises(Exception, match="The caller does not have permission"):
-            accounts_user_links_delete.delete_account_user_link(
-                FAKE_ACCOUNT_ID, FAKE_ACCOUNT_USER_LINK_ID, transport=transport
-            )
diff --git a/google-analytics-admin/accounts_user_links_get.py b/google-analytics-admin/accounts_user_links_get.py
deleted file mode 100644
index 8c6688c..0000000
--- a/google-analytics-admin/accounts_user_links_get.py
+++ /dev/null
@@ -1,73 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-"""Google Analytics Admin API sample application which prints the account user
-link details.
-
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts.userLinks/get
-for more information.
-"""
-# [START analyticsadmin_accounts_user_links_get]
-from google.analytics.admin import AnalyticsAdminServiceClient
-
-
-def run_sample():
-    """Runs the sample."""
-    # TODO(developer): Replace this variable with your Google Analytics
-    #  account ID (e.g. "123456") before running the sample.
-    account_id = "YOUR-GA-ACCOUNT-ID"
-
-    # TODO(developer): Replace this variable with your Google Analytics
-    #  account user link ID (e.g. "123456") before running the sample.
-    account_user_link_id = "YOUR-ACCOUNT-USER-LINK-ID"
-
-    get_account_user_link(account_id, account_user_link_id)
-
-
-def get_account_user_link(
-    account_id: str, account_user_link_id: str, transport: str = None
-):
-    """
-    Retrieves the account user link details.
-
-    Args:
-        account_id(str): The Google Analytics Account ID.
-        account_user_link_id(str): Google Analytics account user link ID.
-        transport(str): The transport to use. For example, "grpc"
-            or "rest". If set to None, a transport is chosen automatically.
-    """
-    client = AnalyticsAdminServiceClient(transport=transport)
-    user_link = client.get_user_link(
-        name=f"accounts/{account_id}/userLinks/{account_user_link_id}"
-    )
-
-    print("Result:")
-    print_user_link(user_link)
-
-
-def print_user_link(user_link):
-    """Prints the user link details."""
-    print(f"Resource name: {user_link.name}")
-    print(f"Email address: {user_link.email_address}")
-    for direct_role in user_link.direct_roles:
-        print(f"Direct role: {direct_role}")
-
-
-# [END analyticsadmin_accounts_user_links_get]
-
-
-if __name__ == "__main__":
-    run_sample()
diff --git a/google-analytics-admin/accounts_user_links_get_test.py b/google-analytics-admin/accounts_user_links_get_test.py
deleted file mode 100644
index 0026edb..0000000
--- a/google-analytics-admin/accounts_user_links_get_test.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-import os
-
-import accounts_user_links_get
-
-TEST_ACCOUNT_ID = os.getenv("GA_TEST_ACCOUNT_ID")
-TEST_USER_LINK_ID = os.getenv("GA_TEST_USER_LINK_ID")
-
-
-def test_accounts_user_links_get(capsys):
-    transports = ["grpc", "rest"]
-    for transport in transports:
-        accounts_user_links_get.get_account_user_link(
-            TEST_ACCOUNT_ID, TEST_USER_LINK_ID, transport=transport
-        )
-        out, _ = capsys.readouterr()
-        assert "Result" in out
diff --git a/google-analytics-admin/accounts_user_links_list.py b/google-analytics-admin/accounts_user_links_list.py
deleted file mode 100644
index 5241157..0000000
--- a/google-analytics-admin/accounts_user_links_list.py
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-"""Google Analytics Admin API sample application which prints user links
-under the specified parent account.
-
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts.userLinks/list
-for more information.
-"""
-# [START analyticsadmin_accounts_user_links_list]
-from google.analytics.admin import AnalyticsAdminServiceClient
-
-
-def run_sample():
-    """Runs the sample."""
-    # TODO(developer): Replace this variable with your Google Analytics
-    #  account ID (e.g. "123456") before running the sample.
-    account_id = "YOUR-GA-ACCOUNT-ID"
-    list_account_user_links(account_id)
-
-
-def list_account_user_links(account_id: str, transport: str = None):
-    """
-    Lists user links under the specified parent account.
-
-    Args:
-        account_id(str): The id of the account.
-        transport(str): The transport to use. For example, "grpc"
-            or "rest". If set to None, a transport is chosen automatically.
-    """
-    client = AnalyticsAdminServiceClient(transport=transport)
-    results = client.list_user_links(parent=f"accounts/{account_id}")
-
-    print("Result:")
-    for user_link in results:
-        print(user_link)
-        print()
-
-
-# [END analyticsadmin_accounts_user_links_list]
-
-
-if __name__ == "__main__":
-    run_sample()
diff --git a/google-analytics-admin/accounts_user_links_list_test.py b/google-analytics-admin/accounts_user_links_list_test.py
deleted file mode 100644
index 0ae5730..0000000
--- a/google-analytics-admin/accounts_user_links_list_test.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-import os
-
-import accounts_user_links_list
-
-TEST_ACCOUNT_ID = os.getenv("GA_TEST_ACCOUNT_ID")
-
-
-def test_accounts_user_links_list(capsys):
-    transports = ["grpc", "rest"]
-    for transport in transports:
-        accounts_user_links_list.list_account_user_links(
-            TEST_ACCOUNT_ID, transport=transport
-        )
-        out, _ = capsys.readouterr()
-        assert "Result" in out
diff --git a/google-analytics-admin/accounts_user_links_update.py b/google-analytics-admin/accounts_user_links_update.py
deleted file mode 100644
index dcb16fb..0000000
--- a/google-analytics-admin/accounts_user_links_update.py
+++ /dev/null
@@ -1,78 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-"""Google Analytics Admin API sample application which updates the account
-user link.
-
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts.userLinks/patch
-for more information.
-"""
-# [START analyticsadmin_accounts_user_links_update]
-from google.analytics.admin import AnalyticsAdminServiceClient
-from google.analytics.admin_v1alpha.types import UserLink
-
-
-def run_sample():
-    """Runs the sample."""
-
-    # !!! ATTENTION !!!
-    #  Running this sample may change/delete your Google Analytics account
-    #  configuration. Make sure to not use the Google Analytics property ID from
-    #  your production environment below.
-
-    # TODO(developer): Replace this variable with your Google Analytics
-    #  account ID (e.g. "123456") before running the sample.
-    account_id = "YOUR-GA-ACCOUNT-ID"
-
-    # TODO(developer): Replace this variable with your Google Analytics
-    #  account user link ID (e.g. "123456") before running the sample.
-    account_user_link_id = "YOUR-ACCOUNT-USER-LINK-ID"
-
-    update_account_user_link(account_id, account_user_link_id)
-
-
-def update_account_user_link(
-    account_id: str, account_user_link_id: str, transport: str = None
-):
-    """
-    Updates the account user link.
-
-    Args:
-        account_id(str): The Google Analytics Account ID.
-        account_user_link_id(str): Google Analytics account user link ID.
-        transport(str): The transport to use. For example, "grpc"
-            or "rest". If set to None, a transport is chosen automatically.
-    """
-    client = AnalyticsAdminServiceClient(transport=transport)
-    # This call updates the email address and direct roles of the user link.
-    # The user link to update is specified in the `name` field of the `UserLink`
-    # instance.
-    user_link = client.update_user_link(
-        user_link=UserLink(
-            name=f"accounts/{account_id}/userLinks/{account_user_link_id}",
-            direct_roles=["predefinedRoles/collaborate"],
-        ),
-    )
-
-    print("Result:")
-    print(user_link)
-
-
-# [END analyticsadmin_accounts_user_links_update]
-
-
-if __name__ == "__main__":
-    run_sample()
diff --git a/google-analytics-admin/accounts_user_links_update_test.py b/google-analytics-admin/accounts_user_links_update_test.py
deleted file mode 100644
index 0083ad5..0000000
--- a/google-analytics-admin/accounts_user_links_update_test.py
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-import pytest
-
-import accounts_user_links_update
-
-FAKE_ACCOUNT_ID = "1"
-FAKE_ACCOUNT_USER_LINK_ID = "1"
-
-
-def test_accounts_user_links_update():
-    transports = ["grpc", "rest"]
-    for transport in transports:
-        # This test ensures that the call is valid and reaches the server, even
-        # though the operation does not succeed due to permission error.
-        with pytest.raises(Exception, match="The caller does not have permission"):
-            accounts_user_links_update.update_account_user_link(
-                FAKE_ACCOUNT_ID, FAKE_ACCOUNT_USER_LINK_ID, transport=transport
-            )
diff --git a/google-analytics-admin/properties_user_links_audit.py b/google-analytics-admin/properties_user_links_audit.py
deleted file mode 100644
index e02b9ba..0000000
--- a/google-analytics-admin/properties_user_links_audit.py
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-"""Google Analytics Admin API sample application which prints user links audit
-data on the Google Analytics 4 property.
-
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.userLinks/audit
-for more information.
-"""
-# [START analyticsadmin_properties_user_links_audit]
-from google.analytics.admin import AnalyticsAdminServiceClient
-from google.analytics.admin_v1alpha.types import AuditUserLinksRequest
-
-
-def run_sample():
-    """Runs the sample."""
-    # TODO(developer): Replace this variable with your Google Analytics 4
-    #  property ID (e.g. "123456") before running the sample.
-    property_id = "YOUR-GA4-PROPERTY-ID"
-    audit_property_user_links(property_id)
-
-
-def audit_property_user_links(property_id: str, transport: str = None):
-    """
-    Lists all user links on the Google Analytics 4 property, including
-    implicit ones that come from effective permissions granted by groups or
-    organization admin roles.
-
-    Args:
-        property_id(str): The Google Analytics Property ID.
-        transport(str): The transport to use. For example, "grpc"
-            or "rest". If set to None, a transport is chosen automatically.
-    """
-    client = AnalyticsAdminServiceClient(transport=transport)
-    results = client.audit_user_links(
-        AuditUserLinksRequest(parent=f"properties/{property_id}")
-    )
-
-    print("Result:")
-    for user_link in results:
-        print(f"Resource name: {user_link.name}")
-        print(f"Email address: {user_link.email_address}")
-        for direct_role in user_link.direct_roles:
-            print(f"Direct role: {direct_role}")
-
-        for effective_role in user_link.effective_roles:
-            print(f"Effective role: {effective_role}")
-        print()
-
-
-# [END analyticsadmin_properties_user_links_audit]
-
-
-if __name__ == "__main__":
-    run_sample()
diff --git a/google-analytics-admin/properties_user_links_audit_test.py b/google-analytics-admin/properties_user_links_audit_test.py
deleted file mode 100644
index 5236cdb..0000000
--- a/google-analytics-admin/properties_user_links_audit_test.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-import os
-
-import properties_user_links_audit
-
-TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
-
-
-def test_properties_user_links_audit(capsys):
-    transports = ["grpc", "rest"]
-    for transport in transports:
-        properties_user_links_audit.audit_property_user_links(
-            TEST_PROPERTY_ID, transport=transport
-        )
-        out, _ = capsys.readouterr()
-        assert "Result" in out
diff --git a/google-analytics-admin/properties_user_links_batch_create.py b/google-analytics-admin/properties_user_links_batch_create.py
deleted file mode 100644
index 5ee4cc1..0000000
--- a/google-analytics-admin/properties_user_links_batch_create.py
+++ /dev/null
@@ -1,90 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-"""Google Analytics Admin API sample application which creates a user link for
-the Google Analytics 4 property using a batch call.
-
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.userLinks/batchCreate
-for more information.
-"""
-# [START analyticsadmin_properties_user_links_batch_create]
-from google.analytics.admin import AnalyticsAdminServiceClient
-from google.analytics.admin_v1alpha.types import (
-    BatchCreateUserLinksRequest,
-    CreateUserLinkRequest,
-    UserLink,
-)
-
-
-def run_sample():
-    """Runs the sample."""
-
-    # !!! ATTENTION !!!
-    #  Running this sample may change/delete your Google Analytics account
-    #  configuration. Make sure to not use the Google Analytics account ID from
-    #  your production environment below.
-
-    # TODO(developer): Replace this variable with your Google Analytics 4
-    #  property ID (e.g. "123456") before running the sample.
-    property_id = "YOUR-GA4-PROPERTY-ID"
-
-    # TODO(developer): Replace this variable with an email address of the user to
-    #  link. This user will be given access to your account after running the
-    #  sample.
-    email_address = "TEST-EMAIL-ADDRESS"
-
-    batch_create_property_user_link(property_id, email_address)
-
-
-def batch_create_property_user_link(
-    property_id: str, email_address: str, transport: str = None
-):
-    """
-    Creates a user link for the Google Analytics 4 property using a batch
-    call.
-
-    Args:
-        property_id(str): The Google Analytics Property ID.
-        email_address(str): Email address of the user to link.
-        transport(str): The transport to use. For example, "grpc"
-            or "rest". If set to None, a transport is chosen automatically.
-    """
-    client = AnalyticsAdminServiceClient(transport=transport)
-    response = client.batch_create_user_links(
-        BatchCreateUserLinksRequest(
-            parent=f"properties/{property_id}",
-            requests=[
-                CreateUserLinkRequest(
-                    user_link=UserLink(
-                        email_address=email_address,
-                        direct_roles=["predefinedRoles/read"],
-                    )
-                )
-            ],
-            notify_new_users=True,
-        )
-    )
-
-    print("Result:")
-    for user_link in response.user_links:
-        print(user_link)
-        print()
-
-
-# [END analyticsadmin_properties_user_links_batch_create]
-
-if __name__ == "__main__":
-    run_sample()
diff --git a/google-analytics-admin/properties_user_links_batch_create_test.py b/google-analytics-admin/properties_user_links_batch_create_test.py
deleted file mode 100644
index b463cbb..0000000
--- a/google-analytics-admin/properties_user_links_batch_create_test.py
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-import pytest
-
-import properties_user_links_batch_create
-
-FAKE_PROPERTY_ID = "1"
-FAKE_EMAIL_ADDRESS = "test@google.com"
-
-
-def test_properties_user_links_batch_create():
-    transports = ["grpc", "rest"]
-    for transport in transports:
-        # This test ensures that the call is valid and reaches the server, even
-        # though the operation does not succeed due to permission error.
-        with pytest.raises(Exception, match="The caller does not have permission"):
-            properties_user_links_batch_create.batch_create_property_user_link(
-                FAKE_PROPERTY_ID, FAKE_EMAIL_ADDRESS, transport=transport
-            )
diff --git a/google-analytics-admin/properties_user_links_batch_delete.py b/google-analytics-admin/properties_user_links_batch_delete.py
deleted file mode 100644
index 3e277cd..0000000
--- a/google-analytics-admin/properties_user_links_batch_delete.py
+++ /dev/null
@@ -1,80 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-"""Google Analytics Admin API sample application which delete the user link for
-the Google Analytics 4 property using a batch call.
-
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.userLinks/batchDelete
-for more information.
-"""
-# [START analyticsadmin_properties_user_links_batch_delete]
-from google.analytics.admin import AnalyticsAdminServiceClient
-from google.analytics.admin_v1alpha.types import (
-    BatchDeleteUserLinksRequest,
-    DeleteUserLinkRequest,
-)
-
-
-def run_sample():
-    """Runs the sample."""
-
-    # !!! ATTENTION !!!
-    #  Running this sample may change/delete your Google Analytics account
-    #  configuration. Make sure to not use the Google Analytics property ID from
-    #  your production environment below.
-
-    # TODO(developer): Replace this variable with your Google Analytics 4
-    #  property ID (e.g. "123456") before running the sample.
-    property_id = "YOUR-GA4-PROPERTY-ID"
-
-    # TODO(developer): Replace this variable with your Google Analytics
-    #  account user link ID (e.g. "123456") before running the sample.
-    property_user_link_id = "YOUR-ACCOUNT-USER-LINK-ID"
-
-    batch_delete_property_user_link(property_id, property_user_link_id)
-
-
-def batch_delete_property_user_link(
-    property_id: str, property_user_link_id: str, transport: str = None
-):
-    """
-    Deletes the GA4 property user link using a batch call.
-
-    Args:
-        property_id(str): The Google Analytics Property ID.
-        property_user_link_id(str): Google Analytics account user link ID.
-        transport(str): The transport to use. For example, "grpc"
-            or "rest". If set to None, a transport is chosen automatically.
-    """
-    client = AnalyticsAdminServiceClient(transport=transport)
-    client.batch_delete_user_links(
-        BatchDeleteUserLinksRequest(
-            parent=f"properties/{property_id}",
-            requests=[
-                DeleteUserLinkRequest(
-                    name=f"properties/{property_id}/userLinks/{property_user_link_id}"
-                )
-            ],
-        )
-    )
-    print("User link deleted")
-
-
-# [END analyticsadmin_properties_user_links_batch_delete]
-
-
-if __name__ == "__main__":
-    run_sample()
diff --git a/google-analytics-admin/properties_user_links_batch_delete_test.py b/google-analytics-admin/properties_user_links_batch_delete_test.py
deleted file mode 100644
index 5aee6f4..0000000
--- a/google-analytics-admin/properties_user_links_batch_delete_test.py
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-import pytest
-
-import properties_user_links_batch_delete
-
-FAKE_PROPERTY_ID = "1"
-FAKE_USER_LINK_ID = "1"
-
-
-def test_properties_user_links_batch_delete():
-    transports = ["grpc", "rest"]
-    for transport in transports:
-        # This test ensures that the call is valid and reaches the server, even
-        # though the operation does not succeed due to permission error.
-        with pytest.raises(Exception, match="The caller does not have permission"):
-            properties_user_links_batch_delete.batch_delete_property_user_link(
-                FAKE_PROPERTY_ID, FAKE_USER_LINK_ID, transport=transport
-            )
diff --git a/google-analytics-admin/properties_user_links_batch_get.py b/google-analytics-admin/properties_user_links_batch_get.py
deleted file mode 100644
index 5c40e7e..0000000
--- a/google-analytics-admin/properties_user_links_batch_get.py
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-"""Google Analytics Admin API sample application which prints details for the
-Google Analytics 4 property user link using a batch call.
-
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.userLinks/batchGet
-for more information.
-"""
-# [START analyticsadmin_properties_user_links_batch_get]
-from google.analytics.admin import AnalyticsAdminServiceClient
-from google.analytics.admin_v1alpha.types import BatchGetUserLinksRequest
-
-
-def run_sample():
-    """Runs the sample."""
-    # TODO(developer): Replace this variable with your Google Analytics 4
-    #  property ID (e.g. "123456") before running the sample.
-    property_id = "YOUR-GA4-PROPERTY-ID"
-
-    # TODO(developer): Replace this variable with your Google Analytics
-    #  account user link ID (e.g. "123456") before running the sample.
-    property_user_link_id = "YOUR-ACCOUNT-USER-LINK-ID"
-
-    batch_get_property_user_link(property_id, property_user_link_id)
-
-
-def batch_get_property_user_link(
-    property_id: str, property_user_link_id: str, transport: str = None
-):
-    """
-    Retrieves details for the Google Analytics 4 property user link using a
-    batch call.
-
-    Args:
-        property_id(str): The Google Analytics Property ID.
-        property_user_link_id(str): Google Analytics account user link ID.
-        transport(str): The transport to use. For example, "grpc"
-            or "rest". If set to None, a transport is chosen automatically.
-    """
-    client = AnalyticsAdminServiceClient(transport=transport)
-    response = client.batch_get_user_links(
-        BatchGetUserLinksRequest(
-            parent=f"properties/{property_id}",
-            names=[f"properties/{property_id}/userLinks/{property_user_link_id}"],
-        )
-    )
-
-    print("Result:")
-    for user_link in response.user_links:
-        print(user_link)
-        print()
-
-
-# [END analyticsadmin_properties_user_links_batch_get]
-
-
-if __name__ == "__main__":
-    run_sample()
diff --git a/google-analytics-admin/properties_user_links_batch_get_test.py b/google-analytics-admin/properties_user_links_batch_get_test.py
deleted file mode 100644
index 9fb31a4..0000000
--- a/google-analytics-admin/properties_user_links_batch_get_test.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-import os
-
-import properties_user_links_batch_get
-
-TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
-TEST_USER_LINK_ID = os.getenv("GA_TEST_PROPERTY_USER_LINK_ID")
-
-
-def test_properties_user_links_batch_get(capsys):
-    transports = ["grpc", "rest"]
-    for transport in transports:
-        properties_user_links_batch_get.batch_get_property_user_link(
-            TEST_PROPERTY_ID, TEST_USER_LINK_ID, transport=transport
-        )
-        out, _ = capsys.readouterr()
-        assert "Result" in out
diff --git a/google-analytics-admin/properties_user_links_batch_update.py b/google-analytics-admin/properties_user_links_batch_update.py
deleted file mode 100644
index c1a4d2e..0000000
--- a/google-analytics-admin/properties_user_links_batch_update.py
+++ /dev/null
@@ -1,91 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-"""Google Analytics Admin API sample application which updates the Google
-Analytics 4 property user link using a batch call.
-
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.userLinks/batchUpdate
-for more information.
-"""
-# [START analyticsadmin_properties_user_links_batch_update]
-from google.analytics.admin import AnalyticsAdminServiceClient
-from google.analytics.admin_v1alpha.types import (
-    BatchUpdateUserLinksRequest,
-    UpdateUserLinkRequest,
-    UserLink,
-)
-
-
-def run_sample():
-    """Runs the sample."""
-
-    # !!! ATTENTION !!!
-    #  Running this sample may change/delete your Google Analytics account
-    #  configuration. Make sure to not use the Google Analytics property ID from
-    #  your production environment below.
-
-    # TODO(developer): Replace this variable with your Google Analytics 4
-    #  property ID (e.g. "123456") before running the sample.
-    property_id = "YOUR-GA4-PROPERTY-ID"
-
-    # TODO(developer): Replace this variable with your Google Analytics
-    #  account user link ID (e.g. "123456") before running the sample.
-    property_user_link_id = "YOUR-ACCOUNT-USER-LINK-ID"
-
-    batch_update_property_user_link(property_id, property_user_link_id)
-
-
-def batch_update_property_user_link(
-    property_id: str, property_user_link_id: str, transport: str = None
-):
-    """
-    Updates the Google Analytics 4 property user link using a batch call.
-
-    Args:
-        property_id(str): The Google Analytics Property ID.
-        property_user_link_id(str): Google Analytics account user link ID.
-        transport(str): The transport to use. For example, "grpc"
-            or "rest". If set to None, a transport is chosen automatically.
-    """
-    client = AnalyticsAdminServiceClient(transport=transport)
-    # This call updates the email address and direct roles of the user link.
-    # The user link to update is specified in the `name` field of the `UserLink`
-    # instance.
-    response = client.batch_update_user_links(
-        BatchUpdateUserLinksRequest(
-            parent=f"properties/{property_id}",
-            requests=[
-                UpdateUserLinkRequest(
-                    user_link=UserLink(
-                        name=f"properties/{property_id}/userLinks/{property_user_link_id}",
-                        direct_roles=["predefinedRoles/collaborate"],
-                    ),
-                )
-            ],
-        )
-    )
-
-    print("Result:")
-    for user_link in response.user_links:
-        print(user_link)
-        print()
-
-
-# [END analyticsadmin_properties_user_links_batch_update]
-
-
-if __name__ == "__main__":
-    run_sample()
diff --git a/google-analytics-admin/properties_user_links_batch_update_test.py b/google-analytics-admin/properties_user_links_batch_update_test.py
deleted file mode 100644
index 08b64b7..0000000
--- a/google-analytics-admin/properties_user_links_batch_update_test.py
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-import pytest
-
-import properties_user_links_batch_update
-
-FAKE_PROPERTY_ID = "1"
-FAKE_USER_LINK_ID = "1"
-
-
-def test_properties_user_links_batch_update():
-    transports = ["grpc", "rest"]
-    for transport in transports:
-        # This test ensures that the call is valid and reaches the server, even
-        # though the operation does not succeed due to permission error.
-        with pytest.raises(Exception, match="The caller does not have permission"):
-            properties_user_links_batch_update.batch_update_property_user_link(
-                FAKE_PROPERTY_ID, FAKE_USER_LINK_ID, transport=transport
-            )
diff --git a/google-analytics-admin/properties_user_links_create.py b/google-analytics-admin/properties_user_links_create.py
deleted file mode 100644
index 24627b6..0000000
--- a/google-analytics-admin/properties_user_links_create.py
+++ /dev/null
@@ -1,78 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-"""Google Analytics Admin API sample application which creates a user link for
-the Google Analytics 4 property.
-
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.userLinks/create
-for more information.
-"""
-# [START analyticsadmin_properties_user_links_create]
-from google.analytics.admin import AnalyticsAdminServiceClient
-from google.analytics.admin_v1alpha.types import CreateUserLinkRequest, UserLink
-
-
-def run_sample():
-    """Runs the sample."""
-
-    # !!! ATTENTION !!!
-    #  Running this sample may change/delete your Google Analytics account
-    #  configuration. Make sure to not use the Google Analytics account ID from
-    #  your production environment below.
-
-    # TODO(developer): Replace this variable with your Google Analytics 4
-    #  property ID (e.g. "123456") before running the sample.
-    property_id = "YOUR-GA4-PROPERTY-ID"
-
-    # TODO(developer): Replace this variable with an email address of the user to
-    #  link. This user will be given access to your account after running the
-    #  sample.
-    email_address = "TEST-EMAIL-ADDRESS"
-
-    create_property_user_link(property_id, email_address)
-
-
-def create_property_user_link(
-    property_id: str, email_address: str, transport: str = None
-):
-    """
-    Creates a user link for the Google Analytics 4 property.
-
-    Args:
-        property_id(str): The Google Analytics Property ID.
-        email_address(str): Email address of the user to link.
-        transport(str): The transport to use. For example, "grpc"
-            or "rest". If set to None, a transport is chosen automatically.
-    """
-    client = AnalyticsAdminServiceClient(transport=transport)
-    user_link = client.create_user_link(
-        CreateUserLinkRequest(
-            parent=f"properties/{property_id}",
-            user_link=UserLink(
-                email_address=email_address, direct_roles=["predefinedRoles/read"]
-            ),
-            notify_new_user=True,
-        )
-    )
-
-    print("Result:")
-    print(user_link)
-
-
-# [END analyticsadmin_properties_user_links_create]
-
-if __name__ == "__main__":
-    run_sample()
diff --git a/google-analytics-admin/properties_user_links_create_test.py b/google-analytics-admin/properties_user_links_create_test.py
deleted file mode 100644
index 3f79d85..0000000
--- a/google-analytics-admin/properties_user_links_create_test.py
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-import pytest
-
-import properties_user_links_create
-
-FAKE_PROPERTY_ID = "1"
-FAKE_EMAIL_ADDRESS = "test@google.com"
-
-
-def test_properties_user_links_create():
-    transports = ["grpc", "rest"]
-    for transport in transports:
-        # This test ensures that the call is valid and reaches the server, even
-        # though the operation does not succeed due to permission error.
-        with pytest.raises(Exception, match="The caller does not have permission"):
-            properties_user_links_create.create_property_user_link(
-                FAKE_PROPERTY_ID, FAKE_EMAIL_ADDRESS, transport=transport
-            )
diff --git a/google-analytics-admin/properties_user_links_delete.py b/google-analytics-admin/properties_user_links_delete.py
deleted file mode 100644
index b70b75c..0000000
--- a/google-analytics-admin/properties_user_links_delete.py
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-"""Google Analytics Admin API sample application which deletes the user link
-from the Google Analytics 4 property.
-
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.userLinks/delete
-for more information.
-"""
-# [START analyticsadmin_properties_user_links_delete]
-from google.analytics.admin import AnalyticsAdminServiceClient
-from google.analytics.admin_v1alpha.types import DeleteUserLinkRequest
-
-
-def run_sample():
-    """Runs the sample."""
-
-    # !!! ATTENTION !!!
-    #  Running this sample may change/delete your Google Analytics account
-    #  configuration. Make sure to not use the Google Analytics property ID from
-    #  your production environment below.
-
-    # TODO(developer): Replace this variable with your Google Analytics 4
-    #  property ID (e.g. "123456") before running the sample.
-    property_id = "YOUR-GA4-PROPERTY-ID"
-
-    # TODO(developer): Replace this variable with your Google Analytics
-    #  account user link ID (e.g. "123456") before running the sample.
-    property_user_link_id = "YOUR-ACCOUNT-USER-LINK-ID"
-
-    delete_property_user_link(property_id, property_user_link_id)
-
-
-def delete_property_user_link(
-    property_id: str, property_user_link_id: str, transport: str = None
-):
-    """
-    Deletes the user link from the Google Analytics 4 property.
-
-    Args:
-        property_id(str): The Google Analytics Property ID.
-        property_user_link_id(str): Google Analytics account user link ID.
-        transport(str): The transport to use. For example, "grpc"
-            or "rest". If set to None, a transport is chosen automatically.
-    """
-    client = AnalyticsAdminServiceClient(transport=transport)
-    client.delete_user_link(
-        DeleteUserLinkRequest(
-            name=f"properties/{property_id}/userLinks/{property_user_link_id}"
-        )
-    )
-    print("User link deleted")
-
-
-# [END analyticsadmin_properties_user_links_delete]
-
-
-if __name__ == "__main__":
-    run_sample()
diff --git a/google-analytics-admin/properties_user_links_delete_test.py b/google-analytics-admin/properties_user_links_delete_test.py
deleted file mode 100644
index c5f4dd6..0000000
--- a/google-analytics-admin/properties_user_links_delete_test.py
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-import pytest
-
-import properties_user_links_delete
-
-FAKE_PROPERTY_ID = "1"
-FAKE_USER_LINK_ID = "1"
-
-
-def test_properties_user_links_delete():
-    transports = ["grpc", "rest"]
-    for transport in transports:
-        # This test ensures that the call is valid and reaches the server, even
-        # though the operation does not succeed due to permission error.
-        with pytest.raises(Exception, match="The caller does not have permission"):
-            properties_user_links_delete.delete_property_user_link(
-                FAKE_PROPERTY_ID, FAKE_USER_LINK_ID, transport=transport
-            )
diff --git a/google-analytics-admin/properties_user_links_get.py b/google-analytics-admin/properties_user_links_get.py
deleted file mode 100644
index 9aa97e5..0000000
--- a/google-analytics-admin/properties_user_links_get.py
+++ /dev/null
@@ -1,73 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-"""Google Analytics Admin API sample application which prints the Google
-Analytics 4 property user link details.
-
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.userLinks/get
-for more information.
-"""
-# [START analyticsadmin_properties_user_links_get]
-from google.analytics.admin import AnalyticsAdminServiceClient
-
-
-def run_sample():
-    """Runs the sample."""
-    # TODO(developer): Replace this variable with your Google Analytics 4
-    #  property ID (e.g. "123456") before running the sample.
-    property_id = "YOUR-GA4-PROPERTY-ID"
-
-    # TODO(developer): Replace this variable with your Google Analytics
-    #  account user link ID (e.g. "123456") before running the sample.
-    property_user_link_id = "YOUR-ACCOUNT-USER-LINK-ID"
-
-    get_property_user_link(property_id, property_user_link_id)
-
-
-def get_property_user_link(
-    property_id: str, property_user_link_id: str, transport: str = None
-):
-    """
-    Retrieves the Google Analytics 4 property user link details.
-
-    Args:
-        property_id(str): The Google Analytics Property ID.
-        property_user_link_id(str): Google Analytics account user link ID.
-        transport(str): The transport to use. For example, "grpc"
-            or "rest". If set to None, a transport is chosen automatically.
-    """
-    client = AnalyticsAdminServiceClient(transport=transport)
-    user_link = client.get_user_link(
-        name=f"properties/{property_id}/userLinks/{property_user_link_id}"
-    )
-
-    print("Result:")
-    print_user_link(user_link)
-
-
-def print_user_link(user_link):
-    """Prints the user link details."""
-    print(f"Resource name: {user_link.name}")
-    print(f"Email address: {user_link.email_address}")
-    for direct_role in user_link.direct_roles:
-        print(f"Direct role: {direct_role}")
-
-
-# [END analyticsadmin_properties_user_links_get]
-
-
-if __name__ == "__main__":
-    run_sample()
diff --git a/google-analytics-admin/properties_user_links_get_test.py b/google-analytics-admin/properties_user_links_get_test.py
deleted file mode 100644
index b05b19f..0000000
--- a/google-analytics-admin/properties_user_links_get_test.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-import os
-
-import properties_user_links_get
-
-TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
-TEST_USER_LINK_ID = os.getenv("GA_TEST_PROPERTY_USER_LINK_ID")
-
-
-def test_properties_user_links_get(capsys):
-    transports = ["grpc", "rest"]
-    for transport in transports:
-        properties_user_links_get.get_property_user_link(
-            TEST_PROPERTY_ID, TEST_USER_LINK_ID, transport=transport
-        )
-        out, _ = capsys.readouterr()
-        assert "Result" in out
diff --git a/google-analytics-admin/properties_user_links_list.py b/google-analytics-admin/properties_user_links_list.py
deleted file mode 100644
index ef6e877..0000000
--- a/google-analytics-admin/properties_user_links_list.py
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-"""Google Analytics Admin API sample application which prints user links under
-the specified parent Google Analytics 4 property.
-
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.userLinks/list
-for more information.
-"""
-# [START analyticsadmin_properties_user_links_list]
-from google.analytics.admin import AnalyticsAdminServiceClient
-
-
-def run_sample():
-    """Runs the sample."""
-    # TODO(developer): Replace this variable with your Google Analytics 4
-    #  property ID (e.g. "123456") before running the sample.
-    property_id = "YOUR-GA4-PROPERTY-ID"
-    list_property_user_links(property_id)
-
-
-def list_property_user_links(property_id: str, transport: str = None):
-    """
-    Lists user links under the specified parent Google Analytics 4
-    property.
-
-    Args:
-        property_id(str): The Google Analytics Property ID.
-        transport(str): The transport to use. For example, "grpc"
-            or "rest". If set to None, a transport is chosen automatically.
-    """
-    client = AnalyticsAdminServiceClient(transport=transport)
-    results = client.list_user_links(parent=f"properties/{property_id}")
-
-    print("Result:")
-    for user_link in results:
-        print(user_link)
-        print()
-
-
-# [END analyticsadmin_properties_user_links_list]
-
-
-if __name__ == "__main__":
-    run_sample()
diff --git a/google-analytics-admin/properties_user_links_list_test.py b/google-analytics-admin/properties_user_links_list_test.py
deleted file mode 100644
index a47d712..0000000
--- a/google-analytics-admin/properties_user_links_list_test.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-import os
-
-import properties_user_links_list
-
-TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
-
-
-def test_properties_user_links_list(capsys):
-    transports = ["grpc", "rest"]
-    for transport in transports:
-        properties_user_links_list.list_property_user_links(
-            TEST_PROPERTY_ID, transport=transport
-        )
-        out, _ = capsys.readouterr()
-        assert "Result" in out
diff --git a/google-analytics-admin/properties_user_links_update.py b/google-analytics-admin/properties_user_links_update.py
deleted file mode 100644
index f20b04f..0000000
--- a/google-analytics-admin/properties_user_links_update.py
+++ /dev/null
@@ -1,78 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-"""Google Analytics Admin API sample application which updates the Google
-Analytics 4 property user link.
-
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.userLinks/update
-for more information.
-"""
-# [START analyticsadmin_properties_user_links_update]
-from google.analytics.admin import AnalyticsAdminServiceClient
-from google.analytics.admin_v1alpha.types import UserLink
-
-
-def run_sample():
-    """Runs the sample."""
-
-    # !!! ATTENTION !!!
-    #  Running this sample may change/delete your Google Analytics account
-    #  configuration. Make sure to not use the Google Analytics property ID from
-    #  your production environment below.
-
-    # TODO(developer): Replace this variable with your Google Analytics 4
-    #  property ID (e.g. "123456") before running the sample.
-    property_id = "YOUR-GA4-PROPERTY-ID"
-
-    # TODO(developer): Replace this variable with your Google Analytics
-    #  account user link ID (e.g. "123456") before running the sample.
-    property_user_link_id = "YOUR-ACCOUNT-USER-LINK-ID"
-
-    update_property_user_link(property_id, property_user_link_id)
-
-
-def update_property_user_link(
-    property_id: str, property_user_link_id: str, transport: str = None
-):
-    """
-    Updates the Google Analytics 4 property user link.
-
-    Args:
-        property_id(str): The Google Analytics Property ID.
-        property_user_link_id(str): Google Analytics account user link ID.
-        transport(str): The transport to use. For example, "grpc"
-            or "rest". If set to None, a transport is chosen automatically.
-    """
-    client = AnalyticsAdminServiceClient(transport=transport)
-    # This call updates the email address and direct roles of the user link.
-    # The user link to update is specified in the `name` field of the `UserLink`
-    # instance.
-    user_link = client.update_user_link(
-        user_link=UserLink(
-            name=f"properties/{property_id}/userLinks/{property_user_link_id}",
-            direct_roles=["predefinedRoles/collaborate"],
-        ),
-    )
-
-    print("Result:")
-    print(user_link)
-
-
-# [END analyticsadmin_properties_user_links_update]
-
-
-if __name__ == "__main__":
-    run_sample()
diff --git a/google-analytics-admin/properties_user_links_update_test.py b/google-analytics-admin/properties_user_links_update_test.py
deleted file mode 100644
index bd471b7..0000000
--- a/google-analytics-admin/properties_user_links_update_test.py
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright 2021 Google LLC All Rights Reserved.
-#
-# 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.
-
-import pytest
-
-import properties_user_links_update
-
-FAKE_PROPERTY_ID = "1"
-FAKE_USER_LINK_ID = "1"
-
-
-def test_properties_user_links_update():
-    transports = ["grpc", "rest"]
-    for transport in transports:
-        # This test ensures that the call is valid and reaches the server, even
-        # though the operation does not succeed due to permission error.
-        with pytest.raises(Exception, match="The caller does not have permission"):
-            properties_user_links_update.update_property_user_link(
-                FAKE_PROPERTY_ID, FAKE_USER_LINK_ID, transport=transport
-            )

From 3bfc087d90a9ed819ed996c66f6d4efc62100ec2 Mon Sep 17 00:00:00 2001
From: Josh Radcliff <jradcliff@users.noreply.github.com>
Date: Mon, 18 Dec 2023 16:10:52 -0500
Subject: [PATCH 182/213] Update access report test with new error message text

---
 google-analytics-admin/properties_run_access_report_test.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/google-analytics-admin/properties_run_access_report_test.py b/google-analytics-admin/properties_run_access_report_test.py
index a7d3c8d..764072c 100644
--- a/google-analytics-admin/properties_run_access_report_test.py
+++ b/google-analytics-admin/properties_run_access_report_test.py
@@ -25,10 +25,11 @@ def test_properties_run_access_report(capsys):
     transports = ["grpc", "rest"]
     for transport in transports:
         # This test ensures that the call is valid and reaches the server, even
-        # though the operation does not succeed due to permission error.
+        # though the operation does not succeed due to the test property not
+        # being a Google Analytics 360 property.
         with pytest.raises(
             Exception,
-            match="Access record reports are only allowed on Google Analytics 360 properties.",
+            match="Data Access Reports are only allowed on Google Analytics 360 properties.",
         ):
             properties_run_access_report.run_access_report(
                 TEST_PROPERTY_ID, transport=transport

From b54306ae5c625e42d7dade169779dad5ec0a30f5 Mon Sep 17 00:00:00 2001
From: Josh Radcliff <jradcliff@users.noreply.github.com>
Date: Mon, 18 Dec 2023 16:40:32 -0500
Subject: [PATCH 183/213] Updated admin nox configuration and contributors
 guide

1.  Copied
    https://github.com/GoogleCloudPlatform/python-docs-samples/blob/main/noxfile-template.py
    to noxfile.py.
2.  Modified noxfile_config.py to allow env variable overrides.
3.  Updated the contributors guide to include sections on style and
    tests.
---
 CONTRIBUTING.md                          |  63 ++++++++++++
 google-analytics-admin/noxfile.py        | 126 ++++++++++++-----------
 google-analytics-admin/noxfile_config.py |  24 +++--
 3 files changed, 147 insertions(+), 66 deletions(-)

diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index f6f482e..1e6921a 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -27,3 +27,66 @@ information on using pull requests.
 This project follows [Google's Open Source Community
 Guidelines](https://opensource.google.com/conduct/).
 
+## Code Style
+
+All Python samples should follow the best practices defined in the [PEP 8 style
+guide](https://www.python.org/dev/peps/pep-0008/) and the [Google Python Style
+Guide](http://google.github.io/styleguide/pyguide.html). The automated linting
+process for Python samples uses [flake8](http://flake8.pycqa.org/en/latest/) to
+verify conformance to common Python coding standards, so the use of flake8 is
+recommended.
+
+If you prefer to use [pylint](https://www.pylint.org/), note that Python samples
+for this repo are not required to conform to pylint’s default settings outside
+the scope of PEP 8, such as the “too many arguments” or “too many local
+variables” warnings.
+
+The use of [Black](https://pypi.org/project/black/) to standardize code
+formatting and simplify diffs is recommended.
+
+The default noxfile defines a `blacken` session for convenience. If you have
+pyenv configured, you can check and format all files in `google-analytics-admin`
+or `google-analytics-data` using the following command:
+
+```sh
+nox -s lint blacken
+```
+
+## Running the tests
+
+1.  Configure your environment and credentials as described in the
+    [README](README.md).
+2.  Determine which GA4 property you want to use for tests, and note its
+    property ID.
+3.  Change into the directory of the project you want to test (either
+    `google-analytics-admin` or `google-analytics-data`).
+4.  Configure environment variables required by tests using the following
+    commands:
+
+    ```sh
+    # These values are required by Admin and Data API samples tests.
+    export GOOGLE_CLOUD_PROJECT=
+    export GA_TEST_PROPERTY_ID=
+    # These values are only required by Admin API samples tests.
+    export GA_TEST_ACCOUNT_ID=
+    export GA_TEST_WEB_DATA_STREAM_ID=
+    export GA_TEST_WEB_DATA_SECRET_ID=
+    export GA_TEST_CONVERSION_EVENT_ID=
+    ```
+
+5.  Execute tests from the `google-analytics-admin` or `google-analytics-data`
+    directory, using either `nox` or `pytest`. Using `nox` provides the
+    additional benefit of formatting all files, and also automatically creates a
+    virtual environment to test samples using different versions of Python.
+
+    *   Using `nox`:
+
+        ```sh
+        nox
+        ```
+
+    *   Using `pytest`:
+
+        ```sh
+        pytest
+        ```
diff --git a/google-analytics-admin/noxfile.py b/google-analytics-admin/noxfile.py
index de104db..7832fa2 100644
--- a/google-analytics-admin/noxfile.py
+++ b/google-analytics-admin/noxfile.py
@@ -12,27 +12,27 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+from __future__ import annotations
 from __future__ import print_function
 
+from collections.abc import Callable
 import glob
 import os
 from pathlib import Path
 import sys
-from typing import Callable, Dict, Optional
 
 import nox
 
+
 # WARNING - WARNING - WARNING - WARNING - WARNING
 # WARNING - WARNING - WARNING - WARNING - WARNING
-#           DO NOT EDIT THIS FILE EVER!
+#       BE CAREFUL WHEN EDITING THIS FILE!
 # WARNING - WARNING - WARNING - WARNING - WARNING
 # WARNING - WARNING - WARNING - WARNING - WARNING
 
-BLACK_VERSION = "black==22.3.0"
-ISORT_VERSION = "isort==5.10.1"
-
 # Copy `noxfile_config.py` to your directory and modify it instead.
 
+
 # `TEST_CONFIG` dict is a configuration hook that allows users to
 # modify the test configurations. The values here should be in sync
 # with `noxfile_config.py`. Users will copy `noxfile_config.py` into
@@ -40,7 +40,7 @@
 
 TEST_CONFIG = {
     # You can opt out from the test for specific Python versions.
-    "ignored_versions": [],
+    "ignored_versions": ["2.7", "3.7", "3.9", "3.10", "3.11"],
     # Old samples are opted out of enforcing Python type hints
     # All new samples should feature them
     "enforce_type_hints": False,
@@ -72,7 +72,7 @@
 TEST_CONFIG.update(TEST_CONFIG_OVERRIDE)
 
 
-def get_pytest_env_vars() -> Dict[str, str]:
+def get_pytest_env_vars() -> dict[str, str]:
     """Returns a dict for pytest invocation."""
     ret = {}
 
@@ -80,25 +80,22 @@ def get_pytest_env_vars() -> Dict[str, str]:
     env_key = TEST_CONFIG["gcloud_project_env"]
     # This should error out if not set.
     ret["GOOGLE_CLOUD_PROJECT"] = os.environ[env_key]
+    ret["GCLOUD_PROJECT"] = os.environ[env_key]  # deprecated
 
     # Apply user supplied envs.
     ret.update(TEST_CONFIG["envs"])
     return ret
 
 
-# DO NOT EDIT - automatically generated.
-# All versions used to test samples.
-ALL_VERSIONS = ["3.7", "3.8", "3.9", "3.10", "3.11"]
+# All versions used to tested samples.
+ALL_VERSIONS = ["2.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
 
 # Any default versions that should be ignored.
 IGNORED_VERSIONS = TEST_CONFIG["ignored_versions"]
 
 TESTED_VERSIONS = sorted([v for v in ALL_VERSIONS if v not in IGNORED_VERSIONS])
 
-INSTALL_LIBRARY_FROM_SOURCE = os.environ.get("INSTALL_LIBRARY_FROM_SOURCE", False) in (
-    "True",
-    "true",
-)
+INSTALL_LIBRARY_FROM_SOURCE = bool(os.environ.get("INSTALL_LIBRARY_FROM_SOURCE", False))
 
 # Error if a python version is missing
 nox.options.error_on_missing_interpreters = True
@@ -108,9 +105,26 @@ def get_pytest_env_vars() -> Dict[str, str]:
 #
 
 
+def _determine_local_import_names(start_dir: str) -> list[str]:
+    """Determines all import names that should be considered "local".
+
+    This is used when running the linter to ensure that import order is
+    properly checked.
+    """
+    file_ext_pairs = [os.path.splitext(path) for path in os.listdir(start_dir)]
+    return [
+        basename
+        for basename, extension in file_ext_pairs
+        if extension == ".py"
+        or os.path.isdir(os.path.join(start_dir, basename))
+        and basename not in ("__pycache__")
+    ]
+
+
 # Linting with flake8.
 #
 # We ignore the following rules:
+#   ANN101: missing type annotation for self in method
 #   E203: whitespace before ‘:’
 #   E266: too many leading ‘#’ for block comment
 #   E501: line too long
@@ -122,8 +136,9 @@ def get_pytest_env_vars() -> Dict[str, str]:
     "--show-source",
     "--builtin=gettext",
     "--max-complexity=20",
+    "--import-order-style=google",
     "--exclude=.nox,.cache,env,lib,generated_pb2,*_pb2.py,*_pb2_grpc.py",
-    "--ignore=E121,E123,E126,E203,E226,E24,E266,E501,E704,W503,W504,I202",
+    "--ignore=ANN101,E121,E123,E126,E203,E226,E24,E266,E501,E704,W503,W504,I202",
     "--max-line-length=88",
 ]
 
@@ -131,11 +146,14 @@ def get_pytest_env_vars() -> Dict[str, str]:
 @nox.session
 def lint(session: nox.sessions.Session) -> None:
     if not TEST_CONFIG["enforce_type_hints"]:
-        session.install("flake8")
+        session.install("flake8", "flake8-import-order")
     else:
-        session.install("flake8", "flake8-annotations")
+        session.install("flake8", "flake8-import-order", "flake8-annotations")
 
+    local_names = _determine_local_import_names(".")
     args = FLAKE8_COMMON_ARGS + [
+        "--application-import-names",
+        ",".join(local_names),
         ".",
     ]
     session.run("flake8", *args)
@@ -148,30 +166,9 @@ def lint(session: nox.sessions.Session) -> None:
 
 @nox.session
 def blacken(session: nox.sessions.Session) -> None:
-    """Run black. Format code to uniform standard."""
-    session.install(BLACK_VERSION)
-    python_files = [path for path in os.listdir(".") if path.endswith(".py")]
-
-    session.run("black", *python_files)
-
-
-#
-# format = isort + black
-#
-
-
-@nox.session
-def format(session: nox.sessions.Session) -> None:
-    """
-    Run isort to sort imports. Then run black
-    to format code to uniform standard.
-    """
-    session.install(BLACK_VERSION, ISORT_VERSION)
+    session.install("black")
     python_files = [path for path in os.listdir(".") if path.endswith(".py")]
 
-    # Use the --fss option to sort imports using strict alphabetical order.
-    # See https://pycqa.github.io/isort/docs/configuration/options.html#force-sort-within-sections
-    session.run("isort", "--fss", *python_files)
     session.run("black", *python_files)
 
 
@@ -187,10 +184,8 @@ def _session_tests(
     session: nox.sessions.Session, post_install: Callable = None
 ) -> None:
     # check for presence of tests
-    test_list = glob.glob("**/*_test.py", recursive=True) + glob.glob(
-        "**/test_*.py", recursive=True
-    )
-    test_list.extend(glob.glob("**/tests", recursive=True))
+    test_list = glob.glob("*_test.py") + glob.glob("test_*.py")
+    test_list.extend(glob.glob("tests"))
 
     if len(test_list) == 0:
         print("No tests found, skipping directory.")
@@ -199,23 +194,42 @@ def _session_tests(
     if TEST_CONFIG["pip_version_override"]:
         pip_version = TEST_CONFIG["pip_version_override"]
         session.install(f"pip=={pip_version}")
+    else:
+        session.install("--upgrade", "pip")
+
     """Runs py.test for a particular project."""
     concurrent_args = []
     if os.path.exists("requirements.txt"):
-        if os.path.exists("constraints.txt"):
-            session.install("-r", "requirements.txt", "-c", "constraints.txt")
-        else:
-            session.install("-r", "requirements.txt")
         with open("requirements.txt") as rfile:
             packages = rfile.read()
+        if os.path.exists("constraints.txt"):
+            session.install(
+                "-r",
+                "requirements.txt",
+                "-c",
+                "constraints.txt",
+                "--only-binary",
+                ":all",
+            )
+        elif "pyspark" in packages:
+            session.install("-r", "requirements.txt", "--use-pep517")
+        else:
+            session.install("-r", "requirements.txt", "--only-binary", ":all")
 
     if os.path.exists("requirements-test.txt"):
-        if os.path.exists("constraints-test.txt"):
-            session.install("-r", "requirements-test.txt", "-c", "constraints-test.txt")
-        else:
-            session.install("-r", "requirements-test.txt")
         with open("requirements-test.txt") as rtfile:
             packages += rtfile.read()
+        if os.path.exists("constraints-test.txt"):
+            session.install(
+                "-r",
+                "requirements-test.txt",
+                "-c",
+                "constraints-test.txt",
+                "--only-binary",
+                ":all",
+            )
+        else:
+            session.install("-r", "requirements-test.txt", "--only-binary", ":all")
 
     if INSTALL_LIBRARY_FROM_SOURCE:
         session.install("-e", _get_repo_root())
@@ -255,20 +269,16 @@ def py(session: nox.sessions.Session) -> None:
 #
 
 
-def _get_repo_root() -> Optional[str]:
+def _get_repo_root() -> str | None:
     """Returns the root folder of the project."""
-    # Get root of this repository. Assume we don't have directories nested deeper than 10 items.
+    # Get root of this repository.
+    # Assume we don't have directories nested deeper than 10 items.
     p = Path(os.getcwd())
     for i in range(10):
         if p is None:
             break
         if Path(p / ".git").exists():
             return str(p)
-        # .git is not available in repos cloned via Cloud Build
-        # setup.py is always in the library's root, so use that instead
-        # https://github.com/googleapis/synthtool/issues/792
-        if Path(p / "setup.py").exists():
-            return str(p)
         p = p.parent
     raise Exception("Unable to detect repository root.")
 
diff --git a/google-analytics-admin/noxfile_config.py b/google-analytics-admin/noxfile_config.py
index bcb670f..27c82eb 100644
--- a/google-analytics-admin/noxfile_config.py
+++ b/google-analytics-admin/noxfile_config.py
@@ -12,22 +12,30 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+import os
+
 TEST_CONFIG_OVERRIDE = {
+    # You can opt out from the test for specific Python versions.
+    "ignored_versions": ["2.7"],
     # An envvar key for determining the project id to use. Change it
     # to 'BUILD_SPECIFIC_GCLOUD_PROJECT' if you want to opt in using a
     # build specific Cloud project. You can also use your own string
     # to use your own Cloud project.
-    "gcloud_project_env": "BUILD_SPECIFIC_GCLOUD_PROJECT",
+    "gcloud_project_env": "GOOGLE_CLOUD_PROJECT",
     # 'gcloud_project_env': 'BUILD_SPECIFIC_GCLOUD_PROJECT',
     # A dictionary you want to inject into your test. Don't put any
     # secrets here. These values will override predefined values.
     "envs": {
-        "GA_TEST_PROPERTY_ID": "276206997",
-        "GA_TEST_ACCOUNT_ID": "199820965",
-        "GA_TEST_USER_LINK_ID": "103401743041912607932",
-        "GA_TEST_PROPERTY_USER_LINK_ID": "105231969274497648555",
-        "GA_TEST_WEB_DATA_STREAM_ID": "2828068992",
-        "GA_TEST_WEB_DATA_SECRET_ID": "2994983412",
-        "GA_TEST_CONVERSION_EVENT_ID": "2719963095",
+        "GA_TEST_PROPERTY_ID": os.getenv("GA_TEST_PROPERTY_ID", "276206997"),
+        "GA_TEST_ACCOUNT_ID": os.getenv("GA_TEST_ACCOUNT_ID", "199820965"),
+        "GA_TEST_WEB_DATA_STREAM_ID": os.getenv(
+            "GA_TEST_WEB_DATA_STREAM_ID", "2828068992"
+        ),
+        "GA_TEST_WEB_DATA_SECRET_ID": os.getenv(
+            "GA_TEST_WEB_DATA_SECRET_ID", "2994983412"
+        ),
+        "GA_TEST_CONVERSION_EVENT_ID": os.getenv(
+            "GA_TEST_CONVERSION_EVENT_ID", "2719963095"
+        ),
     },
 }

From d0deecd5ccdd08d7dce36f01ce175f9af45fd57a Mon Sep 17 00:00:00 2001
From: Josh Radcliff <jradcliff@users.noreply.github.com>
Date: Mon, 18 Dec 2023 16:45:22 -0500
Subject: [PATCH 184/213] Minor formatting fix to contributors guide

---
 CONTRIBUTING.md | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 1e6921a..23dbd00 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -56,11 +56,9 @@ nox -s lint blacken
 
 1.  Configure your environment and credentials as described in the
     [README](README.md).
-2.  Determine which GA4 property you want to use for tests, and note its
-    property ID.
-3.  Change into the directory of the project you want to test (either
+2.  Change into the directory of the project you want to test (either
     `google-analytics-admin` or `google-analytics-data`).
-4.  Configure environment variables required by tests using the following
+3.  Configure environment variables required by tests using the following
     commands:
 
     ```sh
@@ -74,7 +72,7 @@ nox -s lint blacken
     export GA_TEST_CONVERSION_EVENT_ID=
     ```
 
-5.  Execute tests from the `google-analytics-admin` or `google-analytics-data`
+4.  Execute tests from the `google-analytics-admin` or `google-analytics-data`
     directory, using either `nox` or `pytest`. Using `nox` provides the
     additional benefit of formatting all files, and also automatically creates a
     virtual environment to test samples using different versions of Python.

From e9820f41b68a078c5e0255f1ce1f8feefa8aaf6d Mon Sep 17 00:00:00 2001
From: Josh Radcliff <jradcliff@users.noreply.github.com>
Date: Tue, 19 Dec 2023 17:16:29 -0500
Subject: [PATCH 185/213] Added access binding samples

---
 CONTRIBUTING.md                               |  2 +
 .../accounts_access_bindings_batch_create.py  | 88 ++++++++++++++++++
 ...ounts_access_bindings_batch_create_test.py | 31 +++++++
 .../accounts_access_bindings_batch_delete.py  | 80 ++++++++++++++++
 ...ounts_access_bindings_batch_delete_test.py | 31 +++++++
 .../accounts_access_bindings_batch_get.py     | 71 +++++++++++++++
 ...accounts_access_bindings_batch_get_test.py | 30 ++++++
 .../accounts_access_bindings_batch_update.py  | 91 +++++++++++++++++++
 ...ounts_access_bindings_batch_update_test.py | 31 +++++++
 .../accounts_access_bindings_create.py        | 80 ++++++++++++++++
 .../accounts_access_bindings_create_test.py   | 31 +++++++
 .../accounts_access_bindings_delete.py        | 72 +++++++++++++++
 .../accounts_access_bindings_delete_test.py   | 31 +++++++
 .../accounts_access_bindings_get.py           | 73 +++++++++++++++
 .../accounts_access_bindings_get_test.py      | 30 ++++++
 .../accounts_access_bindings_list.py          | 57 ++++++++++++
 .../accounts_access_bindings_list_test.py     | 29 ++++++
 .../accounts_access_bindings_update.py        | 78 ++++++++++++++++
 .../accounts_access_bindings_update_test.py   | 34 +++++++
 ...properties_access_bindings_batch_create.py | 89 ++++++++++++++++++
 ...rties_access_bindings_batch_create_test.py | 31 +++++++
 ...properties_access_bindings_batch_delete.py | 80 ++++++++++++++++
 ...rties_access_bindings_batch_delete_test.py | 31 +++++++
 .../properties_access_bindings_batch_get.py   | 74 +++++++++++++++
 ...operties_access_bindings_batch_get_test.py | 30 ++++++
 ...properties_access_bindings_batch_update.py | 91 +++++++++++++++++++
 ...rties_access_bindings_batch_update_test.py | 31 +++++++
 .../properties_access_bindings_create.py      | 80 ++++++++++++++++
 .../properties_access_bindings_create_test.py | 31 +++++++
 .../properties_access_bindings_delete.py      | 72 +++++++++++++++
 .../properties_access_bindings_delete_test.py | 31 +++++++
 .../properties_access_bindings_get.py         | 73 +++++++++++++++
 .../properties_access_bindings_get_test.py    | 30 ++++++
 .../properties_access_bindings_list.py        | 58 ++++++++++++
 .../properties_access_bindings_list_test.py   | 29 ++++++
 .../properties_access_bindings_update.py      | 78 ++++++++++++++++
 .../properties_access_bindings_update_test.py | 34 +++++++
 google-analytics-admin/properties_get_test.py |  1 -
 .../properties_run_access_report.py           |  3 +-
 39 files changed, 1944 insertions(+), 3 deletions(-)
 create mode 100644 google-analytics-admin/accounts_access_bindings_batch_create.py
 create mode 100644 google-analytics-admin/accounts_access_bindings_batch_create_test.py
 create mode 100644 google-analytics-admin/accounts_access_bindings_batch_delete.py
 create mode 100644 google-analytics-admin/accounts_access_bindings_batch_delete_test.py
 create mode 100644 google-analytics-admin/accounts_access_bindings_batch_get.py
 create mode 100644 google-analytics-admin/accounts_access_bindings_batch_get_test.py
 create mode 100644 google-analytics-admin/accounts_access_bindings_batch_update.py
 create mode 100644 google-analytics-admin/accounts_access_bindings_batch_update_test.py
 create mode 100644 google-analytics-admin/accounts_access_bindings_create.py
 create mode 100644 google-analytics-admin/accounts_access_bindings_create_test.py
 create mode 100644 google-analytics-admin/accounts_access_bindings_delete.py
 create mode 100644 google-analytics-admin/accounts_access_bindings_delete_test.py
 create mode 100644 google-analytics-admin/accounts_access_bindings_get.py
 create mode 100644 google-analytics-admin/accounts_access_bindings_get_test.py
 create mode 100644 google-analytics-admin/accounts_access_bindings_list.py
 create mode 100644 google-analytics-admin/accounts_access_bindings_list_test.py
 create mode 100644 google-analytics-admin/accounts_access_bindings_update.py
 create mode 100644 google-analytics-admin/accounts_access_bindings_update_test.py
 create mode 100644 google-analytics-admin/properties_access_bindings_batch_create.py
 create mode 100644 google-analytics-admin/properties_access_bindings_batch_create_test.py
 create mode 100644 google-analytics-admin/properties_access_bindings_batch_delete.py
 create mode 100644 google-analytics-admin/properties_access_bindings_batch_delete_test.py
 create mode 100644 google-analytics-admin/properties_access_bindings_batch_get.py
 create mode 100644 google-analytics-admin/properties_access_bindings_batch_get_test.py
 create mode 100644 google-analytics-admin/properties_access_bindings_batch_update.py
 create mode 100644 google-analytics-admin/properties_access_bindings_batch_update_test.py
 create mode 100644 google-analytics-admin/properties_access_bindings_create.py
 create mode 100644 google-analytics-admin/properties_access_bindings_create_test.py
 create mode 100644 google-analytics-admin/properties_access_bindings_delete.py
 create mode 100644 google-analytics-admin/properties_access_bindings_delete_test.py
 create mode 100644 google-analytics-admin/properties_access_bindings_get.py
 create mode 100644 google-analytics-admin/properties_access_bindings_get_test.py
 create mode 100644 google-analytics-admin/properties_access_bindings_list.py
 create mode 100644 google-analytics-admin/properties_access_bindings_list_test.py
 create mode 100644 google-analytics-admin/properties_access_bindings_update.py
 create mode 100644 google-analytics-admin/properties_access_bindings_update_test.py

diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 23dbd00..d679a41 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -70,6 +70,8 @@ nox -s lint blacken
     export GA_TEST_WEB_DATA_STREAM_ID=
     export GA_TEST_WEB_DATA_SECRET_ID=
     export GA_TEST_CONVERSION_EVENT_ID=
+    export GA_TEST_ACCOUNT_ACCESS_BINDING_ID=
+    export GA_TEST_PROPERTY_ACCESS_BINDING_ID=
     ```
 
 4.  Execute tests from the `google-analytics-admin` or `google-analytics-data`
diff --git a/google-analytics-admin/accounts_access_bindings_batch_create.py b/google-analytics-admin/accounts_access_bindings_batch_create.py
new file mode 100644
index 0000000..07f423b
--- /dev/null
+++ b/google-analytics-admin/accounts_access_bindings_batch_create.py
@@ -0,0 +1,88 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which creates a access binding for
+the account using a batch call.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts.accessBindings/batchCreate
+for more information.
+"""
+# [START analyticsadmin_accounts_access_bindings_batch_create]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha.types import (
+    AccessBinding,
+    BatchCreateAccessBindingsRequest,
+    CreateAccessBindingRequest,
+)
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics account ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account ID (e.g. "123456") before running the sample.
+    account_id = "YOUR-GA-ACCOUNT-ID"
+
+    # TODO(developer): Replace this variable with an email address of the user to
+    #  link. This user will be given access to your account after running the
+    #  sample.
+    email_address = "TEST-EMAIL-ADDRESS"
+
+    batch_create_account_access_binding(account_id, email_address)
+
+
+def batch_create_account_access_binding(
+    account_id: str, email_address: str, transport: str = None
+):
+    """
+    Creates a access binding for the account using a batch call.
+
+    Args:
+        account_id(str): The Google Analytics Account ID.
+        email_address(str): Email address of the access binding user.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
+    response = client.batch_create_access_bindings(
+        BatchCreateAccessBindingsRequest(
+            parent=f"accounts/{account_id}",
+            requests=[
+                CreateAccessBindingRequest(
+                    access_binding=AccessBinding(
+                        user=email_address,
+                        roles=["predefinedRoles/read"],
+                    )
+                )
+            ],
+        )
+    )
+
+    print("Result:")
+    for access_binding in response.access_bindings:
+        print(access_binding)
+        print()
+
+
+# [END analyticsadmin_accounts_access_bindings_batch_create]
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/accounts_access_bindings_batch_create_test.py b/google-analytics-admin/accounts_access_bindings_batch_create_test.py
new file mode 100644
index 0000000..ad77f65
--- /dev/null
+++ b/google-analytics-admin/accounts_access_bindings_batch_create_test.py
@@ -0,0 +1,31 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import accounts_access_bindings_batch_create
+
+FAKE_ACCOUNT_ID = "1"
+FAKE_EMAIL_ADDRESS = "FAKE_EMAIL_ADDRESS"
+
+
+def test_accounts_access_bindings_batch_create():
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        # This test ensures that the call is valid and reaches the server, even
+        # though the operation does not succeed due to permission error.
+        with pytest.raises(Exception, match="The caller does not have permission"):
+            accounts_access_bindings_batch_create.batch_create_account_access_binding(
+                FAKE_ACCOUNT_ID, FAKE_EMAIL_ADDRESS, transport=transport
+            )
diff --git a/google-analytics-admin/accounts_access_bindings_batch_delete.py b/google-analytics-admin/accounts_access_bindings_batch_delete.py
new file mode 100644
index 0000000..7d54995
--- /dev/null
+++ b/google-analytics-admin/accounts_access_bindings_batch_delete.py
@@ -0,0 +1,80 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which deletes the access binding
+using a batch call.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts.accessBindings/batchDelete
+for more information.
+"""
+# [START analyticsadmin_accounts_access_bindings_batch_delete]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha.types import (
+    BatchDeleteAccessBindingsRequest,
+    DeleteAccessBindingRequest,
+)
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics property ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account ID (e.g. "123456") before running the sample.
+    account_id = "YOUR-GA-ACCOUNT-ID"
+
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account access binding ID (e.g. "123456") before running the sample.
+    account_access_binding_id = "YOUR-ACCOUNT-ACCESS-BINDING-ID"
+
+    batch_delete_account_access_binding(account_id, account_access_binding_id)
+
+
+def batch_delete_account_access_binding(
+    account_id: str, account_access_binding_id: str, transport: str = None
+):
+    """
+    Deletes the access binding using a batch call.
+
+    Args:
+        account_id(str): The Google Analytics Account ID.
+        account_access_binding_id(str): Google Analytics account access binding ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
+    client.batch_delete_access_bindings(
+        BatchDeleteAccessBindingsRequest(
+            parent=f"accounts/{account_id}",
+            requests=[
+                DeleteAccessBindingRequest(
+                    name=f"accounts/{account_id}/accessBindings/{account_access_binding_id}"
+                )
+            ],
+        )
+    )
+    print("Access binding deleted")
+
+
+# [END analyticsadmin_accounts_access_bindings_batch_delete]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/accounts_access_bindings_batch_delete_test.py b/google-analytics-admin/accounts_access_bindings_batch_delete_test.py
new file mode 100644
index 0000000..1977bdf
--- /dev/null
+++ b/google-analytics-admin/accounts_access_bindings_batch_delete_test.py
@@ -0,0 +1,31 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import accounts_access_bindings_batch_delete
+
+FAKE_ACCOUNT_ID = "1"
+FAKE_ACCOUNT_ACCESS_BINDING_ID = "1"
+
+
+def test_accounts_access_bindings_batch_delete():
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        # This test ensures that the call is valid and reaches the server, even
+        # though the operation does not succeed due to permission error.
+        with pytest.raises(Exception, match="The caller does not have permission"):
+            accounts_access_bindings_batch_delete.batch_delete_account_access_binding(
+                FAKE_ACCOUNT_ID, FAKE_ACCOUNT_ACCESS_BINDING_ID, transport=transport
+            )
diff --git a/google-analytics-admin/accounts_access_bindings_batch_get.py b/google-analytics-admin/accounts_access_bindings_batch_get.py
new file mode 100644
index 0000000..f5779c0
--- /dev/null
+++ b/google-analytics-admin/accounts_access_bindings_batch_get.py
@@ -0,0 +1,71 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which prints the details for
+the account access binding using a batch call.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts.accessBindings/batchGet
+for more information.
+"""
+# [START analyticsadmin_accounts_access_bindings_batch_get]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha.types import BatchGetAccessBindingsRequest
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account ID (e.g. "123456") before running the sample.
+    account_id = "YOUR-GA-ACCOUNT-ID"
+
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account access binding ID (e.g. "123456") before running the sample.
+    account_access_binding_id = "YOUR-ACCOUNT-ACCESS-BINDING-ID"
+
+    batch_get_account_access_binding(account_id, account_access_binding_id)
+
+
+def batch_get_account_access_binding(
+    account_id: str, account_access_binding_id: str, transport: str = None
+):
+    """
+    Retrieves details for the account access binding using a batch call.
+
+    Args:
+        account_id(str): The Google Analytics Account ID.
+        account_access_binding_id(str): Google Analytics account access binding ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
+    response = client.batch_get_access_bindings(
+        BatchGetAccessBindingsRequest(
+            parent=f"accounts/{account_id}",
+            names=[f"accounts/{account_id}/accessBindings/{account_access_binding_id}"],
+        )
+    )
+
+    print("Result:")
+    for access_binding in response.access_bindings:
+        print(access_binding)
+        print()
+
+
+# [END analyticsadmin_accounts_access_bindings_batch_get]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/accounts_access_bindings_batch_get_test.py b/google-analytics-admin/accounts_access_bindings_batch_get_test.py
new file mode 100644
index 0000000..681f4c0
--- /dev/null
+++ b/google-analytics-admin/accounts_access_bindings_batch_get_test.py
@@ -0,0 +1,30 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import os
+
+import accounts_access_bindings_batch_get
+
+TEST_ACCOUNT_ID = os.getenv("GA_TEST_ACCOUNT_ID")
+TEST_ACCOUNT_ACCESS_BINDING_ID = os.getenv("GA_TEST_ACCOUNT_ACCESS_BINDING_ID")
+
+
+def test_accounts_access_bindings_batch_get(capsys):
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        accounts_access_bindings_batch_get.batch_get_account_access_binding(
+            TEST_ACCOUNT_ID, TEST_ACCOUNT_ACCESS_BINDING_ID, transport=transport
+        )
+        out, _ = capsys.readouterr()
+        assert "Result" in out
diff --git a/google-analytics-admin/accounts_access_bindings_batch_update.py b/google-analytics-admin/accounts_access_bindings_batch_update.py
new file mode 100644
index 0000000..124d16f
--- /dev/null
+++ b/google-analytics-admin/accounts_access_bindings_batch_update.py
@@ -0,0 +1,91 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which updates the account
+access binding using a batch call.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts.accessBindings/batchUpdate
+for more information.
+"""
+# [START analyticsadmin_accounts_access_bindings_batch_update]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha.types import (
+    AccessBinding,
+    BatchUpdateAccessBindingsRequest,
+    UpdateAccessBindingRequest,
+)
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics property ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account ID (e.g. "123456") before running the sample.
+    account_id = "YOUR-GA-ACCOUNT-ID"
+
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account access binding ID (e.g. "123456") before running the sample.
+    account_access_binding_id = "YOUR-ACCOUNT-ACCESS-BINDING-ID"
+
+    batch_update_account_access_binding(account_id, account_access_binding_id)
+
+
+def batch_update_account_access_binding(
+    account_id: str, account_access_binding_id: str, transport: str = None
+):
+    """
+    Updates the account access binding using a batch call.
+
+    Args:
+        account_id(str): The Google Analytics Account ID.
+        account_access_binding_id(str): Google Analytics account access binding ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
+    # This call updates the email address and direct roles of the access binding.
+    # The access binding to update is specified in the `name` field of the `AccessBinding`
+    # instance.
+    response = client.batch_update_access_bindings(
+        BatchUpdateAccessBindingsRequest(
+            parent=f"accounts/{account_id}",
+            requests=[
+                UpdateAccessBindingRequest(
+                    access_binding=AccessBinding(
+                        name=f"accounts/{account_id}/accessBindings/{account_access_binding_id}",
+                        roles=["predefinedRoles/collaborate"],
+                    ),
+                )
+            ],
+        )
+    )
+
+    print("Result:")
+    for access_binding in response.access_bindings:
+        print(access_binding)
+        print()
+
+
+# [END analyticsadmin_accounts_access_bindings_batch_update]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/accounts_access_bindings_batch_update_test.py b/google-analytics-admin/accounts_access_bindings_batch_update_test.py
new file mode 100644
index 0000000..722db41
--- /dev/null
+++ b/google-analytics-admin/accounts_access_bindings_batch_update_test.py
@@ -0,0 +1,31 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import accounts_access_bindings_batch_update
+
+FAKE_ACCOUNT_ID = "1"
+FAKE_ACCOUNT_ACCESS_BINDING_ID = "1"
+
+
+def test_accounts_access_bindings_batch_update():
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        # This test ensures that the call is valid and reaches the server, even
+        # though the operation does not succeed due to permission error.
+        with pytest.raises(Exception, match="The caller does not have permission"):
+            accounts_access_bindings_batch_update.batch_update_account_access_binding(
+                FAKE_ACCOUNT_ID, FAKE_ACCOUNT_ACCESS_BINDING_ID, transport=transport
+            )
diff --git a/google-analytics-admin/accounts_access_bindings_create.py b/google-analytics-admin/accounts_access_bindings_create.py
new file mode 100644
index 0000000..bacd8c1
--- /dev/null
+++ b/google-analytics-admin/accounts_access_bindings_create.py
@@ -0,0 +1,80 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which creates a access binding
+for the account.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts.accessBindings/create
+for more information.
+"""
+# [START analyticsadmin_accounts_access_bindings_create]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha.types import (
+    AccessBinding,
+    CreateAccessBindingRequest,
+)
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics account ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account ID (e.g. "123456") before running the sample.
+    account_id = "YOUR-GA-ACCOUNT-ID"
+
+    # TODO(developer): Replace this variable with an email address of the user to
+    #  link. This user will be given access to your account after running the
+    #  sample.
+    email_address = "TEST-EMAIL-ADDRESS"
+
+    create_account_access_binding(account_id, email_address)
+
+
+def create_account_access_binding(
+    account_id: str, email_address: str, transport: str = None
+):
+    """
+    Creates a access binding for the account.
+
+    Args:
+        account_id(str): The Google Analytics Account ID.
+        email_address(str): Email address of the access binding user.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
+    access_binding = client.create_access_binding(
+        CreateAccessBindingRequest(
+            parent=f"accounts/{account_id}",
+            access_binding=AccessBinding(
+                user=email_address, roles=["predefinedRoles/read"]
+            ),
+        )
+    )
+
+    print("Result:")
+    print(access_binding)
+
+
+# [END analyticsadmin_accounts_access_bindings_create]
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/accounts_access_bindings_create_test.py b/google-analytics-admin/accounts_access_bindings_create_test.py
new file mode 100644
index 0000000..93845cf
--- /dev/null
+++ b/google-analytics-admin/accounts_access_bindings_create_test.py
@@ -0,0 +1,31 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import accounts_access_bindings_create
+
+FAKE_ACCOUNT_ID = "1"
+FAKE_EMAIL_ADDRESS = "FAKE_EMAIL_ADDRESS"
+
+
+def test_accounts_access_bindings_create():
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        # This test ensures that the call is valid and reaches the server, even
+        # though the operation does not succeed due to permission error.
+        with pytest.raises(Exception, match="The caller does not have permission"):
+            accounts_access_bindings_create.create_account_access_binding(
+                FAKE_ACCOUNT_ID, FAKE_EMAIL_ADDRESS, transport=transport
+            )
diff --git a/google-analytics-admin/accounts_access_bindings_delete.py b/google-analytics-admin/accounts_access_bindings_delete.py
new file mode 100644
index 0000000..146b6a4
--- /dev/null
+++ b/google-analytics-admin/accounts_access_bindings_delete.py
@@ -0,0 +1,72 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which deletes the access binding
+for the account.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts.accessBindings/delete
+for more information.
+"""
+# [START analyticsadmin_accounts_access_bindings_delete]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha.types import DeleteAccessBindingRequest
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics property ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account ID (e.g. "123456") before running the sample.
+    account_id = "YOUR-GA-ACCOUNT-ID"
+
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account access binding ID (e.g. "123456") before running the sample.
+    account_access_binding_id = "YOUR-ACCOUNT-ACCESS-BINDING-ID"
+
+    delete_account_access_binding(account_id, account_access_binding_id)
+
+
+def delete_account_access_binding(
+    account_id: str, account_access_binding_id: str, transport: str = None
+):
+    """
+    Deletes the access binding for the account.
+
+    Args:
+        account_id(str): The Google Analytics Account ID.
+        account_access_binding_id(str): Google Analytics account access binding ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
+    client.delete_access_binding(
+        DeleteAccessBindingRequest(
+            name=f"accounts/{account_id}/accessBindings/{account_access_binding_id}"
+        )
+    )
+    print("Access binding deleted")
+
+
+# [END analyticsadmin_accounts_access_bindings_delete]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/accounts_access_bindings_delete_test.py b/google-analytics-admin/accounts_access_bindings_delete_test.py
new file mode 100644
index 0000000..a7c98eb
--- /dev/null
+++ b/google-analytics-admin/accounts_access_bindings_delete_test.py
@@ -0,0 +1,31 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import accounts_access_bindings_delete
+
+FAKE_ACCOUNT_ID = "1"
+FAKE_ACCOUNT_ACCESS_BINDING_ID = "1"
+
+
+def test_accounts_access_bindings_delete():
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        # This test ensures that the call is valid and reaches the server, even
+        # though the operation does not succeed due to permission error.
+        with pytest.raises(Exception, match="The caller does not have permission"):
+            accounts_access_bindings_delete.delete_account_access_binding(
+                FAKE_ACCOUNT_ID, FAKE_ACCOUNT_ACCESS_BINDING_ID, transport=transport
+            )
diff --git a/google-analytics-admin/accounts_access_bindings_get.py b/google-analytics-admin/accounts_access_bindings_get.py
new file mode 100644
index 0000000..c6d3828
--- /dev/null
+++ b/google-analytics-admin/accounts_access_bindings_get.py
@@ -0,0 +1,73 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which prints the account user
+link details.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts.accessBindings/get
+for more information.
+"""
+# [START analyticsadmin_accounts_access_bindings_get]
+from google.analytics.admin import AnalyticsAdminServiceClient
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account ID (e.g. "123456") before running the sample.
+    account_id = "YOUR-GA-ACCOUNT-ID"
+
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account access binding ID (e.g. "123456") before running the sample.
+    account_access_binding_id = "YOUR-ACCOUNT-ACCESS-BINDING-ID"
+
+    get_account_access_binding(account_id, account_access_binding_id)
+
+
+def get_account_access_binding(
+    account_id: str, account_access_binding_id: str, transport: str = None
+):
+    """
+    Retrieves the account access binding details.
+
+    Args:
+        account_id(str): The Google Analytics Account ID.
+        account_access_binding_id(str): Google Analytics account access binding ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
+    access_binding = client.get_access_binding(
+        name=f"accounts/{account_id}/accessBindings/{account_access_binding_id}"
+    )
+
+    print("Result:")
+    print_access_binding(access_binding)
+
+
+def print_access_binding(access_binding):
+    """Prints the access binding details."""
+    print(f"Resource name: {access_binding.name}")
+    print(f"User: {access_binding.user}")
+    for role in access_binding.roles:
+        print(f"Role: {role}")
+
+
+# [END analyticsadmin_accounts_access_bindings_get]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/accounts_access_bindings_get_test.py b/google-analytics-admin/accounts_access_bindings_get_test.py
new file mode 100644
index 0000000..796e17b
--- /dev/null
+++ b/google-analytics-admin/accounts_access_bindings_get_test.py
@@ -0,0 +1,30 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import os
+
+import accounts_access_bindings_get
+
+TEST_ACCOUNT_ID = os.getenv("GA_TEST_ACCOUNT_ID")
+TEST_ACCOUNT_ACCESS_BINDING_ID = os.getenv("GA_TEST_ACCOUNT_ACCESS_BINDING_ID")
+
+
+def test_accounts_access_bindings_get(capsys):
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        accounts_access_bindings_get.get_account_access_binding(
+            TEST_ACCOUNT_ID, TEST_ACCOUNT_ACCESS_BINDING_ID, transport=transport
+        )
+        out, _ = capsys.readouterr()
+        assert "Result" in out
diff --git a/google-analytics-admin/accounts_access_bindings_list.py b/google-analytics-admin/accounts_access_bindings_list.py
new file mode 100644
index 0000000..ee8dae3
--- /dev/null
+++ b/google-analytics-admin/accounts_access_bindings_list.py
@@ -0,0 +1,57 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which prints access bindings
+under the specified parent account.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts.accessBindings/list
+for more information.
+"""
+# [START analyticsadmin_accounts_access_bindings_list]
+from google.analytics.admin import AnalyticsAdminServiceClient
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account ID (e.g. "123456") before running the sample.
+    account_id = "YOUR-GA-ACCOUNT-ID"
+    list_account_access_bindings(account_id)
+
+
+def list_account_access_bindings(account_id: str, transport: str = None):
+    """
+    Lists access bindings under the specified parent account.
+
+    Args:
+        account_id(str): The id of the account.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
+    results = client.list_access_bindings(parent=f"accounts/{account_id}")
+
+    print("Result:")
+    for access_binding in results:
+        print(access_binding)
+        print()
+
+
+# [END analyticsadmin_accounts_access_bindings_list]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/accounts_access_bindings_list_test.py b/google-analytics-admin/accounts_access_bindings_list_test.py
new file mode 100644
index 0000000..1a3584d
--- /dev/null
+++ b/google-analytics-admin/accounts_access_bindings_list_test.py
@@ -0,0 +1,29 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import os
+
+import accounts_access_bindings_list
+
+TEST_ACCOUNT_ID = os.getenv("GA_TEST_ACCOUNT_ID")
+
+
+def test_accounts_access_bindings_list(capsys):
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        accounts_access_bindings_list.list_account_access_bindings(
+            TEST_ACCOUNT_ID, transport=transport
+        )
+        out, _ = capsys.readouterr()
+        assert "Result" in out
diff --git a/google-analytics-admin/accounts_access_bindings_update.py b/google-analytics-admin/accounts_access_bindings_update.py
new file mode 100644
index 0000000..a062a27
--- /dev/null
+++ b/google-analytics-admin/accounts_access_bindings_update.py
@@ -0,0 +1,78 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which updates the account
+access binding.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts.accessBindings/patch
+for more information.
+"""
+# [START analyticsadmin_accounts_access_bindings_update]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha.types import AccessBinding
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics property ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account ID (e.g. "123456") before running the sample.
+    account_id = "YOUR-GA-ACCOUNT-ID"
+
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account access binding ID (e.g. "123456") before running the sample.
+    account_access_binding_id = "YOUR-ACCOUNT-ACCESS-BINDING-ID"
+
+    update_account_access_binding(account_id, account_access_binding_id)
+
+
+def update_account_access_binding(
+    account_id: str, account_access_binding_id: str, transport: str = None
+):
+    """
+    Updates the account access binding.
+
+    Args:
+        account_id(str): The Google Analytics Account ID.
+        account_access_binding_id(str): Google Analytics account access binding ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
+    # This call updates the email address and direct roles of the access binding.
+    # The access binding to update is specified in the `name` field of the `AccessBinding`
+    # instance.
+    access_binding = client.update_access_binding(
+        access_binding=AccessBinding(
+            name=f"accounts/{account_id}/accessBindings/{account_access_binding_id}",
+            roles=["predefinedRoles/collaborate"],
+        ),
+    )
+
+    print("Result:")
+    print(access_binding)
+
+
+# [END analyticsadmin_accounts_access_bindings_update]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/accounts_access_bindings_update_test.py b/google-analytics-admin/accounts_access_bindings_update_test.py
new file mode 100644
index 0000000..b6cb850
--- /dev/null
+++ b/google-analytics-admin/accounts_access_bindings_update_test.py
@@ -0,0 +1,34 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import accounts_access_bindings_update
+
+FAKE_ACCOUNT_ID = "1"
+FAKE_ACCOUNT_ACCESS_BINDING_ID = "1"
+
+
+def test_accounts_access_bindings_update():
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        # This test ensures that the call is valid and reaches the server, even
+        # though the operation does not succeed due to permission error.
+        with pytest.raises(
+            Exception,
+            match="(The caller does not have permission|Invalid access binding name)",
+        ):
+            accounts_access_bindings_update.update_account_access_binding(
+                FAKE_ACCOUNT_ID, FAKE_ACCOUNT_ACCESS_BINDING_ID, transport=transport
+            )
diff --git a/google-analytics-admin/properties_access_bindings_batch_create.py b/google-analytics-admin/properties_access_bindings_batch_create.py
new file mode 100644
index 0000000..3c4383b
--- /dev/null
+++ b/google-analytics-admin/properties_access_bindings_batch_create.py
@@ -0,0 +1,89 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which creates a access binding for
+the Google Analytics 4 property using a batch call.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.accessBindings/batchCreate
+for more information.
+"""
+# [START analyticsadmin_properties_access_bindings_batch_create]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha.types import (
+    AccessBinding,
+    BatchCreateAccessBindingsRequest,
+    CreateAccessBindingRequest,
+)
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics account ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with an email address of the user to
+    #  link. This user will be given access to your account after running the
+    #  sample.
+    email_address = "TEST-EMAIL-ADDRESS"
+
+    batch_create_property_access_binding(property_id, email_address)
+
+
+def batch_create_property_access_binding(
+    property_id: str, email_address: str, transport: str = None
+):
+    """
+    Creates a access binding for the Google Analytics 4 property using a batch
+    call.
+
+    Args:
+        property_id(str): The Google Analytics Property ID.
+        email_address(str): Email address of the access binding user.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
+    response = client.batch_create_access_bindings(
+        BatchCreateAccessBindingsRequest(
+            parent=f"properties/{property_id}",
+            requests=[
+                CreateAccessBindingRequest(
+                    access_binding=AccessBinding(
+                        user=email_address,
+                        roles=["predefinedRoles/read"],
+                    )
+                )
+            ],
+        )
+    )
+
+    print("Result:")
+    for access_binding in response.access_bindings:
+        print(access_binding)
+        print()
+
+
+# [END analyticsadmin_properties_access_bindings_batch_create]
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_access_bindings_batch_create_test.py b/google-analytics-admin/properties_access_bindings_batch_create_test.py
new file mode 100644
index 0000000..0984e2b
--- /dev/null
+++ b/google-analytics-admin/properties_access_bindings_batch_create_test.py
@@ -0,0 +1,31 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import properties_access_bindings_batch_create
+
+FAKE_PROPERTY_ID = "1"
+FAKE_EMAIL_ADDRESS = "test@google.com"
+
+
+def test_properties_access_bindings_batch_create():
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        # This test ensures that the call is valid and reaches the server, even
+        # though the operation does not succeed due to permission error.
+        with pytest.raises(Exception, match="The caller does not have permission"):
+            properties_access_bindings_batch_create.batch_create_property_access_binding(
+                FAKE_PROPERTY_ID, FAKE_EMAIL_ADDRESS, transport=transport
+            )
diff --git a/google-analytics-admin/properties_access_bindings_batch_delete.py b/google-analytics-admin/properties_access_bindings_batch_delete.py
new file mode 100644
index 0000000..522d7a3
--- /dev/null
+++ b/google-analytics-admin/properties_access_bindings_batch_delete.py
@@ -0,0 +1,80 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which delete the access binding for
+the Google Analytics 4 property using a batch call.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.accessBindings/batchDelete
+for more information.
+"""
+# [START analyticsadmin_properties_access_bindings_batch_delete]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha.types import (
+    BatchDeleteAccessBindingsRequest,
+    DeleteAccessBindingRequest,
+)
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics property ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account access binding ID (e.g. "123456") before running the sample.
+    property_access_binding_id = "YOUR-ACCOUNT-ACCESS-BINDING-ID"
+
+    batch_delete_property_access_binding(property_id, property_access_binding_id)
+
+
+def batch_delete_property_access_binding(
+    property_id: str, property_access_binding_id: str, transport: str = None
+):
+    """
+    Deletes the GA4 property access binding using a batch call.
+
+    Args:
+        property_id(str): The Google Analytics Property ID.
+        property_access_binding_id(str): Google Analytics account access binding ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
+    client.batch_delete_access_bindings(
+        BatchDeleteAccessBindingsRequest(
+            parent=f"properties/{property_id}",
+            requests=[
+                DeleteAccessBindingRequest(
+                    name=f"properties/{property_id}/accessBindings/{property_access_binding_id}"
+                )
+            ],
+        )
+    )
+    print("Access binding deleted")
+
+
+# [END analyticsadmin_properties_access_bindings_batch_delete]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_access_bindings_batch_delete_test.py b/google-analytics-admin/properties_access_bindings_batch_delete_test.py
new file mode 100644
index 0000000..a88a2c0
--- /dev/null
+++ b/google-analytics-admin/properties_access_bindings_batch_delete_test.py
@@ -0,0 +1,31 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import properties_access_bindings_batch_delete
+
+FAKE_PROPERTY_ID = "1"
+FAKE_ACCESS_BINDING_ID = "1"
+
+
+def test_properties_access_bindings_batch_delete():
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        # This test ensures that the call is valid and reaches the server, even
+        # though the operation does not succeed due to permission error.
+        with pytest.raises(Exception, match="The caller does not have permission"):
+            properties_access_bindings_batch_delete.batch_delete_property_access_binding(
+                FAKE_PROPERTY_ID, FAKE_ACCESS_BINDING_ID, transport=transport
+            )
diff --git a/google-analytics-admin/properties_access_bindings_batch_get.py b/google-analytics-admin/properties_access_bindings_batch_get.py
new file mode 100644
index 0000000..b377fa9
--- /dev/null
+++ b/google-analytics-admin/properties_access_bindings_batch_get.py
@@ -0,0 +1,74 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which prints details for the
+Google Analytics 4 property access binding using a batch call.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.accessBindings/batchGet
+for more information.
+"""
+# [START analyticsadmin_properties_access_bindings_batch_get]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha.types import BatchGetAccessBindingsRequest
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account access binding ID (e.g. "123456") before running the sample.
+    property_access_binding_id = "YOUR-ACCOUNT-ACCESS-BINDING-ID"
+
+    batch_get_property_access_binding(property_id, property_access_binding_id)
+
+
+def batch_get_property_access_binding(
+    property_id: str, property_access_binding_id: str, transport: str = None
+):
+    """
+    Retrieves details for the Google Analytics 4 property access binding using a
+    batch call.
+
+    Args:
+        property_id(str): The Google Analytics Property ID.
+        property_access_binding_id(str): Google Analytics account access binding ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
+    response = client.batch_get_access_bindings(
+        BatchGetAccessBindingsRequest(
+            parent=f"properties/{property_id}",
+            names=[
+                f"properties/{property_id}/accessBindings/{property_access_binding_id}"
+            ],
+        )
+    )
+
+    print("Result:")
+    for access_binding in response.access_bindings:
+        print(access_binding)
+        print()
+
+
+# [END analyticsadmin_properties_access_bindings_batch_get]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_access_bindings_batch_get_test.py b/google-analytics-admin/properties_access_bindings_batch_get_test.py
new file mode 100644
index 0000000..fd7f443
--- /dev/null
+++ b/google-analytics-admin/properties_access_bindings_batch_get_test.py
@@ -0,0 +1,30 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import os
+
+import properties_access_bindings_batch_get
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+TEST_ACCESS_BINDING_ID = os.getenv("GA_TEST_PROPERTY_ACCESS_BINDING_ID")
+
+
+def test_properties_access_bindings_batch_get(capsys):
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        properties_access_bindings_batch_get.batch_get_property_access_binding(
+            TEST_PROPERTY_ID, TEST_ACCESS_BINDING_ID, transport=transport
+        )
+        out, _ = capsys.readouterr()
+        assert "Result" in out
diff --git a/google-analytics-admin/properties_access_bindings_batch_update.py b/google-analytics-admin/properties_access_bindings_batch_update.py
new file mode 100644
index 0000000..ca2bcaa
--- /dev/null
+++ b/google-analytics-admin/properties_access_bindings_batch_update.py
@@ -0,0 +1,91 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which updates the Google
+Analytics 4 property access binding using a batch call.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.accessBindings/batchUpdate
+for more information.
+"""
+# [START analyticsadmin_properties_access_bindings_batch_update]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha.types import (
+    AccessBinding,
+    BatchUpdateAccessBindingsRequest,
+    UpdateAccessBindingRequest,
+)
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics property ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account access binding ID (e.g. "123456") before running the sample.
+    property_access_binding_id = "YOUR-ACCOUNT-ACCESS-BINDING-ID"
+
+    batch_update_property_access_binding(property_id, property_access_binding_id)
+
+
+def batch_update_property_access_binding(
+    property_id: str, property_access_binding_id: str, transport: str = None
+):
+    """
+    Updates the Google Analytics 4 property access binding using a batch call.
+
+    Args:
+        property_id(str): The Google Analytics Property ID.
+        property_access_binding_id(str): Google Analytics account access binding ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
+    # This call updates the email address and direct roles of the access binding.
+    # The access binding to update is specified in the `name` field of the `AccessBinding`
+    # instance.
+    response = client.batch_update_access_bindings(
+        BatchUpdateAccessBindingsRequest(
+            parent=f"properties/{property_id}",
+            requests=[
+                UpdateAccessBindingRequest(
+                    access_binding=AccessBinding(
+                        name=f"properties/{property_id}/accessBindings/{property_access_binding_id}",
+                        roles=["predefinedRoles/collaborate"],
+                    ),
+                )
+            ],
+        )
+    )
+
+    print("Result:")
+    for access_binding in response.access_bindings:
+        print(access_binding)
+        print()
+
+
+# [END analyticsadmin_properties_access_bindings_batch_update]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_access_bindings_batch_update_test.py b/google-analytics-admin/properties_access_bindings_batch_update_test.py
new file mode 100644
index 0000000..a9ff413
--- /dev/null
+++ b/google-analytics-admin/properties_access_bindings_batch_update_test.py
@@ -0,0 +1,31 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import properties_access_bindings_batch_update
+
+FAKE_PROPERTY_ID = "1"
+FAKE_ACCESS_BINDING_ID = "1"
+
+
+def test_properties_access_bindings_batch_update():
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        # This test ensures that the call is valid and reaches the server, even
+        # though the operation does not succeed due to permission error.
+        with pytest.raises(Exception, match="The caller does not have permission"):
+            properties_access_bindings_batch_update.batch_update_property_access_binding(
+                FAKE_PROPERTY_ID, FAKE_ACCESS_BINDING_ID, transport=transport
+            )
diff --git a/google-analytics-admin/properties_access_bindings_create.py b/google-analytics-admin/properties_access_bindings_create.py
new file mode 100644
index 0000000..3b42ebf
--- /dev/null
+++ b/google-analytics-admin/properties_access_bindings_create.py
@@ -0,0 +1,80 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which creates a access binding for
+the Google Analytics 4 property.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.accessBindings/create
+for more information.
+"""
+# [START analyticsadmin_properties_access_bindings_create]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha.types import (
+    AccessBinding,
+    CreateAccessBindingRequest,
+)
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics account ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with an email address of the user to
+    #  link. This user will be given access to your account after running the
+    #  sample.
+    email_address = "TEST-EMAIL-ADDRESS"
+
+    create_property_access_binding(property_id, email_address)
+
+
+def create_property_access_binding(
+    property_id: str, email_address: str, transport: str = None
+):
+    """
+    Creates a access binding for the Google Analytics 4 property.
+
+    Args:
+        property_id(str): The Google Analytics Property ID.
+        email_address(str): Email address of the access binding user.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
+    access_binding = client.create_access_binding(
+        CreateAccessBindingRequest(
+            parent=f"properties/{property_id}",
+            access_binding=AccessBinding(
+                user=email_address, roles=["predefinedRoles/read"]
+            ),
+        )
+    )
+
+    print("Result:")
+    print(access_binding)
+
+
+# [END analyticsadmin_properties_access_bindings_create]
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_access_bindings_create_test.py b/google-analytics-admin/properties_access_bindings_create_test.py
new file mode 100644
index 0000000..35df694
--- /dev/null
+++ b/google-analytics-admin/properties_access_bindings_create_test.py
@@ -0,0 +1,31 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import properties_access_bindings_create
+
+FAKE_PROPERTY_ID = "1"
+FAKE_EMAIL_ADDRESS = "test@google.com"
+
+
+def test_properties_access_bindings_create():
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        # This test ensures that the call is valid and reaches the server, even
+        # though the operation does not succeed due to permission error.
+        with pytest.raises(Exception, match="The caller does not have permission"):
+            properties_access_bindings_create.create_property_access_binding(
+                FAKE_PROPERTY_ID, FAKE_EMAIL_ADDRESS, transport=transport
+            )
diff --git a/google-analytics-admin/properties_access_bindings_delete.py b/google-analytics-admin/properties_access_bindings_delete.py
new file mode 100644
index 0000000..3c63589
--- /dev/null
+++ b/google-analytics-admin/properties_access_bindings_delete.py
@@ -0,0 +1,72 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which deletes the access binding
+from the Google Analytics 4 property.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.accessBindings/delete
+for more information.
+"""
+# [START analyticsadmin_properties_access_bindings_delete]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha.types import DeleteAccessBindingRequest
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics property ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account access binding ID (e.g. "123456") before running the sample.
+    property_access_binding_id = "YOUR-ACCOUNT-ACCESS-BINDING-ID"
+
+    delete_property_access_binding(property_id, property_access_binding_id)
+
+
+def delete_property_access_binding(
+    property_id: str, property_access_binding_id: str, transport: str = None
+):
+    """
+    Deletes the access binding from the Google Analytics 4 property.
+
+    Args:
+        property_id(str): The Google Analytics Property ID.
+        property_access_binding_id(str): Google Analytics account access binding ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
+    client.delete_access_binding(
+        DeleteAccessBindingRequest(
+            name=f"properties/{property_id}/accessBindings/{property_access_binding_id}"
+        )
+    )
+    print("Access binding deleted")
+
+
+# [END analyticsadmin_properties_access_bindings_delete]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_access_bindings_delete_test.py b/google-analytics-admin/properties_access_bindings_delete_test.py
new file mode 100644
index 0000000..17bfbb6
--- /dev/null
+++ b/google-analytics-admin/properties_access_bindings_delete_test.py
@@ -0,0 +1,31 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import properties_access_bindings_delete
+
+FAKE_PROPERTY_ID = "1"
+FAKE_ACCESS_BINDING_ID = "1"
+
+
+def test_properties_access_bindings_delete():
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        # This test ensures that the call is valid and reaches the server, even
+        # though the operation does not succeed due to permission error.
+        with pytest.raises(Exception, match="The caller does not have permission"):
+            properties_access_bindings_delete.delete_property_access_binding(
+                FAKE_PROPERTY_ID, FAKE_ACCESS_BINDING_ID, transport=transport
+            )
diff --git a/google-analytics-admin/properties_access_bindings_get.py b/google-analytics-admin/properties_access_bindings_get.py
new file mode 100644
index 0000000..14a1b40
--- /dev/null
+++ b/google-analytics-admin/properties_access_bindings_get.py
@@ -0,0 +1,73 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which prints the Google
+Analytics 4 property access binding details.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.accessBindings/get
+for more information.
+"""
+# [START analyticsadmin_properties_access_bindings_get]
+from google.analytics.admin import AnalyticsAdminServiceClient
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account access binding ID (e.g. "123456") before running the sample.
+    property_access_binding_id = "YOUR-ACCOUNT-ACCESS-BINDING-ID"
+
+    get_property_access_binding(property_id, property_access_binding_id)
+
+
+def get_property_access_binding(
+    property_id: str, property_access_binding_id: str, transport: str = None
+):
+    """
+    Retrieves the Google Analytics 4 property access binding details.
+
+    Args:
+        property_id(str): The Google Analytics Property ID.
+        property_access_binding_id(str): Google Analytics account access binding ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
+    access_binding = client.get_access_binding(
+        name=f"properties/{property_id}/accessBindings/{property_access_binding_id}"
+    )
+
+    print("Result:")
+    print_access_binding(access_binding)
+
+
+def print_access_binding(access_binding):
+    """Prints the access binding details."""
+    print(f"Resource name: {access_binding.name}")
+    print(f"User: {access_binding.user}")
+    for role in access_binding.roles:
+        print(f"Role: {role}")
+
+
+# [END analyticsadmin_properties_access_bindings_get]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_access_bindings_get_test.py b/google-analytics-admin/properties_access_bindings_get_test.py
new file mode 100644
index 0000000..21015f8
--- /dev/null
+++ b/google-analytics-admin/properties_access_bindings_get_test.py
@@ -0,0 +1,30 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import os
+
+import properties_access_bindings_get
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+TEST_ACCESS_BINDING_ID = os.getenv("GA_TEST_PROPERTY_ACCESS_BINDING_ID")
+
+
+def test_properties_access_bindings_get(capsys):
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        properties_access_bindings_get.get_property_access_binding(
+            TEST_PROPERTY_ID, TEST_ACCESS_BINDING_ID, transport=transport
+        )
+        out, _ = capsys.readouterr()
+        assert "Result" in out
diff --git a/google-analytics-admin/properties_access_bindings_list.py b/google-analytics-admin/properties_access_bindings_list.py
new file mode 100644
index 0000000..38ee944
--- /dev/null
+++ b/google-analytics-admin/properties_access_bindings_list.py
@@ -0,0 +1,58 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which prints access bindings under
+the specified parent Google Analytics 4 property.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.accessBindings/list
+for more information.
+"""
+# [START analyticsadmin_properties_access_bindings_list]
+from google.analytics.admin import AnalyticsAdminServiceClient
+
+
+def run_sample():
+    """Runs the sample."""
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+    list_property_access_bindings(property_id)
+
+
+def list_property_access_bindings(property_id: str, transport: str = None):
+    """
+    Lists access bindings under the specified parent Google Analytics 4
+    property.
+
+    Args:
+        property_id(str): The Google Analytics Property ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
+    results = client.list_access_bindings(parent=f"properties/{property_id}")
+
+    print("Result:")
+    for access_binding in results:
+        print(access_binding)
+        print()
+
+
+# [END analyticsadmin_properties_access_bindings_list]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_access_bindings_list_test.py b/google-analytics-admin/properties_access_bindings_list_test.py
new file mode 100644
index 0000000..4b0b251
--- /dev/null
+++ b/google-analytics-admin/properties_access_bindings_list_test.py
@@ -0,0 +1,29 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import os
+
+import properties_access_bindings_list
+
+TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
+
+
+def test_properties_access_bindings_list(capsys):
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        properties_access_bindings_list.list_property_access_bindings(
+            TEST_PROPERTY_ID, transport=transport
+        )
+        out, _ = capsys.readouterr()
+        assert "Result" in out
diff --git a/google-analytics-admin/properties_access_bindings_update.py b/google-analytics-admin/properties_access_bindings_update.py
new file mode 100644
index 0000000..afb4ace
--- /dev/null
+++ b/google-analytics-admin/properties_access_bindings_update.py
@@ -0,0 +1,78 @@
+#!/usr/bin/env python
+
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+"""Google Analytics Admin API sample application which updates the Google
+Analytics 4 property access binding.
+
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.accessBindings/update
+for more information.
+"""
+# [START analyticsadmin_properties_access_bindings_update]
+from google.analytics.admin import AnalyticsAdminServiceClient
+from google.analytics.admin_v1alpha.types import AccessBinding
+
+
+def run_sample():
+    """Runs the sample."""
+
+    # !!! ATTENTION !!!
+    #  Running this sample may change/delete your Google Analytics account
+    #  configuration. Make sure to not use the Google Analytics property ID from
+    #  your production environment below.
+
+    # TODO(developer): Replace this variable with your Google Analytics 4
+    #  property ID (e.g. "123456") before running the sample.
+    property_id = "YOUR-GA4-PROPERTY-ID"
+
+    # TODO(developer): Replace this variable with your Google Analytics
+    #  account access binding ID (e.g. "123456") before running the sample.
+    property_access_binding_id = "YOUR-ACCOUNT-ACCESS-BINDING-ID"
+
+    update_property_access_binding(property_id, property_access_binding_id)
+
+
+def update_property_access_binding(
+    property_id: str, property_access_binding_id: str, transport: str = None
+):
+    """
+    Updates the Google Analytics 4 property access binding.
+
+    Args:
+        property_id(str): The Google Analytics Property ID.
+        property_access_binding_id(str): Google Analytics account access binding ID.
+        transport(str): The transport to use. For example, "grpc"
+            or "rest". If set to None, a transport is chosen automatically.
+    """
+    client = AnalyticsAdminServiceClient(transport=transport)
+    # This call updates the email address and direct roles of the access binding.
+    # The access binding to update is specified in the `name` field of the `AccessBinding`
+    # instance.
+    access_binding = client.update_access_binding(
+        access_binding=AccessBinding(
+            name=f"properties/{property_id}/accessBindings/{property_access_binding_id}",
+            roles=["predefinedRoles/collaborate"],
+        ),
+    )
+
+    print("Result:")
+    print(access_binding)
+
+
+# [END analyticsadmin_properties_access_bindings_update]
+
+
+if __name__ == "__main__":
+    run_sample()
diff --git a/google-analytics-admin/properties_access_bindings_update_test.py b/google-analytics-admin/properties_access_bindings_update_test.py
new file mode 100644
index 0000000..c81af5d
--- /dev/null
+++ b/google-analytics-admin/properties_access_bindings_update_test.py
@@ -0,0 +1,34 @@
+# Copyright 2021 Google LLC All Rights Reserved.
+#
+# 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.
+
+import pytest
+
+import properties_access_bindings_update
+
+FAKE_PROPERTY_ID = "1"
+FAKE_ACCESS_BINDING_ID = "1"
+
+
+def test_properties_access_bindings_update():
+    transports = ["grpc", "rest"]
+    for transport in transports:
+        # This test ensures that the call is valid and reaches the server, even
+        # though the operation does not succeed due to permission error.
+        with pytest.raises(
+            Exception,
+            match="The caller does not have permission|Invalid access binding name",
+        ):
+            properties_access_bindings_update.update_property_access_binding(
+                FAKE_PROPERTY_ID, FAKE_ACCESS_BINDING_ID, transport=transport
+            )
diff --git a/google-analytics-admin/properties_get_test.py b/google-analytics-admin/properties_get_test.py
index db07183..a770c39 100644
--- a/google-analytics-admin/properties_get_test.py
+++ b/google-analytics-admin/properties_get_test.py
@@ -17,7 +17,6 @@
 import properties_get
 
 TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
-TEST_USER_LINK_ID = os.getenv("GA_USER_LINK_ID")
 
 
 def test_properties_get(capsys):
diff --git a/google-analytics-admin/properties_run_access_report.py b/google-analytics-admin/properties_run_access_report.py
index 6cad3fe..6e51909 100644
--- a/google-analytics-admin/properties_run_access_report.py
+++ b/google-analytics-admin/properties_run_access_report.py
@@ -43,7 +43,7 @@ def run_access_report(property_id: str, transport: str = None):
     """
     Runs an access report for a Google Analytics property. The report will
     aggregate over dimensions `userEmail`, `accessedPropertyId`,
-    `propertyUserLink`, `reportType`, `revenueDataReturned`, `costDataReturned`,
+    `reportType`, `revenueDataReturned`, `costDataReturned`,
     `userIP`, and return the access count, as well as the most recent access
     time for each combination.
     See https://developers.google.com/analytics/devguides/config/admin/v1/access-api-schema
@@ -59,7 +59,6 @@ def run_access_report(property_id: str, transport: str = None):
         dimensions=[
             AccessDimension(dimension_name="userEmail"),
             AccessDimension(dimension_name="accessedPropertyId"),
-            AccessDimension(dimension_name="propertyUserLink"),
             AccessDimension(dimension_name="reportType"),
             AccessDimension(dimension_name="revenueDataReturned"),
             AccessDimension(dimension_name="costDataReturned"),

From a22d3e69c32d68a0d2fb7597a33a6a81b01ff142 Mon Sep 17 00:00:00 2001
From: Josh Radcliff <jradcliff@users.noreply.github.com>
Date: Wed, 20 Dec 2023 13:59:50 -0500
Subject: [PATCH 186/213] Update comments in access binding samples

---
 .../accounts_access_bindings_batch_update.py                 | 5 ++---
 google-analytics-admin/accounts_access_bindings_update.py    | 5 ++---
 .../properties_access_bindings_batch_update.py               | 5 ++---
 google-analytics-admin/properties_access_bindings_update.py  | 5 ++---
 4 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/google-analytics-admin/accounts_access_bindings_batch_update.py b/google-analytics-admin/accounts_access_bindings_batch_update.py
index 124d16f..7095105 100644
--- a/google-analytics-admin/accounts_access_bindings_batch_update.py
+++ b/google-analytics-admin/accounts_access_bindings_batch_update.py
@@ -61,9 +61,8 @@ def batch_update_account_access_binding(
             or "rest". If set to None, a transport is chosen automatically.
     """
     client = AnalyticsAdminServiceClient(transport=transport)
-    # This call updates the email address and direct roles of the access binding.
-    # The access binding to update is specified in the `name` field of the `AccessBinding`
-    # instance.
+    # This call updates the roles of the access binding. The access binding to
+    # update is specified in the `name` field of the `AccessBinding` instance.
     response = client.batch_update_access_bindings(
         BatchUpdateAccessBindingsRequest(
             parent=f"accounts/{account_id}",
diff --git a/google-analytics-admin/accounts_access_bindings_update.py b/google-analytics-admin/accounts_access_bindings_update.py
index a062a27..442cf4f 100644
--- a/google-analytics-admin/accounts_access_bindings_update.py
+++ b/google-analytics-admin/accounts_access_bindings_update.py
@@ -57,9 +57,8 @@ def update_account_access_binding(
             or "rest". If set to None, a transport is chosen automatically.
     """
     client = AnalyticsAdminServiceClient(transport=transport)
-    # This call updates the email address and direct roles of the access binding.
-    # The access binding to update is specified in the `name` field of the `AccessBinding`
-    # instance.
+    # This call updates the roles of the access binding. The access binding to
+    # update is specified in the `name` field of the `AccessBinding` instance.
     access_binding = client.update_access_binding(
         access_binding=AccessBinding(
             name=f"accounts/{account_id}/accessBindings/{account_access_binding_id}",
diff --git a/google-analytics-admin/properties_access_bindings_batch_update.py b/google-analytics-admin/properties_access_bindings_batch_update.py
index ca2bcaa..01cbfde 100644
--- a/google-analytics-admin/properties_access_bindings_batch_update.py
+++ b/google-analytics-admin/properties_access_bindings_batch_update.py
@@ -61,9 +61,8 @@ def batch_update_property_access_binding(
             or "rest". If set to None, a transport is chosen automatically.
     """
     client = AnalyticsAdminServiceClient(transport=transport)
-    # This call updates the email address and direct roles of the access binding.
-    # The access binding to update is specified in the `name` field of the `AccessBinding`
-    # instance.
+    # This call updates the roles of the access binding. The access binding to
+    # update is specified in the `name` field of the `AccessBinding` instance.
     response = client.batch_update_access_bindings(
         BatchUpdateAccessBindingsRequest(
             parent=f"properties/{property_id}",
diff --git a/google-analytics-admin/properties_access_bindings_update.py b/google-analytics-admin/properties_access_bindings_update.py
index afb4ace..9ec08f9 100644
--- a/google-analytics-admin/properties_access_bindings_update.py
+++ b/google-analytics-admin/properties_access_bindings_update.py
@@ -57,9 +57,8 @@ def update_property_access_binding(
             or "rest". If set to None, a transport is chosen automatically.
     """
     client = AnalyticsAdminServiceClient(transport=transport)
-    # This call updates the email address and direct roles of the access binding.
-    # The access binding to update is specified in the `name` field of the `AccessBinding`
-    # instance.
+    # This call updates the roles of the access binding. The access binding to
+    # update is specified in the `name` field of the `AccessBinding` instance.
     access_binding = client.update_access_binding(
         access_binding=AccessBinding(
             name=f"properties/{property_id}/accessBindings/{property_access_binding_id}",

From 0b69da9315cca7c77b22fd2fa945c95f433404eb Mon Sep 17 00:00:00 2001
From: Josh Radcliff <jradcliff@users.noreply.github.com>
Date: Thu, 23 May 2024 17:38:18 -0400
Subject: [PATCH 187/213] Configure Renovate

---
 .github/renovate.json5 | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100644 .github/renovate.json5

diff --git a/.github/renovate.json5 b/.github/renovate.json5
new file mode 100644
index 0000000..bc74ad7
--- /dev/null
+++ b/.github/renovate.json5
@@ -0,0 +1,27 @@
+// Based partially on https://github.com/GoogleCloudPlatform/python-docs-samples/blob/main/renovate.json
+{
+    "extends": [
+        // https://docs.renovatebot.com/presets-config/#configrecommended
+        "config:recommended",
+        "schedule:earlyMondays",
+        ":ignoreUnstable",
+    ],
+    // Apply label to PRs.
+    "labels": [
+        "dependencies",
+    ],
+    // https://docs.renovatebot.com/configuration-options/#minimumreleaseage
+    "minimumReleaseAge": "3 days",
+    "dependencyDashboardLabels": [
+        "type: process",
+    ],
+    "rebaseWhen": "behind-base-branch",
+    "semanticCommits": "enabled",
+    // Create PR for vulnerability alerts immediately.
+    "vulnerabilityAlerts": {
+        "labels": [
+            "security"
+        ],
+        "minimumReleaseAge": null
+    },
+}

From 1170b82ec520567dafa45d02e7bda2c7b796494a Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Thu, 23 May 2024 23:42:36 +0200
Subject: [PATCH 188/213] chore(deps): update dependency pytest to v7.4.4 (#8)

---
 google-analytics-admin/requirements-test.txt | 2 +-
 google-analytics-data/requirements-test.txt  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/google-analytics-admin/requirements-test.txt b/google-analytics-admin/requirements-test.txt
index de1887b..fa427e1 100644
--- a/google-analytics-admin/requirements-test.txt
+++ b/google-analytics-admin/requirements-test.txt
@@ -1 +1 @@
-pytest==7.4.2
\ No newline at end of file
+pytest==7.4.4
\ No newline at end of file
diff --git a/google-analytics-data/requirements-test.txt b/google-analytics-data/requirements-test.txt
index 2a929ed..cb87efc 100644
--- a/google-analytics-data/requirements-test.txt
+++ b/google-analytics-data/requirements-test.txt
@@ -1 +1 @@
-pytest==7.4.2
+pytest==7.4.4

From 2d6d07a6e233f932a5bd6e3c8fc51be9bda7a190 Mon Sep 17 00:00:00 2001
From: Josh Radcliff <jradcliff@users.noreply.github.com>
Date: Thu, 22 Aug 2024 10:10:33 -0400
Subject: [PATCH 189/213] Update remaining references from 'conversions' to
 'keyEvents'

---
 CONTRIBUTING.md                               |  2 +-
 .../accounts_search_change_history_events.py  |  8 ++---
 google-analytics-admin/noxfile_config.py      |  4 +--
 ...ate.py => properties_key_events_create.py} | 30 ++++++++--------
 ...y => properties_key_events_create_test.py} |  6 ++--
 ...ete.py => properties_key_events_delete.py} | 28 +++++++--------
 ...y => properties_key_events_delete_test.py} | 10 +++---
 ...ts_get.py => properties_key_events_get.py} | 36 +++++++++----------
 ...t.py => properties_key_events_get_test.py} | 10 +++---
 ..._list.py => properties_key_events_list.py} | 28 +++++++--------
 ....py => properties_key_events_list_test.py} |  6 ++--
 google-analytics-admin/requirements.txt       |  4 +--
 ...n_realtime_report_with_multiple_metrics.py |  2 +-
 .../run_report_with_pagination.py             |  4 +--
 14 files changed, 85 insertions(+), 93 deletions(-)
 rename google-analytics-admin/{properties_conversion_events_create.py => properties_key_events_create.py} (68%)
 rename google-analytics-admin/{properties_conversion_events_create_test.py => properties_key_events_create_test.py} (86%)
 rename google-analytics-admin/{properties_conversion_events_delete.py => properties_key_events_delete.py} (69%)
 rename google-analytics-admin/{properties_conversion_events_delete_test.py => properties_key_events_delete_test.py} (77%)
 rename google-analytics-admin/{properties_conversion_events_get.py => properties_key_events_get.py} (60%)
 rename google-analytics-admin/{properties_conversion_events_get_test.py => properties_key_events_get_test.py} (73%)
 rename google-analytics-admin/{properties_conversion_events_list.py => properties_key_events_list.py} (63%)
 rename google-analytics-admin/{properties_conversion_events_list_test.py => properties_key_events_list_test.py} (84%)

diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index d679a41..9c18541 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -69,7 +69,7 @@ nox -s lint blacken
     export GA_TEST_ACCOUNT_ID=
     export GA_TEST_WEB_DATA_STREAM_ID=
     export GA_TEST_WEB_DATA_SECRET_ID=
-    export GA_TEST_CONVERSION_EVENT_ID=
+    export GA_TEST_KEY_EVENT_ID=
     export GA_TEST_ACCOUNT_ACCESS_BINDING_ID=
     export GA_TEST_PROPERTY_ACCESS_BINDING_ID=
     ```
diff --git a/google-analytics-admin/accounts_search_change_history_events.py b/google-analytics-admin/accounts_search_change_history_events.py
index 1fb57dc..e784b1f 100644
--- a/google-analytics-admin/accounts_search_change_history_events.py
+++ b/google-analytics-admin/accounts_search_change_history_events.py
@@ -20,7 +20,7 @@
 See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts/searchChangeHistoryEvents
 for more information.
 """
-# [START analyticsadmin_properties_conversion_events_create]
+# [START analyticsadmin_properties_key_events_create]
 from datetime import datetime, timedelta
 
 from google.analytics.admin import (
@@ -107,8 +107,8 @@ def print_resource(resource):
         print("  DisplayVideo360AdvertiserLink resource")
     elif resource.display_video_360_advertiser_link_proposal:
         print("  DisplayVideo360AdvertiserLinkProposal resource")
-    elif resource.conversion_event:
-        print("  ConversionEvent resource")
+    elif resource.key_event:
+        print("  KeyEvent resource")
     elif resource.measurement_protocol_secret:
         print("  MeasurementProtocolSecret resource")
     elif resource.custom_dimension:
@@ -123,7 +123,7 @@ def print_resource(resource):
     print()
 
 
-# [END analyticsadmin_properties_conversion_events_create]
+# [END analyticsadmin_properties_key_events_create]
 
 if __name__ == "__main__":
     run_sample()
diff --git a/google-analytics-admin/noxfile_config.py b/google-analytics-admin/noxfile_config.py
index 27c82eb..93cd38b 100644
--- a/google-analytics-admin/noxfile_config.py
+++ b/google-analytics-admin/noxfile_config.py
@@ -34,8 +34,6 @@
         "GA_TEST_WEB_DATA_SECRET_ID": os.getenv(
             "GA_TEST_WEB_DATA_SECRET_ID", "2994983412"
         ),
-        "GA_TEST_CONVERSION_EVENT_ID": os.getenv(
-            "GA_TEST_CONVERSION_EVENT_ID", "2719963095"
-        ),
+        "GA_TEST_KEY_EVENT_ID": os.getenv("GA_TEST_KEY_EVENT_ID", "2719963095"),
     },
 }
diff --git a/google-analytics-admin/properties_conversion_events_create.py b/google-analytics-admin/properties_key_events_create.py
similarity index 68%
rename from google-analytics-admin/properties_conversion_events_create.py
rename to google-analytics-admin/properties_key_events_create.py
index 528ae83..11fcdab 100644
--- a/google-analytics-admin/properties_conversion_events_create.py
+++ b/google-analytics-admin/properties_key_events_create.py
@@ -14,15 +14,15 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-"""Google Analytics Admin API sample application which creates a conversion
+"""Google Analytics Admin API sample application which creates a key
 event for the Google Analytics 4 property.
 
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.conversionEvents/create
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.keyEvents/create
 for more information.
 """
-# [START analyticsadmin_properties_conversion_events_create]
+# [START analyticsadmin_properties_key_events_create]
 from google.analytics.admin import AnalyticsAdminServiceClient
-from google.analytics.admin_v1alpha import ConversionEvent
+from google.analytics.admin_v1alpha import KeyEvent
 
 
 def run_sample():
@@ -37,12 +37,12 @@ def run_sample():
     #  property ID (e.g. "123456") before running the sample.
     property_id = "YOUR-GA4-PROPERTY-ID"
 
-    create_conversion_event(property_id)
+    create_key_event(property_id)
 
 
-def create_conversion_event(property_id: str, transport: str = None):
+def create_key_event(property_id: str, transport: str = None):
     """
-    Creates a conversion event for the Google Analytics 4 property.
+    Creates a key event for the Google Analytics 4 property.
 
     Args:
         property_id(str): The Google Analytics Property ID.
@@ -50,20 +50,20 @@ def create_conversion_event(property_id: str, transport: str = None):
             or "rest". If set to None, a transport is chosen automatically.
     """
     client = AnalyticsAdminServiceClient(transport=transport)
-    conversion_event = client.create_conversion_event(
+    key_event = client.create_key_event(
         parent=f"properties/{property_id}",
-        conversion_event=ConversionEvent(event_name="test_purchase"),
+        key_event=KeyEvent(event_name="test_purchase"),
     )
 
     print("Result:")
-    print(f"Resource name: {conversion_event.name}")
-    print(f"Event name: {conversion_event.event_name}")
-    print(f"Create time: {conversion_event.create_time}")
-    print(f"Deletable: {conversion_event.deletable}")
-    print(f"Custom: {conversion_event.custom}")
+    print(f"Resource name: {key_event.name}")
+    print(f"Event name: {key_event.event_name}")
+    print(f"Create time: {key_event.create_time}")
+    print(f"Deletable: {key_event.deletable}")
+    print(f"Custom: {key_event.custom}")
 
 
-# [END analyticsadmin_properties_conversion_events_create]
+# [END analyticsadmin_properties_key_events_create]
 
 if __name__ == "__main__":
     run_sample()
diff --git a/google-analytics-admin/properties_conversion_events_create_test.py b/google-analytics-admin/properties_key_events_create_test.py
similarity index 86%
rename from google-analytics-admin/properties_conversion_events_create_test.py
rename to google-analytics-admin/properties_key_events_create_test.py
index 5012bdc..85aa23c 100644
--- a/google-analytics-admin/properties_conversion_events_create_test.py
+++ b/google-analytics-admin/properties_key_events_create_test.py
@@ -14,17 +14,17 @@
 
 import pytest
 
-import properties_conversion_events_create
+import properties_key_events_create
 
 FAKE_PROPERTY_ID = "1"
 
 
-def test_properties_conversion_events_create():
+def test_properties_key_events_create():
     transports = ["grpc", "rest"]
     for transport in transports:
         # This test ensures that the call is valid and reaches the server, even
         # though the operation does not succeed due to permission error.
         with pytest.raises(Exception, match="The caller does not have permission"):
-            properties_conversion_events_create.create_conversion_event(
+            properties_key_events_create.create_key_event(
                 FAKE_PROPERTY_ID, transport=transport
             )
diff --git a/google-analytics-admin/properties_conversion_events_delete.py b/google-analytics-admin/properties_key_events_delete.py
similarity index 69%
rename from google-analytics-admin/properties_conversion_events_delete.py
rename to google-analytics-admin/properties_key_events_delete.py
index da46342..047db74 100644
--- a/google-analytics-admin/properties_conversion_events_delete.py
+++ b/google-analytics-admin/properties_key_events_delete.py
@@ -14,14 +14,14 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-"""Google Analytics Admin API sample application which deletes a conversion
+"""Google Analytics Admin API sample application which deletes a key
 event for the Google Analytics 4 property.
 
 
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.conversionEvents/delete
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.keyEvents/delete
 for more information.
 """
-# [START analyticsadmin_properties_conversion_events_delete]
+# [START analyticsadmin_properties_key_events_delete]
 from google.analytics.admin import AnalyticsAdminServiceClient
 
 
@@ -37,33 +37,29 @@ def run_sample():
     #  property ID (e.g. "123456") before running the sample.
     property_id = "YOUR-GA4-PROPERTY-ID"
 
-    # TODO(developer): Replace this variable with your conversion event ID
+    # TODO(developer): Replace this variable with your key event ID
     #  (e.g. "123456") before running the sample.
-    conversion_event_id = "YOUR-CONVERSION-EVENT-ID"
+    key_event_id = "YOUR-KEY-EVENT-ID"
 
-    delete_conversion_event(property_id, conversion_event_id)
+    delete_key_event(property_id, key_event_id)
 
 
-def delete_conversion_event(
-    property_id: str, conversion_event_id: str, transport: str = None
-):
+def delete_key_event(property_id: str, key_event_id: str, transport: str = None):
     """
-    Deletes the conversion event for the Google Analytics 4 property.
+    Deletes the key event for the Google Analytics 4 property.
 
     Args:
         property_id(str): The Google Analytics Property ID.
-        conversion_event_id(str): The conversion event ID
+        key_event_id(str): The key event ID
         transport(str): The transport to use. For example, "grpc"
             or "rest". If set to None, a transport is chosen automatically.
     """
     client = AnalyticsAdminServiceClient(transport=transport)
-    client.delete_conversion_event(
-        name=f"properties/{property_id}/conversionEvents/{conversion_event_id}"
-    )
-    print("Conversion event deleted")
+    client.delete_key_event(name=f"properties/{property_id}/keyEvents/{key_event_id}")
+    print("Key event deleted")
 
 
-# [END analyticsadmin_properties_conversion_events_delete]
+# [END analyticsadmin_properties_key_events_delete]
 
 
 if __name__ == "__main__":
diff --git a/google-analytics-admin/properties_conversion_events_delete_test.py b/google-analytics-admin/properties_key_events_delete_test.py
similarity index 77%
rename from google-analytics-admin/properties_conversion_events_delete_test.py
rename to google-analytics-admin/properties_key_events_delete_test.py
index 2a85c81..678ecf4 100644
--- a/google-analytics-admin/properties_conversion_events_delete_test.py
+++ b/google-analytics-admin/properties_key_events_delete_test.py
@@ -14,18 +14,18 @@
 
 import pytest
 
-import properties_conversion_events_delete
+import properties_key_events_delete
 
 FAKE_PROPERTY_ID = "1"
-FAKE_CONVERSION_EVENT_ID = "1"
+FAKE_KEY_EVENT_ID = "1"
 
 
-def test_properties_conversion_events_delete():
+def test_properties_key_events_delete():
     transports = ["grpc", "rest"]
     for transport in transports:
         # This test ensures that the call is valid and reaches the server, even
         # though the operation does not succeed due to permission error.
         with pytest.raises(Exception, match="The caller does not have permission"):
-            properties_conversion_events_delete.delete_conversion_event(
-                FAKE_PROPERTY_ID, FAKE_CONVERSION_EVENT_ID, transport=transport
+            properties_key_events_delete.delete_key_event(
+                FAKE_PROPERTY_ID, FAKE_KEY_EVENT_ID, transport=transport
             )
diff --git a/google-analytics-admin/properties_conversion_events_get.py b/google-analytics-admin/properties_key_events_get.py
similarity index 60%
rename from google-analytics-admin/properties_conversion_events_get.py
rename to google-analytics-admin/properties_key_events_get.py
index 6a8a435..e888018 100644
--- a/google-analytics-admin/properties_conversion_events_get.py
+++ b/google-analytics-admin/properties_key_events_get.py
@@ -14,13 +14,13 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-"""Google Analytics Admin API sample application which prints the conversion
+"""Google Analytics Admin API sample application which prints the key
 event details.
 
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.conversionEvents/get
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.keyEvents/get
 for more information.
 """
-# [START analyticsadmin_properties_conversion_events_get]
+# [START analyticsadmin_properties_key_events_get]
 from google.analytics.admin import AnalyticsAdminServiceClient
 
 
@@ -30,38 +30,36 @@ def run_sample():
     #  property ID (e.g. "123456") before running the sample.
     property_id = "YOUR-GA4-PROPERTY-ID"
 
-    # TODO(developer): Replace this variable with your conversion event ID
+    # TODO(developer): Replace this variable with your key event ID
     #  (e.g. "123456") before running the sample.
-    conversion_event_id = "YOUR-CONVERSION-EVENT-ID"
+    key_event_id = "YOUR-KEY-EVENT-ID"
 
-    get_conversion_event(property_id, conversion_event_id)
+    get_key_event(property_id, key_event_id)
 
 
-def get_conversion_event(
-    property_id: str, conversion_event_id: str, transport: str = None
-):
+def get_key_event(property_id: str, key_event_id: str, transport: str = None):
     """
-    Retrieves the details for the conversion event.
+    Retrieves the details for the key event.
     Args:
         property_id(str): The Google Analytics Property ID.
-        conversion_event_id(str): The conversion event ID
+        key_event_id(str): The key event ID
         transport(str): The transport to use. For example, "grpc"
             or "rest". If set to None, a transport is chosen automatically.
     """
     client = AnalyticsAdminServiceClient(transport=transport)
-    conversion_event = client.get_conversion_event(
-        name=f"properties/{property_id}/conversionEvents/{conversion_event_id}"
+    key_event = client.get_key_event(
+        name=f"properties/{property_id}/keyEvents/{key_event_id}"
     )
 
     print("Result:")
-    print(f"Resource name: {conversion_event.name}")
-    print(f"Event name: {conversion_event.event_name}")
-    print(f"Create time: {conversion_event.create_time}")
-    print(f"Deletable: {conversion_event.deletable}")
-    print(f"Custom: {conversion_event.custom}")
+    print(f"Resource name: {key_event.name}")
+    print(f"Event name: {key_event.event_name}")
+    print(f"Create time: {key_event.create_time}")
+    print(f"Deletable: {key_event.deletable}")
+    print(f"Custom: {key_event.custom}")
 
 
-# [END analyticsadmin_properties_conversion_events_get]
+# [END analyticsadmin_properties_key_events_get]
 
 
 if __name__ == "__main__":
diff --git a/google-analytics-admin/properties_conversion_events_get_test.py b/google-analytics-admin/properties_key_events_get_test.py
similarity index 73%
rename from google-analytics-admin/properties_conversion_events_get_test.py
rename to google-analytics-admin/properties_key_events_get_test.py
index 719c95d..076a09b 100644
--- a/google-analytics-admin/properties_conversion_events_get_test.py
+++ b/google-analytics-admin/properties_key_events_get_test.py
@@ -14,17 +14,17 @@
 
 import os
 
-import properties_conversion_events_get
+import properties_key_events_get
 
 TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
-TEST_CONVERSION_EVENT_ID = os.getenv("GA_TEST_CONVERSION_EVENT_ID")
+TEST_KEY_EVENT_ID = os.getenv("GA_TEST_KEY_EVENT_ID")
 
 
-def test_properties_conversion_events_get(capsys):
+def test_properties_key_events_get(capsys):
     transports = ["grpc", "rest"]
     for transport in transports:
-        properties_conversion_events_get.get_conversion_event(
-            TEST_PROPERTY_ID, TEST_CONVERSION_EVENT_ID, transport=transport
+        properties_key_events_get.get_key_event(
+            TEST_PROPERTY_ID, TEST_KEY_EVENT_ID, transport=transport
         )
         out, _ = capsys.readouterr()
         assert "Result" in out
diff --git a/google-analytics-admin/properties_conversion_events_list.py b/google-analytics-admin/properties_key_events_list.py
similarity index 63%
rename from google-analytics-admin/properties_conversion_events_list.py
rename to google-analytics-admin/properties_key_events_list.py
index 41c7a43..e67824d 100644
--- a/google-analytics-admin/properties_conversion_events_list.py
+++ b/google-analytics-admin/properties_key_events_list.py
@@ -14,13 +14,13 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-"""Google Analytics Admin API sample application which lists conversion events
+"""Google Analytics Admin API sample application which lists key events
 for the Google Analytics 4 property.
 
-See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.conversionEvents/list
+See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.keyEvents/list
 for more information.
 """
-# [START analyticsadmin_properties_conversion_events_list]
+# [START analyticsadmin_properties_key_events_list]
 from google.analytics.admin import AnalyticsAdminServiceClient
 
 
@@ -30,12 +30,12 @@ def run_sample():
     #  property ID (e.g. "123456") before running the sample.
     property_id = "YOUR-GA4-PROPERTY-ID"
 
-    list_conversion_events(property_id)
+    list_key_events(property_id)
 
 
-def list_conversion_events(property_id: str, transport: str = None):
+def list_key_events(property_id: str, transport: str = None):
     """
-    Lists conversion events for the Google Analytics 4 property.
+    Lists key events for the Google Analytics 4 property.
 
     Args:
         property_id(str): The Google Analytics Property ID.
@@ -43,19 +43,19 @@ def list_conversion_events(property_id: str, transport: str = None):
             or "rest". If set to None, a transport is chosen automatically.
     """
     client = AnalyticsAdminServiceClient(transport=transport)
-    results = client.list_conversion_events(parent=f"properties/{property_id}")
+    results = client.list_key_events(parent=f"properties/{property_id}")
 
     print("Result:")
-    for conversion_event in results:
-        print(f"Resource name: {conversion_event.name}")
-        print(f"Event name: {conversion_event.event_name}")
-        print(f"Create time: {conversion_event.create_time}")
-        print(f"Deletable: {conversion_event.deletable}")
-        print(f"Custom: {conversion_event.custom}")
+    for key_event in results:
+        print(f"Resource name: {key_event.name}")
+        print(f"Event name: {key_event.event_name}")
+        print(f"Create time: {key_event.create_time}")
+        print(f"Deletable: {key_event.deletable}")
+        print(f"Custom: {key_event.custom}")
         print()
 
 
-# [END analyticsadmin_properties_conversion_events_list]
+# [END analyticsadmin_properties_key_events_list]
 
 
 if __name__ == "__main__":
diff --git a/google-analytics-admin/properties_conversion_events_list_test.py b/google-analytics-admin/properties_key_events_list_test.py
similarity index 84%
rename from google-analytics-admin/properties_conversion_events_list_test.py
rename to google-analytics-admin/properties_key_events_list_test.py
index 8687599..3acbe3f 100644
--- a/google-analytics-admin/properties_conversion_events_list_test.py
+++ b/google-analytics-admin/properties_key_events_list_test.py
@@ -14,15 +14,15 @@
 
 import os
 
-import properties_conversion_events_list
+import properties_key_events_list
 
 TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID")
 
 
-def test_properties_conversion_events_list(capsys):
+def test_properties_key_events_list(capsys):
     transports = ["grpc", "rest"]
     for transport in transports:
-        properties_conversion_events_list.list_conversion_events(
+        properties_key_events_list.list_key_events(
             TEST_PROPERTY_ID, transport=transport
         )
         out, _ = capsys.readouterr()
diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index fa07523..f0a37a5 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-admin==0.21.0
-google-auth-oauthlib==1.1.0
\ No newline at end of file
+google-analytics-admin==0.23.0
+google-auth-oauthlib==1.1.0
diff --git a/google-analytics-data/run_realtime_report_with_multiple_metrics.py b/google-analytics-data/run_realtime_report_with_multiple_metrics.py
index 831b32b..120c326 100644
--- a/google-analytics-data/run_realtime_report_with_multiple_metrics.py
+++ b/google-analytics-data/run_realtime_report_with_multiple_metrics.py
@@ -46,7 +46,7 @@ def run_realtime_report_with_multiple_metrics(property_id="YOUR-GA4-PROPERTY-ID"
     request = RunRealtimeReportRequest(
         property=f"properties/{property_id}",
         dimensions=[Dimension(name="unifiedScreenName")],
-        metrics=[Metric(name="screenPageViews"), Metric(name="conversions")],
+        metrics=[Metric(name="screenPageViews"), Metric(name="keyEvents")],
     )
     response = client.run_realtime_report(request)
     print_run_report_response(response)
diff --git a/google-analytics-data/run_report_with_pagination.py b/google-analytics-data/run_report_with_pagination.py
index 9211993..f8af1cd 100644
--- a/google-analytics-data/run_report_with_pagination.py
+++ b/google-analytics-data/run_report_with_pagination.py
@@ -56,7 +56,7 @@ def run_report_with_pagination(property_id="YOUR-GA4-PROPERTY-ID"):
         ],
         metrics=[
             Metric(name="sessions"),
-            Metric(name="conversions"),
+            Metric(name="keyEvents"),
             Metric(name="totalRevenue"),
         ],
         limit=100000,
@@ -79,7 +79,7 @@ def run_report_with_pagination(property_id="YOUR-GA4-PROPERTY-ID"):
         ],
         metrics=[
             Metric(name="sessions"),
-            Metric(name="conversions"),
+            Metric(name="keyEvents"),
             Metric(name="totalRevenue"),
         ],
         limit=100000,

From 0161d1528293baec958270ed4cfe5fa58dffd4a7 Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Thu, 22 Aug 2024 19:57:13 +0200
Subject: [PATCH 190/213] chore(deps): update dependency google-analytics-data
 to v0.18.11 (#10)

---
 google-analytics-data/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index ecbbd50..cdccc73 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-data==0.17.2
+google-analytics-data==0.18.11
 google-auth-oauthlib==1.1.0
\ No newline at end of file

From 82ac309469a822649b3701405ecd1d851e909542 Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Thu, 22 Aug 2024 20:00:59 +0200
Subject: [PATCH 191/213] chore(deps): update dependency google-auth-oauthlib
 to v1.2.1 (#11)

---
 google-analytics-admin/requirements.txt | 2 +-
 google-analytics-data/requirements.txt  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index f0a37a5..7b5cd7d 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
 google-analytics-admin==0.23.0
-google-auth-oauthlib==1.1.0
+google-auth-oauthlib==1.2.1
diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index cdccc73..a2c852b 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
 google-analytics-data==0.18.11
-google-auth-oauthlib==1.1.0
\ No newline at end of file
+google-auth-oauthlib==1.2.1
\ No newline at end of file

From 99495691a97f807f372246c53e1b4221a3261e1d Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Thu, 22 Aug 2024 20:04:01 +0200
Subject: [PATCH 192/213] chore(deps): update dependency pytest to v8 (#12)

---
 google-analytics-admin/requirements-test.txt | 2 +-
 google-analytics-data/requirements-test.txt  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/google-analytics-admin/requirements-test.txt b/google-analytics-admin/requirements-test.txt
index fa427e1..3566307 100644
--- a/google-analytics-admin/requirements-test.txt
+++ b/google-analytics-admin/requirements-test.txt
@@ -1 +1 @@
-pytest==7.4.4
\ No newline at end of file
+pytest==8.3.2
\ No newline at end of file
diff --git a/google-analytics-data/requirements-test.txt b/google-analytics-data/requirements-test.txt
index cb87efc..fe93bd5 100644
--- a/google-analytics-data/requirements-test.txt
+++ b/google-analytics-data/requirements-test.txt
@@ -1 +1 @@
-pytest==7.4.4
+pytest==8.3.2

From 40c18aeb399fda5186f70628d3c1af53a59196c1 Mon Sep 17 00:00:00 2001
From: Josh Radcliff <jradcliff@users.noreply.github.com>
Date: Mon, 30 Sep 2024 12:15:12 -0400
Subject: [PATCH 193/213] Revert change history key events change (#16)

There isn't a key_event (to replace conversion_event) in ChangeHistoryResource yet.
---
 .../accounts_search_change_history_events.py              | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/google-analytics-admin/accounts_search_change_history_events.py b/google-analytics-admin/accounts_search_change_history_events.py
index e784b1f..313980f 100644
--- a/google-analytics-admin/accounts_search_change_history_events.py
+++ b/google-analytics-admin/accounts_search_change_history_events.py
@@ -20,7 +20,7 @@
 See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts/searchChangeHistoryEvents
 for more information.
 """
-# [START analyticsadmin_properties_key_events_create]
+# [START analyticsadmin_accounts_search_change_history_events]
 from datetime import datetime, timedelta
 
 from google.analytics.admin import (
@@ -107,8 +107,8 @@ def print_resource(resource):
         print("  DisplayVideo360AdvertiserLink resource")
     elif resource.display_video_360_advertiser_link_proposal:
         print("  DisplayVideo360AdvertiserLinkProposal resource")
-    elif resource.key_event:
-        print("  KeyEvent resource")
+    elif resource.conversion_event:
+        print("  ConversionEvent resource")
     elif resource.measurement_protocol_secret:
         print("  MeasurementProtocolSecret resource")
     elif resource.custom_dimension:
@@ -123,7 +123,7 @@ def print_resource(resource):
     print()
 
 
-# [END analyticsadmin_properties_key_events_create]
+# [END analyticsadmin_accounts_search_change_history_events]
 
 if __name__ == "__main__":
     run_sample()

From dd8cf612b0d96fbf2bd7de30e0d990378acbd0c2 Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Mon, 30 Sep 2024 20:58:15 +0200
Subject: [PATCH 194/213] chore(deps): update dependency pytest to v8.3.3 (#14)

---
 google-analytics-admin/requirements-test.txt | 2 +-
 google-analytics-data/requirements-test.txt  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/google-analytics-admin/requirements-test.txt b/google-analytics-admin/requirements-test.txt
index 3566307..f9ddc40 100644
--- a/google-analytics-admin/requirements-test.txt
+++ b/google-analytics-admin/requirements-test.txt
@@ -1 +1 @@
-pytest==8.3.2
\ No newline at end of file
+pytest==8.3.3
\ No newline at end of file
diff --git a/google-analytics-data/requirements-test.txt b/google-analytics-data/requirements-test.txt
index fe93bd5..40543aa 100644
--- a/google-analytics-data/requirements-test.txt
+++ b/google-analytics-data/requirements-test.txt
@@ -1 +1 @@
-pytest==8.3.2
+pytest==8.3.3

From 270f65f8cdbb49ac8a9831b54b4c6859a72df709 Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Mon, 30 Sep 2024 20:58:57 +0200
Subject: [PATCH 195/213] chore(deps): update dependency google-analytics-data
 to v0.18.12 (#15)

---
 google-analytics-data/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index a2c852b..af647a9 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-data==0.18.11
+google-analytics-data==0.18.12
 google-auth-oauthlib==1.2.1
\ No newline at end of file

From e9dce3e562ab5bed09aa422ade08db94ba66c946 Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Wed, 30 Oct 2024 15:42:26 +0100
Subject: [PATCH 196/213] chore(deps): update dependency google-analytics-data
 to v0.18.14 (#17)

---
 google-analytics-data/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index af647a9..5e1d8ed 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-data==0.18.12
+google-analytics-data==0.18.14
 google-auth-oauthlib==1.2.1
\ No newline at end of file

From 6477fc38bbec9931d5dd7faae7ba470bf4a0d501 Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Mon, 4 Nov 2024 15:02:55 +0100
Subject: [PATCH 197/213] chore(deps): update dependency google-analytics-data
 to v0.18.15 (#20)

---
 google-analytics-data/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index 5e1d8ed..de724dc 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-data==0.18.14
+google-analytics-data==0.18.15
 google-auth-oauthlib==1.2.1
\ No newline at end of file

From a8223c42889ac8a3f5e0166617c068287b78218a Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Mon, 4 Nov 2024 15:31:38 +0100
Subject: [PATCH 198/213] chore(deps): update dependency google-analytics-admin
 to v0.23.2 (#19)

---
 google-analytics-admin/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index 7b5cd7d..65a4899 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-admin==0.23.0
+google-analytics-admin==0.23.2
 google-auth-oauthlib==1.2.1

From 1883835358617da82cf421eb7c6e272254facad5 Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Mon, 9 Dec 2024 15:19:41 +0100
Subject: [PATCH 199/213] chore(deps): update dependency pytest to v8.3.4 (#21)

---
 google-analytics-admin/requirements-test.txt | 2 +-
 google-analytics-data/requirements-test.txt  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/google-analytics-admin/requirements-test.txt b/google-analytics-admin/requirements-test.txt
index f9ddc40..1c98737 100644
--- a/google-analytics-admin/requirements-test.txt
+++ b/google-analytics-admin/requirements-test.txt
@@ -1 +1 @@
-pytest==8.3.3
\ No newline at end of file
+pytest==8.3.4
\ No newline at end of file
diff --git a/google-analytics-data/requirements-test.txt b/google-analytics-data/requirements-test.txt
index 40543aa..d197ada 100644
--- a/google-analytics-data/requirements-test.txt
+++ b/google-analytics-data/requirements-test.txt
@@ -1 +1 @@
-pytest==8.3.3
+pytest==8.3.4

From 2c9ae0d089b3a6cf58aa17208d87efc0a480f885 Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Mon, 16 Dec 2024 15:18:35 +0100
Subject: [PATCH 200/213] chore(deps): update dependency google-analytics-data
 to v0.18.16 (#23)

---
 google-analytics-data/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index de724dc..f32e510 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-data==0.18.15
+google-analytics-data==0.18.16
 google-auth-oauthlib==1.2.1
\ No newline at end of file

From b223cee24e50855b778133230ae427ed029029cf Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Mon, 16 Dec 2024 15:22:44 +0100
Subject: [PATCH 201/213] chore(deps): update dependency google-analytics-admin
 to v0.23.3 (#22)

---
 google-analytics-admin/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index 65a4899..fda507a 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-admin==0.23.2
+google-analytics-admin==0.23.3
 google-auth-oauthlib==1.2.1

From 7127f61c849ddd1c7b9033d69c111dcc2c1e3a3b Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Tue, 18 Feb 2025 16:10:17 +0100
Subject: [PATCH 202/213] chore(deps): update dependency google-analytics-data
 to v0.18.17 (#25)

---
 google-analytics-data/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index f32e510..dab09fe 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-data==0.18.16
+google-analytics-data==0.18.17
 google-auth-oauthlib==1.2.1
\ No newline at end of file

From e33b2ab2e3f51d7b4bf9e8a74c5fdac624c57a51 Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Tue, 18 Feb 2025 16:29:02 +0100
Subject: [PATCH 203/213] chore(deps): update dependency google-analytics-admin
 to v0.23.4 (#24)

---
 google-analytics-admin/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index fda507a..87dec33 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-admin==0.23.3
+google-analytics-admin==0.23.4
 google-auth-oauthlib==1.2.1

From 807aa19e23ecdfaffc25f71cde35f74ee490423e Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Mon, 10 Mar 2025 14:25:03 +0100
Subject: [PATCH 204/213] chore(deps): update dependency google-analytics-admin
 to v0.23.5 (#26)

---
 google-analytics-admin/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index 87dec33..c600289 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-admin==0.23.4
+google-analytics-admin==0.23.5
 google-auth-oauthlib==1.2.1

From f17010ee43a33238664d9a805a63408e55f04ddf Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Mon, 10 Mar 2025 14:39:19 +0100
Subject: [PATCH 205/213] chore(deps): update dependency pytest to v8.3.5 (#27)

---
 google-analytics-admin/requirements-test.txt | 2 +-
 google-analytics-data/requirements-test.txt  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/google-analytics-admin/requirements-test.txt b/google-analytics-admin/requirements-test.txt
index 1c98737..d852363 100644
--- a/google-analytics-admin/requirements-test.txt
+++ b/google-analytics-admin/requirements-test.txt
@@ -1 +1 @@
-pytest==8.3.4
\ No newline at end of file
+pytest==8.3.5
\ No newline at end of file
diff --git a/google-analytics-data/requirements-test.txt b/google-analytics-data/requirements-test.txt
index d197ada..2c78728 100644
--- a/google-analytics-data/requirements-test.txt
+++ b/google-analytics-data/requirements-test.txt
@@ -1 +1 @@
-pytest==8.3.4
+pytest==8.3.5

From 331152adea5000f01df52808bfec456347b0a8cd Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Mon, 24 Mar 2025 14:24:13 +0100
Subject: [PATCH 206/213] chore(deps): update dependency google-analytics-data
 to v0.18.18 (#29)

---
 google-analytics-data/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index dab09fe..41198d4 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-data==0.18.17
+google-analytics-data==0.18.18
 google-auth-oauthlib==1.2.1
\ No newline at end of file

From e417d0834908d10d3e21c5b826b7cc509e5c0065 Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Mon, 24 Mar 2025 14:28:33 +0100
Subject: [PATCH 207/213] chore(deps): update dependency google-analytics-admin
 to v0.23.6 (#28)

---
 google-analytics-admin/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index c600289..541dcb2 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-admin==0.23.5
+google-analytics-admin==0.23.6
 google-auth-oauthlib==1.2.1

From b80ee1fab070677d9c30ee4bb863ac97ba74d86a Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Mon, 21 Apr 2025 14:14:45 +0100
Subject: [PATCH 208/213] chore(deps): update dependency google-analytics-admin
 to v0.24.0 (#30)

---
 google-analytics-admin/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index 541dcb2..2f2a446 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-admin==0.23.6
+google-analytics-admin==0.24.0
 google-auth-oauthlib==1.2.1

From afefaaa2af8d650ab2c5ef6f2fdeb836affb280d Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Mon, 28 Apr 2025 15:22:10 +0200
Subject: [PATCH 209/213] chore(deps): update dependency google-auth-oauthlib
 to v1.2.2 (#31)

---
 google-analytics-admin/requirements.txt | 2 +-
 google-analytics-data/requirements.txt  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index 2f2a446..9d105d5 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
 google-analytics-admin==0.24.0
-google-auth-oauthlib==1.2.1
+google-auth-oauthlib==1.2.2
diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index 41198d4..d12c840 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
 google-analytics-data==0.18.18
-google-auth-oauthlib==1.2.1
\ No newline at end of file
+google-auth-oauthlib==1.2.2
\ No newline at end of file

From a0ad5124dfd124fdc9761673ffc067106fc38fd2 Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Tue, 10 Jun 2025 16:21:08 +0200
Subject: [PATCH 210/213] chore(deps): update dependency pytest to v8.4.0 (#32)

---
 google-analytics-admin/requirements-test.txt | 2 +-
 google-analytics-data/requirements-test.txt  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/google-analytics-admin/requirements-test.txt b/google-analytics-admin/requirements-test.txt
index d852363..7c5a0b3 100644
--- a/google-analytics-admin/requirements-test.txt
+++ b/google-analytics-admin/requirements-test.txt
@@ -1 +1 @@
-pytest==8.3.5
\ No newline at end of file
+pytest==8.4.0
\ No newline at end of file
diff --git a/google-analytics-data/requirements-test.txt b/google-analytics-data/requirements-test.txt
index 2c78728..69d461f 100644
--- a/google-analytics-data/requirements-test.txt
+++ b/google-analytics-data/requirements-test.txt
@@ -1 +1 @@
-pytest==8.3.5
+pytest==8.4.0

From 6c343278accf1912cbdb3f52534d271cb9e4acb1 Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Mon, 16 Jun 2025 15:07:46 +0200
Subject: [PATCH 211/213] chore(deps): update dependency google-analytics-data
 to v0.18.19 (#33)

---
 google-analytics-data/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-data/requirements.txt b/google-analytics-data/requirements.txt
index d12c840..a9c0137 100644
--- a/google-analytics-data/requirements.txt
+++ b/google-analytics-data/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-data==0.18.18
+google-analytics-data==0.18.19
 google-auth-oauthlib==1.2.2
\ No newline at end of file

From d8edb4dac88881cfe4b3bfe810ab4cfee63d3d2c Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Mon, 23 Jun 2025 15:22:15 +0200
Subject: [PATCH 212/213] chore(deps): update dependency pytest to v8.4.1 (#34)

---
 google-analytics-admin/requirements-test.txt | 2 +-
 google-analytics-data/requirements-test.txt  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/google-analytics-admin/requirements-test.txt b/google-analytics-admin/requirements-test.txt
index 7c5a0b3..225ee3d 100644
--- a/google-analytics-admin/requirements-test.txt
+++ b/google-analytics-admin/requirements-test.txt
@@ -1 +1 @@
-pytest==8.4.0
\ No newline at end of file
+pytest==8.4.1
\ No newline at end of file
diff --git a/google-analytics-data/requirements-test.txt b/google-analytics-data/requirements-test.txt
index 69d461f..8e0e884 100644
--- a/google-analytics-data/requirements-test.txt
+++ b/google-analytics-data/requirements-test.txt
@@ -1 +1 @@
-pytest==8.4.0
+pytest==8.4.1

From c7aca7e5cff0af665a726606df1027fc358d4cd0 Mon Sep 17 00:00:00 2001
From: Mend Renovate <bot@renovateapp.com>
Date: Mon, 30 Jun 2025 15:11:15 +0200
Subject: [PATCH 213/213] chore(deps): update dependency google-analytics-admin
 to v0.24.1 (#35)

---
 google-analytics-admin/requirements.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/google-analytics-admin/requirements.txt b/google-analytics-admin/requirements.txt
index 9d105d5..75035a8 100644
--- a/google-analytics-admin/requirements.txt
+++ b/google-analytics-admin/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-admin==0.24.0
+google-analytics-admin==0.24.1
 google-auth-oauthlib==1.2.2
