chore: migrate default branch from master to main (#1498)

diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index 08bdc2b..f9d0952 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -10,7 +10,7 @@
 # The python-samples-reviewers team is the default owner for samples changes
 /samples/  @googleapis/python-samples-owners
 
-# For more information, see https://github.com/googleapis/repo-automation-bots/blob/master/packages/auto-approve/README.md
+# For more information, see https://github.com/googleapis/repo-automation-bots/blob/main/packages/auto-approve/README.md
 .github/auto-approve.yml @googleapis/github-automation @googleapis/yoshi-python
 
 # The following is needed to auto-approve changes to static discovery artifacts and generated documentation.
diff --git a/.github/auto-approve.yml b/.github/auto-approve.yml
index a84a36a..c163c08 100644
--- a/.github/auto-approve.yml
+++ b/.github/auto-approve.yml
@@ -1,4 +1,4 @@
-# https://github.com/googleapis/repo-automation-bots/tree/master/packages/auto-approve
+# https://github.com/googleapis/repo-automation-bots/tree/main/packages/auto-approve
 
 rules:
 
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 26e97f6..872e1eb 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -31,10 +31,10 @@
         id: date
         run: echo "::set-output name=current_date::$(date +'%Y-%m-%d')"
 
-      - name: Check out master branch
+      - name: Check out main branch
         uses: actions/checkout@v2
         with:
-          ref: refs/heads/master
+          ref: refs/heads/main
 
       - name: Create branch
         run: |
@@ -113,7 +113,7 @@
                 const createPrResult = await github.pulls.create({
                   owner: owner,
                   repo: repo,
-                  base: 'master',
+                  base: 'main',
                   head: `${owner}:${branch}`,
                   title: prTitle,
                   body: prBody
diff --git a/.kokoro/build.sh b/.kokoro/build.sh
index ffd5da9..72abfa4 100755
--- a/.kokoro/build.sh
+++ b/.kokoro/build.sh
@@ -41,7 +41,7 @@
 python3 -m nox --version
 
 # If this is a continuous build, send the test log to the FlakyBot.
-# See https://github.com/googleapis/repo-automation-bots/tree/master/packages/flakybot.
+# See https://github.com/googleapis/repo-automation-bots/tree/main/packages/flakybot.
 if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"continuous"* ]]; then
   cleanup() {
     chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot
diff --git a/.kokoro/test-samples-impl.sh b/.kokoro/test-samples-impl.sh
index 311a8d5..8a324c9 100755
--- a/.kokoro/test-samples-impl.sh
+++ b/.kokoro/test-samples-impl.sh
@@ -80,7 +80,7 @@
     EXIT=$?
 
     # If this is a periodic build, send the test log to the FlakyBot.
-    # See https://github.com/googleapis/repo-automation-bots/tree/master/packages/flakybot.
+    # See https://github.com/googleapis/repo-automation-bots/tree/main/packages/flakybot.
     if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then
       chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot
       $KOKORO_GFILE_DIR/linux_amd64/flakybot
diff --git a/.repo-metadata.json b/.repo-metadata.json
index 83a8540..cda9011 100644
--- a/.repo-metadata.json
+++ b/.repo-metadata.json
@@ -2,7 +2,7 @@
 {
     "name": "google-api-python-client",
     "name_pretty": "Google API Python Client",
-    "client_documentation": "https://github.com/googleapis/google-api-python-client/tree/master/docs#google-api-client-library-for-python-docs",
+    "client_documentation": "https://github.com/googleapis/google-api-python-client/tree/main/docs#google-api-client-library-for-python-docs",
     "issue_tracker": "https://github.com/googleapis/google-api-python-client/issues",
     "release_level": "ga",
     "language": "python",
diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst
index f868b86..8af7af6 100644
--- a/CONTRIBUTING.rst
+++ b/CONTRIBUTING.rst
@@ -13,7 +13,7 @@
 * Fork this repository and use github pull requests for all submissions
 * Follow
   `Contributor Code of Conduct
-  <https://github.com/googleapis/google-api-python-client/blob/master/CODE_OF_CONDUCT.md>`__
+  <https://github.com/googleapis/google-api-python-client/blob/main/CODE_OF_CONDUCT.md>`__
   and `Community Guidelines <https://opensource.google/conduct/>`__
 * Follow `Google Python Style Guide <https://google.github.io/styleguide/pyguide.html>`__
   and `this commit authoring style <http://chris.beams.io/posts/git-commit/#seven-rules>`__
diff --git a/README.md b/README.md
index 334e1ec..e74c3ea 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@
 
 This is the [Google API Python client library](https://cloud.google.com/apis/docs/client-libraries-explained#google_api_client_libraries)
 for Google's discovery based APIs. To get started, please see the
-[docs folder](https://github.com/googleapis/google-api-python-client/blob/master/docs/README.md).
+[docs folder](https://github.com/googleapis/google-api-python-client/blob/main/docs/README.md).
 
 This library is considered complete and is in maintenance mode. This means
 that we will address critical bugs and security issues but will not add any
@@ -30,12 +30,12 @@
 As a result of caching the discovery documents, the size of this package is at least 
 50 MB larger compared to the previous version. 
 
-Please see the [Migration Guide](https://github.com/googleapis/google-api-python-client/blob/master/UPGRADING.md)
+Please see the [Migration Guide](https://github.com/googleapis/google-api-python-client/blob/main/UPGRADING.md)
 for more information.
 
 ## Documentation
 
-See the [docs folder](https://github.com/googleapis/google-api-python-client/blob/master/docs/README.md) for more detailed instructions and additional documentation.
+See the [docs folder](https://github.com/googleapis/google-api-python-client/blob/main/docs/README.md) for more detailed instructions and additional documentation.
 
 ## Other Google API libraries
 
@@ -115,6 +115,6 @@
 
 ## Contributing
 
-Please see our [Contribution Guide](https://github.com/googleapis/google-api-python-client/blob/master/CONTRIBUTING.rst).
+Please see our [Contribution Guide](https://github.com/googleapis/google-api-python-client/blob/main/CONTRIBUTING.rst).
 In particular, we love pull requests - but please make sure to sign
 the contributor license agreement.
diff --git a/docs/mocks.md b/docs/mocks.md
index 72256ac..8770f70 100644
--- a/docs/mocks.md
+++ b/docs/mocks.md
@@ -2,7 +2,7 @@
 
 The use of [Mock objects](https://en.wikipedia.org/wiki/Mock_object) is a standard testing methodology for Python and other object-oriented languages. This library defines Mock classes that simulate responses to API calls. You can use them to test how your code handles basic interactions with Google APIs.
 
-> **Note:** Many of the [Python Client Library test scripts](https://github.com/googleapis/google-api-python-client/tree/master/tests) use these classes.
+> **Note:** Many of the [Python Client Library test scripts](https://github.com/googleapis/google-api-python-client/tree/main/tests) use these classes.
 
 ## HttpMock
 
diff --git a/owlbot.py b/owlbot.py
index 1df7f43..c13fb3a 100644
--- a/owlbot.py
+++ b/owlbot.py
@@ -39,3 +39,8 @@
 # ----------------------------------------------------------------------------
 
 python.py_samples(skip_readmes=True)
+
+# Remove the replacements below once https://github.com/googleapis/synthtool/pull/1188 is merged
+
+# Update googleapis/repo-automation-bots repo to main in .kokoro/*.sh files
+s.replace(".kokoro/*.sh", "repo-automation-bots/tree/master", "repo-automation-bots/tree/main")
diff --git a/scripts/updatediscoveryartifacts.py b/scripts/updatediscoveryartifacts.py
index b823bd7..761d42f 100644
--- a/scripts/updatediscoveryartifacts.py
+++ b/scripts/updatediscoveryartifacts.py
@@ -52,7 +52,7 @@
         [
             "git",
             "diff",
-            "origin/master",
+            "origin/main",
             "--name-only",
             "--",
             DISCOVERY_DOC_DIR / "*.json",