diff --git a/.coveragerc b/.coveragerc
index dd39c8546..f12d4dc21 100644
--- a/.coveragerc
+++ b/.coveragerc
@@ -17,9 +17,12 @@
# Generated by synthtool. DO NOT EDIT!
[run]
branch = True
+omit =
+ google/cloud/bigtable_admin/__init__.py
+ google/cloud/bigtable_admin/gapic_version.py
[report]
-fail_under = 100
+fail_under = 99
show_missing = True
exclude_lines =
# Re-enable the standard pragma
@@ -29,7 +32,4 @@ exclude_lines =
# Ignore abstract methods
raise NotImplementedError
omit =
- */gapic/*.py
- */proto/*.py
- */core/*.py
- */site-packages/*.py
\ No newline at end of file
+ */site-packages/*.py
diff --git a/.cross_sync/README.md b/.cross_sync/README.md
new file mode 100644
index 000000000..0d8a1cf8c
--- /dev/null
+++ b/.cross_sync/README.md
@@ -0,0 +1,75 @@
+# CrossSync
+
+CrossSync provides a simple way to share logic between async and sync code.
+It is made up of a small library that provides:
+1. a set of shims that provide a shared sync/async API surface
+2. annotations that are used to guide generation of a sync version from an async class
+
+Using CrossSync, the async code is treated as the source of truth, and sync code is generated from it.
+
+## Usage
+
+### CrossSync Shims
+
+Many Asyncio components have direct, 1:1 threaded counterparts for use in non-asyncio code. CrossSync
+provides a compatibility layer that works with both
+
+| CrossSync | Asyncio Version | Sync Version |
+| --- | --- | --- |
+| CrossSync.Queue | asyncio.Queue | queue.Queue |
+| CrossSync.Condition | asyncio.Condition | threading.Condition |
+| CrossSync.Future | asyncio.Future | Concurrent.futures.Future |
+| CrossSync.Task | asyncio.Task | Concurrent.futures.Future |
+| CrossSync.Event | asyncio.Event | threading.Event |
+| CrossSync.Semaphore | asyncio.Semaphore | threading.Semaphore |
+| CrossSync.Awaitable | typing.Awaitable | typing.Union (no-op type) |
+| CrossSync.Iterable | typing.AsyncIterable | typing.Iterable |
+| CrossSync.Iterator | typing.AsyncIterator | typing.Iterator |
+| CrossSync.Generator | typing.AsyncGenerator | typing.Generator |
+| CrossSync.Retry | google.api_core.retry.AsyncRetry | google.api_core.retry.Retry |
+| CrossSync.StopIteration | StopAsyncIteration | StopIteration |
+| CrossSync.Mock | unittest.mock.AsyncMock | unittest.mock.Mock |
+
+Custom aliases can be added using `CrossSync.add_mapping(class, name)`
+
+Additionally, CrossSync provides method implementations that work equivalently in async and sync code:
+- `CrossSync.sleep()`
+- `CrossSync.gather_partials()`
+- `CrossSync.wait()`
+- `CrossSync.condition_wait()`
+- `CrossSync,event_wait()`
+- `CrossSync.create_task()`
+- `CrossSync.retry_target()`
+- `CrossSync.retry_target_stream()`
+
+### Annotations
+
+CrossSync provides a set of annotations to mark up async classes, to guide the generation of sync code.
+
+- `@CrossSync.convert_sync`
+ - marks classes for conversion. Unmarked classes will be copied as-is
+ - if add_mapping is included, the async and sync classes can be accessed using a shared CrossSync.X alias
+- `@CrossSync.convert`
+ - marks async functions for conversion. Unmarked methods will be copied as-is
+- `@CrossSync.drop`
+ - marks functions or classes that should not be included in sync output
+- `@CrossSync.pytest`
+ - marks test functions. Test functions automatically have all async keywords stripped (i.e., rm_aio is unneeded)
+- `CrossSync.add_mapping`
+ - manually registers a new CrossSync.X alias, for custom types
+- `CrossSync.rm_aio`
+ - Marks regions of the code that include asyncio keywords that should be stripped during generation
+
+### Code Generation
+
+Generation can be initiated using `nox -s generate_sync`
+from the root of the project. This will find all classes with the `__CROSS_SYNC_OUTPUT__ = "path/to/output"`
+annotation, and generate a sync version of classes marked with `@CrossSync.convert_sync` at the output path.
+
+There is a unit test at `tests/unit/data/test_sync_up_to_date.py` that verifies that the generated code is up to date
+
+## Architecture
+
+CrossSync is made up of two parts:
+- the runtime shims and annotations live in `/google/cloud/bigtable/_cross_sync`
+- the code generation logic lives in `/.cross_sync/` in the repo root
diff --git a/.cross_sync/generate.py b/.cross_sync/generate.py
new file mode 100644
index 000000000..5158d0f37
--- /dev/null
+++ b/.cross_sync/generate.py
@@ -0,0 +1,107 @@
+# Copyright 2024 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+from __future__ import annotations
+from typing import Sequence
+import ast
+"""
+Entrypoint for initiating an async -> sync conversion using CrossSync
+
+Finds all python files rooted in a given directory, and uses
+transformers.CrossSyncFileProcessor to handle any files marked with
+__CROSS_SYNC_OUTPUT__
+"""
+
+
+def extract_header_comments(file_path) -> str:
+ """
+ Extract the file header. Header is defined as the top-level
+ comments before any code or imports
+ """
+ header = []
+ with open(file_path, "r") as f:
+ for line in f:
+ if line.startswith("#") or line.strip() == "":
+ header.append(line)
+ else:
+ break
+ header.append("\n# This file is automatically generated by CrossSync. Do not edit manually.\n\n")
+ return "".join(header)
+
+
+class CrossSyncOutputFile:
+
+ def __init__(self, output_path: str, ast_tree, header: str | None = None):
+ self.output_path = output_path
+ self.tree = ast_tree
+ self.header = header or ""
+
+ def render(self, with_formatter=True, save_to_disk: bool = True) -> str:
+ """
+ Render the file to a string, and optionally save to disk
+
+ Args:
+ with_formatter: whether to run the output through black before returning
+ save_to_disk: whether to write the output to the file path
+ """
+ full_str = self.header + ast.unparse(self.tree)
+ if with_formatter:
+ import black # type: ignore
+ import autoflake # type: ignore
+
+ full_str = black.format_str(
+ autoflake.fix_code(full_str, remove_all_unused_imports=True),
+ mode=black.FileMode(),
+ )
+ if save_to_disk:
+ import os
+ os.makedirs(os.path.dirname(self.output_path), exist_ok=True)
+ with open(self.output_path, "w") as f:
+ f.write(full_str)
+ return full_str
+
+
+def convert_files_in_dir(directory: str) -> set[CrossSyncOutputFile]:
+ import glob
+ from transformers import CrossSyncFileProcessor
+
+ # find all python files in the directory
+ files = glob.glob(directory + "/**/*.py", recursive=True)
+ # keep track of the output files pointed to by the annotated classes
+ artifacts: set[CrossSyncOutputFile] = set()
+ file_transformer = CrossSyncFileProcessor()
+ # run each file through ast transformation to find all annotated classes
+ for file_path in files:
+ ast_tree = ast.parse(open(file_path).read())
+ output_path = file_transformer.get_output_path(ast_tree)
+ if output_path is not None:
+ # contains __CROSS_SYNC_OUTPUT__ annotation
+ converted_tree = file_transformer.visit(ast_tree)
+ header = extract_header_comments(file_path)
+ artifacts.add(CrossSyncOutputFile(output_path, converted_tree, header))
+ # return set of output artifacts
+ return artifacts
+
+
+def save_artifacts(artifacts: Sequence[CrossSyncOutputFile]):
+ for a in artifacts:
+ a.render(save_to_disk=True)
+
+
+if __name__ == "__main__":
+ import sys
+
+ search_root = sys.argv[1]
+ outputs = convert_files_in_dir(search_root)
+ print(f"Generated {len(outputs)} artifacts: {[a.output_path for a in outputs]}")
+ save_artifacts(outputs)
diff --git a/.cross_sync/transformers.py b/.cross_sync/transformers.py
new file mode 100644
index 000000000..9adadd0aa
--- /dev/null
+++ b/.cross_sync/transformers.py
@@ -0,0 +1,338 @@
+# Copyright 2024 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+"""
+Provides a set of ast.NodeTransformer subclasses that are composed to generate
+async code into sync code.
+
+At a high level:
+- The main entrypoint is CrossSyncFileProcessor, which is used to find files in
+ the codebase that include __CROSS_SYNC_OUTPUT__, and transform them
+ according to the `CrossSync` annotations they contains
+- SymbolReplacer is used to swap out CrossSync.X with CrossSync._Sync_Impl.X
+- RmAioFunctions is used to strip out asyncio keywords marked with CrossSync.rm_aio
+ (deferring to AsyncToSync to handle the actual transformation)
+- StripAsyncConditionalBranches finds `if CrossSync.is_async:` conditionals, and strips out
+ the unneeded branch for the sync output
+"""
+from __future__ import annotations
+
+import ast
+
+import sys
+# add cross_sync to path
+sys.path.append("google/cloud/bigtable/data/_cross_sync")
+from _decorators import AstDecorator
+
+
+class SymbolReplacer(ast.NodeTransformer):
+ """
+ Replaces all instances of a symbol in an AST with a replacement
+
+ Works for function signatures, method calls, docstrings, and type annotations
+ """
+ def __init__(self, replacements: dict[str, str]):
+ self.replacements = replacements
+
+ def visit_Name(self, node):
+ if node.id in self.replacements:
+ node.id = self.replacements[node.id]
+ return node
+
+ def visit_Attribute(self, node):
+ return ast.copy_location(
+ ast.Attribute(
+ self.visit(node.value),
+ self.replacements.get(node.attr, node.attr),
+ node.ctx,
+ ),
+ node,
+ )
+
+ def visit_AsyncFunctionDef(self, node):
+ """
+ Replace async function docstrings
+ """
+ # use same logic as FunctionDef
+ return self.visit_FunctionDef(node)
+
+ def visit_FunctionDef(self, node):
+ """
+ Replace function docstrings
+ """
+ docstring = ast.get_docstring(node)
+ if docstring and isinstance(node.body[0], ast.Expr) \
+ and isinstance(node.body[0].value, ast.Constant) \
+ and isinstance(node.body[0].value.value, str) \
+ :
+ for key_word, replacement in self.replacements.items():
+ docstring = docstring.replace(key_word, replacement)
+ node.body[0].value.value = docstring
+ return self.generic_visit(node)
+
+ def visit_Constant(self, node):
+ """Replace string type annotations"""
+ try:
+ node.value = self.replacements.get(node.value, node.value)
+ except TypeError:
+ # ignore unhashable types (e.g. list)
+ pass
+ return node
+
+
+class AsyncToSync(ast.NodeTransformer):
+ """
+ Replaces or strips all async keywords from a given AST
+ """
+ def visit_Await(self, node):
+ """
+ Strips await keyword
+ """
+ return self.visit(node.value)
+
+ def visit_AsyncFor(self, node):
+ """
+ Replaces `async for` with `for`
+ """
+ return ast.copy_location(
+ ast.For(
+ self.visit(node.target),
+ self.visit(node.iter),
+ [self.visit(stmt) for stmt in node.body],
+ [self.visit(stmt) for stmt in node.orelse],
+ ),
+ node,
+ )
+
+ def visit_AsyncWith(self, node):
+ """
+ Replaces `async with` with `with`
+ """
+ return ast.copy_location(
+ ast.With(
+ [self.visit(item) for item in node.items],
+ [self.visit(stmt) for stmt in node.body],
+ ),
+ node,
+ )
+
+ def visit_AsyncFunctionDef(self, node):
+ """
+ Replaces `async def` with `def`
+ """
+ return ast.copy_location(
+ ast.FunctionDef(
+ node.name,
+ self.visit(node.args),
+ [self.visit(stmt) for stmt in node.body],
+ [self.visit(decorator) for decorator in node.decorator_list],
+ node.returns and self.visit(node.returns),
+ ),
+ node,
+ )
+
+ def visit_ListComp(self, node):
+ """
+ Replaces `async for` with `for` in list comprehensions
+ """
+ for generator in node.generators:
+ generator.is_async = False
+ return self.generic_visit(node)
+
+
+class RmAioFunctions(ast.NodeTransformer):
+ """
+ Visits all calls marked with CrossSync.rm_aio, and removes asyncio keywords
+ """
+ RM_AIO_FN_NAME = "rm_aio"
+ RM_AIO_CLASS_NAME = "CrossSync"
+
+ def __init__(self):
+ self.to_sync = AsyncToSync()
+
+ def _is_rm_aio_call(self, node) -> bool:
+ """
+ Check if a node is a CrossSync.rm_aio call
+ """
+ if isinstance(node, ast.Call) and isinstance(node.func, ast.Attribute) and isinstance(node.func.value, ast.Name):
+ if node.func.attr == self.RM_AIO_FN_NAME and node.func.value.id == self.RM_AIO_CLASS_NAME:
+ return True
+ return False
+
+ def visit_Call(self, node):
+ if self._is_rm_aio_call(node):
+ return self.visit(self.to_sync.visit(node.args[0]))
+ return self.generic_visit(node)
+
+ def visit_AsyncWith(self, node):
+ """
+ `async with` statements can contain multiple async context managers.
+
+ If any of them contains a CrossSync.rm_aio statement, convert into standard `with` statement
+ """
+ if any(self._is_rm_aio_call(item.context_expr) for item in node.items
+ ):
+ new_node = ast.copy_location(
+ ast.With(
+ [self.visit(item) for item in node.items],
+ [self.visit(stmt) for stmt in node.body],
+ ),
+ node,
+ )
+ return self.generic_visit(new_node)
+ return self.generic_visit(node)
+
+ def visit_AsyncFor(self, node):
+ """
+ Async for statements are not fully wrapped by calls
+ """
+ it = node.iter
+ if self._is_rm_aio_call(it):
+ return ast.copy_location(
+ ast.For(
+ self.visit(node.target),
+ self.visit(it),
+ [self.visit(stmt) for stmt in node.body],
+ [self.visit(stmt) for stmt in node.orelse],
+ ),
+ node,
+ )
+ return self.generic_visit(node)
+
+
+class StripAsyncConditionalBranches(ast.NodeTransformer):
+ """
+ Visits all if statements in an AST, and removes branches marked with CrossSync.is_async
+ """
+
+ def visit_If(self, node):
+ """
+ remove CrossSync.is_async branches from top-level if statements
+ """
+ kept_branch = None
+ # check for CrossSync.is_async
+ if self._is_async_check(node.test):
+ kept_branch = node.orelse
+ # check for not CrossSync.is_async
+ elif isinstance(node.test, ast.UnaryOp) and isinstance(node.test.op, ast.Not) and self._is_async_check(node.test.operand):
+ kept_branch = node.body
+ if kept_branch is not None:
+ # only keep the statements in the kept branch
+ return [self.visit(n) for n in kept_branch]
+ else:
+ # keep the entire if statement
+ return self.generic_visit(node)
+
+ def _is_async_check(self, node) -> bool:
+ """
+ Check for CrossSync.is_async or CrossSync.is_async == True checks
+ """
+ if isinstance(node, ast.Attribute):
+ # for CrossSync.is_async
+ return isinstance(node.value, ast.Name) and node.value.id == "CrossSync" and node.attr == "is_async"
+ elif isinstance(node, ast.Compare):
+ # for CrossSync.is_async == True
+ return self._is_async_check(node.left) and (isinstance(node.ops[0], ast.Eq) or isinstance(node.ops[0], ast.Is)) and len(node.comparators) == 1 and node.comparators[0].value == True
+ return False
+
+
+class CrossSyncFileProcessor(ast.NodeTransformer):
+ """
+ Visits a file, looking for __CROSS_SYNC_OUTPUT__ annotations
+
+ If found, the file is processed with the following steps:
+ - Strip out asyncio keywords within CrossSync.rm_aio calls
+ - transform classes and methods annotated with CrossSync decorators
+ - statements behind CrossSync.is_async conditional branches are removed
+ - Replace remaining CrossSync statements with corresponding CrossSync._Sync_Impl calls
+ - save changes in an output file at path specified by __CROSS_SYNC_OUTPUT__
+ """
+ FILE_ANNOTATION = "__CROSS_SYNC_OUTPUT__"
+
+ def get_output_path(self, node):
+ for n in node.body:
+ if isinstance(n, ast.Assign):
+ for target in n.targets:
+ if isinstance(target, ast.Name) and target.id == self.FILE_ANNOTATION:
+ # return the output path
+ return n.value.value.replace(".", "/") + ".py"
+
+ def visit_Module(self, node):
+ # look for __CROSS_SYNC_OUTPUT__ Assign statement
+ output_path = self.get_output_path(node)
+ if output_path:
+ # if found, process the file
+ converted = self.generic_visit(node)
+ # strip out CrossSync.rm_aio calls
+ converted = RmAioFunctions().visit(converted)
+ # strip out CrossSync.is_async branches
+ converted = StripAsyncConditionalBranches().visit(converted)
+ # replace CrossSync statements
+ converted = SymbolReplacer({"CrossSync": "CrossSync._Sync_Impl"}).visit(converted)
+ return converted
+ else:
+ # not cross_sync file. Return None
+ return None
+
+ def visit_ClassDef(self, node):
+ """
+ Called for each class in file. If class has a CrossSync decorator, it will be transformed
+ according to the decorator arguments. Otherwise, class is returned unchanged
+ """
+ orig_decorators = node.decorator_list
+ for decorator in orig_decorators:
+ try:
+ handler = AstDecorator.get_for_node(decorator)
+ # transformation is handled in sync_ast_transform method of the decorator
+ node = handler.sync_ast_transform(node, globals())
+ except ValueError:
+ # not cross_sync decorator
+ continue
+ return self.generic_visit(node) if node else None
+
+ def visit_Assign(self, node):
+ """
+ strip out __CROSS_SYNC_OUTPUT__ assignments
+ """
+ if isinstance(node.targets[0], ast.Name) and node.targets[0].id == self.FILE_ANNOTATION:
+ return None
+ return self.generic_visit(node)
+
+ def visit_FunctionDef(self, node):
+ """
+ Visit any sync methods marked with CrossSync decorators
+ """
+ return self.visit_AsyncFunctionDef(node)
+
+ def visit_AsyncFunctionDef(self, node):
+ """
+ Visit and transform any async methods marked with CrossSync decorators
+ """
+ try:
+ if hasattr(node, "decorator_list"):
+ found_list, node.decorator_list = node.decorator_list, []
+ for decorator in found_list:
+ try:
+ handler = AstDecorator.get_for_node(decorator)
+ node = handler.sync_ast_transform(node, globals())
+ if node is None:
+ return None
+ # recurse to any nested functions
+ node = self.generic_visit(node)
+ except ValueError:
+ # keep unknown decorators
+ node.decorator_list.append(decorator)
+ continue
+ return self.generic_visit(node)
+ except ValueError as e:
+ raise ValueError(f"node {node.name} failed") from e
diff --git a/.flake8 b/.flake8
index ed9316381..32986c792 100644
--- a/.flake8
+++ b/.flake8
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# Copyright 2020 Google LLC
+# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@
# Generated by synthtool. DO NOT EDIT!
[flake8]
-ignore = E203, E266, E501, W503
+ignore = E203, E231, E266, E501, W503
exclude =
# Exclude generated code.
**/proto/**
@@ -26,6 +26,7 @@ exclude =
*_pb2.py
# Standard linting exemptions.
+ **/.nox/**
__pycache__,
.git,
*.pyc,
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index 59302d617..4012444e4 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -3,9 +3,10 @@
#
# For syntax help see:
# https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax
+# Note: This file is autogenerated. To make changes to the codeowner team, please update .repo-metadata.json.
+# @googleapis/yoshi-python @googleapis/api-bigtable @googleapis/api-bigtable-partners are the default owners for changes in this repo
+* @googleapis/yoshi-python @googleapis/api-bigtable @googleapis/api-bigtable-partners
-# The bigtable-dpe team is the default owner for anything not
-# explicitly taken by someone else.
-* @googleapis/bigtable-dpe
-/samples/ @googleapis/bigtable-dpe @googleapis/python-samples-owners
\ No newline at end of file
+# @googleapis/python-samples-reviewers @googleapis/api-bigtable @googleapis/api-bigtable-partners are the default owners for samples changes
+/samples/ @googleapis/python-samples-reviewers @googleapis/api-bigtable @googleapis/api-bigtable-partners @googleapis/cloud-sdk-python-team
diff --git a/google/cloud/bigtable.py b/.github/auto-label.yaml
similarity index 66%
rename from google/cloud/bigtable.py
rename to .github/auto-label.yaml
index 72858878e..21786a4eb 100644
--- a/google/cloud/bigtable.py
+++ b/.github/auto-label.yaml
@@ -1,20 +1,20 @@
-# Copyright 2017 Google LLC
+# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
-# https://www.apache.org/licenses/LICENSE-2.0
+# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+requestsize:
+ enabled: true
-from __future__ import absolute_import
-
-from google.cloud.bigtable_v2 import BigtableClient
-from google.cloud.bigtable_v2 import types
-
-__all__ = ("types", "BigtableClient")
+path:
+ pullrequest: true
+ paths:
+ samples: "samples"
diff --git a/.github/blunderbuss.yml b/.github/blunderbuss.yml
new file mode 100644
index 000000000..1e27e789a
--- /dev/null
+++ b/.github/blunderbuss.yml
@@ -0,0 +1,20 @@
+# Blunderbuss config
+#
+# This file controls who is assigned for pull requests and issues.
+# Note: This file is autogenerated. To make changes to the assignee
+# team, please update `codeowner_team` in `.repo-metadata.json`.
+assign_issues:
+ - googleapis/api-bigtable
+ - googleapis/api-bigtable-partners
+
+assign_issues_by:
+ - labels:
+ - "samples"
+ to:
+ - googleapis/python-samples-reviewers
+ - googleapis/api-bigtable
+ - googleapis/api-bigtable-partners
+
+assign_prs:
+ - googleapis/api-bigtable
+ - googleapis/api-bigtable-partners
diff --git a/.github/flakybot.yaml b/.github/flakybot.yaml
new file mode 100644
index 000000000..2159a1bca
--- /dev/null
+++ b/.github/flakybot.yaml
@@ -0,0 +1,15 @@
+# Copyright 2024 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+issuePriority: p2
\ No newline at end of file
diff --git a/.github/header-checker-lint.yml b/.github/header-checker-lint.yml
new file mode 100644
index 000000000..6fe78aa79
--- /dev/null
+++ b/.github/header-checker-lint.yml
@@ -0,0 +1,15 @@
+{"allowedCopyrightHolders": ["Google LLC"],
+ "allowedLicenses": ["Apache-2.0", "MIT", "BSD-3"],
+ "ignoreFiles": ["**/requirements.txt", "**/requirements-test.txt", "**/__init__.py", "samples/**/constraints.txt", "samples/**/constraints-test.txt"],
+ "sourceFileExtensions": [
+ "ts",
+ "js",
+ "java",
+ "sh",
+ "Dockerfile",
+ "yaml",
+ "py",
+ "html",
+ "txt"
+ ]
+}
\ No newline at end of file
diff --git a/.github/release-please.yml b/.github/release-please.yml
deleted file mode 100644
index 4507ad059..000000000
--- a/.github/release-please.yml
+++ /dev/null
@@ -1 +0,0 @@
-releaseType: python
diff --git a/google/cloud/bigtable_admin_v2/gapic/__init__.py b/.github/snippet-bot.yml
similarity index 100%
rename from google/cloud/bigtable_admin_v2/gapic/__init__.py
rename to .github/snippet-bot.yml
diff --git a/.github/workflows/conformance.yaml b/.github/workflows/conformance.yaml
new file mode 100644
index 000000000..f7396eaa9
--- /dev/null
+++ b/.github/workflows/conformance.yaml
@@ -0,0 +1,64 @@
+# Copyright 2023 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.
+# Github action job to test core java library features on
+# downstream client libraries before they are released.
+on:
+ push:
+ branches:
+ - main
+ pull_request:
+name: Conformance
+jobs:
+ conformance:
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ test-version: [ "v0.0.4" ]
+ py-version: [ 3.13 ]
+ client-type: [ "async", "sync"]
+ # None of the clients currently support reverse scans, execute query plan refresh, retry info, or routing cookie
+ include:
+ - client-type: "async"
+ test_args: "-skip \"PlanRefresh|_Reverse|_WithRetryInfo|_WithRoutingCookie\""
+ - client-type: "sync"
+ test_args: "-skip \"PlanRefresh|_Reverse|_WithRetryInfo|_WithRoutingCookie|_Generic_MultiStream\""
+ fail-fast: false
+ name: "${{ matrix.client-type }} client / python ${{ matrix.py-version }} / test tag ${{ matrix.test-version }}"
+ steps:
+ - uses: actions/checkout@v4
+ name: "Checkout python-bigtable"
+ - uses: actions/checkout@v4
+ name: "Checkout conformance tests"
+ with:
+ repository: googleapis/cloud-bigtable-clients-test
+ ref: ${{ matrix.test-version }}
+ path: cloud-bigtable-clients-test
+ - uses: actions/setup-python@v5
+ with:
+ python-version: ${{ matrix.py-version }}
+ - uses: actions/setup-go@v5
+ with:
+ go-version: '>=1.20.2'
+ - run: chmod +x .kokoro/conformance.sh
+ - run: pip install -e .
+ name: "Install python-bigtable from HEAD"
+ - run: go version
+ - run: .kokoro/conformance.sh
+ name: "Run tests"
+ env:
+ CLIENT_TYPE: ${{ matrix.client-type }}
+ PYTHONUNBUFFERED: 1
+ TEST_ARGS: ${{ matrix.test_args }}
+ PROXY_PORT: 9999
+
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
new file mode 100644
index 000000000..2833fe98f
--- /dev/null
+++ b/.github/workflows/docs.yml
@@ -0,0 +1,38 @@
+on:
+ pull_request:
+ branches:
+ - main
+name: docs
+jobs:
+ docs:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Setup Python
+ uses: actions/setup-python@v5
+ with:
+ python-version: "3.10"
+ - name: Install nox
+ run: |
+ python -m pip install --upgrade setuptools pip wheel
+ python -m pip install nox
+ - name: Run docs
+ run: |
+ nox -s docs
+ docfx:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Setup Python
+ uses: actions/setup-python@v5
+ with:
+ python-version: "3.10"
+ - name: Install nox
+ run: |
+ python -m pip install --upgrade setuptools pip wheel
+ python -m pip install nox
+ - name: Run docfx
+ run: |
+ nox -s docfx
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
new file mode 100644
index 000000000..9a0598202
--- /dev/null
+++ b/.github/workflows/lint.yml
@@ -0,0 +1,25 @@
+on:
+ pull_request:
+ branches:
+ - main
+name: lint
+jobs:
+ lint:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Setup Python
+ uses: actions/setup-python@v5
+ with:
+ python-version: "3.13"
+ - name: Install nox
+ run: |
+ python -m pip install --upgrade setuptools pip wheel
+ python -m pip install nox
+ - name: Run lint
+ run: |
+ nox -s lint
+ - name: Run lint_setup_py
+ run: |
+ nox -s lint_setup_py
diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml
new file mode 100644
index 000000000..f2b78a536
--- /dev/null
+++ b/.github/workflows/mypy.yml
@@ -0,0 +1,22 @@
+on:
+ pull_request:
+ branches:
+ - main
+name: mypy
+jobs:
+ mypy:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Setup Python
+ uses: actions/setup-python@v5
+ with:
+ python-version: "3.13"
+ - name: Install nox
+ run: |
+ python -m pip install --upgrade setuptools pip wheel
+ python -m pip install nox
+ - name: Run mypy
+ run: |
+ nox -s mypy
diff --git a/.github/workflows/system_emulated.yml b/.github/workflows/system_emulated.yml
new file mode 100644
index 000000000..d8bbbb639
--- /dev/null
+++ b/.github/workflows/system_emulated.yml
@@ -0,0 +1,29 @@
+name: "Run systests on emulator"
+on:
+ pull_request:
+ branches:
+ - main
+
+jobs:
+
+ run-systests:
+ runs-on: ubuntu-22.04
+
+ steps:
+
+ - name: Checkout
+ uses: actions/checkout@v4
+
+ - name: Setup Python
+ uses: actions/setup-python@v5
+ with:
+ python-version: '3.13'
+
+ - name: Setup GCloud SDK
+ uses: google-github-actions/setup-gcloud@v2.1.1
+
+ - name: Install / run Nox
+ run: |
+ python -m pip install --upgrade setuptools pip
+ python -m pip install nox
+ nox -s system_emulated
diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml
new file mode 100644
index 000000000..dad646c6b
--- /dev/null
+++ b/.github/workflows/unittest.yml
@@ -0,0 +1,61 @@
+on:
+ pull_request:
+ branches:
+ - main
+name: unittest
+jobs:
+ unit:
+ # TODO(https://github.com/googleapis/gapic-generator-python/issues/2303): use `ubuntu-latest` once this bug is fixed.
+ # Use ubuntu-22.04 until Python 3.7 is removed from the test matrix
+ # https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories
+ runs-on: ubuntu-22.04
+ strategy:
+ matrix:
+ python: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Setup Python
+ uses: actions/setup-python@v5
+ with:
+ python-version: ${{ matrix.python }}
+ - name: Install nox
+ run: |
+ python -m pip install --upgrade setuptools pip wheel
+ python -m pip install nox
+ - name: Run unit tests
+ env:
+ COVERAGE_FILE: .coverage-${{ matrix.python }}
+ run: |
+ nox -s unit-${{ matrix.python }}
+ - name: Upload coverage results
+ uses: actions/upload-artifact@v4
+ with:
+ name: coverage-artifact-${{ matrix.python }}
+ path: .coverage-${{ matrix.python }}
+ include-hidden-files: true
+
+ cover:
+ runs-on: ubuntu-latest
+ needs:
+ - unit
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ - name: Setup Python
+ uses: actions/setup-python@v5
+ with:
+ python-version: "3.13"
+ - name: Install coverage
+ run: |
+ python -m pip install --upgrade setuptools pip wheel
+ python -m pip install coverage
+ - name: Download coverage results
+ uses: actions/download-artifact@v4
+ with:
+ path: .coverage-results/
+ - name: Report coverage results
+ run: |
+ find .coverage-results -type f -name '*.zip' -exec unzip {} \;
+ coverage combine .coverage-results/**/.coverage*
+ coverage report --show-missing --fail-under=99
diff --git a/.gitignore b/.gitignore
index b87e1ed58..d083ea1dd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -46,15 +46,19 @@ pip-log.txt
# Built documentation
docs/_build
bigquery/docs/generated
+docs.metadata
# Virtual environment
env/
+venv/
+
+# Test logs
coverage.xml
-sponge_log.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
\ No newline at end of file
+pylintrc.test
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 000000000..5fa9b1ed5
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,6 @@
+[submodule "python-api-core"]
+ path = python-api-core
+ url = git@github.com:googleapis/python-api-core.git
+[submodule "gapic-generator-fork"]
+ path = gapic-generator-fork
+ url = git@github.com:googleapis/gapic-generator-python.git
diff --git a/.kokoro/build.sh b/.kokoro/build.sh
index f59d28954..d41b45aa1 100755
--- a/.kokoro/build.sh
+++ b/.kokoro/build.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright 2018 Google LLC
+# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -15,7 +15,13 @@
set -eo pipefail
-cd github/python-bigtable
+CURRENT_DIR=$(dirname "${BASH_SOURCE[0]}")
+
+if [[ -z "${PROJECT_ROOT:-}" ]]; then
+ PROJECT_ROOT=$(realpath "${CURRENT_DIR}/..")
+fi
+
+pushd "${PROJECT_ROOT}"
# Disable buffering, so that the logs stream through.
export PYTHONUNBUFFERED=1
@@ -24,16 +30,31 @@ export PYTHONUNBUFFERED=1
env | grep KOKORO
# Setup service account credentials.
-export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/service-account.json
+if [[ -f "${KOKORO_GFILE_DIR}/service-account.json" ]]
+then
+ export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/service-account.json
+fi
# Setup project id.
-export PROJECT_ID=$(cat "${KOKORO_GFILE_DIR}/project-id.json")
-
-# Remove old nox
-python3.6 -m pip uninstall --yes --quiet nox-automation
-
-# Install nox
-python3.6 -m pip install --upgrade --quiet nox
-python3.6 -m nox --version
-
-python3.6 -m nox
+if [[ -f "${KOKORO_GFILE_DIR}/project-id.json" ]]
+then
+ export PROJECT_ID=$(cat "${KOKORO_GFILE_DIR}/project-id.json")
+fi
+
+# If this is a continuous build, send the test log to the 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
+ $KOKORO_GFILE_DIR/linux_amd64/flakybot
+ }
+ trap cleanup EXIT HUP
+fi
+
+# If NOX_SESSION is set, it only runs the specified session,
+# otherwise run all the sessions.
+if [[ -n "${NOX_SESSION:-}" ]]; then
+ python3 -m nox -s ${NOX_SESSION:-}
+else
+ python3 -m nox
+fi
diff --git a/.kokoro/conformance.sh b/.kokoro/conformance.sh
new file mode 100644
index 000000000..fd585142e
--- /dev/null
+++ b/.kokoro/conformance.sh
@@ -0,0 +1,43 @@
+#!/bin/bash
+
+# Copyright 2023 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.
+
+set -eo pipefail
+
+## cd to the parent directory, i.e. the root of the git repo
+cd $(dirname $0)/..
+
+# Build and start the proxy in a separate process
+pushd test_proxy
+nohup python test_proxy.py --port $PROXY_PORT --client_type=$CLIENT_TYPE &
+proxyPID=$!
+popd
+
+# Kill proxy on exit
+function cleanup() {
+ echo "Cleanup testbench";
+ kill $proxyPID
+}
+trap cleanup EXIT
+
+# Run the conformance test
+echo "running tests with args: $TEST_ARGS"
+pushd cloud-bigtable-clients-test/tests
+eval "go test -v -proxy_addr=:$PROXY_PORT $TEST_ARGS"
+RETURN_CODE=$?
+popd
+
+echo "exiting with ${RETURN_CODE}"
+exit ${RETURN_CODE}
diff --git a/.kokoro/continuous/prerelease-deps.cfg b/.kokoro/continuous/prerelease-deps.cfg
new file mode 100644
index 000000000..3595fb43f
--- /dev/null
+++ b/.kokoro/continuous/prerelease-deps.cfg
@@ -0,0 +1,7 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+# Only run this nox session.
+env_vars: {
+ key: "NOX_SESSION"
+ value: "prerelease_deps"
+}
diff --git a/.kokoro/docs/common.cfg b/.kokoro/docs/common.cfg
deleted file mode 100644
index 8769b3116..000000000
--- a/.kokoro/docs/common.cfg
+++ /dev/null
@@ -1,48 +0,0 @@
-# Format: //devtools/kokoro/config/proto/build.proto
-
-# Build logs will be here
-action {
- define_artifacts {
- regex: "**/*sponge_log.xml"
- }
-}
-
-# Download trampoline resources.
-gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"
-
-# Use the trampoline script to run in docker.
-build_file: "python-bigtable/.kokoro/trampoline.sh"
-
-# Configure the docker image for kokoro-trampoline.
-env_vars: {
- key: "TRAMPOLINE_IMAGE"
- value: "gcr.io/cloud-devrel-kokoro-resources/python-multi"
-}
-env_vars: {
- key: "TRAMPOLINE_BUILD_FILE"
- value: "github/python-bigtable/.kokoro/publish-docs.sh"
-}
-
-env_vars: {
- key: "STAGING_BUCKET"
- value: "docs-staging"
-}
-
-# Fetch the token needed for reporting release status to GitHub
-before_action {
- fetch_keystore {
- keystore_resource {
- keystore_config_id: 73713
- keyname: "yoshi-automation-github-key"
- }
- }
-}
-
-before_action {
- fetch_keystore {
- keystore_resource {
- keystore_config_id: 73713
- keyname: "docuploader_service_account"
- }
- }
-}
\ No newline at end of file
diff --git a/.kokoro/docs/docs.cfg b/.kokoro/docs/docs.cfg
deleted file mode 100644
index 8f43917d9..000000000
--- a/.kokoro/docs/docs.cfg
+++ /dev/null
@@ -1 +0,0 @@
-# Format: //devtools/kokoro/config/proto/build.proto
\ No newline at end of file
diff --git a/.kokoro/populate-secrets.sh b/.kokoro/populate-secrets.sh
new file mode 100755
index 000000000..c435402f4
--- /dev/null
+++ b/.kokoro/populate-secrets.sh
@@ -0,0 +1,43 @@
+#!/bin/bash
+# Copyright 2024 Google LLC.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+set -eo pipefail
+
+function now { date +"%Y-%m-%d %H:%M:%S" | tr -d '\n' ;}
+function msg { println "$*" >&2 ;}
+function println { printf '%s\n' "$(now) $*" ;}
+
+
+# Populates requested secrets set in SECRET_MANAGER_KEYS from service account:
+# kokoro-trampoline@cloud-devrel-kokoro-resources.iam.gserviceaccount.com
+SECRET_LOCATION="${KOKORO_GFILE_DIR}/secret_manager"
+msg "Creating folder on disk for secrets: ${SECRET_LOCATION}"
+mkdir -p ${SECRET_LOCATION}
+for key in $(echo ${SECRET_MANAGER_KEYS} | sed "s/,/ /g")
+do
+ msg "Retrieving secret ${key}"
+ docker run --entrypoint=gcloud \
+ --volume=${KOKORO_GFILE_DIR}:${KOKORO_GFILE_DIR} \
+ gcr.io/google.com/cloudsdktool/cloud-sdk \
+ secrets versions access latest \
+ --project cloud-devrel-kokoro-resources \
+ --secret ${key} > \
+ "${SECRET_LOCATION}/${key}"
+ if [[ $? == 0 ]]; then
+ msg "Secret written to ${SECRET_LOCATION}/${key}"
+ else
+ msg "Error retrieving secret ${key}"
+ fi
+done
diff --git a/.kokoro/presubmit/conformance.cfg b/.kokoro/presubmit/conformance.cfg
new file mode 100644
index 000000000..4f44e8a78
--- /dev/null
+++ b/.kokoro/presubmit/conformance.cfg
@@ -0,0 +1,6 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+env_vars: {
+ key: "NOX_SESSION"
+ value: "conformance"
+}
diff --git a/.kokoro/presubmit/prerelease-deps.cfg b/.kokoro/presubmit/prerelease-deps.cfg
new file mode 100644
index 000000000..3595fb43f
--- /dev/null
+++ b/.kokoro/presubmit/prerelease-deps.cfg
@@ -0,0 +1,7 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+# Only run this nox session.
+env_vars: {
+ key: "NOX_SESSION"
+ value: "prerelease_deps"
+}
diff --git a/.kokoro/presubmit/presubmit.cfg b/.kokoro/presubmit/presubmit.cfg
index 8f43917d9..b158096f0 100644
--- a/.kokoro/presubmit/presubmit.cfg
+++ b/.kokoro/presubmit/presubmit.cfg
@@ -1 +1,7 @@
-# Format: //devtools/kokoro/config/proto/build.proto
\ No newline at end of file
+# Format: //devtools/kokoro/config/proto/build.proto
+
+# Disable system tests.
+env_vars: {
+ key: "RUN_SYSTEM_TESTS"
+ value: "false"
+}
diff --git a/.kokoro/presubmit/system-3.9.cfg b/.kokoro/presubmit/system-3.9.cfg
new file mode 100644
index 000000000..b8ae66b37
--- /dev/null
+++ b/.kokoro/presubmit/system-3.9.cfg
@@ -0,0 +1,7 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+# Only run this nox session.
+env_vars: {
+ key: "NOX_SESSION"
+ value: "system-3.9"
+}
\ No newline at end of file
diff --git a/.kokoro/presubmit/system.cfg b/.kokoro/presubmit/system.cfg
new file mode 100644
index 000000000..30956a3ab
--- /dev/null
+++ b/.kokoro/presubmit/system.cfg
@@ -0,0 +1,7 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+# Only run this nox session.
+env_vars: {
+ key: "NOX_SESSION"
+ value: "system-3.10"
+}
diff --git a/.kokoro/publish-docs.sh b/.kokoro/publish-docs.sh
deleted file mode 100755
index 7d51f64af..000000000
--- a/.kokoro/publish-docs.sh
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/bin/bash
-# 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
-#
-# https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-set -eo pipefail
-
-# Disable buffering, so that the logs stream through.
-export PYTHONUNBUFFERED=1
-
-cd github/python-bigtable
-
-# Remove old nox
-python3.6 -m pip uninstall --yes --quiet nox-automation
-
-# Install nox
-python3.6 -m pip install --upgrade --quiet nox
-python3.6 -m nox --version
-
-# build docs
-nox -s docs
-
-python3 -m pip install gcp-docuploader
-
-# install a json parser
-sudo apt-get update
-sudo apt-get -y install software-properties-common
-sudo add-apt-repository universe
-sudo apt-get update
-sudo apt-get -y install jq
-
-# create metadata
-python3 -m docuploader create-metadata \
- --name=$(jq --raw-output '.name // empty' .repo-metadata.json) \
- --version=$(python3 setup.py --version) \
- --language=$(jq --raw-output '.language // empty' .repo-metadata.json) \
- --distribution-name=$(python3 setup.py --name) \
- --product-page=$(jq --raw-output '.product_documentation // empty' .repo-metadata.json) \
- --github-repository=$(jq --raw-output '.repo // empty' .repo-metadata.json) \
- --issue-tracker=$(jq --raw-output '.issue_tracker // empty' .repo-metadata.json)
-
-cat docs.metadata
-
-# upload docs
-python3 -m docuploader upload docs/_build/html --metadata-file docs.metadata --staging-bucket docs-staging
diff --git a/.kokoro/release.sh b/.kokoro/release.sh
deleted file mode 100755
index 102d0ba6d..000000000
--- a/.kokoro/release.sh
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/bash
-# 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
-#
-# https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-set -eo pipefail
-
-# Start the releasetool reporter
-python3 -m pip install gcp-releasetool
-python3 -m releasetool publish-reporter-script > /tmp/publisher-script; source /tmp/publisher-script
-
-# Ensure that we have the latest versions of Twine, Wheel, and Setuptools.
-python3 -m pip install --upgrade twine wheel setuptools
-
-# Disable buffering, so that the logs stream through.
-export PYTHONUNBUFFERED=1
-
-# Move into the package, build the distribution and upload.
-TWINE_PASSWORD=$(cat "${KOKORO_KEYSTORE_DIR}/73713_google_cloud_pypi_password")
-cd github/python-bigtable
-python3 setup.py sdist bdist_wheel
-twine upload --username gcloudpypi --password "${TWINE_PASSWORD}" dist/*
diff --git a/.kokoro/release/common.cfg b/.kokoro/release/common.cfg
deleted file mode 100644
index d1edfb69d..000000000
--- a/.kokoro/release/common.cfg
+++ /dev/null
@@ -1,64 +0,0 @@
-# Format: //devtools/kokoro/config/proto/build.proto
-
-# Build logs will be here
-action {
- define_artifacts {
- regex: "**/*sponge_log.xml"
- }
-}
-
-# Download trampoline resources.
-gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"
-
-# Use the trampoline script to run in docker.
-build_file: "python-bigtable/.kokoro/trampoline.sh"
-
-# Configure the docker image for kokoro-trampoline.
-env_vars: {
- key: "TRAMPOLINE_IMAGE"
- value: "gcr.io/cloud-devrel-kokoro-resources/python-multi"
-}
-env_vars: {
- key: "TRAMPOLINE_BUILD_FILE"
- value: "github/python-bigtable/.kokoro/release.sh"
-}
-
-# Fetch the token needed for reporting release status to GitHub
-before_action {
- fetch_keystore {
- keystore_resource {
- keystore_config_id: 73713
- keyname: "yoshi-automation-github-key"
- }
- }
-}
-
-# Fetch PyPI password
-before_action {
- fetch_keystore {
- keystore_resource {
- keystore_config_id: 73713
- keyname: "google_cloud_pypi_password"
- }
- }
-}
-
-# Fetch magictoken to use with Magic Github Proxy
-before_action {
- fetch_keystore {
- keystore_resource {
- keystore_config_id: 73713
- keyname: "releasetool-magictoken"
- }
- }
-}
-
-# Fetch api key to use with Magic Github Proxy
-before_action {
- fetch_keystore {
- keystore_resource {
- keystore_config_id: 73713
- keyname: "magic-github-proxy-api-key"
- }
- }
-}
diff --git a/.kokoro/release/release.cfg b/.kokoro/release/release.cfg
deleted file mode 100644
index 8f43917d9..000000000
--- a/.kokoro/release/release.cfg
+++ /dev/null
@@ -1 +0,0 @@
-# Format: //devtools/kokoro/config/proto/build.proto
\ No newline at end of file
diff --git a/.kokoro/samples/lint/common.cfg b/.kokoro/samples/lint/common.cfg
index b597cb22f..54b069fd0 100644
--- a/.kokoro/samples/lint/common.cfg
+++ b/.kokoro/samples/lint/common.cfg
@@ -31,4 +31,4 @@ gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples"
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"
# Use the trampoline script to run in docker.
-build_file: "python-bigtable/.kokoro/trampoline.sh"
\ No newline at end of file
+build_file: "python-bigtable/.kokoro/trampoline_v2.sh"
\ No newline at end of file
diff --git a/.kokoro/samples/python3.6/common.cfg b/.kokoro/samples/python3.10/common.cfg
similarity index 78%
rename from .kokoro/samples/python3.6/common.cfg
rename to .kokoro/samples/python3.10/common.cfg
index dd6620136..0dc18096b 100644
--- a/.kokoro/samples/python3.6/common.cfg
+++ b/.kokoro/samples/python3.10/common.cfg
@@ -10,7 +10,13 @@ action {
# Specify which tests to run
env_vars: {
key: "RUN_TESTS_SESSION"
- value: "py-3.6"
+ value: "py-3.10"
+}
+
+# Declare build specific Cloud project.
+env_vars: {
+ key: "BUILD_SPECIFIC_GCLOUD_PROJECT"
+ value: "python-docs-samples-tests-310"
}
env_vars: {
@@ -31,4 +37,4 @@ gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples"
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"
# Use the trampoline script to run in docker.
-build_file: "python-bigtable/.kokoro/trampoline.sh"
\ No newline at end of file
+build_file: "python-bigtable/.kokoro/trampoline_v2.sh"
\ No newline at end of file
diff --git a/.kokoro/samples/python3.6/presubmit.cfg b/.kokoro/samples/python3.10/continuous.cfg
similarity index 100%
rename from .kokoro/samples/python3.6/presubmit.cfg
rename to .kokoro/samples/python3.10/continuous.cfg
diff --git a/.kokoro/samples/python3.10/periodic-head.cfg b/.kokoro/samples/python3.10/periodic-head.cfg
new file mode 100644
index 000000000..be25a34f9
--- /dev/null
+++ b/.kokoro/samples/python3.10/periodic-head.cfg
@@ -0,0 +1,11 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+env_vars: {
+ key: "INSTALL_LIBRARY_FROM_SOURCE"
+ value: "True"
+}
+
+env_vars: {
+ key: "TRAMPOLINE_BUILD_FILE"
+ value: "github/python-bigtable/.kokoro/test-samples-against-head.sh"
+}
diff --git a/.kokoro/samples/python3.6/periodic.cfg b/.kokoro/samples/python3.10/periodic.cfg
similarity index 98%
rename from .kokoro/samples/python3.6/periodic.cfg
rename to .kokoro/samples/python3.10/periodic.cfg
index 50fec9649..71cd1e597 100644
--- a/.kokoro/samples/python3.6/periodic.cfg
+++ b/.kokoro/samples/python3.10/periodic.cfg
@@ -3,4 +3,4 @@
env_vars: {
key: "INSTALL_LIBRARY_FROM_SOURCE"
value: "False"
-}
\ No newline at end of file
+}
diff --git a/.kokoro/samples/python3.10/presubmit.cfg b/.kokoro/samples/python3.10/presubmit.cfg
new file mode 100644
index 000000000..a1c8d9759
--- /dev/null
+++ b/.kokoro/samples/python3.10/presubmit.cfg
@@ -0,0 +1,6 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+env_vars: {
+ key: "INSTALL_LIBRARY_FROM_SOURCE"
+ value: "True"
+}
\ No newline at end of file
diff --git a/.kokoro/samples/python3.11/common.cfg b/.kokoro/samples/python3.11/common.cfg
new file mode 100644
index 000000000..467d405ae
--- /dev/null
+++ b/.kokoro/samples/python3.11/common.cfg
@@ -0,0 +1,40 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+# Build logs will be here
+action {
+ define_artifacts {
+ regex: "**/*sponge_log.xml"
+ }
+}
+
+# Specify which tests to run
+env_vars: {
+ key: "RUN_TESTS_SESSION"
+ value: "py-3.11"
+}
+
+# Declare build specific Cloud project.
+env_vars: {
+ key: "BUILD_SPECIFIC_GCLOUD_PROJECT"
+ value: "python-docs-samples-tests-311"
+}
+
+env_vars: {
+ key: "TRAMPOLINE_BUILD_FILE"
+ value: "github/python-bigtable/.kokoro/test-samples.sh"
+}
+
+# Configure the docker image for kokoro-trampoline.
+env_vars: {
+ key: "TRAMPOLINE_IMAGE"
+ value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker"
+}
+
+# Download secrets for samples
+gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples"
+
+# Download trampoline resources.
+gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"
+
+# Use the trampoline script to run in docker.
+build_file: "python-bigtable/.kokoro/trampoline_v2.sh"
\ No newline at end of file
diff --git a/.kokoro/samples/python3.6/continuous.cfg b/.kokoro/samples/python3.11/continuous.cfg
similarity index 97%
rename from .kokoro/samples/python3.6/continuous.cfg
rename to .kokoro/samples/python3.11/continuous.cfg
index 7218af149..a1c8d9759 100644
--- a/.kokoro/samples/python3.6/continuous.cfg
+++ b/.kokoro/samples/python3.11/continuous.cfg
@@ -3,5 +3,4 @@
env_vars: {
key: "INSTALL_LIBRARY_FROM_SOURCE"
value: "True"
-}
-
+}
\ No newline at end of file
diff --git a/.kokoro/samples/python3.11/periodic-head.cfg b/.kokoro/samples/python3.11/periodic-head.cfg
new file mode 100644
index 000000000..be25a34f9
--- /dev/null
+++ b/.kokoro/samples/python3.11/periodic-head.cfg
@@ -0,0 +1,11 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+env_vars: {
+ key: "INSTALL_LIBRARY_FROM_SOURCE"
+ value: "True"
+}
+
+env_vars: {
+ key: "TRAMPOLINE_BUILD_FILE"
+ value: "github/python-bigtable/.kokoro/test-samples-against-head.sh"
+}
diff --git a/.kokoro/samples/python3.11/periodic.cfg b/.kokoro/samples/python3.11/periodic.cfg
new file mode 100644
index 000000000..71cd1e597
--- /dev/null
+++ b/.kokoro/samples/python3.11/periodic.cfg
@@ -0,0 +1,6 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+env_vars: {
+ key: "INSTALL_LIBRARY_FROM_SOURCE"
+ value: "False"
+}
diff --git a/.kokoro/samples/python3.11/presubmit.cfg b/.kokoro/samples/python3.11/presubmit.cfg
new file mode 100644
index 000000000..a1c8d9759
--- /dev/null
+++ b/.kokoro/samples/python3.11/presubmit.cfg
@@ -0,0 +1,6 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+env_vars: {
+ key: "INSTALL_LIBRARY_FROM_SOURCE"
+ value: "True"
+}
\ No newline at end of file
diff --git a/.kokoro/samples/python3.12/common.cfg b/.kokoro/samples/python3.12/common.cfg
new file mode 100644
index 000000000..34e0a95f3
--- /dev/null
+++ b/.kokoro/samples/python3.12/common.cfg
@@ -0,0 +1,40 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+# Build logs will be here
+action {
+ define_artifacts {
+ regex: "**/*sponge_log.xml"
+ }
+}
+
+# Specify which tests to run
+env_vars: {
+ key: "RUN_TESTS_SESSION"
+ value: "py-3.12"
+}
+
+# Declare build specific Cloud project.
+env_vars: {
+ key: "BUILD_SPECIFIC_GCLOUD_PROJECT"
+ value: "python-docs-samples-tests-312"
+}
+
+env_vars: {
+ key: "TRAMPOLINE_BUILD_FILE"
+ value: "github/python-bigtable/.kokoro/test-samples.sh"
+}
+
+# Configure the docker image for kokoro-trampoline.
+env_vars: {
+ key: "TRAMPOLINE_IMAGE"
+ value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker"
+}
+
+# Download secrets for samples
+gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples"
+
+# Download trampoline resources.
+gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"
+
+# Use the trampoline script to run in docker.
+build_file: "python-bigtable/.kokoro/trampoline_v2.sh"
\ No newline at end of file
diff --git a/.kokoro/samples/python3.12/continuous.cfg b/.kokoro/samples/python3.12/continuous.cfg
new file mode 100644
index 000000000..a1c8d9759
--- /dev/null
+++ b/.kokoro/samples/python3.12/continuous.cfg
@@ -0,0 +1,6 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+env_vars: {
+ key: "INSTALL_LIBRARY_FROM_SOURCE"
+ value: "True"
+}
\ No newline at end of file
diff --git a/.kokoro/samples/python3.12/periodic-head.cfg b/.kokoro/samples/python3.12/periodic-head.cfg
new file mode 100644
index 000000000..be25a34f9
--- /dev/null
+++ b/.kokoro/samples/python3.12/periodic-head.cfg
@@ -0,0 +1,11 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+env_vars: {
+ key: "INSTALL_LIBRARY_FROM_SOURCE"
+ value: "True"
+}
+
+env_vars: {
+ key: "TRAMPOLINE_BUILD_FILE"
+ value: "github/python-bigtable/.kokoro/test-samples-against-head.sh"
+}
diff --git a/.kokoro/samples/python3.12/periodic.cfg b/.kokoro/samples/python3.12/periodic.cfg
new file mode 100644
index 000000000..71cd1e597
--- /dev/null
+++ b/.kokoro/samples/python3.12/periodic.cfg
@@ -0,0 +1,6 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+env_vars: {
+ key: "INSTALL_LIBRARY_FROM_SOURCE"
+ value: "False"
+}
diff --git a/.kokoro/samples/python3.12/presubmit.cfg b/.kokoro/samples/python3.12/presubmit.cfg
new file mode 100644
index 000000000..a1c8d9759
--- /dev/null
+++ b/.kokoro/samples/python3.12/presubmit.cfg
@@ -0,0 +1,6 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+env_vars: {
+ key: "INSTALL_LIBRARY_FROM_SOURCE"
+ value: "True"
+}
\ No newline at end of file
diff --git a/.kokoro/samples/python3.13/common.cfg b/.kokoro/samples/python3.13/common.cfg
new file mode 100644
index 000000000..15ba807cb
--- /dev/null
+++ b/.kokoro/samples/python3.13/common.cfg
@@ -0,0 +1,40 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+# Build logs will be here
+action {
+ define_artifacts {
+ regex: "**/*sponge_log.xml"
+ }
+}
+
+# Specify which tests to run
+env_vars: {
+ key: "RUN_TESTS_SESSION"
+ value: "py-3.13"
+}
+
+# Declare build specific Cloud project.
+env_vars: {
+ key: "BUILD_SPECIFIC_GCLOUD_PROJECT"
+ value: "python-docs-samples-tests-313"
+}
+
+env_vars: {
+ key: "TRAMPOLINE_BUILD_FILE"
+ value: "github/python-bigtable/.kokoro/test-samples.sh"
+}
+
+# Configure the docker image for kokoro-trampoline.
+env_vars: {
+ key: "TRAMPOLINE_IMAGE"
+ value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker"
+}
+
+# Download secrets for samples
+gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples"
+
+# Download trampoline resources.
+gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"
+
+# Use the trampoline script to run in docker.
+build_file: "python-bigtable/.kokoro/trampoline_v2.sh"
diff --git a/.kokoro/samples/python3.13/continuous.cfg b/.kokoro/samples/python3.13/continuous.cfg
new file mode 100644
index 000000000..a1c8d9759
--- /dev/null
+++ b/.kokoro/samples/python3.13/continuous.cfg
@@ -0,0 +1,6 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+env_vars: {
+ key: "INSTALL_LIBRARY_FROM_SOURCE"
+ value: "True"
+}
\ No newline at end of file
diff --git a/.kokoro/samples/python3.13/periodic-head.cfg b/.kokoro/samples/python3.13/periodic-head.cfg
new file mode 100644
index 000000000..be25a34f9
--- /dev/null
+++ b/.kokoro/samples/python3.13/periodic-head.cfg
@@ -0,0 +1,11 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+env_vars: {
+ key: "INSTALL_LIBRARY_FROM_SOURCE"
+ value: "True"
+}
+
+env_vars: {
+ key: "TRAMPOLINE_BUILD_FILE"
+ value: "github/python-bigtable/.kokoro/test-samples-against-head.sh"
+}
diff --git a/.kokoro/samples/python3.13/periodic.cfg b/.kokoro/samples/python3.13/periodic.cfg
new file mode 100644
index 000000000..71cd1e597
--- /dev/null
+++ b/.kokoro/samples/python3.13/periodic.cfg
@@ -0,0 +1,6 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+env_vars: {
+ key: "INSTALL_LIBRARY_FROM_SOURCE"
+ value: "False"
+}
diff --git a/.kokoro/samples/python3.13/presubmit.cfg b/.kokoro/samples/python3.13/presubmit.cfg
new file mode 100644
index 000000000..a1c8d9759
--- /dev/null
+++ b/.kokoro/samples/python3.13/presubmit.cfg
@@ -0,0 +1,6 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+env_vars: {
+ key: "INSTALL_LIBRARY_FROM_SOURCE"
+ value: "True"
+}
\ No newline at end of file
diff --git a/.kokoro/samples/python3.14/common.cfg b/.kokoro/samples/python3.14/common.cfg
new file mode 100644
index 000000000..a9ea06119
--- /dev/null
+++ b/.kokoro/samples/python3.14/common.cfg
@@ -0,0 +1,40 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+# Build logs will be here
+action {
+ define_artifacts {
+ regex: "**/*sponge_log.xml"
+ }
+}
+
+# Specify which tests to run
+env_vars: {
+ key: "RUN_TESTS_SESSION"
+ value: "py-3.14"
+}
+
+# Declare build specific Cloud project.
+env_vars: {
+ key: "BUILD_SPECIFIC_GCLOUD_PROJECT"
+ value: "python-docs-samples-tests-314"
+}
+
+env_vars: {
+ key: "TRAMPOLINE_BUILD_FILE"
+ value: "github/python-bigtable/.kokoro/test-samples.sh"
+}
+
+# Configure the docker image for kokoro-trampoline.
+env_vars: {
+ key: "TRAMPOLINE_IMAGE"
+ value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker"
+}
+
+# Download secrets for samples
+gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples"
+
+# Download trampoline resources.
+gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"
+
+# Use the trampoline script to run in docker.
+build_file: "python-bigtable/.kokoro/trampoline_v2.sh"
diff --git a/.kokoro/samples/python3.14/continuous.cfg b/.kokoro/samples/python3.14/continuous.cfg
new file mode 100644
index 000000000..a1c8d9759
--- /dev/null
+++ b/.kokoro/samples/python3.14/continuous.cfg
@@ -0,0 +1,6 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+env_vars: {
+ key: "INSTALL_LIBRARY_FROM_SOURCE"
+ value: "True"
+}
\ No newline at end of file
diff --git a/.kokoro/samples/python3.14/periodic-head.cfg b/.kokoro/samples/python3.14/periodic-head.cfg
new file mode 100644
index 000000000..be25a34f9
--- /dev/null
+++ b/.kokoro/samples/python3.14/periodic-head.cfg
@@ -0,0 +1,11 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+env_vars: {
+ key: "INSTALL_LIBRARY_FROM_SOURCE"
+ value: "True"
+}
+
+env_vars: {
+ key: "TRAMPOLINE_BUILD_FILE"
+ value: "github/python-bigtable/.kokoro/test-samples-against-head.sh"
+}
diff --git a/.kokoro/samples/python3.14/periodic.cfg b/.kokoro/samples/python3.14/periodic.cfg
new file mode 100644
index 000000000..71cd1e597
--- /dev/null
+++ b/.kokoro/samples/python3.14/periodic.cfg
@@ -0,0 +1,6 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+env_vars: {
+ key: "INSTALL_LIBRARY_FROM_SOURCE"
+ value: "False"
+}
diff --git a/.kokoro/samples/python3.14/presubmit.cfg b/.kokoro/samples/python3.14/presubmit.cfg
new file mode 100644
index 000000000..a1c8d9759
--- /dev/null
+++ b/.kokoro/samples/python3.14/presubmit.cfg
@@ -0,0 +1,6 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+env_vars: {
+ key: "INSTALL_LIBRARY_FROM_SOURCE"
+ value: "True"
+}
\ No newline at end of file
diff --git a/.kokoro/samples/python3.7/common.cfg b/.kokoro/samples/python3.7/common.cfg
index 6ee44dbb9..7db66bb86 100644
--- a/.kokoro/samples/python3.7/common.cfg
+++ b/.kokoro/samples/python3.7/common.cfg
@@ -13,6 +13,12 @@ env_vars: {
value: "py-3.7"
}
+# Declare build specific Cloud project.
+env_vars: {
+ key: "BUILD_SPECIFIC_GCLOUD_PROJECT"
+ value: "python-docs-samples-tests-py37"
+}
+
env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/python-bigtable/.kokoro/test-samples.sh"
@@ -31,4 +37,4 @@ gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples"
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"
# Use the trampoline script to run in docker.
-build_file: "python-bigtable/.kokoro/trampoline.sh"
\ No newline at end of file
+build_file: "python-bigtable/.kokoro/trampoline_v2.sh"
\ No newline at end of file
diff --git a/.kokoro/samples/python3.7/periodic-head.cfg b/.kokoro/samples/python3.7/periodic-head.cfg
new file mode 100644
index 000000000..be25a34f9
--- /dev/null
+++ b/.kokoro/samples/python3.7/periodic-head.cfg
@@ -0,0 +1,11 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+env_vars: {
+ key: "INSTALL_LIBRARY_FROM_SOURCE"
+ value: "True"
+}
+
+env_vars: {
+ key: "TRAMPOLINE_BUILD_FILE"
+ value: "github/python-bigtable/.kokoro/test-samples-against-head.sh"
+}
diff --git a/.kokoro/samples/python3.7/periodic.cfg b/.kokoro/samples/python3.7/periodic.cfg
index 50fec9649..71cd1e597 100644
--- a/.kokoro/samples/python3.7/periodic.cfg
+++ b/.kokoro/samples/python3.7/periodic.cfg
@@ -3,4 +3,4 @@
env_vars: {
key: "INSTALL_LIBRARY_FROM_SOURCE"
value: "False"
-}
\ No newline at end of file
+}
diff --git a/.kokoro/samples/python3.8/common.cfg b/.kokoro/samples/python3.8/common.cfg
index cc909eb20..482008891 100644
--- a/.kokoro/samples/python3.8/common.cfg
+++ b/.kokoro/samples/python3.8/common.cfg
@@ -13,6 +13,12 @@ env_vars: {
value: "py-3.8"
}
+# Declare build specific Cloud project.
+env_vars: {
+ key: "BUILD_SPECIFIC_GCLOUD_PROJECT"
+ value: "python-docs-samples-tests-py38"
+}
+
env_vars: {
key: "TRAMPOLINE_BUILD_FILE"
value: "github/python-bigtable/.kokoro/test-samples.sh"
@@ -31,4 +37,4 @@ gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples"
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"
# Use the trampoline script to run in docker.
-build_file: "python-bigtable/.kokoro/trampoline.sh"
\ No newline at end of file
+build_file: "python-bigtable/.kokoro/trampoline_v2.sh"
\ No newline at end of file
diff --git a/.kokoro/samples/python3.8/periodic-head.cfg b/.kokoro/samples/python3.8/periodic-head.cfg
new file mode 100644
index 000000000..be25a34f9
--- /dev/null
+++ b/.kokoro/samples/python3.8/periodic-head.cfg
@@ -0,0 +1,11 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+env_vars: {
+ key: "INSTALL_LIBRARY_FROM_SOURCE"
+ value: "True"
+}
+
+env_vars: {
+ key: "TRAMPOLINE_BUILD_FILE"
+ value: "github/python-bigtable/.kokoro/test-samples-against-head.sh"
+}
diff --git a/.kokoro/samples/python3.8/periodic.cfg b/.kokoro/samples/python3.8/periodic.cfg
index 50fec9649..71cd1e597 100644
--- a/.kokoro/samples/python3.8/periodic.cfg
+++ b/.kokoro/samples/python3.8/periodic.cfg
@@ -3,4 +3,4 @@
env_vars: {
key: "INSTALL_LIBRARY_FROM_SOURCE"
value: "False"
-}
\ No newline at end of file
+}
diff --git a/.kokoro/samples/python3.9/common.cfg b/.kokoro/samples/python3.9/common.cfg
new file mode 100644
index 000000000..4e3b12fcc
--- /dev/null
+++ b/.kokoro/samples/python3.9/common.cfg
@@ -0,0 +1,40 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+# Build logs will be here
+action {
+ define_artifacts {
+ regex: "**/*sponge_log.xml"
+ }
+}
+
+# Specify which tests to run
+env_vars: {
+ key: "RUN_TESTS_SESSION"
+ value: "py-3.9"
+}
+
+# Declare build specific Cloud project.
+env_vars: {
+ key: "BUILD_SPECIFIC_GCLOUD_PROJECT"
+ value: "python-docs-samples-tests-py39"
+}
+
+env_vars: {
+ key: "TRAMPOLINE_BUILD_FILE"
+ value: "github/python-bigtable/.kokoro/test-samples.sh"
+}
+
+# Configure the docker image for kokoro-trampoline.
+env_vars: {
+ key: "TRAMPOLINE_IMAGE"
+ value: "gcr.io/cloud-devrel-kokoro-resources/python-samples-testing-docker"
+}
+
+# Download secrets for samples
+gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/python-docs-samples"
+
+# Download trampoline resources.
+gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"
+
+# Use the trampoline script to run in docker.
+build_file: "python-bigtable/.kokoro/trampoline_v2.sh"
\ No newline at end of file
diff --git a/.kokoro/samples/python3.9/continuous.cfg b/.kokoro/samples/python3.9/continuous.cfg
new file mode 100644
index 000000000..a1c8d9759
--- /dev/null
+++ b/.kokoro/samples/python3.9/continuous.cfg
@@ -0,0 +1,6 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+env_vars: {
+ key: "INSTALL_LIBRARY_FROM_SOURCE"
+ value: "True"
+}
\ No newline at end of file
diff --git a/.kokoro/samples/python3.9/periodic-head.cfg b/.kokoro/samples/python3.9/periodic-head.cfg
new file mode 100644
index 000000000..be25a34f9
--- /dev/null
+++ b/.kokoro/samples/python3.9/periodic-head.cfg
@@ -0,0 +1,11 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+env_vars: {
+ key: "INSTALL_LIBRARY_FROM_SOURCE"
+ value: "True"
+}
+
+env_vars: {
+ key: "TRAMPOLINE_BUILD_FILE"
+ value: "github/python-bigtable/.kokoro/test-samples-against-head.sh"
+}
diff --git a/.kokoro/samples/python3.9/periodic.cfg b/.kokoro/samples/python3.9/periodic.cfg
new file mode 100644
index 000000000..71cd1e597
--- /dev/null
+++ b/.kokoro/samples/python3.9/periodic.cfg
@@ -0,0 +1,6 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+env_vars: {
+ key: "INSTALL_LIBRARY_FROM_SOURCE"
+ value: "False"
+}
diff --git a/.kokoro/samples/python3.9/presubmit.cfg b/.kokoro/samples/python3.9/presubmit.cfg
new file mode 100644
index 000000000..a1c8d9759
--- /dev/null
+++ b/.kokoro/samples/python3.9/presubmit.cfg
@@ -0,0 +1,6 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+env_vars: {
+ key: "INSTALL_LIBRARY_FROM_SOURCE"
+ value: "True"
+}
\ No newline at end of file
diff --git a/.kokoro/test-samples-against-head.sh b/.kokoro/test-samples-against-head.sh
new file mode 100755
index 000000000..e9d8bd79a
--- /dev/null
+++ b/.kokoro/test-samples-against-head.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+# Copyright 2024 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# A customized test runner for samples.
+#
+# For periodic builds, you can specify this file for testing against head.
+
+# `-e` enables the script to automatically fail when a command fails
+# `-o pipefail` sets the exit code to the rightmost comment to exit with a non-zero
+set -eo pipefail
+# Enables `**` to include files nested inside sub-folders
+shopt -s globstar
+
+exec .kokoro/test-samples-impl.sh
diff --git a/.kokoro/test-samples-impl.sh b/.kokoro/test-samples-impl.sh
new file mode 100755
index 000000000..53e365bc4
--- /dev/null
+++ b/.kokoro/test-samples-impl.sh
@@ -0,0 +1,103 @@
+#!/bin/bash
+# Copyright 2024 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+# `-e` enables the script to automatically fail when a command fails
+# `-o pipefail` sets the exit code to the rightmost comment to exit with a non-zero
+set -eo pipefail
+# Enables `**` to include files nested inside sub-folders
+shopt -s globstar
+
+# Exit early if samples don't exist
+if ! find samples -name 'requirements.txt' | grep -q .; then
+ echo "No tests run. './samples/**/requirements.txt' not found"
+ exit 0
+fi
+
+# Disable buffering, so that the logs stream through.
+export PYTHONUNBUFFERED=1
+
+# Debug: show build environment
+env | grep KOKORO
+
+# Install nox
+# `virtualenv==20.26.6` is added for Python 3.7 compatibility
+python3.9 -m pip install --upgrade --quiet nox virtualenv==20.26.6
+
+# Use secrets acessor service account to get secrets
+if [[ -f "${KOKORO_GFILE_DIR}/secrets_viewer_service_account.json" ]]; then
+ gcloud auth activate-service-account \
+ --key-file="${KOKORO_GFILE_DIR}/secrets_viewer_service_account.json" \
+ --project="cloud-devrel-kokoro-resources"
+fi
+
+# This script will create 3 files:
+# - testing/test-env.sh
+# - testing/service-account.json
+# - testing/client-secrets.json
+./scripts/decrypt-secrets.sh
+
+source ./testing/test-env.sh
+export GOOGLE_APPLICATION_CREDENTIALS=$(pwd)/testing/service-account.json
+
+# For cloud-run session, we activate the service account for gcloud sdk.
+gcloud auth activate-service-account \
+ --key-file "${GOOGLE_APPLICATION_CREDENTIALS}"
+
+export GOOGLE_CLIENT_SECRETS=$(pwd)/testing/client-secrets.json
+
+echo -e "\n******************** TESTING PROJECTS ********************"
+
+# Switch to 'fail at end' to allow all tests to complete before exiting.
+set +e
+# Use RTN to return a non-zero value if the test fails.
+RTN=0
+ROOT=$(pwd)
+# Find all requirements.txt in the samples directory (may break on whitespace).
+for file in samples/**/requirements.txt; do
+ cd "$ROOT"
+ # Navigate to the project folder.
+ file=$(dirname "$file")
+ cd "$file"
+
+ echo "------------------------------------------------------------"
+ echo "- testing $file"
+ echo "------------------------------------------------------------"
+
+ # Use nox to execute the tests for the project.
+ python3.9 -m nox -s "$RUN_TESTS_SESSION"
+ EXIT=$?
+
+ # If this is a periodic build, send the test log to the 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
+ fi
+
+ if [[ $EXIT -ne 0 ]]; then
+ RTN=1
+ echo -e "\n Testing failed: Nox returned a non-zero exit code. \n"
+ else
+ echo -e "\n Testing completed.\n"
+ fi
+
+done
+cd "$ROOT"
+
+# Workaround for Kokoro permissions issue: delete secrets
+rm testing/{test-env.sh,client-secrets.json,service-account.json}
+
+exit "$RTN"
diff --git a/.kokoro/test-samples.sh b/.kokoro/test-samples.sh
index 6da844235..7933d8201 100755
--- a/.kokoro/test-samples.sh
+++ b/.kokoro/test-samples.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright 2020 Google LLC
+# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -13,6 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+# The default test runner for samples.
+#
+# For periodic builds, we rewinds the repo to the latest release, and
+# run test-samples-impl.sh.
# `-e` enables the script to automatically fail when a command fails
# `-o pipefail` sets the exit code to the rightmost comment to exit with a non-zero
@@ -20,85 +24,21 @@ set -eo pipefail
# Enables `**` to include files nested inside sub-folders
shopt -s globstar
-cd github/python-bigtable
-
# Run periodic samples tests at latest release
if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then
+ # preserving the test runner implementation.
+ cp .kokoro/test-samples-impl.sh "${TMPDIR}/test-samples-impl.sh"
+ echo "--- IMPORTANT IMPORTANT IMPORTANT ---"
+ echo "Now we rewind the repo back to the latest release..."
LATEST_RELEASE=$(git describe --abbrev=0 --tags)
git checkout $LATEST_RELEASE
-fi
-
-# Disable buffering, so that the logs stream through.
-export PYTHONUNBUFFERED=1
-
-# Debug: show build environment
-env | grep KOKORO
-
-# Install nox
-python3.6 -m pip install --upgrade --quiet nox
-
-# Use secrets acessor service account to get secrets
-if [[ -f "${KOKORO_GFILE_DIR}/secrets_viewer_service_account.json" ]]; then
- gcloud auth activate-service-account \
- --key-file="${KOKORO_GFILE_DIR}/secrets_viewer_service_account.json" \
- --project="cloud-devrel-kokoro-resources"
-fi
-
-# This script will create 3 files:
-# - testing/test-env.sh
-# - testing/service-account.json
-# - testing/client-secrets.json
-./scripts/decrypt-secrets.sh
-
-source ./testing/test-env.sh
-export GOOGLE_APPLICATION_CREDENTIALS=$(pwd)/testing/service-account.json
-
-# For cloud-run session, we activate the service account for gcloud sdk.
-gcloud auth activate-service-account \
- --key-file "${GOOGLE_APPLICATION_CREDENTIALS}"
-
-export GOOGLE_CLIENT_SECRETS=$(pwd)/testing/client-secrets.json
-
-echo -e "\n******************** TESTING PROJECTS ********************"
-
-# Switch to 'fail at end' to allow all tests to complete before exiting.
-set +e
-# Use RTN to return a non-zero value if the test fails.
-RTN=0
-ROOT=$(pwd)
-# Find all requirements.txt in the samples directory (may break on whitespace).
-for file in samples/**/requirements.txt; do
- cd "$ROOT"
- # Navigate to the project folder.
- file=$(dirname "$file")
- cd "$file"
-
- echo "------------------------------------------------------------"
- echo "- testing $file"
- echo "------------------------------------------------------------"
-
- # Use nox to execute the tests for the project.
- python3.6 -m nox -s "$RUN_TESTS_SESSION"
- EXIT=$?
-
- # If this is a periodic build, send the test log to the Build Cop Bot.
- # See https://github.com/googleapis/repo-automation-bots/tree/master/packages/buildcop.
- if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then
- chmod +x $KOKORO_GFILE_DIR/linux_amd64/buildcop
- $KOKORO_GFILE_DIR/linux_amd64/buildcop
+ echo "The current head is: "
+ echo $(git rev-parse --verify HEAD)
+ echo "--- IMPORTANT IMPORTANT IMPORTANT ---"
+ # move back the test runner implementation if there's no file.
+ if [ ! -f .kokoro/test-samples-impl.sh ]; then
+ cp "${TMPDIR}/test-samples-impl.sh" .kokoro/test-samples-impl.sh
fi
+fi
- if [[ $EXIT -ne 0 ]]; then
- RTN=1
- echo -e "\n Testing failed: Nox returned a non-zero exit code. \n"
- else
- echo -e "\n Testing completed.\n"
- fi
-
-done
-cd "$ROOT"
-
-# Workaround for Kokoro permissions issue: delete secrets
-rm testing/{test-env.sh,client-secrets.json,service-account.json}
-
-exit "$RTN"
\ No newline at end of file
+exec .kokoro/test-samples-impl.sh
diff --git a/.kokoro/trampoline.sh b/.kokoro/trampoline.sh
index e8c4251f3..48f796997 100755
--- a/.kokoro/trampoline.sh
+++ b/.kokoro/trampoline.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright 2017 Google Inc.
+# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -15,9 +15,14 @@
set -eo pipefail
-python3 "${KOKORO_GFILE_DIR}/trampoline_v1.py" || ret_code=$?
+# Always run the cleanup script, regardless of the success of bouncing into
+# the container.
+function cleanup() {
+ chmod +x ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh
+ ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh
+ echo "cleanup";
+}
+trap cleanup EXIT
-chmod +x ${KOKORO_GFILE_DIR}/trampoline_cleanup.sh
-${KOKORO_GFILE_DIR}/trampoline_cleanup.sh || true
-
-exit ${ret_code}
+$(dirname $0)/populate-secrets.sh # Secret Manager secrets.
+python3 "${KOKORO_GFILE_DIR}/trampoline_v1.py"
\ No newline at end of file
diff --git a/.kokoro/trampoline_v2.sh b/.kokoro/trampoline_v2.sh
new file mode 100755
index 000000000..d03f92dfc
--- /dev/null
+++ b/.kokoro/trampoline_v2.sh
@@ -0,0 +1,487 @@
+#!/usr/bin/env bash
+# Copyright 2024 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# trampoline_v2.sh
+#
+# This script does 3 things.
+#
+# 1. Prepare the Docker image for the test
+# 2. Run the Docker with appropriate flags to run the test
+# 3. Upload the newly built Docker image
+#
+# in a way that is somewhat compatible with trampoline_v1.
+#
+# To run this script, first download few files from gcs to /dev/shm.
+# (/dev/shm is passed into the container as KOKORO_GFILE_DIR).
+#
+# gcloud storage cp gs://cloud-devrel-kokoro-resources/python-docs-samples/secrets_viewer_service_account.json /dev/shm
+# gcloud storage cp gs://cloud-devrel-kokoro-resources/python-docs-samples/automl_secrets.txt /dev/shm
+#
+# Then run the script.
+# .kokoro/trampoline_v2.sh
+#
+# These environment variables are required:
+# TRAMPOLINE_IMAGE: The docker image to use.
+# TRAMPOLINE_DOCKERFILE: The location of the Dockerfile.
+#
+# You can optionally change these environment variables:
+# TRAMPOLINE_IMAGE_UPLOAD:
+# (true|false): Whether to upload the Docker image after the
+# successful builds.
+# TRAMPOLINE_BUILD_FILE: The script to run in the docker container.
+# TRAMPOLINE_WORKSPACE: The workspace path in the docker container.
+# Defaults to /workspace.
+# Potentially there are some repo specific envvars in .trampolinerc in
+# the project root.
+
+
+set -euo pipefail
+
+TRAMPOLINE_VERSION="2.0.5"
+
+if command -v tput >/dev/null && [[ -n "${TERM:-}" ]]; then
+ readonly IO_COLOR_RED="$(tput setaf 1)"
+ readonly IO_COLOR_GREEN="$(tput setaf 2)"
+ readonly IO_COLOR_YELLOW="$(tput setaf 3)"
+ readonly IO_COLOR_RESET="$(tput sgr0)"
+else
+ readonly IO_COLOR_RED=""
+ readonly IO_COLOR_GREEN=""
+ readonly IO_COLOR_YELLOW=""
+ readonly IO_COLOR_RESET=""
+fi
+
+function function_exists {
+ [ $(LC_ALL=C type -t $1)"" == "function" ]
+}
+
+# Logs a message using the given color. The first argument must be one
+# of the IO_COLOR_* variables defined above, such as
+# "${IO_COLOR_YELLOW}". The remaining arguments will be logged in the
+# given color. The log message will also have an RFC-3339 timestamp
+# prepended (in UTC). You can disable the color output by setting
+# TERM=vt100.
+function log_impl() {
+ local color="$1"
+ shift
+ local timestamp="$(date -u "+%Y-%m-%dT%H:%M:%SZ")"
+ echo "================================================================"
+ echo "${color}${timestamp}:" "$@" "${IO_COLOR_RESET}"
+ echo "================================================================"
+}
+
+# Logs the given message with normal coloring and a timestamp.
+function log() {
+ log_impl "${IO_COLOR_RESET}" "$@"
+}
+
+# Logs the given message in green with a timestamp.
+function log_green() {
+ log_impl "${IO_COLOR_GREEN}" "$@"
+}
+
+# Logs the given message in yellow with a timestamp.
+function log_yellow() {
+ log_impl "${IO_COLOR_YELLOW}" "$@"
+}
+
+# Logs the given message in red with a timestamp.
+function log_red() {
+ log_impl "${IO_COLOR_RED}" "$@"
+}
+
+readonly tmpdir=$(mktemp -d -t ci-XXXXXXXX)
+readonly tmphome="${tmpdir}/h"
+mkdir -p "${tmphome}"
+
+function cleanup() {
+ rm -rf "${tmpdir}"
+}
+trap cleanup EXIT
+
+RUNNING_IN_CI="${RUNNING_IN_CI:-false}"
+
+# The workspace in the container, defaults to /workspace.
+TRAMPOLINE_WORKSPACE="${TRAMPOLINE_WORKSPACE:-/workspace}"
+
+pass_down_envvars=(
+ # TRAMPOLINE_V2 variables.
+ # Tells scripts whether they are running as part of CI or not.
+ "RUNNING_IN_CI"
+ # Indicates which CI system we're in.
+ "TRAMPOLINE_CI"
+ # Indicates the version of the script.
+ "TRAMPOLINE_VERSION"
+)
+
+log_yellow "Building with Trampoline ${TRAMPOLINE_VERSION}"
+
+# Detect which CI systems we're in. If we're in any of the CI systems
+# we support, `RUNNING_IN_CI` will be true and `TRAMPOLINE_CI` will be
+# the name of the CI system. Both envvars will be passing down to the
+# container for telling which CI system we're in.
+if [[ -n "${KOKORO_BUILD_ID:-}" ]]; then
+ # descriptive env var for indicating it's on CI.
+ RUNNING_IN_CI="true"
+ TRAMPOLINE_CI="kokoro"
+ if [[ "${TRAMPOLINE_USE_LEGACY_SERVICE_ACCOUNT:-}" == "true" ]]; then
+ if [[ ! -f "${KOKORO_GFILE_DIR}/kokoro-trampoline.service-account.json" ]]; then
+ log_red "${KOKORO_GFILE_DIR}/kokoro-trampoline.service-account.json does not exist. Did you forget to mount cloud-devrel-kokoro-resources/trampoline? Aborting."
+ exit 1
+ fi
+ # This service account will be activated later.
+ TRAMPOLINE_SERVICE_ACCOUNT="${KOKORO_GFILE_DIR}/kokoro-trampoline.service-account.json"
+ else
+ if [[ "${TRAMPOLINE_VERBOSE:-}" == "true" ]]; then
+ gcloud auth list
+ fi
+ log_yellow "Configuring Container Registry access"
+ gcloud auth configure-docker --quiet
+ fi
+ pass_down_envvars+=(
+ # KOKORO dynamic variables.
+ "KOKORO_BUILD_NUMBER"
+ "KOKORO_BUILD_ID"
+ "KOKORO_JOB_NAME"
+ "KOKORO_GIT_COMMIT"
+ "KOKORO_GITHUB_COMMIT"
+ "KOKORO_GITHUB_PULL_REQUEST_NUMBER"
+ "KOKORO_GITHUB_PULL_REQUEST_COMMIT"
+ # For FlakyBot
+ "KOKORO_GITHUB_COMMIT_URL"
+ "KOKORO_GITHUB_PULL_REQUEST_URL"
+ )
+elif [[ "${TRAVIS:-}" == "true" ]]; then
+ RUNNING_IN_CI="true"
+ TRAMPOLINE_CI="travis"
+ pass_down_envvars+=(
+ "TRAVIS_BRANCH"
+ "TRAVIS_BUILD_ID"
+ "TRAVIS_BUILD_NUMBER"
+ "TRAVIS_BUILD_WEB_URL"
+ "TRAVIS_COMMIT"
+ "TRAVIS_COMMIT_MESSAGE"
+ "TRAVIS_COMMIT_RANGE"
+ "TRAVIS_JOB_NAME"
+ "TRAVIS_JOB_NUMBER"
+ "TRAVIS_JOB_WEB_URL"
+ "TRAVIS_PULL_REQUEST"
+ "TRAVIS_PULL_REQUEST_BRANCH"
+ "TRAVIS_PULL_REQUEST_SHA"
+ "TRAVIS_PULL_REQUEST_SLUG"
+ "TRAVIS_REPO_SLUG"
+ "TRAVIS_SECURE_ENV_VARS"
+ "TRAVIS_TAG"
+ )
+elif [[ -n "${GITHUB_RUN_ID:-}" ]]; then
+ RUNNING_IN_CI="true"
+ TRAMPOLINE_CI="github-workflow"
+ pass_down_envvars+=(
+ "GITHUB_WORKFLOW"
+ "GITHUB_RUN_ID"
+ "GITHUB_RUN_NUMBER"
+ "GITHUB_ACTION"
+ "GITHUB_ACTIONS"
+ "GITHUB_ACTOR"
+ "GITHUB_REPOSITORY"
+ "GITHUB_EVENT_NAME"
+ "GITHUB_EVENT_PATH"
+ "GITHUB_SHA"
+ "GITHUB_REF"
+ "GITHUB_HEAD_REF"
+ "GITHUB_BASE_REF"
+ )
+elif [[ "${CIRCLECI:-}" == "true" ]]; then
+ RUNNING_IN_CI="true"
+ TRAMPOLINE_CI="circleci"
+ pass_down_envvars+=(
+ "CIRCLE_BRANCH"
+ "CIRCLE_BUILD_NUM"
+ "CIRCLE_BUILD_URL"
+ "CIRCLE_COMPARE_URL"
+ "CIRCLE_JOB"
+ "CIRCLE_NODE_INDEX"
+ "CIRCLE_NODE_TOTAL"
+ "CIRCLE_PREVIOUS_BUILD_NUM"
+ "CIRCLE_PROJECT_REPONAME"
+ "CIRCLE_PROJECT_USERNAME"
+ "CIRCLE_REPOSITORY_URL"
+ "CIRCLE_SHA1"
+ "CIRCLE_STAGE"
+ "CIRCLE_USERNAME"
+ "CIRCLE_WORKFLOW_ID"
+ "CIRCLE_WORKFLOW_JOB_ID"
+ "CIRCLE_WORKFLOW_UPSTREAM_JOB_IDS"
+ "CIRCLE_WORKFLOW_WORKSPACE_ID"
+ )
+fi
+
+# Configure the service account for pulling the docker image.
+function repo_root() {
+ local dir="$1"
+ while [[ ! -d "${dir}/.git" ]]; do
+ dir="$(dirname "$dir")"
+ done
+ echo "${dir}"
+}
+
+# Detect the project root. In CI builds, we assume the script is in
+# the git tree and traverse from there, otherwise, traverse from `pwd`
+# to find `.git` directory.
+if [[ "${RUNNING_IN_CI:-}" == "true" ]]; then
+ PROGRAM_PATH="$(realpath "$0")"
+ PROGRAM_DIR="$(dirname "${PROGRAM_PATH}")"
+ PROJECT_ROOT="$(repo_root "${PROGRAM_DIR}")"
+else
+ PROJECT_ROOT="$(repo_root $(pwd))"
+fi
+
+log_yellow "Changing to the project root: ${PROJECT_ROOT}."
+cd "${PROJECT_ROOT}"
+
+# To support relative path for `TRAMPOLINE_SERVICE_ACCOUNT`, we need
+# to use this environment variable in `PROJECT_ROOT`.
+if [[ -n "${TRAMPOLINE_SERVICE_ACCOUNT:-}" ]]; then
+
+ mkdir -p "${tmpdir}/gcloud"
+ gcloud_config_dir="${tmpdir}/gcloud"
+
+ log_yellow "Using isolated gcloud config: ${gcloud_config_dir}."
+ export CLOUDSDK_CONFIG="${gcloud_config_dir}"
+
+ log_yellow "Using ${TRAMPOLINE_SERVICE_ACCOUNT} for authentication."
+ gcloud auth activate-service-account \
+ --key-file "${TRAMPOLINE_SERVICE_ACCOUNT}"
+ log_yellow "Configuring Container Registry access"
+ gcloud auth configure-docker --quiet
+fi
+
+required_envvars=(
+ # The basic trampoline configurations.
+ "TRAMPOLINE_IMAGE"
+ "TRAMPOLINE_BUILD_FILE"
+)
+
+if [[ -f "${PROJECT_ROOT}/.trampolinerc" ]]; then
+ source "${PROJECT_ROOT}/.trampolinerc"
+fi
+
+log_yellow "Checking environment variables."
+for e in "${required_envvars[@]}"
+do
+ if [[ -z "${!e:-}" ]]; then
+ log "Missing ${e} env var. Aborting."
+ exit 1
+ fi
+done
+
+# We want to support legacy style TRAMPOLINE_BUILD_FILE used with V1
+# script: e.g. "github/repo-name/.kokoro/run_tests.sh"
+TRAMPOLINE_BUILD_FILE="${TRAMPOLINE_BUILD_FILE#github/*/}"
+log_yellow "Using TRAMPOLINE_BUILD_FILE: ${TRAMPOLINE_BUILD_FILE}"
+
+# ignore error on docker operations and test execution
+set +e
+
+log_yellow "Preparing Docker image."
+# We only download the docker image in CI builds.
+if [[ "${RUNNING_IN_CI:-}" == "true" ]]; then
+ # Download the docker image specified by `TRAMPOLINE_IMAGE`
+
+ # We may want to add --max-concurrent-downloads flag.
+
+ log_yellow "Start pulling the Docker image: ${TRAMPOLINE_IMAGE}."
+ if docker pull "${TRAMPOLINE_IMAGE}"; then
+ log_green "Finished pulling the Docker image: ${TRAMPOLINE_IMAGE}."
+ has_image="true"
+ else
+ log_red "Failed pulling the Docker image: ${TRAMPOLINE_IMAGE}."
+ has_image="false"
+ fi
+else
+ # For local run, check if we have the image.
+ if docker images "${TRAMPOLINE_IMAGE}:latest" | grep "${TRAMPOLINE_IMAGE}"; then
+ has_image="true"
+ else
+ has_image="false"
+ fi
+fi
+
+
+# The default user for a Docker container has uid 0 (root). To avoid
+# creating root-owned files in the build directory we tell docker to
+# use the current user ID.
+user_uid="$(id -u)"
+user_gid="$(id -g)"
+user_name="$(id -un)"
+
+# To allow docker in docker, we add the user to the docker group in
+# the host os.
+docker_gid=$(cut -d: -f3 < <(getent group docker))
+
+update_cache="false"
+if [[ "${TRAMPOLINE_DOCKERFILE:-none}" != "none" ]]; then
+ # Build the Docker image from the source.
+ context_dir=$(dirname "${TRAMPOLINE_DOCKERFILE}")
+ docker_build_flags=(
+ "-f" "${TRAMPOLINE_DOCKERFILE}"
+ "-t" "${TRAMPOLINE_IMAGE}"
+ "--build-arg" "UID=${user_uid}"
+ "--build-arg" "USERNAME=${user_name}"
+ )
+ if [[ "${has_image}" == "true" ]]; then
+ docker_build_flags+=("--cache-from" "${TRAMPOLINE_IMAGE}")
+ fi
+
+ log_yellow "Start building the docker image."
+ if [[ "${TRAMPOLINE_VERBOSE:-false}" == "true" ]]; then
+ echo "docker build" "${docker_build_flags[@]}" "${context_dir}"
+ fi
+
+ # ON CI systems, we want to suppress docker build logs, only
+ # output the logs when it fails.
+ if [[ "${RUNNING_IN_CI:-}" == "true" ]]; then
+ if docker build "${docker_build_flags[@]}" "${context_dir}" \
+ > "${tmpdir}/docker_build.log" 2>&1; then
+ if [[ "${TRAMPOLINE_VERBOSE:-}" == "true" ]]; then
+ cat "${tmpdir}/docker_build.log"
+ fi
+
+ log_green "Finished building the docker image."
+ update_cache="true"
+ else
+ log_red "Failed to build the Docker image, aborting."
+ log_yellow "Dumping the build logs:"
+ cat "${tmpdir}/docker_build.log"
+ exit 1
+ fi
+ else
+ if docker build "${docker_build_flags[@]}" "${context_dir}"; then
+ log_green "Finished building the docker image."
+ update_cache="true"
+ else
+ log_red "Failed to build the Docker image, aborting."
+ exit 1
+ fi
+ fi
+else
+ if [[ "${has_image}" != "true" ]]; then
+ log_red "We do not have ${TRAMPOLINE_IMAGE} locally, aborting."
+ exit 1
+ fi
+fi
+
+# We use an array for the flags so they are easier to document.
+docker_flags=(
+ # Remove the container after it exists.
+ "--rm"
+
+ # Use the host network.
+ "--network=host"
+
+ # Run in priviledged mode. We are not using docker for sandboxing or
+ # isolation, just for packaging our dev tools.
+ "--privileged"
+
+ # Run the docker script with the user id. Because the docker image gets to
+ # write in ${PWD} you typically want this to be your user id.
+ # To allow docker in docker, we need to use docker gid on the host.
+ "--user" "${user_uid}:${docker_gid}"
+
+ # Pass down the USER.
+ "--env" "USER=${user_name}"
+
+ # Mount the project directory inside the Docker container.
+ "--volume" "${PROJECT_ROOT}:${TRAMPOLINE_WORKSPACE}"
+ "--workdir" "${TRAMPOLINE_WORKSPACE}"
+ "--env" "PROJECT_ROOT=${TRAMPOLINE_WORKSPACE}"
+
+ # Mount the temporary home directory.
+ "--volume" "${tmphome}:/h"
+ "--env" "HOME=/h"
+
+ # Allow docker in docker.
+ "--volume" "/var/run/docker.sock:/var/run/docker.sock"
+
+ # Mount the /tmp so that docker in docker can mount the files
+ # there correctly.
+ "--volume" "/tmp:/tmp"
+ # Pass down the KOKORO_GFILE_DIR and KOKORO_KEYSTORE_DIR
+ # TODO(tmatsuo): This part is not portable.
+ "--env" "TRAMPOLINE_SECRET_DIR=/secrets"
+ "--volume" "${KOKORO_GFILE_DIR:-/dev/shm}:/secrets/gfile"
+ "--env" "KOKORO_GFILE_DIR=/secrets/gfile"
+ "--volume" "${KOKORO_KEYSTORE_DIR:-/dev/shm}:/secrets/keystore"
+ "--env" "KOKORO_KEYSTORE_DIR=/secrets/keystore"
+)
+
+# Add an option for nicer output if the build gets a tty.
+if [[ -t 0 ]]; then
+ docker_flags+=("-it")
+fi
+
+# Passing down env vars
+for e in "${pass_down_envvars[@]}"
+do
+ if [[ -n "${!e:-}" ]]; then
+ docker_flags+=("--env" "${e}=${!e}")
+ fi
+done
+
+# If arguments are given, all arguments will become the commands run
+# in the container, otherwise run TRAMPOLINE_BUILD_FILE.
+if [[ $# -ge 1 ]]; then
+ log_yellow "Running the given commands '" "${@:1}" "' in the container."
+ readonly commands=("${@:1}")
+ if [[ "${TRAMPOLINE_VERBOSE:-}" == "true" ]]; then
+ echo docker run "${docker_flags[@]}" "${TRAMPOLINE_IMAGE}" "${commands[@]}"
+ fi
+ docker run "${docker_flags[@]}" "${TRAMPOLINE_IMAGE}" "${commands[@]}"
+else
+ log_yellow "Running the tests in a Docker container."
+ docker_flags+=("--entrypoint=${TRAMPOLINE_BUILD_FILE}")
+ if [[ "${TRAMPOLINE_VERBOSE:-}" == "true" ]]; then
+ echo docker run "${docker_flags[@]}" "${TRAMPOLINE_IMAGE}"
+ fi
+ docker run "${docker_flags[@]}" "${TRAMPOLINE_IMAGE}"
+fi
+
+
+test_retval=$?
+
+if [[ ${test_retval} -eq 0 ]]; then
+ log_green "Build finished with ${test_retval}"
+else
+ log_red "Build finished with ${test_retval}"
+fi
+
+# Only upload it when the test passes.
+if [[ "${update_cache}" == "true" ]] && \
+ [[ $test_retval == 0 ]] && \
+ [[ "${TRAMPOLINE_IMAGE_UPLOAD:-false}" == "true" ]]; then
+ log_yellow "Uploading the Docker image."
+ if docker push "${TRAMPOLINE_IMAGE}"; then
+ log_green "Finished uploading the Docker image."
+ else
+ log_red "Failed uploading the Docker image."
+ fi
+ # Call trampoline_after_upload_hook if it's defined.
+ if function_exists trampoline_after_upload_hook; then
+ trampoline_after_upload_hook
+ fi
+
+fi
+
+exit "${test_retval}"
diff --git a/.librarian/generator-input/.repo-metadata.json b/.librarian/generator-input/.repo-metadata.json
new file mode 100644
index 000000000..9de4b5f92
--- /dev/null
+++ b/.librarian/generator-input/.repo-metadata.json
@@ -0,0 +1,80 @@
+{
+ "name": "bigtable",
+ "name_pretty": "Cloud Bigtable",
+ "product_documentation": "https://cloud.google.com/bigtable",
+ "client_documentation": "https://cloud.google.com/python/docs/reference/bigtable/latest",
+ "issue_tracker": "https://issuetracker.google.com/savedsearches/559777",
+ "release_level": "stable",
+ "language": "python",
+ "library_type": "GAPIC_COMBO",
+ "repo": "googleapis/python-bigtable",
+ "distribution_name": "google-cloud-bigtable",
+ "api_id": "bigtable.googleapis.com",
+ "requires_billing": true,
+ "samples": [
+ {
+ "name": "Hello World in Cloud Bigtable",
+ "description": "Demonstrates how to connect to Cloud Bigtable and run some basic operations. More information available at: https://cloud.google.com/bigtable/docs/samples-python-hello",
+ "file": "main.py",
+ "runnable": true,
+ "custom_content": "
usage: main.py [-h] [--table TABLE] project_id instance_id
Demonstrates how to connect to Cloud Bigtable and run some basic operations.
Prerequisites: - Create a Cloud Bigtable cluster.
https://cloud.google.com/bigtable/docs/creating-cluster - Set your Google
Application Default Credentials.
https://developers.google.com/identity/protocols/application-default-
credentials
positional arguments:
project_id Your Cloud Platform project ID.
instance_id ID of the Cloud Bigtable instance to connect to.
optional arguments:
-h, --help show this help message and exit
--table TABLE Table to create and destroy. (default: Hello-Bigtable)
",
+ "override_path": "hello"
+ },
+ {
+ "name": "Hello World using HappyBase",
+ "description": "This sample demonstrates using the Google Cloud Client Library HappyBase package, an implementation of the HappyBase API to connect to and interact with Cloud Bigtable. More information available at: https://cloud.google.com/bigtable/docs/samples-python-hello-happybase",
+ "file": "main.py",
+ "runnable": true,
+ "custom_content": "usage: main.py [-h] [--table TABLE] project_id instance_id
Demonstrates how to connect to Cloud Bigtable and run some basic operations.
Prerequisites: - Create a Cloud Bigtable cluster.
https://cloud.google.com/bigtable/docs/creating-cluster - Set your Google
Application Default Credentials.
https://developers.google.com/identity/protocols/application-default-
credentials
positional arguments:
project_id Your Cloud Platform project ID.
instance_id ID of the Cloud Bigtable instance to connect to.
optional arguments:
-h, --help show this help message and exit
--table TABLE Table to create and destroy. (default: Hello-Bigtable)
",
+ "override_path": "hello_happybase"
+ },
+ {
+ "name": "cbt Command Demonstration",
+ "description": "This page explains how to use the cbt command to connect to a Cloud Bigtable instance, perform basic administrative tasks, and read and write data in a table. More information about this quickstart is available at https://cloud.google.com/bigtable/docs/quickstart-cbt",
+ "file": "instanceadmin.py",
+ "runnable": true,
+ "custom_content": "usage: instanceadmin.py [-h] [run] [dev-instance] [del-instance] [add-cluster] [del-cluster] project_id instance_id cluster_id
Demonstrates how to connect to Cloud Bigtable and run some basic operations.
Prerequisites: - Create a Cloud Bigtable cluster.
https://cloud.google.com/bigtable/docs/creating-cluster - Set your Google
Application Default Credentials.
https://developers.google.com/identity/protocols/application-default-
credentials
positional arguments:
project_id Your Cloud Platform project ID.
instance_id ID of the Cloud Bigtable instance to connect to.
optional arguments:
-h, --help show this help message and exit
--table TABLE Table to create and destroy. (default: Hello-Bigtable)
",
+ "override_path": "instanceadmin"
+ },
+ {
+ "name": "Metric Scaler",
+ "description": "This sample demonstrates how to use Stackdriver Monitoring to scale Cloud Bigtable based on CPU usage.",
+ "file": "metricscaler.py",
+ "runnable": true,
+ "custom_content": "usage: metricscaler.py [-h] [--high_cpu_threshold HIGH_CPU_THRESHOLD] [--low_cpu_threshold LOW_CPU_THRESHOLD] [--short_sleep SHORT_SLEEP] [--long_sleep LONG_SLEEP] bigtable_instance bigtable_cluster
usage: metricscaler.py [-h] [--high_cpu_threshold HIGH_CPU_THRESHOLD]
[--low_cpu_threshold LOW_CPU_THRESHOLD]
[--short_sleep SHORT_SLEEP] [--long_sleep LONG_SLEEP]
bigtable_instance bigtable_cluster
Scales Cloud Bigtable clusters based on CPU usage.
positional arguments:
bigtable_instance ID of the Cloud Bigtable instance to connect to.
bigtable_cluster ID of the Cloud Bigtable cluster to connect to.
optional arguments:
-h, --help show this help message and exit
--high_cpu_threshold HIGH_CPU_THRESHOLD
If Cloud Bigtable CPU usage is above this threshold,
scale up
--low_cpu_threshold LOW_CPU_THRESHOLD
If Cloud Bigtable CPU usage is below this threshold,
scale down
--short_sleep SHORT_SLEEP
How long to sleep in seconds between checking metrics
after no scale operation
--long_sleep LONG_SLEEP
How long to sleep in seconds between checking metrics
after a scaling operation
",
+ "override_path": "metricscaler"
+ },
+ {
+ "name": "Quickstart",
+ "description": "Demonstrates of Cloud Bigtable. This sample creates a Bigtable client, connects to an instance and then to a table, then closes the connection.",
+ "file": "main.py",
+ "runnable": true,
+ "custom_content": "usage: main.py [-h] [--table TABLE] project_id instance_id
positional arguments:
project_id Your Cloud Platform project ID.
instance_id ID of the Cloud Bigtable instance to connect to.
optional arguments:
-h, --help show this help message and exit
--table TABLE Existing table used in the quickstart. (default: my-table)
",
+ "override_path": "quickstart"
+ },
+ {
+ "name": "Quickstart using HappyBase",
+ "description": "Demonstrates of Cloud Bigtable using HappyBase. This sample creates a Bigtable client, connects to an instance and then to a table, then closes the connection.",
+ "file": "main.py",
+ "runnable": true,
+ "custom_content": "usage: main.py [-h] [--table TABLE] project_id instance_id
usage: main.py [-h] [--table TABLE] project_id instance_id
positional arguments:
project_id Your Cloud Platform project ID.
instance_id ID of the Cloud Bigtable instance to connect to.
optional arguments:
-h, --help show this help message and exit
--table TABLE Existing table used in the quickstart. (default: my-table)usage: tableadmin.py [-h] [run] [delete] [--table TABLE] project_id instance_id
Demonstrates how to connect to Cloud Bigtable and run some basic operations.
Prerequisites: - Create a Cloud Bigtable cluster.
https://cloud.google.com/bigtable/docs/creating-cluster - Set your Google
Application Default Credentials.
https://developers.google.com/identity/protocols/application-default-
credentials
positional arguments:
project_id Your Cloud Platform project ID.
instance_id ID of the Cloud Bigtable instance to connect to.
optional arguments:
-h, --help show this help message and exit
--table TABLE Table to create and destroy. (default: Hello-Bigtable)
",
+ "override_path": "tableadmin"
+ }
+ ],
+ "default_version": "v2",
+ "codeowner_team": "@googleapis/api-bigtable @googleapis/api-bigtable-partners",
+ "api_shortname": "bigtable"
+}
diff --git a/.librarian/generator-input/librarian.py b/.librarian/generator-input/librarian.py
new file mode 100644
index 000000000..5b943d24b
--- /dev/null
+++ b/.librarian/generator-input/librarian.py
@@ -0,0 +1,266 @@
+# Copyright 2018 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.
+
+"""This script is used to synthesize generated parts of this library."""
+
+from pathlib import Path
+import re
+import textwrap
+from typing import List, Optional
+
+import synthtool as s
+from synthtool import gcp, _tracked_paths
+from synthtool.languages import python
+from synthtool.sources import templates
+
+common = gcp.CommonTemplates()
+
+# These flags are needed because certain post-processing operations
+# append things after a certain line of text, and can infinitely loop
+# in a Github PR. We use these flags to only do those operations
+# on fresh copies of files found in googleapis-gen, and not on user-submitted
+# changes.
+is_fresh_admin_copy = False
+is_fresh_admin_v2_copy = False
+is_fresh_admin_docs_copy = False
+
+for library in s.get_staging_dirs("v2"):
+ s.move(library / "google/cloud/bigtable_v2")
+ is_fresh_admin_copy = \
+ s.move(library / "google/cloud/bigtable_admin")
+ is_fresh_admin_v2_copy = \
+ s.move(library / "google/cloud/bigtable_admin_v2")
+ s.move(library / "tests")
+ s.move(library / "samples")
+ s.move(library / "scripts")
+ is_fresh_admin_docs_copy = \
+ s.move(library / "docs/bigtable_admin_v2", destination="docs/admin_client")
+
+s.remove_staging_dirs()
+
+# ----------------------------------------------------------------------------
+# Add templated files
+# ----------------------------------------------------------------------------
+templated_files = common.py_library(
+ samples=True, # set to True only if there are samples
+ split_system_tests=True,
+ microgenerator=True,
+ cov_level=99,
+ system_test_external_dependencies=[
+ "pytest-asyncio==0.21.2",
+ ],
+ system_test_python_versions=["3.9"],
+ unit_test_python_versions=["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"],
+ default_python_version="3.13",
+)
+
+s.move(templated_files, excludes=[".coveragerc", "README.rst", ".github/**", ".kokoro/**", "noxfile.py", "renovate.json"])
+
+
+s.shell.run(["nox", "-s", "blacken"], hide_output=False)
+
+# ----------------------------------------------------------------------------
+# Always supply app_profile_id in routing headers: https://github.com/googleapis/python-bigtable/pull/1109
+# TODO: remove after backend no longer requires empty strings
+# ----------------------------------------------------------------------------
+for file in ["async_client.py", "client.py"]:
+ s.replace(
+ f"google/cloud/bigtable_v2/services/bigtable/{file}",
+ "if request.app_profile_id:",
+ "if True: # always attach app_profile_id, even if empty string"
+ )
+# fix tests
+s.replace(
+ "tests/unit/gapic/bigtable_v2/test_bigtable.py",
+ 'assert \(\n\s*gapic_v1\.routing_header\.to_grpc_metadata\(expected_headers\) in kw\["metadata"\]\n.*',
+ """# assert the expected headers are present, in any order
+ routing_string = next(
+ iter([m[1] for m in kw["metadata"] if m[0] == "x-goog-request-params"])
+ )
+ assert all([f"{k}={v}" in routing_string for k, v in expected_headers.items()])"""
+)
+s.replace(
+ "tests/unit/gapic/bigtable_v2/test_bigtable.py",
+ 'expected_headers = {"name": "projects/sample1/instances/sample2"}',
+ """expected_headers = {
+ "name": "projects/sample1/instances/sample2",
+ "app_profile_id": "",
+ }"""
+)
+s.replace(
+ "tests/unit/gapic/bigtable_v2/test_bigtable.py",
+ """
+ expected_headers = {
+ "table_name": "projects/sample1/instances/sample2/tables/sample3"
+ }
+""",
+ """
+ expected_headers = {
+ "table_name": "projects/sample1/instances/sample2/tables/sample3",
+ "app_profile_id": "",
+ }
+"""
+)
+
+# ----------------------------------------------------------------------------
+# Samples templates
+# ----------------------------------------------------------------------------
+
+python.py_samples(skip_readmes=True)
+
+# --------------------------------------------------------------------------
+# Admin Overlay work
+# --------------------------------------------------------------------------
+
+# Add overlay imports to top level __init__.py files in admin_v2 and admin at the end
+# of each file, after the __all__ definition. These changes should only be done on fresh
+# copies of the __init__.py files.
+def add_overlay_to_init_py(init_py_location, import_statements, should_add):
+ if should_add:
+ s.replace(
+ init_py_location,
+ r"(?s)(^__all__ = \(.*\)$)",
+ r"\1\n\n" + import_statements
+ )
+
+add_overlay_to_init_py(
+ "google/cloud/bigtable_admin_v2/__init__.py",
+ """from .overlay import * # noqa: F403\n
+__all__ += overlay.__all__ # noqa: F405""",
+ is_fresh_admin_v2_copy,
+)
+
+add_overlay_to_init_py(
+ "google/cloud/bigtable_admin/__init__.py",
+ """import google.cloud.bigtable_admin_v2.overlay # noqa: F401
+from google.cloud.bigtable_admin_v2.overlay import * # noqa: F401, F403
+
+__all__ += google.cloud.bigtable_admin_v2.overlay.__all__""",
+ is_fresh_admin_copy,
+)
+
+# Replace all instances of BaseBigtableTableAdminClient/BaseBigtableAdminAsyncClient
+# in samples and docstrings with BigtableTableAdminClient/BigtableTableAdminAsyncClient
+s.replace(
+ [
+ "google/cloud/bigtable_admin_v2/services/*/client.py",
+ "google/cloud/bigtable_admin_v2/services/*/async_client.py",
+ "samples/generated_samples/bigtableadmin_v2_*.py"
+ ],
+ r"client = bigtable_admin_v2\.Base(BigtableTableAdmin(Async)?Client\(\))",
+ r"client = bigtable_admin_v2.\1"
+)
+
+# Fix an improperly formatted table that breaks nox -s docs.
+s.replace(
+ "google/cloud/bigtable_admin_v2/types/table.py",
+ """ For example, if \\\\_key =
+ "some_id#2024-04-30#\\\\x00\\\\x13\\\\x00\\\\xf3" with the following
+ schema: \\{ fields \\{ field_name: "id" type \\{ string \\{
+ encoding: utf8_bytes \\{\\} \\} \\} \\} fields \\{ field_name: "date"
+ type \\{ string \\{ encoding: utf8_bytes \\{\\} \\} \\} \\} fields \\{
+ field_name: "product_code" type \\{ int64 \\{ encoding:
+ big_endian_bytes \\{\\} \\} \\} \\} encoding \\{ delimited_bytes \\{
+ delimiter: "#" \\} \\} \\}
+
+ \\| The decoded key parts would be: id = "some_id", date =
+ "2024-04-30", product_code = 1245427 The query "SELECT
+ \\\\_key, product_code FROM table" will return two columns:
+ /------------------------------------------------------
+ \\| \\\\\\| \\\\_key \\\\\\| product_code \\\\\\| \\\\\\|
+ --------------------------------------\\|--------------\\\\\\| \\\\\\|
+ "some_id#2024-04-30#\\\\x00\\\\x13\\\\x00\\\\xf3" \\\\\\| 1245427 \\\\\\|
+ ------------------------------------------------------/
+""",
+ textwrap.indent(
+ """For example, if \\\\_key =
+"some_id#2024-04-30#\\\\x00\\\\x13\\\\x00\\\\xf3" with the following
+schema:
+
+.. code-block::
+
+ {
+ fields {
+ field_name: "id"
+ type { string { encoding: utf8_bytes {} } }
+ }
+ fields {
+ field_name: "date"
+ type { string { encoding: utf8_bytes {} } }
+ }
+ fields {
+ field_name: "product_code"
+ type { int64 { encoding: big_endian_bytes {} } }
+ }
+ encoding { delimited_bytes { delimiter: "#" } }
+ }
+
+The decoded key parts would be:
+id = "some_id", date = "2024-04-30", product_code = 1245427
+The query "SELECT \\\\_key, product_code FROM table" will return
+two columns:
+
++========================================+==============+
+| \\\\_key | product_code |
++========================================+==============+
+| "some_id#2024-04-30#\\\\x00\\\\x13\\\\x00\\\\xf3" | 1245427 |
++----------------------------------------+--------------+
+""",
+ " " * 12,
+ ),
+)
+
+# These changes should only be done on fresh copies of the .rst files
+# from googleapis-gen.
+if is_fresh_admin_docs_copy:
+ # Change the subpackage for clients with overridden internal methods in them
+ # from service to overlay.service.
+ s.replace(
+ "docs/admin_client/bigtable_table_admin.rst",
+ r"^\.\. automodule:: google\.cloud\.bigtable_admin_v2\.services\.bigtable_table_admin$",
+ ".. automodule:: google.cloud.bigtable_admin_v2.overlay.services.bigtable_table_admin"
+ )
+
+ # Add overlay types to types documentation
+ s.replace(
+ "docs/admin_client/types_.rst",
+ r"""(\.\. automodule:: google\.cloud\.bigtable_admin_v2\.types
+ :members:
+ :show-inheritance:)
+""",
+ r"""\1
+
+.. automodule:: google.cloud.bigtable_admin_v2.overlay.types
+ :members:
+ :show-inheritance:
+"""
+ )
+
+# These changes should only be done on a fresh copy of table.py
+# from googleapis-gen.
+if is_fresh_admin_v2_copy:
+ # Add the oneof_message import into table.py for GcRule
+ s.replace(
+ "google/cloud/bigtable_admin_v2/types/table.py",
+ r"^(from google\.cloud\.bigtable_admin_v2\.types import .+)$",
+ r"""\1
+from google.cloud.bigtable_admin_v2.utils import oneof_message""",
+ )
+
+ # Re-subclass GcRule in table.py
+ s.replace(
+ "google/cloud/bigtable_admin_v2/types/table.py",
+ r"class GcRule\(proto\.Message\)\:",
+ "class GcRule(oneof_message.OneofMessage):",
+ )
diff --git a/.librarian/generator-input/noxfile.py b/.librarian/generator-input/noxfile.py
new file mode 100644
index 000000000..d1176966e
--- /dev/null
+++ b/.librarian/generator-input/noxfile.py
@@ -0,0 +1,569 @@
+# -*- coding: utf-8 -*-
+#
+# Copyright 2024 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Generated by synthtool. DO NOT EDIT!
+
+from __future__ import absolute_import
+
+import os
+import pathlib
+import re
+import shutil
+from typing import Dict, List
+import warnings
+
+import nox
+
+FLAKE8_VERSION = "flake8==6.1.0"
+BLACK_VERSION = "black[jupyter]==23.3.0"
+ISORT_VERSION = "isort==5.11.0"
+LINT_PATHS = ["google", "tests", "noxfile.py", "setup.py"]
+
+DEFAULT_PYTHON_VERSION = "3.13"
+
+UNIT_TEST_PYTHON_VERSIONS: List[str] = [
+ "3.7",
+ "3.8",
+ "3.9",
+ "3.10",
+ "3.11",
+ "3.12",
+ "3.13",
+ "3.14",
+]
+UNIT_TEST_STANDARD_DEPENDENCIES = [
+ "mock",
+ "asyncmock",
+ "pytest",
+ "pytest-cov",
+ "pytest-asyncio",
+ BLACK_VERSION,
+ "autoflake",
+]
+UNIT_TEST_EXTERNAL_DEPENDENCIES: List[str] = []
+UNIT_TEST_LOCAL_DEPENDENCIES: List[str] = []
+UNIT_TEST_DEPENDENCIES: List[str] = []
+UNIT_TEST_EXTRAS: List[str] = []
+UNIT_TEST_EXTRAS_BY_PYTHON: Dict[str, List[str]] = {}
+
+SYSTEM_TEST_PYTHON_VERSIONS: List[str] = ["3.10", "3.14"]
+SYSTEM_TEST_STANDARD_DEPENDENCIES: List[str] = [
+ "mock",
+ "pytest",
+ "google-cloud-testutils",
+]
+SYSTEM_TEST_EXTERNAL_DEPENDENCIES: List[str] = [
+ "pytest-asyncio==0.21.2",
+ BLACK_VERSION,
+ "pyyaml==6.0.2",
+]
+SYSTEM_TEST_LOCAL_DEPENDENCIES: List[str] = []
+SYSTEM_TEST_DEPENDENCIES: List[str] = []
+SYSTEM_TEST_EXTRAS: List[str] = []
+SYSTEM_TEST_EXTRAS_BY_PYTHON: Dict[str, List[str]] = {}
+
+CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()
+
+# 'docfx' is excluded since it only needs to run in 'docs-presubmit'
+nox.options.sessions = [
+ "unit-3.10",
+ "unit-3.11",
+ "unit-3.12",
+ "unit-3.13",
+ "unit-3.14",
+ "system_emulated",
+ "system",
+ "mypy",
+ "cover",
+ "lint",
+ "lint_setup_py",
+ "blacken",
+ "docs",
+ "format",
+]
+
+# Error if a python version is missing
+nox.options.error_on_missing_interpreters = True
+
+
+@nox.session(python=DEFAULT_PYTHON_VERSION)
+def lint(session):
+ """Run linters.
+
+ Returns a failure if the linters find linting errors or sufficiently
+ serious code quality issues.
+ """
+ session.install(FLAKE8_VERSION, BLACK_VERSION)
+ session.run(
+ "black",
+ "--check",
+ *LINT_PATHS,
+ )
+ session.run("flake8", "google", "tests")
+
+
+@nox.session(python=DEFAULT_PYTHON_VERSION)
+def blacken(session):
+ """Run black. Format code to uniform standard."""
+ session.install(BLACK_VERSION)
+ session.run(
+ "black",
+ *LINT_PATHS,
+ )
+
+
+@nox.session(python=DEFAULT_PYTHON_VERSION)
+def format(session):
+ """
+ Run isort to sort imports. Then run black
+ to format code to uniform standard.
+ """
+ session.install(BLACK_VERSION, ISORT_VERSION)
+ # 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",
+ *LINT_PATHS,
+ )
+ session.run(
+ "black",
+ *LINT_PATHS,
+ )
+
+
+@nox.session(python=DEFAULT_PYTHON_VERSION)
+def mypy(session):
+ """Verify type hints are mypy compatible."""
+ session.install("-e", ".")
+ session.install(
+ "mypy", "types-setuptools", "types-protobuf", "types-mock", "types-requests"
+ )
+ session.install("google-cloud-testutils")
+ session.run("mypy", "-p", "google.cloud.bigtable.data")
+
+
+@nox.session(python=DEFAULT_PYTHON_VERSION)
+def lint_setup_py(session):
+ """Verify that setup.py is valid (including RST check)."""
+ session.install("setuptools", "docutils", "pygments")
+ session.run("python", "setup.py", "check", "--restructuredtext", "--strict")
+
+
+def install_unittest_dependencies(session, *constraints):
+ standard_deps = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_DEPENDENCIES
+ session.install(*standard_deps, *constraints)
+
+ if UNIT_TEST_EXTERNAL_DEPENDENCIES:
+ warnings.warn(
+ "'unit_test_external_dependencies' is deprecated. Instead, please "
+ "use 'unit_test_dependencies' or 'unit_test_local_dependencies'.",
+ DeprecationWarning,
+ )
+ session.install(*UNIT_TEST_EXTERNAL_DEPENDENCIES, *constraints)
+
+ if UNIT_TEST_LOCAL_DEPENDENCIES:
+ session.install(*UNIT_TEST_LOCAL_DEPENDENCIES, *constraints)
+
+ if UNIT_TEST_EXTRAS_BY_PYTHON:
+ extras = UNIT_TEST_EXTRAS_BY_PYTHON.get(session.python, [])
+ elif UNIT_TEST_EXTRAS:
+ extras = UNIT_TEST_EXTRAS
+ else:
+ extras = []
+
+ if extras:
+ session.install("-e", f".[{','.join(extras)}]", *constraints)
+ else:
+ session.install("-e", ".", *constraints)
+
+
+@nox.session(python=UNIT_TEST_PYTHON_VERSIONS)
+@nox.parametrize(
+ "protobuf_implementation",
+ ["python", "upb", "cpp"],
+)
+def unit(session, protobuf_implementation):
+ # Install all test dependencies, then install this package in-place.
+ py_version = tuple([int(v) for v in session.python.split(".")])
+ if protobuf_implementation == "cpp" and py_version >= (3, 11):
+ session.skip("cpp implementation is not supported in python 3.11+")
+
+ constraints_path = str(
+ CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"
+ )
+ install_unittest_dependencies(session, "-c", constraints_path)
+
+ # TODO(https://github.com/googleapis/synthtool/issues/1976):
+ # Remove the 'cpp' implementation once support for Protobuf 3.x is dropped.
+ # The 'cpp' implementation requires Protobuf<4.
+ if protobuf_implementation == "cpp":
+ session.install("protobuf<4")
+
+ # Run py.test against the unit tests.
+ session.run(
+ "py.test",
+ "--quiet",
+ f"--junitxml=unit_{session.python}_sponge_log.xml",
+ "--cov=google",
+ "--cov=tests/unit",
+ "--cov-append",
+ "--cov-config=.coveragerc",
+ "--cov-report=",
+ "--cov-fail-under=0",
+ os.path.join("tests", "unit"),
+ *session.posargs,
+ env={
+ "PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation,
+ },
+ )
+
+
+def install_systemtest_dependencies(session, *constraints):
+ # Use pre-release gRPC for system tests.
+ # Exclude version 1.52.0rc1 which has a known issue.
+ # See https://github.com/grpc/grpc/issues/32163
+ session.install("--pre", "grpcio!=1.52.0rc1")
+
+ session.install(*SYSTEM_TEST_STANDARD_DEPENDENCIES, *constraints)
+
+ if SYSTEM_TEST_EXTERNAL_DEPENDENCIES:
+ session.install(*SYSTEM_TEST_EXTERNAL_DEPENDENCIES, *constraints)
+
+ if SYSTEM_TEST_LOCAL_DEPENDENCIES:
+ session.install("-e", *SYSTEM_TEST_LOCAL_DEPENDENCIES, *constraints)
+
+ if SYSTEM_TEST_DEPENDENCIES:
+ session.install("-e", *SYSTEM_TEST_DEPENDENCIES, *constraints)
+
+ if SYSTEM_TEST_EXTRAS_BY_PYTHON:
+ extras = SYSTEM_TEST_EXTRAS_BY_PYTHON.get(session.python, [])
+ elif SYSTEM_TEST_EXTRAS:
+ extras = SYSTEM_TEST_EXTRAS
+ else:
+ extras = []
+
+ if extras:
+ session.install("-e", f".[{','.join(extras)}]", *constraints)
+ else:
+ session.install("-e", ".", *constraints)
+
+
+@nox.session(python=DEFAULT_PYTHON_VERSION)
+def system_emulated(session):
+ import subprocess
+ import signal
+
+ try:
+ subprocess.call(["gcloud", "--version"])
+ except OSError:
+ session.skip("gcloud not found but required for emulator support")
+
+ # Currently, CI/CD doesn't have beta component of gcloud.
+ subprocess.call(["gcloud", "components", "install", "beta", "bigtable"])
+
+ hostport = "localhost:8789"
+ session.env["BIGTABLE_EMULATOR_HOST"] = hostport
+
+ p = subprocess.Popen(
+ ["gcloud", "beta", "emulators", "bigtable", "start", "--host-port", hostport]
+ )
+
+ try:
+ system(session)
+ finally:
+ # Stop Emulator
+ os.killpg(os.getpgid(p.pid), signal.SIGKILL)
+
+
+@nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS)
+@nox.parametrize("client_type", ["async", "sync", "legacy"])
+def conformance(session, client_type):
+ # install dependencies
+ constraints_path = str(
+ CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"
+ )
+ install_unittest_dependencies(session, "-c", constraints_path)
+ with session.chdir("test_proxy"):
+ # download the conformance test suite
+ session.run(
+ "bash",
+ "-e",
+ "run_tests.sh",
+ external=True,
+ env={"CLIENT_TYPE": client_type},
+ )
+
+
+@nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS)
+def system(session):
+ """Run the system test suite."""
+ constraints_path = str(
+ CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt"
+ )
+ system_test_path = os.path.join("tests", "system.py")
+ system_test_folder_path = os.path.join("tests", "system")
+
+ # Check the value of `RUN_SYSTEM_TESTS` env var. It defaults to true.
+ if os.environ.get("RUN_SYSTEM_TESTS", "true") == "false":
+ session.skip("RUN_SYSTEM_TESTS is set to false, skipping")
+ # Install pyopenssl for mTLS testing.
+ if os.environ.get("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true":
+ session.install("pyopenssl")
+
+ system_test_exists = os.path.exists(system_test_path)
+ system_test_folder_exists = os.path.exists(system_test_folder_path)
+ # Sanity check: only run tests if found.
+ if not system_test_exists and not system_test_folder_exists:
+ session.skip("System tests were not found")
+
+ install_systemtest_dependencies(session, "-c", constraints_path)
+
+ # Run py.test against the system tests.
+ if system_test_exists:
+ session.run(
+ "py.test",
+ "--quiet",
+ f"--junitxml=system_{session.python}_sponge_log.xml",
+ system_test_path,
+ *session.posargs,
+ )
+ if system_test_folder_exists:
+ session.run(
+ "py.test",
+ "--quiet",
+ f"--junitxml=system_{session.python}_sponge_log.xml",
+ system_test_folder_path,
+ *session.posargs,
+ )
+
+
+@nox.session(python=DEFAULT_PYTHON_VERSION)
+def cover(session):
+ """Run the final coverage report.
+
+ This outputs the coverage report aggregating coverage from the unit
+ test runs (not system test runs), and then erases coverage data.
+ """
+ session.install("coverage", "pytest-cov")
+ session.run("coverage", "report", "--show-missing", "--fail-under=99")
+
+ session.run("coverage", "erase")
+
+
+@nox.session(python="3.10")
+def docs(session):
+ """Build the docs for this library."""
+
+ session.install("-e", ".")
+ session.install(
+ # We need to pin to specific versions of the `sphinxcontrib-*` packages
+ # which still support sphinx 4.x.
+ # See https://github.com/googleapis/sphinx-docfx-yaml/issues/344
+ # and https://github.com/googleapis/sphinx-docfx-yaml/issues/345.
+ "sphinxcontrib-applehelp==1.0.4",
+ "sphinxcontrib-devhelp==1.0.2",
+ "sphinxcontrib-htmlhelp==2.0.1",
+ "sphinxcontrib-qthelp==1.0.3",
+ "sphinxcontrib-serializinghtml==1.1.5",
+ "sphinx==4.5.0",
+ "alabaster",
+ "recommonmark",
+ )
+
+ shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True)
+ session.run(
+ "sphinx-build",
+ "-W", # warnings as errors
+ "-T", # show full traceback on exception
+ "-N", # no colors
+ "-b",
+ "html",
+ "-d",
+ os.path.join("docs", "_build", "doctrees", ""),
+ os.path.join("docs", ""),
+ os.path.join("docs", "_build", "html", ""),
+ )
+
+
+@nox.session(python="3.10")
+def docfx(session):
+ """Build the docfx yaml files for this library."""
+
+ session.install("-e", ".")
+ session.install(
+ # We need to pin to specific versions of the `sphinxcontrib-*` packages
+ # which still support sphinx 4.x.
+ # See https://github.com/googleapis/sphinx-docfx-yaml/issues/344
+ # and https://github.com/googleapis/sphinx-docfx-yaml/issues/345.
+ "sphinxcontrib-applehelp==1.0.4",
+ "sphinxcontrib-devhelp==1.0.2",
+ "sphinxcontrib-htmlhelp==2.0.1",
+ "sphinxcontrib-qthelp==1.0.3",
+ "sphinxcontrib-serializinghtml==1.1.5",
+ "gcp-sphinx-docfx-yaml",
+ "alabaster",
+ "recommonmark",
+ )
+
+ shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True)
+ session.run(
+ "sphinx-build",
+ "-T", # show full traceback on exception
+ "-N", # no colors
+ "-D",
+ (
+ "extensions=sphinx.ext.autodoc,"
+ "sphinx.ext.autosummary,"
+ "docfx_yaml.extension,"
+ "sphinx.ext.intersphinx,"
+ "sphinx.ext.coverage,"
+ "sphinx.ext.napoleon,"
+ "sphinx.ext.todo,"
+ "sphinx.ext.viewcode,"
+ "recommonmark"
+ ),
+ "-b",
+ "html",
+ "-d",
+ os.path.join("docs", "_build", "doctrees", ""),
+ os.path.join("docs", ""),
+ os.path.join("docs", "_build", "html", ""),
+ )
+ # Customization: Add extra sections to the table of contents for the Classic vs Async clients
+ session.install("pyyaml")
+ session.run("python", "docs/scripts/patch_devsite_toc.py")
+
+
+@nox.session(python="3.14")
+@nox.parametrize(
+ "protobuf_implementation",
+ ["python", "upb", "cpp"],
+)
+def prerelease_deps(session, protobuf_implementation):
+ """Run all tests with prerelease versions of dependencies installed."""
+
+ py_version = tuple([int(v) for v in session.python.split(".")])
+ if protobuf_implementation == "cpp" and py_version >= (3, 11):
+ session.skip("cpp implementation is not supported in python 3.11+")
+
+ # Install all dependencies
+ session.install("-e", ".[all, tests, tracing]")
+ unit_deps_all = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_EXTERNAL_DEPENDENCIES
+ session.install(*unit_deps_all)
+ system_deps_all = (
+ SYSTEM_TEST_STANDARD_DEPENDENCIES + SYSTEM_TEST_EXTERNAL_DEPENDENCIES
+ )
+ session.install(*system_deps_all)
+
+ # Because we test minimum dependency versions on the minimum Python
+ # version, the first version we test with in the unit tests sessions has a
+ # constraints file containing all dependencies and extras.
+ with open(
+ CURRENT_DIRECTORY
+ / "testing"
+ / f"constraints-{UNIT_TEST_PYTHON_VERSIONS[0]}.txt",
+ encoding="utf-8",
+ ) as constraints_file:
+ constraints_text = constraints_file.read()
+
+ # Ignore leading whitespace and comment lines.
+ constraints_deps = [
+ match.group(1)
+ for match in re.finditer(
+ r"^\s*(\S+)(?===\S+)", constraints_text, flags=re.MULTILINE
+ )
+ ]
+
+ session.install(*constraints_deps)
+
+ prerel_deps = [
+ "protobuf",
+ # dependency of grpc
+ "six",
+ "grpc-google-iam-v1",
+ "googleapis-common-protos",
+ "grpcio",
+ "grpcio-status",
+ "google-api-core",
+ "google-auth",
+ "proto-plus",
+ "google-cloud-testutils",
+ # dependencies of google-cloud-testutils"
+ "click",
+ ]
+
+ for dep in prerel_deps:
+ session.install("--pre", "--no-deps", "--upgrade", dep)
+
+ # Remaining dependencies
+ other_deps = [
+ "requests",
+ "cryptography",
+ ]
+ session.install(*other_deps)
+
+ # Print out prerelease package versions
+ session.run(
+ "python", "-c", "import google.protobuf; print(google.protobuf.__version__)"
+ )
+ session.run("python", "-c", "import grpc; print(grpc.__version__)")
+ session.run("python", "-c", "import google.auth; print(google.auth.__version__)")
+
+ session.run(
+ "py.test",
+ "tests/unit",
+ env={
+ "PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation,
+ },
+ )
+
+ system_test_path = os.path.join("tests", "system.py")
+ system_test_folder_path = os.path.join("tests", "system")
+
+ # Only run system tests if found.
+ if os.path.exists(system_test_path):
+ session.run(
+ "py.test",
+ "--verbose",
+ f"--junitxml=system_{session.python}_sponge_log.xml",
+ system_test_path,
+ *session.posargs,
+ env={
+ "PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation,
+ },
+ )
+ if os.path.exists(system_test_folder_path):
+ session.run(
+ "py.test",
+ "--verbose",
+ f"--junitxml=system_{session.python}_sponge_log.xml",
+ system_test_folder_path,
+ *session.posargs,
+ env={
+ "PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation,
+ },
+ )
+
+
+@nox.session(python="3.10")
+def generate_sync(session):
+ """
+ Re-generate sync files for the library from CrossSync-annotated async source
+ """
+ session.install(BLACK_VERSION)
+ session.install("autoflake")
+ session.run("python", ".cross_sync/generate.py", ".")
diff --git a/.librarian/generator-input/setup.py b/.librarian/generator-input/setup.py
new file mode 100644
index 000000000..fd8062970
--- /dev/null
+++ b/.librarian/generator-input/setup.py
@@ -0,0 +1,100 @@
+# Copyright 2018 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.
+
+import io
+import os
+
+import setuptools
+
+
+package_root = os.path.abspath(os.path.dirname(__file__))
+
+# Package metadata.
+
+name = "google-cloud-bigtable"
+description = "Google Cloud Bigtable API client library"
+
+version = {}
+with open(os.path.join(package_root, "google/cloud/bigtable/gapic_version.py")) as fp:
+ exec(fp.read(), version)
+version = version["__version__"]
+
+
+# Should be one of:
+# 'Development Status :: 3 - Alpha'
+# 'Development Status :: 4 - Beta'
+# 'Development Status :: 5 - Production/Stable'
+release_status = "Development Status :: 5 - Production/Stable"
+dependencies = [
+ "google-api-core[grpc] >= 2.17.0, <3.0.0",
+ "google-cloud-core >= 1.4.4, <3.0.0",
+ "google-auth >= 2.23.0, <3.0.0,!=2.24.0,!=2.25.0",
+ "grpc-google-iam-v1 >= 0.12.4, <1.0.0",
+ "proto-plus >= 1.22.3, <2.0.0",
+ "proto-plus >= 1.25.0, <2.0.0; python_version>='3.13'",
+ "protobuf>=3.20.2,<7.0.0,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5",
+ "google-crc32c>=1.5.0, <2.0.0dev",
+]
+extras = {"libcst": "libcst >= 0.2.5"}
+
+
+# Setup boilerplate below this line.
+
+package_root = os.path.abspath(os.path.dirname(__file__))
+
+readme_filename = os.path.join(package_root, "README.rst")
+with io.open(readme_filename, encoding="utf-8") as readme_file:
+ readme = readme_file.read()
+
+# Only include packages under the 'google' namespace. Do not include tests,
+# benchmarks, etc.
+packages = [
+ package
+ for package in setuptools.find_namespace_packages()
+ if package.startswith("google")
+]
+
+setuptools.setup(
+ name=name,
+ version=version,
+ description=description,
+ long_description=readme,
+ author="Google LLC",
+ author_email="googleapis-packages@google.com",
+ license="Apache 2.0",
+ url="https://github.com/googleapis/python-bigtable",
+ classifiers=[
+ release_status,
+ "Intended Audience :: Developers",
+ "License :: OSI Approved :: Apache Software License",
+ "Programming Language :: Python",
+ "Programming Language :: Python :: 3.7",
+ "Programming Language :: Python :: 3.8",
+ "Programming Language :: Python :: 3.9",
+ "Programming Language :: Python :: 3.10",
+ "Programming Language :: Python :: 3.11",
+ "Programming Language :: Python :: 3.12",
+ "Programming Language :: Python :: 3.13",
+ "Programming Language :: Python :: 3.14",
+ "Operating System :: OS Independent",
+ "Topic :: Internet",
+ ],
+ platforms="Posix; MacOS X; Windows",
+ packages=packages,
+ install_requires=dependencies,
+ extras_require=extras,
+ python_requires=">=3.7",
+ include_package_data=True,
+ zip_safe=False,
+)
diff --git a/.librarian/state.yaml b/.librarian/state.yaml
new file mode 100644
index 000000000..71d0e465d
--- /dev/null
+++ b/.librarian/state.yaml
@@ -0,0 +1,40 @@
+image: us-central1-docker.pkg.dev/cloud-sdk-librarian-prod/images-prod/python-librarian-generator@sha256:b8058df4c45e9a6e07f6b4d65b458d0d059241dd34c814f151c8bf6b89211209
+libraries:
+ - id: google-cloud-bigtable
+ version: 2.35.0
+ last_generated_commit: 9637e50bc0ff6a5e8944980aaf6a2b7f34a90910
+ apis:
+ - path: google/bigtable/v2
+ service_config: bigtable_v2.yaml
+ - path: google/bigtable/admin/v2
+ service_config: bigtableadmin_v2.yaml
+ source_roots:
+ - .
+ preserve_regex: []
+ remove_regex:
+ - ^.pre-commit-config.yaml
+ - ^.repo-metadata.json
+ - ^.trampolinerc
+ - ^docs/admin_client/bigtable
+ - ^docs/admin_client/services_.rst
+ - ^docs/admin_client/types_.rst
+ - ^docs/summary_overview.md
+ - ^google/cloud/bigtable_v2
+ - ^google/cloud/bigtable_admin/
+ - ^google/cloud/bigtable_admin_v2/services
+ - ^google/cloud/bigtable_admin_v2/types
+ - ^google/cloud/bigtable_admin_v2/__init__.py
+ - ^google/cloud/bigtable_admin_v2/gapic
+ - ^google/cloud/bigtable_admin_v2/py.typed
+ - ^samples/AUTHORING_GUIDE.md
+ - ^samples/CONTRIBUTING.md
+ - ^samples/generated_samples
+ - ^tests/unit/gapic
+ - ^noxfile.py
+ - ^scripts/fixup_bigtable
+ - ^setup.py
+ - ^SECURITY.md
+ - ^tests/__init__.py
+ - ^tests/unit/__init__.py
+ - ^tests/unit/gapic
+ tag_format: v{version}
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 000000000..1d74695f7
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,31 @@
+# Copyright 2024 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# See https://pre-commit.com for more information
+# See https://pre-commit.com/hooks.html for more hooks
+repos:
+- repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v4.0.1
+ hooks:
+ - id: trailing-whitespace
+ - id: end-of-file-fixer
+ - id: check-yaml
+- repo: https://github.com/psf/black
+ rev: 23.7.0
+ hooks:
+ - id: black
+- repo: https://github.com/pycqa/flake8
+ rev: 6.1.0
+ hooks:
+ - id: flake8
diff --git a/.repo-metadata.json b/.repo-metadata.json
index cfda5a11e..9de4b5f92 100644
--- a/.repo-metadata.json
+++ b/.repo-metadata.json
@@ -1,13 +1,80 @@
{
- "name": "bigtable",
- "name_pretty": "Cloud Bigtable",
- "product_documentation": "https://cloud.google.com/bigtable",
- "client_documentation": "https://googleapis.dev/python/bigtable/latest",
- "issue_tracker": "https://issuetracker.google.com/savedsearches/559777",
- "release_level": "ga",
- "language": "python",
- "repo": "googleapis/python-bigtable",
- "distribution_name": "google-cloud-bigtable",
- "api_id": "bigtable.googleapis.com",
- "requires_billing": true
-}
\ No newline at end of file
+ "name": "bigtable",
+ "name_pretty": "Cloud Bigtable",
+ "product_documentation": "https://cloud.google.com/bigtable",
+ "client_documentation": "https://cloud.google.com/python/docs/reference/bigtable/latest",
+ "issue_tracker": "https://issuetracker.google.com/savedsearches/559777",
+ "release_level": "stable",
+ "language": "python",
+ "library_type": "GAPIC_COMBO",
+ "repo": "googleapis/python-bigtable",
+ "distribution_name": "google-cloud-bigtable",
+ "api_id": "bigtable.googleapis.com",
+ "requires_billing": true,
+ "samples": [
+ {
+ "name": "Hello World in Cloud Bigtable",
+ "description": "Demonstrates how to connect to Cloud Bigtable and run some basic operations. More information available at: https://cloud.google.com/bigtable/docs/samples-python-hello",
+ "file": "main.py",
+ "runnable": true,
+ "custom_content": "usage: main.py [-h] [--table TABLE] project_id instance_id
Demonstrates how to connect to Cloud Bigtable and run some basic operations.
Prerequisites: - Create a Cloud Bigtable cluster.
https://cloud.google.com/bigtable/docs/creating-cluster - Set your Google
Application Default Credentials.
https://developers.google.com/identity/protocols/application-default-
credentials
positional arguments:
project_id Your Cloud Platform project ID.
instance_id ID of the Cloud Bigtable instance to connect to.
optional arguments:
-h, --help show this help message and exit
--table TABLE Table to create and destroy. (default: Hello-Bigtable)
",
+ "override_path": "hello"
+ },
+ {
+ "name": "Hello World using HappyBase",
+ "description": "This sample demonstrates using the Google Cloud Client Library HappyBase package, an implementation of the HappyBase API to connect to and interact with Cloud Bigtable. More information available at: https://cloud.google.com/bigtable/docs/samples-python-hello-happybase",
+ "file": "main.py",
+ "runnable": true,
+ "custom_content": "usage: main.py [-h] [--table TABLE] project_id instance_id
Demonstrates how to connect to Cloud Bigtable and run some basic operations.
Prerequisites: - Create a Cloud Bigtable cluster.
https://cloud.google.com/bigtable/docs/creating-cluster - Set your Google
Application Default Credentials.
https://developers.google.com/identity/protocols/application-default-
credentials
positional arguments:
project_id Your Cloud Platform project ID.
instance_id ID of the Cloud Bigtable instance to connect to.
optional arguments:
-h, --help show this help message and exit
--table TABLE Table to create and destroy. (default: Hello-Bigtable)
",
+ "override_path": "hello_happybase"
+ },
+ {
+ "name": "cbt Command Demonstration",
+ "description": "This page explains how to use the cbt command to connect to a Cloud Bigtable instance, perform basic administrative tasks, and read and write data in a table. More information about this quickstart is available at https://cloud.google.com/bigtable/docs/quickstart-cbt",
+ "file": "instanceadmin.py",
+ "runnable": true,
+ "custom_content": "usage: instanceadmin.py [-h] [run] [dev-instance] [del-instance] [add-cluster] [del-cluster] project_id instance_id cluster_id
Demonstrates how to connect to Cloud Bigtable and run some basic operations.
Prerequisites: - Create a Cloud Bigtable cluster.
https://cloud.google.com/bigtable/docs/creating-cluster - Set your Google
Application Default Credentials.
https://developers.google.com/identity/protocols/application-default-
credentials
positional arguments:
project_id Your Cloud Platform project ID.
instance_id ID of the Cloud Bigtable instance to connect to.
optional arguments:
-h, --help show this help message and exit
--table TABLE Table to create and destroy. (default: Hello-Bigtable)
",
+ "override_path": "instanceadmin"
+ },
+ {
+ "name": "Metric Scaler",
+ "description": "This sample demonstrates how to use Stackdriver Monitoring to scale Cloud Bigtable based on CPU usage.",
+ "file": "metricscaler.py",
+ "runnable": true,
+ "custom_content": "usage: metricscaler.py [-h] [--high_cpu_threshold HIGH_CPU_THRESHOLD] [--low_cpu_threshold LOW_CPU_THRESHOLD] [--short_sleep SHORT_SLEEP] [--long_sleep LONG_SLEEP] bigtable_instance bigtable_cluster
usage: metricscaler.py [-h] [--high_cpu_threshold HIGH_CPU_THRESHOLD]
[--low_cpu_threshold LOW_CPU_THRESHOLD]
[--short_sleep SHORT_SLEEP] [--long_sleep LONG_SLEEP]
bigtable_instance bigtable_cluster
Scales Cloud Bigtable clusters based on CPU usage.
positional arguments:
bigtable_instance ID of the Cloud Bigtable instance to connect to.
bigtable_cluster ID of the Cloud Bigtable cluster to connect to.
optional arguments:
-h, --help show this help message and exit
--high_cpu_threshold HIGH_CPU_THRESHOLD
If Cloud Bigtable CPU usage is above this threshold,
scale up
--low_cpu_threshold LOW_CPU_THRESHOLD
If Cloud Bigtable CPU usage is below this threshold,
scale down
--short_sleep SHORT_SLEEP
How long to sleep in seconds between checking metrics
after no scale operation
--long_sleep LONG_SLEEP
How long to sleep in seconds between checking metrics
after a scaling operation
",
+ "override_path": "metricscaler"
+ },
+ {
+ "name": "Quickstart",
+ "description": "Demonstrates of Cloud Bigtable. This sample creates a Bigtable client, connects to an instance and then to a table, then closes the connection.",
+ "file": "main.py",
+ "runnable": true,
+ "custom_content": "usage: main.py [-h] [--table TABLE] project_id instance_id
positional arguments:
project_id Your Cloud Platform project ID.
instance_id ID of the Cloud Bigtable instance to connect to.
optional arguments:
-h, --help show this help message and exit
--table TABLE Existing table used in the quickstart. (default: my-table)
",
+ "override_path": "quickstart"
+ },
+ {
+ "name": "Quickstart using HappyBase",
+ "description": "Demonstrates of Cloud Bigtable using HappyBase. This sample creates a Bigtable client, connects to an instance and then to a table, then closes the connection.",
+ "file": "main.py",
+ "runnable": true,
+ "custom_content": "usage: main.py [-h] [--table TABLE] project_id instance_id
usage: main.py [-h] [--table TABLE] project_id instance_id
positional arguments:
project_id Your Cloud Platform project ID.
instance_id ID of the Cloud Bigtable instance to connect to.
optional arguments:
-h, --help show this help message and exit
--table TABLE Existing table used in the quickstart. (default: my-table)usage: tableadmin.py [-h] [run] [delete] [--table TABLE] project_id instance_id
Demonstrates how to connect to Cloud Bigtable and run some basic operations.
Prerequisites: - Create a Cloud Bigtable cluster.
https://cloud.google.com/bigtable/docs/creating-cluster - Set your Google
Application Default Credentials.
https://developers.google.com/identity/protocols/application-default-
credentials
positional arguments:
project_id Your Cloud Platform project ID.
instance_id ID of the Cloud Bigtable instance to connect to.
optional arguments:
-h, --help show this help message and exit
--table TABLE Table to create and destroy. (default: Hello-Bigtable)
",
+ "override_path": "tableadmin"
+ }
+ ],
+ "default_version": "v2",
+ "codeowner_team": "@googleapis/api-bigtable @googleapis/api-bigtable-partners",
+ "api_shortname": "bigtable"
+}
diff --git a/.trampolinerc b/.trampolinerc
new file mode 100644
index 000000000..008015237
--- /dev/null
+++ b/.trampolinerc
@@ -0,0 +1,61 @@
+# Copyright 2024 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Add required env vars here.
+required_envvars+=(
+)
+
+# Add env vars which are passed down into the container here.
+pass_down_envvars+=(
+ "NOX_SESSION"
+ ###############
+ # Docs builds
+ ###############
+ "STAGING_BUCKET"
+ "V2_STAGING_BUCKET"
+ ##################
+ # Samples builds
+ ##################
+ "INSTALL_LIBRARY_FROM_SOURCE"
+ "RUN_TESTS_SESSION"
+ "BUILD_SPECIFIC_GCLOUD_PROJECT"
+ # Target directories.
+ "RUN_TESTS_DIRS"
+ # The nox session to run.
+ "RUN_TESTS_SESSION"
+)
+
+# Prevent unintentional override on the default image.
+if [[ "${TRAMPOLINE_IMAGE_UPLOAD:-false}" == "true" ]] && \
+ [[ -z "${TRAMPOLINE_IMAGE:-}" ]]; then
+ echo "Please set TRAMPOLINE_IMAGE if you want to upload the Docker image."
+ exit 1
+fi
+
+# Define the default value if it makes sense.
+if [[ -z "${TRAMPOLINE_IMAGE_UPLOAD:-}" ]]; then
+ TRAMPOLINE_IMAGE_UPLOAD=""
+fi
+
+if [[ -z "${TRAMPOLINE_IMAGE:-}" ]]; then
+ TRAMPOLINE_IMAGE=""
+fi
+
+if [[ -z "${TRAMPOLINE_DOCKERFILE:-}" ]]; then
+ TRAMPOLINE_DOCKERFILE=""
+fi
+
+if [[ -z "${TRAMPOLINE_BUILD_FILE:-}" ]]; then
+ TRAMPOLINE_BUILD_FILE=""
+fi
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a0ee45d5b..cbb707694 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,793 @@
[1]: https://pypi.org/project/google-cloud-bigtable/#history
+## [2.35.0](https://github.com/googleapis/python-bigtable/compare/v2.34.0...v2.35.0) (2025-12-16)
+
+
+### Features
+
+* support mTLS certificates when available (#1249) ([ca20219cf45305de25dfb715f69dd63bce9981b7](https://github.com/googleapis/python-bigtable/commit/ca20219cf45305de25dfb715f69dd63bce9981b7))
+* add basic interceptor to client (#1206) ([6561cfac605ba7c5b3f750c3bdca9108e517ba77](https://github.com/googleapis/python-bigtable/commit/6561cfac605ba7c5b3f750c3bdca9108e517ba77))
+* add PeerInfo proto in Bigtable API ([72dfdc440c22db0f4c372e6f11a9f7dc83fed350](https://github.com/googleapis/python-bigtable/commit/72dfdc440c22db0f4c372e6f11a9f7dc83fed350))
+* Add Type API updates needed to support structured keys in materialized views ([72dfdc440c22db0f4c372e6f11a9f7dc83fed350](https://github.com/googleapis/python-bigtable/commit/72dfdc440c22db0f4c372e6f11a9f7dc83fed350))
+* Add encodings for STRUCT and the Timestamp type ([72dfdc440c22db0f4c372e6f11a9f7dc83fed350](https://github.com/googleapis/python-bigtable/commit/72dfdc440c22db0f4c372e6f11a9f7dc83fed350))
+
+
+### Bug Fixes
+
+* async client uses fixed grace period (#1236) ([544db1cd7af876298b8637f495b6c7b2a0bcf16c](https://github.com/googleapis/python-bigtable/commit/544db1cd7af876298b8637f495b6c7b2a0bcf16c))
+* re-export AddToCell for consistency (#1241) ([2a5baf11d30dc383a7b48d5f43b6cbb6160782e3](https://github.com/googleapis/python-bigtable/commit/2a5baf11d30dc383a7b48d5f43b6cbb6160782e3))
+* retry cancelled errors (#1235) ([e3fd5d8668303db4ed35e9bf6be48b46954f9d67](https://github.com/googleapis/python-bigtable/commit/e3fd5d8668303db4ed35e9bf6be48b46954f9d67))
+* Add ReadRows/SampleRowKeys bindings for materialized views ([72dfdc440c22db0f4c372e6f11a9f7dc83fed350](https://github.com/googleapis/python-bigtable/commit/72dfdc440c22db0f4c372e6f11a9f7dc83fed350))
+* Deprecate credentials_file argument ([72dfdc440c22db0f4c372e6f11a9f7dc83fed350](https://github.com/googleapis/python-bigtable/commit/72dfdc440c22db0f4c372e6f11a9f7dc83fed350))
+
+## [2.34.0](https://github.com/googleapis/python-bigtable/compare/v2.33.0...v2.34.0) (2025-10-16)
+
+
+### Features
+
+* Add support for Python 3.14 ([#1217](https://github.com/googleapis/python-bigtable/issues/1217)) ([263332a](https://github.com/googleapis/python-bigtable/commit/263332af71a229cb4fa598008a708137086a6f67))
+
+## [2.33.0](https://github.com/googleapis/python-bigtable/compare/v2.32.0...v2.33.0) (2025-10-06)
+
+
+### Features
+
+* Add support for Proto and Enum types ([#1202](https://github.com/googleapis/python-bigtable/issues/1202)) ([34ceb86](https://github.com/googleapis/python-bigtable/commit/34ceb86007db08d453fa25cca4968d5b498ffcd6))
+* Expose universe_domain for tpc ([#1150](https://github.com/googleapis/python-bigtable/issues/1150)) ([451fd97](https://github.com/googleapis/python-bigtable/commit/451fd97e435218ffed47d39423680ffc4feccac4))
+
+
+### Bug Fixes
+
+* Fix instance registration cleanup on early iterator termination ([#1216](https://github.com/googleapis/python-bigtable/issues/1216)) ([bbfd746](https://github.com/googleapis/python-bigtable/commit/bbfd746c61a6362efa42c7899ec3e34ceb541c83))
+* Refactor channel refresh ([#1174](https://github.com/googleapis/python-bigtable/issues/1174)) ([6fa3008](https://github.com/googleapis/python-bigtable/commit/6fa30084058bc34d4487d1fee5c87d7795ff167a))
+
+## [2.32.0](https://github.com/googleapis/python-bigtable/compare/v2.31.0...v2.32.0) (2025-08-01)
+
+
+### Features
+
+* Add Idempotency to Cloud Bigtable MutateRowsRequest API ([#1143](https://github.com/googleapis/python-bigtable/issues/1143)) ([c3e3eb0](https://github.com/googleapis/python-bigtable/commit/c3e3eb0e4ce44ece72b150dc5822846627074fba))
+* Add support for AddToCell in Data Client ([#1147](https://github.com/googleapis/python-bigtable/issues/1147)) ([1a5b4b5](https://github.com/googleapis/python-bigtable/commit/1a5b4b514cadae5c83d61296314285d3774992c5))
+* Implement SQL support in test proxy ([#1106](https://github.com/googleapis/python-bigtable/issues/1106)) ([7a91bbf](https://github.com/googleapis/python-bigtable/commit/7a91bbfb9df23f7e93c40b88648840342af6f16f))
+* Modernized Bigtable Admin Client featuring selective GAPIC generation ([#1177](https://github.com/googleapis/python-bigtable/issues/1177)) ([58e7d37](https://github.com/googleapis/python-bigtable/commit/58e7d3782df6b13a42af053263afc575222a6b83))
+
+## [2.31.0](https://github.com/googleapis/python-bigtable/compare/v2.30.1...v2.31.0) (2025-05-22)
+
+
+### Features
+
+* Add deletion_protection support for LVs ([#1108](https://github.com/googleapis/python-bigtable/issues/1108)) ([c6d384d](https://github.com/googleapis/python-bigtable/commit/c6d384d4a104c182326e22dc3f10b7b905780dee))
+* Support authorized views ([#1034](https://github.com/googleapis/python-bigtable/issues/1034)) ([97a0198](https://github.com/googleapis/python-bigtable/commit/97a019833d82e617769c56761aa5548d3ab896b9))
+* Throw better error on invalid metadata response ([#1107](https://github.com/googleapis/python-bigtable/issues/1107)) ([2642317](https://github.com/googleapis/python-bigtable/commit/2642317077b723ca8fd62aa86322b524868c2c4d))
+
+
+### Bug Fixes
+
+* Re-add py-typed file for bigtable package ([#1085](https://github.com/googleapis/python-bigtable/issues/1085)) ([0c322c7](https://github.com/googleapis/python-bigtable/commit/0c322c79ecbe4cde3e79d8e83ac655a978d07877))
+
+## [2.30.1](https://github.com/googleapis/python-bigtable/compare/v2.30.0...v2.30.1) (2025-04-17)
+
+
+### Bug Fixes
+
+* Populate SQL app_profile_id header even when it is unset ([#1109](https://github.com/googleapis/python-bigtable/issues/1109)) ([17b75bd](https://github.com/googleapis/python-bigtable/commit/17b75bd746cb0a616f64a05eb0ed72b46de28a17))
+
+## [2.30.0](https://github.com/googleapis/python-bigtable/compare/v2.29.0...v2.30.0) (2025-03-18)
+
+
+### Features
+
+* Update ExecuteQuery to use Prepare ([#1100](https://github.com/googleapis/python-bigtable/issues/1100)) ([8a7abc1](https://github.com/googleapis/python-bigtable/commit/8a7abc1e9c34a9122b2d648e8a358a7097ed3a5d))
+
+
+### Bug Fixes
+
+* Allow protobuf 6.x ([#1092](https://github.com/googleapis/python-bigtable/issues/1092)) ([1015fa8](https://github.com/googleapis/python-bigtable/commit/1015fa83c505487f09820e3a37f76690bd00ab5d))
+* Remove setup.cfg configuration for creating universal wheels ([#1097](https://github.com/googleapis/python-bigtable/issues/1097)) ([95f4b82](https://github.com/googleapis/python-bigtable/commit/95f4b8233cba2a18633e64c5e0bc177e23767a83))
+
+## [2.29.0](https://github.com/googleapis/python-bigtable/compare/v2.28.1...v2.29.0) (2025-02-26)
+
+
+### Features
+
+* Add support for array and float32 SQL query params ([#1078](https://github.com/googleapis/python-bigtable/issues/1078)) ([89b8da8](https://github.com/googleapis/python-bigtable/commit/89b8da8a445aeb08854d9fa77cbc0e4fc042c87f))
+
+
+### Bug Fixes
+
+* Grpc channel refresh ([#1087](https://github.com/googleapis/python-bigtable/issues/1087)) ([f44b36b](https://github.com/googleapis/python-bigtable/commit/f44b36bf51e3e4e3b8a774f96e682d3f1f8d4b16))
+
+## [2.28.1](https://github.com/googleapis/python-bigtable/compare/v2.28.0...v2.28.1) (2025-01-17)
+
+
+### Bug Fixes
+
+* Allow empty headers for btql routing ([#1072](https://github.com/googleapis/python-bigtable/issues/1072)) ([e7ecfeb](https://github.com/googleapis/python-bigtable/commit/e7ecfeb8984a45c880d9483305964fff347eb4b8))
+
+## [2.28.0](https://github.com/googleapis/python-bigtable/compare/v2.27.0...v2.28.0) (2025-01-08)
+
+
+### Features
+
+* Add generated sync client ([#1017](https://github.com/googleapis/python-bigtable/issues/1017)) ([f974823](https://github.com/googleapis/python-bigtable/commit/f974823bf8a74c2f8b1bc69997b13bc1acaf8bef))
+
+## [2.27.0](https://github.com/googleapis/python-bigtable/compare/v2.26.0...v2.27.0) (2024-11-12)
+
+
+### Features
+
+* Add support for Cloud Bigtable Node Scaling Factor for CBT Clusters ([#1023](https://github.com/googleapis/python-bigtable/issues/1023)) ([0809c6a](https://github.com/googleapis/python-bigtable/commit/0809c6ac274e909103ad160a8bcab95f8bb46f31))
+* Surface `retry` param to `Table.read_row` api ([#982](https://github.com/googleapis/python-bigtable/issues/982)) ([a8286d2](https://github.com/googleapis/python-bigtable/commit/a8286d2a510f654f9c270c3c761c02e4ab3817d4))
+
+
+### Bug Fixes
+
+* Registering duplicate instance ([#1033](https://github.com/googleapis/python-bigtable/issues/1033)) ([2bca8fb](https://github.com/googleapis/python-bigtable/commit/2bca8fb220eeb1906fc6a3cf1f879f3d41fbbff8))
+
+## [2.26.0](https://github.com/googleapis/python-bigtable/compare/v2.25.0...v2.26.0) (2024-08-12)
+
+
+### Features
+
+* Add fields and the BackupType proto for Hot Backups ([#1010](https://github.com/googleapis/python-bigtable/issues/1010)) ([b95801f](https://github.com/googleapis/python-bigtable/commit/b95801ffa8081e0072232247fbc5879105c109a6))
+* Add MergeToCell to Mutation APIs ([f029a24](https://github.com/googleapis/python-bigtable/commit/f029a242e2b0e6020d0b87ef256a414194321fad))
+* Add min, max, hll aggregators and more types ([f029a24](https://github.com/googleapis/python-bigtable/commit/f029a242e2b0e6020d0b87ef256a414194321fad))
+* Async execute query client ([#1011](https://github.com/googleapis/python-bigtable/issues/1011)) ([45bc8c4](https://github.com/googleapis/python-bigtable/commit/45bc8c4a0fe567ce5e0126a1a70e7eb3dca93e92))
+
+
+### Bug Fixes
+
+* Use single routing metadata header ([#1005](https://github.com/googleapis/python-bigtable/issues/1005)) ([20eeb0a](https://github.com/googleapis/python-bigtable/commit/20eeb0a68d7b44d07a6d84bc7a7e040ad63bb96d))
+
+
+### Documentation
+
+* Add clarification around SQL timestamps ([#1012](https://github.com/googleapis/python-bigtable/issues/1012)) ([6e80190](https://github.com/googleapis/python-bigtable/commit/6e801900bbe9385d3b579b8c3327c87c3617d92f))
+* Corrected various type documentation ([f029a24](https://github.com/googleapis/python-bigtable/commit/f029a242e2b0e6020d0b87ef256a414194321fad))
+
+## [2.25.0](https://github.com/googleapis/python-bigtable/compare/v2.24.0...v2.25.0) (2024-07-18)
+
+
+### Features
+
+* Publish ProtoRows Message ([7ac8e14](https://github.com/googleapis/python-bigtable/commit/7ac8e142f99a6891b6bc286858f764def503e89a))
+* Publish the Cloud Bigtable ExecuteQuery API ([7ac8e14](https://github.com/googleapis/python-bigtable/commit/7ac8e142f99a6891b6bc286858f764def503e89a))
+
+
+### Bug Fixes
+
+* Allow protobuf 5.x ([7ac8e14](https://github.com/googleapis/python-bigtable/commit/7ac8e142f99a6891b6bc286858f764def503e89a))
+
+## [2.24.0](https://github.com/googleapis/python-bigtable/compare/v2.23.1...v2.24.0) (2024-06-11)
+
+
+### Features
+
+* Add String type with Utf8Raw encoding to Bigtable API ([#968](https://github.com/googleapis/python-bigtable/issues/968)) ([2a2bbfd](https://github.com/googleapis/python-bigtable/commit/2a2bbfdba6737c508ab1073d37fef680ca2a8c2f))
+* Improve async sharding ([#977](https://github.com/googleapis/python-bigtable/issues/977)) ([fd1f7da](https://github.com/googleapis/python-bigtable/commit/fd1f7dafd38f7f0e714a3384a27176f485523682))
+
+
+### Bug Fixes
+
+* **backup:** Backup name regex ([#970](https://github.com/googleapis/python-bigtable/issues/970)) ([6ef122a](https://github.com/googleapis/python-bigtable/commit/6ef122ad49f43e3a22cde5cb6fdaefd947670136))
+* Improve rowset revision ([#979](https://github.com/googleapis/python-bigtable/issues/979)) ([da27527](https://github.com/googleapis/python-bigtable/commit/da275279a7e619e4cd3e72b10ac629d6e0e1fe47))
+
+## [2.23.1](https://github.com/googleapis/python-bigtable/compare/v2.23.0...v2.23.1) (2024-04-15)
+
+
+### Bug Fixes
+
+* Use insecure grpc channel with emulator ([#946](https://github.com/googleapis/python-bigtable/issues/946)) ([aa31706](https://github.com/googleapis/python-bigtable/commit/aa3170663f9bd09d70c99d4e76c07f7f293ad935))
+
+## [2.23.0](https://github.com/googleapis/python-bigtable/compare/v2.22.0...v2.23.0) (2024-02-07)
+
+
+### Features
+
+* Add async data client preview ([7088e39](https://github.com/googleapis/python-bigtable/commit/7088e39c6bac10e5f830e8fa68e181412910ec5a))
+* Adding feature flags for routing cookie and retry info ([#905](https://github.com/googleapis/python-bigtable/issues/905)) ([1859e67](https://github.com/googleapis/python-bigtable/commit/1859e67961629663a8749eea849b5b005fcbc09f))
+
+
+### Bug Fixes
+
+* Fix `ValueError` in `test__validate_universe_domain` ([#929](https://github.com/googleapis/python-bigtable/issues/929)) ([aa76a5a](https://github.com/googleapis/python-bigtable/commit/aa76a5aaa349386d5972d96e1255389e30df8764))
+
+## [2.22.0](https://github.com/googleapis/python-bigtable/compare/v2.21.0...v2.22.0) (2023-12-12)
+
+
+### Features
+
+* Add support for Cloud Bigtable Request Priorities in App Profiles ([#871](https://github.com/googleapis/python-bigtable/issues/871)) ([a4d551e](https://github.com/googleapis/python-bigtable/commit/a4d551e34006202ee96a395a2107d7acdc5881de))
+* Add support for Python 3.12 ([#888](https://github.com/googleapis/python-bigtable/issues/888)) ([4f050aa](https://github.com/googleapis/python-bigtable/commit/4f050aa5aed9a9dcf209779d5c10e5de8e2ff19e))
+* Introduce compatibility with native namespace packages ([#893](https://github.com/googleapis/python-bigtable/issues/893)) ([d218f4e](https://github.com/googleapis/python-bigtable/commit/d218f4ebd4ed6705721dca9318df955b40b0d0ac))
+* Publish CopyBackup protos to external customers ([#855](https://github.com/googleapis/python-bigtable/issues/855)) ([4105df7](https://github.com/googleapis/python-bigtable/commit/4105df762f1318c49bba030063897f0c50e4daee))
+
+
+### Bug Fixes
+
+* Add feature flag for improved mutate rows throttling ([e5af359](https://github.com/googleapis/python-bigtable/commit/e5af3597f45fc4c094c59abca876374f5a866c1b))
+* Add lock to flow control ([#899](https://github.com/googleapis/python-bigtable/issues/899)) ([e4e63c7](https://github.com/googleapis/python-bigtable/commit/e4e63c7b5b91273b3aae04fda59cc5a21c848de2))
+* Mutations batcher race condition ([#896](https://github.com/googleapis/python-bigtable/issues/896)) ([fe58f61](https://github.com/googleapis/python-bigtable/commit/fe58f617c7364d7e99e2ec50abd5f080852bf033))
+* Require google-cloud-core 1.4.4 ([#866](https://github.com/googleapis/python-bigtable/issues/866)) ([09f8a46](https://github.com/googleapis/python-bigtable/commit/09f8a4667d8b68a9f2048ba1aa57db4f775a2c03))
+* Use `retry_async` instead of `retry` in async client ([597efd1](https://github.com/googleapis/python-bigtable/commit/597efd11d15f20549010b4301be4d9768326e6a2))
+
+
+### Documentation
+
+* Minor formatting ([e5af359](https://github.com/googleapis/python-bigtable/commit/e5af3597f45fc4c094c59abca876374f5a866c1b))
+
+## [2.21.0](https://github.com/googleapis/python-bigtable/compare/v2.20.0...v2.21.0) (2023-08-02)
+
+
+### Features
+
+* Add last_scanned_row_responses to FeatureFlags ([#845](https://github.com/googleapis/python-bigtable/issues/845)) ([14a6739](https://github.com/googleapis/python-bigtable/commit/14a673901f82fa247c8027730a0bba41e0ec4757))
+
+
+### Documentation
+
+* Minor formatting ([#851](https://github.com/googleapis/python-bigtable/issues/851)) ([5ebe231](https://github.com/googleapis/python-bigtable/commit/5ebe2312dab70210811fca68c6625d2546442afd))
+
+## [2.20.0](https://github.com/googleapis/python-bigtable/compare/v2.19.0...v2.20.0) (2023-07-17)
+
+
+### Features
+
+* Add experimental reverse scan for public preview ([d5720f8](https://github.com/googleapis/python-bigtable/commit/d5720f8f5b5a81572f31d40051b3ec0f1d104304))
+* Increase the maximum retention period for a Cloud Bigtable backup from 30 days to 90 days ([d5720f8](https://github.com/googleapis/python-bigtable/commit/d5720f8f5b5a81572f31d40051b3ec0f1d104304))
+
+
+### Bug Fixes
+
+* Add async context manager return types ([#828](https://github.com/googleapis/python-bigtable/issues/828)) ([475a160](https://github.com/googleapis/python-bigtable/commit/475a16072f3ad41357bdb765fff608a39141ec00))
+
+
+### Documentation
+
+* Fix formatting for reversed order field example ([#831](https://github.com/googleapis/python-bigtable/issues/831)) ([fddd0ba](https://github.com/googleapis/python-bigtable/commit/fddd0ba97155e112af92a98fd8f20e59b139d177))
+
+## [2.19.0](https://github.com/googleapis/python-bigtable/compare/v2.18.1...v2.19.0) (2023-06-08)
+
+
+### Features
+
+* Add ChangeStreamConfig to CreateTable and UpdateTable ([#786](https://github.com/googleapis/python-bigtable/issues/786)) ([cef70f2](https://github.com/googleapis/python-bigtable/commit/cef70f243541820225f86a520e0b2abd3a7354f7))
+
+
+### Bug Fixes
+
+* Add a callback function on flush_rows ([#796](https://github.com/googleapis/python-bigtable/issues/796)) ([589aa5d](https://github.com/googleapis/python-bigtable/commit/589aa5d04f6b5a2bd310d0bf06aeb7058fb6fcd2))
+
+
+### Documentation
+
+* **samples:** Add region tags ([#788](https://github.com/googleapis/python-bigtable/issues/788)) ([ecf539c](https://github.com/googleapis/python-bigtable/commit/ecf539c4c976fd9e5505b8abf0b697b218f09fef))
+
+## [2.18.1](https://github.com/googleapis/python-bigtable/compare/v2.18.0...v2.18.1) (2023-05-11)
+
+
+### Bug Fixes
+
+* Revert "Feat: Threaded MutationsBatcher" ([#773](https://github.com/googleapis/python-bigtable/issues/773)) ([a767cff](https://github.com/googleapis/python-bigtable/commit/a767cff95d990994f85f5fd05cc10f952087b49d))
+
+## [2.18.0](https://github.com/googleapis/python-bigtable/compare/v2.17.0...v2.18.0) (2023-05-10)
+
+
+### Features
+
+* Publish RateLimitInfo and FeatureFlag protos ([#768](https://github.com/googleapis/python-bigtable/issues/768)) ([171fea6](https://github.com/googleapis/python-bigtable/commit/171fea6de57a47f92a2a56050f8bfe7518144df7))
+* Threaded MutationsBatcher ([#722](https://github.com/googleapis/python-bigtable/issues/722)) ([7521a61](https://github.com/googleapis/python-bigtable/commit/7521a617c121ead96a21ca47959a53b2db2da090))
+
+
+### Bug Fixes
+
+* Pass the "retry" when calling read_rows. ([#759](https://github.com/googleapis/python-bigtable/issues/759)) ([505273b](https://github.com/googleapis/python-bigtable/commit/505273b72bf83d8f92d0e0a92d62f22bce96cc3d))
+
+
+### Documentation
+
+* Fix delete from column family example ([#764](https://github.com/googleapis/python-bigtable/issues/764)) ([128b4e1](https://github.com/googleapis/python-bigtable/commit/128b4e1f3eea2dad903d84c8f2933b17a5f0d226))
+* Fix formatting of request arg in docstring ([#756](https://github.com/googleapis/python-bigtable/issues/756)) ([45d3e43](https://github.com/googleapis/python-bigtable/commit/45d3e4308c4f494228c2e6e18a36285c557cb0c3))
+
+## [2.17.0](https://github.com/googleapis/python-bigtable/compare/v2.16.0...v2.17.0) (2023-03-01)
+
+
+### Features
+
+* Add new_partitions field for CloseStream for Cloud Bigtable ChangeStream ([#740](https://github.com/googleapis/python-bigtable/issues/740)) ([1adcad4](https://github.com/googleapis/python-bigtable/commit/1adcad440368f6d7df6710a013e7fab076461aed))
+
+## [2.16.0](https://github.com/googleapis/python-bigtable/compare/v2.15.0...v2.16.0) (2023-02-27)
+
+
+### Features
+
+* Enable "rest" transport in Python for services supporting numeric enums ([c5116e0](https://github.com/googleapis/python-bigtable/commit/c5116e097aacf9ddae249de57fab1849aff10d86))
+* Publish the Cloud Bigtable Change Streams ([c5116e0](https://github.com/googleapis/python-bigtable/commit/c5116e097aacf9ddae249de57fab1849aff10d86))
+
+
+### Bug Fixes
+
+* Add context manager return types ([beb5bf3](https://github.com/googleapis/python-bigtable/commit/beb5bf3bca4b517d095de3faa17d20e4d89fb295))
+* **deps:** Require google-api-core>=1.34.0,>=2.11.0 ([c5116e0](https://github.com/googleapis/python-bigtable/commit/c5116e097aacf9ddae249de57fab1849aff10d86))
+
+
+### Documentation
+
+* Add documentation for enums ([beb5bf3](https://github.com/googleapis/python-bigtable/commit/beb5bf3bca4b517d095de3faa17d20e4d89fb295))
+
+## [2.15.0](https://github.com/googleapis/python-bigtable/compare/v2.14.1...v2.15.0) (2023-01-10)
+
+
+### Features
+
+* Add support for python 3.11 ([#718](https://github.com/googleapis/python-bigtable/issues/718)) ([803a15e](https://github.com/googleapis/python-bigtable/commit/803a15ef0cd3713411eeb5d21258c12bbe1dcab6))
+
+## [2.14.1](https://github.com/googleapis/python-bigtable/compare/v2.14.0...v2.14.1) (2022-12-06)
+
+
+### Bug Fixes
+
+* **deps:** Require google-api-core >=1.34.0, >=2.11.0 ([e5875cb](https://github.com/googleapis/python-bigtable/commit/e5875cbe8551329fbb64f273ca21d6b7ada641ec))
+* Drop usage of pkg_resources ([e5875cb](https://github.com/googleapis/python-bigtable/commit/e5875cbe8551329fbb64f273ca21d6b7ada641ec))
+* Fix timeout default values ([e5875cb](https://github.com/googleapis/python-bigtable/commit/e5875cbe8551329fbb64f273ca21d6b7ada641ec))
+
+
+### Documentation
+
+* **samples:** Snippetgen should call await on the operation coroutine before calling result ([e5875cb](https://github.com/googleapis/python-bigtable/commit/e5875cbe8551329fbb64f273ca21d6b7ada641ec))
+
+## [2.14.0](https://github.com/googleapis/python-bigtable/compare/v2.13.2...v2.14.0) (2022-11-30)
+
+
+### Features
+
+* Add typing to proto.Message based class attributes ([c1538d5](https://github.com/googleapis/python-bigtable/commit/c1538d5c5a001a9febb4b466d3d09fd1fd167f66))
+* remove enum value ReadRowsRequest.RequestStatsView.REQUEST_STATS_EFFICIENCY ([c1538d5](https://github.com/googleapis/python-bigtable/commit/c1538d5c5a001a9febb4b466d3d09fd1fd167f66))
+* remove field ReadIterationStats.deletes_seen ([c1538d5](https://github.com/googleapis/python-bigtable/commit/c1538d5c5a001a9febb4b466d3d09fd1fd167f66))
+* remove field RequestStats.read_efficiency_stats ([c1538d5](https://github.com/googleapis/python-bigtable/commit/c1538d5c5a001a9febb4b466d3d09fd1fd167f66))
+* remove proto ReadEfficiencyStats ([c1538d5](https://github.com/googleapis/python-bigtable/commit/c1538d5c5a001a9febb4b466d3d09fd1fd167f66))
+* rename field RequestStats.all_read_stats to full_read_stats_view ([c1538d5](https://github.com/googleapis/python-bigtable/commit/c1538d5c5a001a9febb4b466d3d09fd1fd167f66))
+* rename proto AllReadStats to FullReadStatsView ([c1538d5](https://github.com/googleapis/python-bigtable/commit/c1538d5c5a001a9febb4b466d3d09fd1fd167f66))
+* rename proto ReadIteratorStats to ReadIterationStats ([c1538d5](https://github.com/googleapis/python-bigtable/commit/c1538d5c5a001a9febb4b466d3d09fd1fd167f66))
+
+
+### Bug Fixes
+
+* Add dict typing for client_options ([c1538d5](https://github.com/googleapis/python-bigtable/commit/c1538d5c5a001a9febb4b466d3d09fd1fd167f66))
+
+## [2.13.2](https://github.com/googleapis/python-bigtable/compare/v2.13.1...v2.13.2) (2022-10-20)
+
+
+### Bug Fixes
+
+* Respect deadlines for column family operations ([#687](https://github.com/googleapis/python-bigtable/issues/687)) ([df2e64a](https://github.com/googleapis/python-bigtable/commit/df2e64a79bbd8b28d0991706607af99d539320d1))
+
+## [2.13.1](https://github.com/googleapis/python-bigtable/compare/v2.13.0...v2.13.1) (2022-10-10)
+
+
+### Bug Fixes
+
+* **deps:** Allow protobuf 3.19.5 ([#682](https://github.com/googleapis/python-bigtable/issues/682)) ([0bb3420](https://github.com/googleapis/python-bigtable/commit/0bb3420decac74058ee099d72f8932556409f2aa))
+
+## [2.13.0](https://github.com/googleapis/python-bigtable/compare/v2.12.0...v2.13.0) (2022-09-29)
+
+
+### Features
+
+* Publish the RequestStats proto ([#676](https://github.com/googleapis/python-bigtable/issues/676)) ([199949b](https://github.com/googleapis/python-bigtable/commit/199949b2a930706654680b91a93f2a903bf112bf))
+
+
+### Bug Fixes
+
+* **deps:** Require protobuf >= 3.20.2 ([#679](https://github.com/googleapis/python-bigtable/issues/679)) ([030ef38](https://github.com/googleapis/python-bigtable/commit/030ef3868c442a8a21c4b4d6217b99cab09a1be7))
+
+## [2.12.0](https://github.com/googleapis/python-bigtable/compare/v2.11.3...v2.12.0) (2022-09-19)
+
+
+### Features
+
+* Publish CBT deletion_protection field in Table, UpdateTableRequest, and UpdateTable API ([#670](https://github.com/googleapis/python-bigtable/issues/670)) ([c57289c](https://github.com/googleapis/python-bigtable/commit/c57289c03335380694580202d746ca4f679dce9b))
+
+
+### Documentation
+
+* Remove unnecessary comment ([#674](https://github.com/googleapis/python-bigtable/issues/674)) ([9c62655](https://github.com/googleapis/python-bigtable/commit/9c62655de7fecd93ee7a1bb95b208d94798727cd))
+
+## [2.11.3](https://github.com/googleapis/python-bigtable/compare/v2.11.2...v2.11.3) (2022-08-17)
+
+
+### Performance Improvements
+
+* optimize row merging ([#628](https://github.com/googleapis/python-bigtable/issues/628)) ([c71ec70](https://github.com/googleapis/python-bigtable/commit/c71ec70e55f6e236e46127870a9ed4717eee5da5))
+
+## [2.11.2](https://github.com/googleapis/python-bigtable/compare/v2.11.1...v2.11.2) (2022-08-11)
+
+
+### Bug Fixes
+
+* **deps:** allow protobuf < 5.0.0 ([#631](https://github.com/googleapis/python-bigtable/issues/631)) ([fd54fc6](https://github.com/googleapis/python-bigtable/commit/fd54fc63340a3e01fae1ccc4c648dd90900f8a94))
+* **deps:** require proto-plus >= 1.22.0 ([fd54fc6](https://github.com/googleapis/python-bigtable/commit/fd54fc63340a3e01fae1ccc4c648dd90900f8a94))
+
+## [2.11.1](https://github.com/googleapis/python-bigtable/compare/v2.11.0...v2.11.1) (2022-08-08)
+
+
+### Bug Fixes
+
+* Retry the RST Stream error in mutate rows and read rows([#624](https://github.com/googleapis/python-bigtable/issues/624)) ([d24574a](https://github.com/googleapis/python-bigtable/commit/d24574a722de61bdeffa6588bcb08f56e62ba3bd))
+
+## [2.11.0](https://github.com/googleapis/python-bigtable/compare/v2.10.1...v2.11.0) (2022-08-04)
+
+
+### Features
+
+* add audience parameter ([a7a7699](https://github.com/googleapis/python-bigtable/commit/a7a76998fad3c12215527e4ebb517a1526cc152e))
+* add satisfies_pzs output only field ([#614](https://github.com/googleapis/python-bigtable/issues/614)) ([7dc1469](https://github.com/googleapis/python-bigtable/commit/7dc1469fef2dc38f1509b35a37e9c97381ab7601))
+* Add storage_utilization_gib_per_node to Autoscaling target ([a7a7699](https://github.com/googleapis/python-bigtable/commit/a7a76998fad3c12215527e4ebb517a1526cc152e))
+* Cloud Bigtable Undelete Table service and message proto files ([a7a7699](https://github.com/googleapis/python-bigtable/commit/a7a76998fad3c12215527e4ebb517a1526cc152e))
+
+
+### Bug Fixes
+
+* **deps:** require google-api-core>=1.32.0,>=2.8.0 ([a7a7699](https://github.com/googleapis/python-bigtable/commit/a7a76998fad3c12215527e4ebb517a1526cc152e))
+* require python 3.7+ ([#610](https://github.com/googleapis/python-bigtable/issues/610)) ([10d00f5](https://github.com/googleapis/python-bigtable/commit/10d00f5af5d5878c26529f5e48a5fb8d8385696d))
+
+
+### Performance Improvements
+
+* improve row merging ([#619](https://github.com/googleapis/python-bigtable/issues/619)) ([b4853e5](https://github.com/googleapis/python-bigtable/commit/b4853e59d0efd8a7b37f3fcb06b14dbd9f5d20a4))
+
+## [2.10.1](https://github.com/googleapis/python-bigtable/compare/v2.10.0...v2.10.1) (2022-06-03)
+
+
+### Bug Fixes
+
+* **deps:** require protobuf <4.0.0dev ([#595](https://github.com/googleapis/python-bigtable/issues/595)) ([a4deaf7](https://github.com/googleapis/python-bigtable/commit/a4deaf7b1b5c4b7ce8f6dc5bb96d32ea8ff55c2d))
+
+
+### Documentation
+
+* fix changelog header to consistent size ([#596](https://github.com/googleapis/python-bigtable/issues/596)) ([51961c3](https://github.com/googleapis/python-bigtable/commit/51961c32686fe5851e957581b85adbe92a073e03))
+
+## [2.10.0](https://github.com/googleapis/python-bigtable/compare/v2.9.0...v2.10.0) (2022-05-30)
+
+
+### Features
+
+* refreshes Bigtable Admin API(s) protos ([#589](https://github.com/googleapis/python-bigtable/issues/589)) ([b508e33](https://github.com/googleapis/python-bigtable/commit/b508e3321937850d65242283e82f5413feb6081a))
+
+
+### Documentation
+
+* Add EncryptionInfo documentation ([#588](https://github.com/googleapis/python-bigtable/issues/588)) ([bedbf1b](https://github.com/googleapis/python-bigtable/commit/bedbf1b1bb304ff45f31ad20004ff96041ce716c))
+
+## [2.9.0](https://github.com/googleapis/python-bigtable/compare/v2.8.1...v2.9.0) (2022-04-14)
+
+
+### Features
+
+* App Profile multi cluster routing support with specified cluster ids ([#549](https://github.com/googleapis/python-bigtable/issues/549)) ([a0ed5b5](https://github.com/googleapis/python-bigtable/commit/a0ed5b5dfda1f3980b1a8eb349b2b5d8ab428a4b))
+* AuditConfig for IAM v1 ([4e50278](https://github.com/googleapis/python-bigtable/commit/4e50278c73f608a7c493692d8d17e7dd2aa7ba44))
+
+
+### Bug Fixes
+
+* **deps:** require grpc-google-iam-v1 >=0.12.4 ([4e50278](https://github.com/googleapis/python-bigtable/commit/4e50278c73f608a7c493692d8d17e7dd2aa7ba44))
+
+
+### Documentation
+
+* fix type in docstring for map fields ([4e50278](https://github.com/googleapis/python-bigtable/commit/4e50278c73f608a7c493692d8d17e7dd2aa7ba44))
+
+## [2.8.1](https://github.com/googleapis/python-bigtable/compare/v2.8.0...v2.8.1) (2022-04-07)
+
+
+### Bug Fixes
+
+* Prevent sending full table scan when retrying ([#554](https://github.com/googleapis/python-bigtable/issues/554)) ([56f5357](https://github.com/googleapis/python-bigtable/commit/56f5357c09ac867491b934f6029776dcd74c6eac))
+
+## [2.8.0](https://github.com/googleapis/python-bigtable/compare/v2.7.1...v2.8.0) (2022-04-04)
+
+
+### Features
+
+* Add ListHotTablets API method and protobufs ([#542](https://github.com/googleapis/python-bigtable/issues/542)) ([483f139](https://github.com/googleapis/python-bigtable/commit/483f139f5065d55378bd850c33e89db460119fc1))
+
+
+### Documentation
+
+* explain mutate vs mutate_rows ([#543](https://github.com/googleapis/python-bigtable/issues/543)) ([84cfb0a](https://github.com/googleapis/python-bigtable/commit/84cfb0abdfabd8aa2f292fc0bb7e6deab50f87f1))
+* Remove the limitation that all clusters in a CMEK instance must use the same key ([f008eea](https://github.com/googleapis/python-bigtable/commit/f008eea69a6c7c1a027cefc7f16d46042b524db1))
+* Update `cpu_utilization_percent` limit ([#547](https://github.com/googleapis/python-bigtable/issues/547)) ([f008eea](https://github.com/googleapis/python-bigtable/commit/f008eea69a6c7c1a027cefc7f16d46042b524db1))
+
+## [2.7.1](https://github.com/googleapis/python-bigtable/compare/v2.7.0...v2.7.1) (2022-03-17)
+
+
+### Bug Fixes
+
+* Ensure message fields are copied when building retry request ([#533](https://github.com/googleapis/python-bigtable/issues/533)) ([ff7f190](https://github.com/googleapis/python-bigtable/commit/ff7f1901b6420e66e1388e757eeec20d30484ad9))
+
+## [2.7.0](https://github.com/googleapis/python-bigtable/compare/v2.6.0...v2.7.0) (2022-03-06)
+
+
+### Features
+
+* Add support for autoscaling ([#509](https://github.com/googleapis/python-bigtable/issues/509)) ([8f4e197](https://github.com/googleapis/python-bigtable/commit/8f4e197148644ded934190814ff44fa132a2dda6))
+
+
+### Bug Fixes
+
+* **deps:** require google-api-core>=1.31.5, >=2.3.2 ([#526](https://github.com/googleapis/python-bigtable/issues/526)) ([a8a92ee](https://github.com/googleapis/python-bigtable/commit/a8a92ee1b6bd284055fee3e1029a9a6aacbc5f1c))
+* **deps:** require proto-plus>=1.15.0 ([a8a92ee](https://github.com/googleapis/python-bigtable/commit/a8a92ee1b6bd284055fee3e1029a9a6aacbc5f1c))
+
+## [2.6.0](https://github.com/googleapis/python-bigtable/compare/v2.5.2...v2.6.0) (2022-02-26)
+
+
+### Features
+
+* add WarmAndPing request for channel priming ([#504](https://github.com/googleapis/python-bigtable/issues/504)) ([df5fc1f](https://github.com/googleapis/python-bigtable/commit/df5fc1f7d6ded88d9bce67f7cc6989981745931f))
+
+## [2.5.2](https://github.com/googleapis/python-bigtable/compare/v2.5.1...v2.5.2) (2022-02-24)
+
+
+### Bug Fixes
+
+* Pass app_profile_id when building updated request ([#512](https://github.com/googleapis/python-bigtable/issues/512)) ([2f8ba7a](https://github.com/googleapis/python-bigtable/commit/2f8ba7a4801b17b5afb6180a7ace1327a2d05a52))
+
+## [2.5.1](https://github.com/googleapis/python-bigtable/compare/v2.5.0...v2.5.1) (2022-02-17)
+
+
+### Bug Fixes
+
+* **deps:** move libcst to extras ([#508](https://github.com/googleapis/python-bigtable/issues/508)) ([4b4d7e2](https://github.com/googleapis/python-bigtable/commit/4b4d7e2796788b2cd3764f54ff532a9c9d092aec))
+
+## [2.5.0](https://github.com/googleapis/python-bigtable/compare/v2.4.0...v2.5.0) (2022-02-07)
+
+
+### Features
+
+* add 'Instance.create_time' field ([#449](https://github.com/googleapis/python-bigtable/issues/449)) ([b9ecfa9](https://github.com/googleapis/python-bigtable/commit/b9ecfa97281ae21dcf233e60c70cacc701f12c32))
+* add api key support ([#497](https://github.com/googleapis/python-bigtable/issues/497)) ([ee3a6c4](https://github.com/googleapis/python-bigtable/commit/ee3a6c4c5f810fab08671db3407195864ecc1972))
+* add Autoscaling API ([#475](https://github.com/googleapis/python-bigtable/issues/475)) ([97b3cdd](https://github.com/googleapis/python-bigtable/commit/97b3cddb908098e255e7a1209cdb985087b95a26))
+* add context manager support in client ([#440](https://github.com/googleapis/python-bigtable/issues/440)) ([a3d2cf1](https://github.com/googleapis/python-bigtable/commit/a3d2cf18b49cddc91e5e6448c46d6b936d86954d))
+* add support for Python 3.10 ([#437](https://github.com/googleapis/python-bigtable/issues/437)) ([3cf0814](https://github.com/googleapis/python-bigtable/commit/3cf08149411f3f4df41e9b5a9894dbfb101bd86f))
+
+
+### Bug Fixes
+
+* **deps:** drop packaging dependency ([a535f99](https://github.com/googleapis/python-bigtable/commit/a535f99e9f0bb16488a5d372a0a6efc3c4b69186))
+* **deps:** require google-api-core >= 1.28.0 ([a535f99](https://github.com/googleapis/python-bigtable/commit/a535f99e9f0bb16488a5d372a0a6efc3c4b69186))
+* improper types in pagers generation ([f9c7699](https://github.com/googleapis/python-bigtable/commit/f9c7699eb6d4071314abbb0477ba47370059e041))
+* improve type hints, mypy checks ([#448](https://github.com/googleapis/python-bigtable/issues/448)) ([a99bf88](https://github.com/googleapis/python-bigtable/commit/a99bf88417d6aec03923447c70c2752f6bb5c459))
+* resolve DuplicateCredentialArgs error when using credentials_file ([d6bff70](https://github.com/googleapis/python-bigtable/commit/d6bff70654b41e31d2ac83d307bdc6bbd111201e))
+
+
+### Documentation
+
+* clarify comments in ReadRowsRequest and RowFilter ([#494](https://github.com/googleapis/python-bigtable/issues/494)) ([1efd9b5](https://github.com/googleapis/python-bigtable/commit/1efd9b598802f766a3c4c8c78ec7b0ca208d3325))
+* list oneofs in docstring ([a535f99](https://github.com/googleapis/python-bigtable/commit/a535f99e9f0bb16488a5d372a0a6efc3c4b69186))
+
+## [2.4.0](https://www.github.com/googleapis/python-bigtable/compare/v2.3.3...v2.4.0) (2021-09-24)
+
+
+### Features
+
+* Publish new fields to support cluster group routing for Cloud Bigtable ([#407](https://www.github.com/googleapis/python-bigtable/issues/407)) ([66af554](https://www.github.com/googleapis/python-bigtable/commit/66af554a103eea0139cb313691d69f4c88a9e87f))
+
+
+### Bug Fixes
+
+* add 'dict' annotation type to 'request' ([160bfd3](https://www.github.com/googleapis/python-bigtable/commit/160bfd317a83561821acc0212d3514701a031ac6))
+
+## [2.3.3](https://www.github.com/googleapis/python-bigtable/compare/v2.3.2...v2.3.3) (2021-07-24)
+
+
+### Bug Fixes
+
+* enable self signed jwt for grpc ([#397](https://www.github.com/googleapis/python-bigtable/issues/397)) ([9d43a38](https://www.github.com/googleapis/python-bigtable/commit/9d43a388470746608d324ca8d72f41bb3a4492b7))
+
+## [2.3.2](https://www.github.com/googleapis/python-bigtable/compare/v2.3.1...v2.3.2) (2021-07-20)
+
+
+### Bug Fixes
+
+* **deps:** pin 'google-{api,cloud}-core', 'google-auth' to allow 2.x versions ([#379](https://www.github.com/googleapis/python-bigtable/issues/379)) ([95b2e13](https://www.github.com/googleapis/python-bigtable/commit/95b2e13b776dca4a6998313c41aa960ffe2e47e9))
+* directly append to pb for beter read row performance ([#382](https://www.github.com/googleapis/python-bigtable/issues/382)) ([7040e11](https://www.github.com/googleapis/python-bigtable/commit/7040e113b93bb2e0625c054486305235d8f14c2a))
+
+## [2.3.1](https://www.github.com/googleapis/python-bigtable/compare/v2.3.0...v2.3.1) (2021-07-13)
+
+
+### Bug Fixes
+
+* use public 'table_admin_client' property in backups methods ([#359](https://www.github.com/googleapis/python-bigtable/issues/359)) ([bc57c79](https://www.github.com/googleapis/python-bigtable/commit/bc57c79640b270ff89fd10ec243dd04559168c5c))
+
+## [2.3.0](https://www.github.com/googleapis/python-bigtable/compare/v2.2.0...v2.3.0) (2021-07-01)
+
+
+### Features
+
+* add always_use_jwt_access ([#333](https://www.github.com/googleapis/python-bigtable/issues/333)) ([f1fce5b](https://www.github.com/googleapis/python-bigtable/commit/f1fce5b0694d965202fc2a4fcf8bc6e09e78deae))
+
+
+### Bug Fixes
+
+* **deps:** add packaging requirement ([#326](https://www.github.com/googleapis/python-bigtable/issues/326)) ([d31c27b](https://www.github.com/googleapis/python-bigtable/commit/d31c27b01d1f7c351effc2856a8d4777a1a10690))
+* **deps:** require google-api-core >= 1.26.0 ([#344](https://www.github.com/googleapis/python-bigtable/issues/344)) ([ce4ceb6](https://www.github.com/googleapis/python-bigtable/commit/ce4ceb6d8fe74eff16cf9ca151e0b98502256a2f))
+* disable always_use_jwt_access ([#348](https://www.github.com/googleapis/python-bigtable/issues/348)) ([4623248](https://www.github.com/googleapis/python-bigtable/commit/4623248376deccf4651d4badf8966311ebe3c16a))
+
+
+### Documentation
+
+* add paramter mutation_timeout to instance.table docs ([#305](https://www.github.com/googleapis/python-bigtable/issues/305)) ([5bbd06e](https://www.github.com/googleapis/python-bigtable/commit/5bbd06e5413e8b7597ba128174b10fe45fd38380))
+* fix broken links in multiprocessing.rst ([#317](https://www.github.com/googleapis/python-bigtable/issues/317)) ([e329352](https://www.github.com/googleapis/python-bigtable/commit/e329352d7e6d81de1d1d770c73406a60d29d01bb))
+* omit mention of Python 2.7 in 'CONTRIBUTING.rst' ([#1127](https://www.github.com/googleapis/python-bigtable/issues/1127)) ([#329](https://www.github.com/googleapis/python-bigtable/issues/329)) ([6bf0c64](https://www.github.com/googleapis/python-bigtable/commit/6bf0c647bcebed641b4cbdc5eb70528c88b26a01)), closes [#1126](https://www.github.com/googleapis/python-bigtable/issues/1126)
+
+## [2.2.0](https://www.github.com/googleapis/python-bigtable/compare/v2.1.0...v2.2.0) (2021-04-30)
+
+
+### Features
+
+* backup restore to different instance ([#300](https://www.github.com/googleapis/python-bigtable/issues/300)) ([049a25f](https://www.github.com/googleapis/python-bigtable/commit/049a25f903bb6b062e41430b6e7ce6d7b164f22c))
+
+## [2.1.0](https://www.github.com/googleapis/python-bigtable/compare/v2.0.0...v2.1.0) (2021-04-21)
+
+
+### Features
+
+* customer managed keys (CMEK) ([#249](https://www.github.com/googleapis/python-bigtable/issues/249)) ([93df829](https://www.github.com/googleapis/python-bigtable/commit/93df82998cc0218cbc4a1bc2ab41a48b7478758d))
+
+## [2.0.0](https://www.github.com/googleapis/python-bigtable/compare/v1.7.0...v2.0.0) (2021-04-06)
+
+
+### ⚠ BREAKING CHANGES
+
+* microgenerator changes (#203)
+
+### Features
+
+* microgenerator changes ([#203](https://www.github.com/googleapis/python-bigtable/issues/203)) ([b31bd87](https://www.github.com/googleapis/python-bigtable/commit/b31bd87c3fa8cad32768611a52d5effcc7d9b3e2))
+* publish new fields for CMEK ([#222](https://www.github.com/googleapis/python-bigtable/issues/222)) ([0fe5b63](https://www.github.com/googleapis/python-bigtable/commit/0fe5b638e45e711d25f55664689a9baf4d12dc57))
+
+
+### Bug Fixes
+
+* address issue in establishing an emulator connection ([#246](https://www.github.com/googleapis/python-bigtable/issues/246)) ([1a31826](https://www.github.com/googleapis/python-bigtable/commit/1a31826e2e378468e057160c07d850ebca1c5879))
+* fix unit test that could be broken by user's environment ([#239](https://www.github.com/googleapis/python-bigtable/issues/239)) ([cbd712e](https://www.github.com/googleapis/python-bigtable/commit/cbd712e6d3aded0c025525f97da1d667fbe2f061))
+* guard assignments of certain values against None ([#220](https://www.github.com/googleapis/python-bigtable/issues/220)) ([341f448](https://www.github.com/googleapis/python-bigtable/commit/341f448ce378375ab79bfc82f864fb6c88ed71a0))
+* **retry:** restore grpc_service_config for CreateBackup and {Restore,Snapshot}Table ([#240](https://www.github.com/googleapis/python-bigtable/issues/240)) ([79f1734](https://www.github.com/googleapis/python-bigtable/commit/79f1734c897e5e1b2fd02d043185c44b7ee34dc9))
+
+
+### Documentation
+
+* add backup docs ([#251](https://www.github.com/googleapis/python-bigtable/issues/251)) ([7d5c7aa](https://www.github.com/googleapis/python-bigtable/commit/7d5c7aa92cb476b07ac9efb5d231888c4c417783))
+
+
+### Dependencies
+
+* update gapic-generator-python to 0.40.11 ([#230](https://www.github.com/googleapis/python-bigtable/issues/230)) ([47d5dc1](https://www.github.com/googleapis/python-bigtable/commit/47d5dc1853f0be609e666e8a8fad0146f2905482))
+* upgrade gapic-generator-python to 0.43.1 ([#276](https://www.github.com/googleapis/python-bigtable/issues/276)) ([0e9fe54](https://www.github.com/googleapis/python-bigtable/commit/0e9fe5410e1b5d16ae0735ba1f606f7d1befafb9))
+
+## [2.0.0-dev1](https://www.github.com/googleapis/python-bigtable/compare/v1.7.0...v2.0.0-dev1) (2021-02-24)
+
+
+### ⚠ BREAKING CHANGES
+
+* microgenerator changes (#203)
+
+### Features
+
+* microgenerator changes ([#203](https://www.github.com/googleapis/python-bigtable/issues/203)) ([b31bd87](https://www.github.com/googleapis/python-bigtable/commit/b31bd87c3fa8cad32768611a52d5effcc7d9b3e2))
+
+
+### Bug Fixes
+
+* guard assignments of certain values against None ([#220](https://www.github.com/googleapis/python-bigtable/issues/220)) ([341f448](https://www.github.com/googleapis/python-bigtable/commit/341f448ce378375ab79bfc82f864fb6c88ed71a0))
+
+## [1.7.0](https://www.github.com/googleapis/python-bigtable/compare/v1.6.1...v1.7.0) (2021-02-09)
+
+
+### Features
+
+* add keep alive timeout ([#182](https://www.github.com/googleapis/python-bigtable/issues/182)) ([e9637cb](https://www.github.com/googleapis/python-bigtable/commit/e9637cbd4461dcca509dca43ef116d6ff41b80c7))
+* support filtering on incrementable values ([#178](https://www.github.com/googleapis/python-bigtable/issues/178)) ([e221352](https://www.github.com/googleapis/python-bigtable/commit/e2213520951d3da97019a1d784e5bf31d94e3353))
+
+
+### Bug Fixes
+
+* Renaming region tags to not conflict with documentation snippets ([#190](https://www.github.com/googleapis/python-bigtable/issues/190)) ([dd0cdc5](https://www.github.com/googleapis/python-bigtable/commit/dd0cdc5bcfd92e18ab9a7255684a9f5b21198867))
+
+
+### Documentation
+
+* update python contributing guide ([#206](https://www.github.com/googleapis/python-bigtable/issues/206)) ([e301ac3](https://www.github.com/googleapis/python-bigtable/commit/e301ac3b61364d779fdb50a57ae8e2cb9952df9e))
+
+## [1.6.1](https://www.github.com/googleapis/python-bigtable/compare/v1.6.0...v1.6.1) (2020-12-01)
+
+
+### Documentation
+
+* update intersphinx mappings ([#172](https://www.github.com/googleapis/python-bigtable/issues/172)) ([7b09368](https://www.github.com/googleapis/python-bigtable/commit/7b09368d5121782c7f271b3575c838e8a2284c05))
+
+## [1.6.0](https://www.github.com/googleapis/python-bigtable/compare/v1.5.1...v1.6.0) (2020-11-16)
+
+
+### Features
+
+* add 'timeout' arg to 'Table.mutate_rows' ([#157](https://www.github.com/googleapis/python-bigtable/issues/157)) ([6d597a1](https://www.github.com/googleapis/python-bigtable/commit/6d597a1e5be05c993c9f86beca4c1486342caf94)), closes [/github.com/googleapis/python-bigtable/issues/7#issuecomment-715538708](https://www.github.com/googleapis//github.com/googleapis/python-bigtable/issues/7/issues/issuecomment-715538708) [#7](https://www.github.com/googleapis/python-bigtable/issues/7)
+* Backup Level IAM ([#160](https://www.github.com/googleapis/python-bigtable/issues/160)) ([44932cb](https://www.github.com/googleapis/python-bigtable/commit/44932cb8710e12279dbd4e9271577f8bee238980))
+
+## [1.5.1](https://www.github.com/googleapis/python-bigtable/compare/v1.5.0...v1.5.1) (2020-10-06)
+
+
+### Bug Fixes
+
+* harden version data gathering against DistributionNotFound ([#150](https://www.github.com/googleapis/python-bigtable/issues/150)) ([c815421](https://www.github.com/googleapis/python-bigtable/commit/c815421422f1c845983e174651a5292767cfe2e7))
+
+## [1.5.0](https://www.github.com/googleapis/python-bigtable/compare/v1.4.0...v1.5.0) (2020-09-22)
+
+
+### Features
+
+* add 'Rowset.add_row_range_with_prefix' ([#30](https://www.github.com/googleapis/python-bigtable/issues/30)) ([4796ac8](https://www.github.com/googleapis/python-bigtable/commit/4796ac85c877d75ed596cde7628dae31918ef726))
+* add response status to DirectRow.commit() ([#128](https://www.github.com/googleapis/python-bigtable/issues/128)) ([2478bb8](https://www.github.com/googleapis/python-bigtable/commit/2478bb864adbc71ef606e2b10b3bdfe3a7d44717)), closes [#127](https://www.github.com/googleapis/python-bigtable/issues/127)
+* pass 'client_options' to base class ctor ([#104](https://www.github.com/googleapis/python-bigtable/issues/104)) ([e55ca07](https://www.github.com/googleapis/python-bigtable/commit/e55ca07561f9c946276f3bde599e69947769f560)), closes [#69](https://www.github.com/googleapis/python-bigtable/issues/69)
+
+
+### Bug Fixes
+
+* pass timeout to 'PartialRowsData.response_iterator' ([#16](https://www.github.com/googleapis/python-bigtable/issues/16)) ([8f76434](https://www.github.com/googleapis/python-bigtable/commit/8f764343e01d50ad880363f5a4e5630122cbdb25))
+* retry if failure occurs on initial call in MutateRows ([#123](https://www.github.com/googleapis/python-bigtable/issues/123)) ([0c9cde8](https://www.github.com/googleapis/python-bigtable/commit/0c9cde8ade0e4f50d06bbbd1b4169ae5c545b2c0))
+* **python_samples:** README link fix, enforce samples=True ([#114](https://www.github.com/googleapis/python-bigtable/issues/114)) ([dfe658a](https://www.github.com/googleapis/python-bigtable/commit/dfe658a2b1270eda7a8a084aca28d65b3297a04f))
+
+
+### Documentation
+
+* add sample for writing data with Beam ([#80](https://www.github.com/googleapis/python-bigtable/issues/80)) ([6900290](https://www.github.com/googleapis/python-bigtable/commit/6900290e00daf04ca545284b3f0a591a2de11136))
+* clarify 'Table.read_rows' snippet ([#50](https://www.github.com/googleapis/python-bigtable/issues/50)) ([5ca8bbd](https://www.github.com/googleapis/python-bigtable/commit/5ca8bbd0fb9c4a7cef7b4cbb67d1ba9f2382f2d8))
+* document 'row_set' module explicitly ([#29](https://www.github.com/googleapis/python-bigtable/issues/29)) ([0e0291e](https://www.github.com/googleapis/python-bigtable/commit/0e0291e56cbaeec00ede5275e17af2968a12251c))
+* Pysamples new readme gen ([#112](https://www.github.com/googleapis/python-bigtable/issues/112)) ([3ecca7a](https://www.github.com/googleapis/python-bigtable/commit/3ecca7a7b52b0f4fc38db5c5016622b994c1a8aa))
+* remove indent from snippet code blocks ([#49](https://www.github.com/googleapis/python-bigtable/issues/49)) ([1fbadf9](https://www.github.com/googleapis/python-bigtable/commit/1fbadf906204c622b9cff3fa073d8fc43d3597f7))
+* switch links to client documentation ([#93](https://www.github.com/googleapis/python-bigtable/issues/93)) ([2c973e6](https://www.github.com/googleapis/python-bigtable/commit/2c973e6cce969e7003be0b3d7a164bdc61b91ef1))
+* update docs build (via synth) ([#99](https://www.github.com/googleapis/python-bigtable/issues/99)) ([c301b53](https://www.github.com/googleapis/python-bigtable/commit/c301b53db4f7d48fd76548a5cd3a01cc46ff1522)), closes [#700](https://www.github.com/googleapis/python-bigtable/issues/700)
+* update links to reflect new Github org ([#48](https://www.github.com/googleapis/python-bigtable/issues/48)) ([9bb11ed](https://www.github.com/googleapis/python-bigtable/commit/9bb11edc885958286b5b31fa18cfd0db95338cb4))
+* use correct storage type constant in docstrings ([#110](https://www.github.com/googleapis/python-bigtable/issues/110)) ([bc6db77](https://www.github.com/googleapis/python-bigtable/commit/bc6db77809a89fd6f3b2095cfe9b84d2da1bf304))
+* **samples:** filter cpu query to get metrics for the correct resources [([#4238](https://www.github.com/googleapis/python-bigtable/issues/4238))](https://github.com/GoogleCloudPlatform/python-docs-samples/issues/4238) ([#81](https://www.github.com/googleapis/python-bigtable/issues/81)) ([2c8c386](https://www.github.com/googleapis/python-bigtable/commit/2c8c3864c43a7ac9c85a0cd7c9cd4eec7434b42d))
+
+## [1.4.0](https://www.github.com/googleapis/python-bigtable/compare/v1.3.0...v1.4.0) (2020-07-21)
+
+
+### Features
+
+* **bigtable:** Managed Backups wrappers ([#57](https://www.github.com/googleapis/python-bigtable/issues/57)) ([a351734](https://www.github.com/googleapis/python-bigtable/commit/a351734ae16b4a689b89e6a42f63ea3ea5ad84ca))
+
+## [1.3.0](https://www.github.com/googleapis/python-bigtable/compare/v1.2.1...v1.3.0) (2020-07-16)
+
+
+### Features
+
+* **api_core:** support version 3 policy bindings ([#9869](https://www.github.com/googleapis/python-bigtable/issues/9869)) ([a9dee32](https://www.github.com/googleapis/python-bigtable/commit/a9dee327ab39e22a014b3c4126f1c9d1beebe2d1))
+* **bigtable:** add py2 deprecation warnings; standardize use of 'required' in docstrings (via synth) ([#10064](https://www.github.com/googleapis/python-bigtable/issues/10064)) ([5460de0](https://www.github.com/googleapis/python-bigtable/commit/5460de0f7e0d936a23289f679c2b1a3040a21247))
+* Create CODEOWNERS ([#27](https://www.github.com/googleapis/python-bigtable/issues/27)) ([2b63746](https://www.github.com/googleapis/python-bigtable/commit/2b6374600d911b3dfd567eafd964260eb00a2bc0))
+* **bigtable:** skip system tests failing with emulator ([#18](https://www.github.com/googleapis/python-bigtable/issues/18)) ([399d3d3](https://www.github.com/googleapis/python-bigtable/commit/399d3d3f960786f616ab6085f142a9703b0391e0))
+* **bigtable:** support requested_policy_version for Instance IAM ([#10001](https://www.github.com/googleapis/python-bigtable/issues/10001)) ([7e5d963](https://www.github.com/googleapis/python-bigtable/commit/7e5d963857fd8f7547778d5247b53c24de7a43f6)), closes [#3](https://www.github.com/googleapis/python-bigtable/issues/3)
+* update gapic-generator and go microgen, backups generated api ([#55](https://www.github.com/googleapis/python-bigtable/issues/55)) ([c38888d](https://www.github.com/googleapis/python-bigtable/commit/c38888de3d0b1c49c438a7d350f42bc1805809f2))
+
+
+### Bug Fixes
+
+* localdeps ([5d799b2](https://www.github.com/googleapis/python-bigtable/commit/5d799b2d99e79ee9d20ae6cf2663d670493a8db3))
+* test_utils ([43481a9](https://www.github.com/googleapis/python-bigtable/commit/43481a91275e93fadd22eaa7cba3891a00cb97f8))
+* **python:** change autodoc_default_flags to autodoc_default_options ([#58](https://www.github.com/googleapis/python-bigtable/issues/58)) ([5c1d618](https://www.github.com/googleapis/python-bigtable/commit/5c1d61827618d254c453b3871c0022a8d35bfbb2))
+
+
+### Documentation
+
+* add note about multiprocessing usage ([#26](https://www.github.com/googleapis/python-bigtable/issues/26)) ([1449589](https://www.github.com/googleapis/python-bigtable/commit/1449589e8b5b9037dae4e9b071ff7e7662992e18))
+* **bigtable:** clean up ([#32](https://www.github.com/googleapis/python-bigtable/issues/32)) ([9f4068c](https://www.github.com/googleapis/python-bigtable/commit/9f4068cf8eb4351c02a4862380547ecf2564d838))
+* add samples from bigtable ([#38](https://www.github.com/googleapis/python-bigtable/issues/38)) ([1121f0d](https://www.github.com/googleapis/python-bigtable/commit/1121f0d647dbfc6c70a459b0979465803fdfad7b)), closes [#371](https://www.github.com/googleapis/python-bigtable/issues/371) [#383](https://www.github.com/googleapis/python-bigtable/issues/383) [#383](https://www.github.com/googleapis/python-bigtable/issues/383) [#456](https://www.github.com/googleapis/python-bigtable/issues/456) [#456](https://www.github.com/googleapis/python-bigtable/issues/456) [#540](https://www.github.com/googleapis/python-bigtable/issues/540) [#540](https://www.github.com/googleapis/python-bigtable/issues/540) [#542](https://www.github.com/googleapis/python-bigtable/issues/542) [#542](https://www.github.com/googleapis/python-bigtable/issues/542) [#544](https://www.github.com/googleapis/python-bigtable/issues/544) [#544](https://www.github.com/googleapis/python-bigtable/issues/544) [#576](https://www.github.com/googleapis/python-bigtable/issues/576) [#599](https://www.github.com/googleapis/python-bigtable/issues/599) [#599](https://www.github.com/googleapis/python-bigtable/issues/599) [#656](https://www.github.com/googleapis/python-bigtable/issues/656) [#715](https://www.github.com/googleapis/python-bigtable/issues/715) [#715](https://www.github.com/googleapis/python-bigtable/issues/715) [#781](https://www.github.com/googleapis/python-bigtable/issues/781) [#781](https://www.github.com/googleapis/python-bigtable/issues/781) [#887](https://www.github.com/googleapis/python-bigtable/issues/887) [#887](https://www.github.com/googleapis/python-bigtable/issues/887) [#914](https://www.github.com/googleapis/python-bigtable/issues/914) [#914](https://www.github.com/googleapis/python-bigtable/issues/914) [#922](https://www.github.com/googleapis/python-bigtable/issues/922) [#922](https://www.github.com/googleapis/python-bigtable/issues/922) [#962](https://www.github.com/googleapis/python-bigtable/issues/962) [#962](https://www.github.com/googleapis/python-bigtable/issues/962) [#1004](https://www.github.com/googleapis/python-bigtable/issues/1004) [#1004](https://www.github.com/googleapis/python-bigtable/issues/1004) [#1003](https://www.github.com/googleapis/python-bigtable/issues/1003) [#1005](https://www.github.com/googleapis/python-bigtable/issues/1005) [#1005](https://www.github.com/googleapis/python-bigtable/issues/1005) [#1028](https://www.github.com/googleapis/python-bigtable/issues/1028) [#1055](https://www.github.com/googleapis/python-bigtable/issues/1055) [#1055](https://www.github.com/googleapis/python-bigtable/issues/1055) [#1055](https://www.github.com/googleapis/python-bigtable/issues/1055) [#1057](https://www.github.com/googleapis/python-bigtable/issues/1057) [#1093](https://www.github.com/googleapis/python-bigtable/issues/1093) [#1093](https://www.github.com/googleapis/python-bigtable/issues/1093) [#1093](https://www.github.com/googleapis/python-bigtable/issues/1093) [#1094](https://www.github.com/googleapis/python-bigtable/issues/1094) [#1094](https://www.github.com/googleapis/python-bigtable/issues/1094) [#1121](https://www.github.com/googleapis/python-bigtable/issues/1121) [#1121](https://www.github.com/googleapis/python-bigtable/issues/1121) [#1121](https://www.github.com/googleapis/python-bigtable/issues/1121) [#1156](https://www.github.com/googleapis/python-bigtable/issues/1156) [#1158](https://www.github.com/googleapis/python-bigtable/issues/1158) [#1158](https://www.github.com/googleapis/python-bigtable/issues/1158) [#1158](https://www.github.com/googleapis/python-bigtable/issues/1158) [#1186](https://www.github.com/googleapis/python-bigtable/issues/1186) [#1186](https://www.github.com/googleapis/python-bigtable/issues/1186) [#1186](https://www.github.com/googleapis/python-bigtable/issues/1186) [#1199](https://www.github.com/googleapis/python-bigtable/issues/1199) [#1199](https://www.github.com/googleapis/python-bigtable/issues/1199) [#1199](https://www.github.com/googleapis/python-bigtable/issues/1199) [#1254](https://www.github.com/googleapis/python-bigtable/issues/1254) [#1254](https://www.github.com/googleapis/python-bigtable/issues/1254) [#1254](https://www.github.com/googleapis/python-bigtable/issues/1254) [#1377](https://www.github.com/googleapis/python-bigtable/issues/1377) [#1377](https://www.github.com/googleapis/python-bigtable/issues/1377) [#1377](https://www.github.com/googleapis/python-bigtable/issues/1377) [#1441](https://www.github.com/googleapis/python-bigtable/issues/1441) [#1441](https://www.github.com/googleapis/python-bigtable/issues/1441) [#1441](https://www.github.com/googleapis/python-bigtable/issues/1441) [#1464](https://www.github.com/googleapis/python-bigtable/issues/1464) [#1464](https://www.github.com/googleapis/python-bigtable/issues/1464) [#1464](https://www.github.com/googleapis/python-bigtable/issues/1464) [#1549](https://www.github.com/googleapis/python-bigtable/issues/1549) [#1562](https://www.github.com/googleapis/python-bigtable/issues/1562) [#1555](https://www.github.com/googleapis/python-bigtable/issues/1555) [#1616](https://www.github.com/googleapis/python-bigtable/issues/1616) [#1616](https://www.github.com/googleapis/python-bigtable/issues/1616) [#1665](https://www.github.com/googleapis/python-bigtable/issues/1665) [#1670](https://www.github.com/googleapis/python-bigtable/issues/1670) [#1664](https://www.github.com/googleapis/python-bigtable/issues/1664) [#1674](https://www.github.com/googleapis/python-bigtable/issues/1674) [#1755](https://www.github.com/googleapis/python-bigtable/issues/1755) [#1755](https://www.github.com/googleapis/python-bigtable/issues/1755) [#1755](https://www.github.com/googleapis/python-bigtable/issues/1755) [#1764](https://www.github.com/googleapis/python-bigtable/issues/1764) [#1764](https://www.github.com/googleapis/python-bigtable/issues/1764) [#1770](https://www.github.com/googleapis/python-bigtable/issues/1770) [#1794](https://www.github.com/googleapis/python-bigtable/issues/1794) [#1846](https://www.github.com/googleapis/python-bigtable/issues/1846) [#1846](https://www.github.com/googleapis/python-bigtable/issues/1846) [#1846](https://www.github.com/googleapis/python-bigtable/issues/1846) [#1846](https://www.github.com/googleapis/python-bigtable/issues/1846) [#1846](https://www.github.com/googleapis/python-bigtable/issues/1846) [#1846](https://www.github.com/googleapis/python-bigtable/issues/1846) [#1878](https://www.github.com/googleapis/python-bigtable/issues/1878) [#1890](https://www.github.com/googleapis/python-bigtable/issues/1890) [#1980](https://www.github.com/googleapis/python-bigtable/issues/1980) [#1980](https://www.github.com/googleapis/python-bigtable/issues/1980) [#1980](https://www.github.com/googleapis/python-bigtable/issues/1980) [#1980](https://www.github.com/googleapis/python-bigtable/issues/1980) [#1980](https://www.github.com/googleapis/python-bigtable/issues/1980) [#1980](https://www.github.com/googleapis/python-bigtable/issues/1980) [#1980](https://www.github.com/googleapis/python-bigtable/issues/1980) [#2057](https://www.github.com/googleapis/python-bigtable/issues/2057) [#2057](https://www.github.com/googleapis/python-bigtable/issues/2057) [#2054](https://www.github.com/googleapis/python-bigtable/issues/2054) [#2054](https://www.github.com/googleapis/python-bigtable/issues/2054) [#2018](https://www.github.com/googleapis/python-bigtable/issues/2018) [#2018](https://www.github.com/googleapis/python-bigtable/issues/2018) [#2224](https://www.github.com/googleapis/python-bigtable/issues/2224) [#2201](https://www.github.com/googleapis/python-bigtable/issues/2201) [#2436](https://www.github.com/googleapis/python-bigtable/issues/2436) [#2436](https://www.github.com/googleapis/python-bigtable/issues/2436) [#2436](https://www.github.com/googleapis/python-bigtable/issues/2436) [#2436](https://www.github.com/googleapis/python-bigtable/issues/2436) [#2436](https://www.github.com/googleapis/python-bigtable/issues/2436) [#2436](https://www.github.com/googleapis/python-bigtable/issues/2436) [#2436](https://www.github.com/googleapis/python-bigtable/issues/2436) [#2005](https://www.github.com/googleapis/python-bigtable/issues/2005) [#2005](https://www.github.com/googleapis/python-bigtable/issues/2005) [#2005](https://www.github.com/googleapis/python-bigtable/issues/2005) [#2005](https://www.github.com/googleapis/python-bigtable/issues/2005) [#2005](https://www.github.com/googleapis/python-bigtable/issues/2005) [#2692](https://www.github.com/googleapis/python-bigtable/issues/2692) [#2692](https://www.github.com/googleapis/python-bigtable/issues/2692) [#2692](https://www.github.com/googleapis/python-bigtable/issues/2692) [#2692](https://www.github.com/googleapis/python-bigtable/issues/2692) [#2692](https://www.github.com/googleapis/python-bigtable/issues/2692) [#2692](https://www.github.com/googleapis/python-bigtable/issues/2692) [#2692](https://www.github.com/googleapis/python-bigtable/issues/2692) [#2692](https://www.github.com/googleapis/python-bigtable/issues/2692) [#3066](https://www.github.com/googleapis/python-bigtable/issues/3066) [#2707](https://www.github.com/googleapis/python-bigtable/issues/2707) [#3103](https://www.github.com/googleapis/python-bigtable/issues/3103) [#2806](https://www.github.com/googleapis/python-bigtable/issues/2806) [#2806](https://www.github.com/googleapis/python-bigtable/issues/2806) [#2806](https://www.github.com/googleapis/python-bigtable/issues/2806) [#2806](https://www.github.com/googleapis/python-bigtable/issues/2806) [#2806](https://www.github.com/googleapis/python-bigtable/issues/2806) [#2806](https://www.github.com/googleapis/python-bigtable/issues/2806) [#2806](https://www.github.com/googleapis/python-bigtable/issues/2806) [#2806](https://www.github.com/googleapis/python-bigtable/issues/2806) [#3459](https://www.github.com/googleapis/python-bigtable/issues/3459) [#3494](https://www.github.com/googleapis/python-bigtable/issues/3494) [#3070](https://www.github.com/googleapis/python-bigtable/issues/3070) [#3119](https://www.github.com/googleapis/python-bigtable/issues/3119) [#3738](https://www.github.com/googleapis/python-bigtable/issues/3738) [#3738](https://www.github.com/googleapis/python-bigtable/issues/3738) [#3738](https://www.github.com/googleapis/python-bigtable/issues/3738) [#3739](https://www.github.com/googleapis/python-bigtable/issues/3739) [#3739](https://www.github.com/googleapis/python-bigtable/issues/3739) [#3740](https://www.github.com/googleapis/python-bigtable/issues/3740) [#3783](https://www.github.com/googleapis/python-bigtable/issues/3783) [#3877](https://www.github.com/googleapis/python-bigtable/issues/3877)
+* **bigtable:** fix incorrect display_name update ([#46](https://www.github.com/googleapis/python-bigtable/issues/46)) ([1ac60be](https://www.github.com/googleapis/python-bigtable/commit/1ac60be05521b69c924118d40f88e07728a2f75e))
+* **bigtable:** remove missing argument from instance declaration ([#47](https://www.github.com/googleapis/python-bigtable/issues/47)) ([c966647](https://www.github.com/googleapis/python-bigtable/commit/c9666475dc31d581fdac0fc1c65e75ee9e27d832)), closes [#42](https://www.github.com/googleapis/python-bigtable/issues/42)
+
## 1.2.1
01-03-2020 10:05 PST
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
index b3d1f6029..039f43681 100644
--- a/CODE_OF_CONDUCT.md
+++ b/CODE_OF_CONDUCT.md
@@ -1,44 +1,95 @@
-# Contributor Code of Conduct
+# 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.
+## Our Pledge
-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.
+In the interest of fostering an open and welcoming environment, we as
+contributors and maintainers pledge to making participation in our project and
+our community a harassment-free experience for everyone, regardless of age, body
+size, disability, ethnicity, gender identity and expression, level of
+experience, education, socio-economic status, nationality, personal appearance,
+race, religion, or sexual identity and orientation.
+
+## Our Standards
+
+Examples of behavior that contributes to creating a positive environment
+include:
+
+* Using welcoming and inclusive language
+* Being respectful of differing viewpoints and experiences
+* Gracefully accepting constructive criticism
+* Focusing on what is best for the community
+* Showing empathy towards other community members
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.
+* The use of sexualized language or imagery and unwelcome sexual attention or
+ advances
+* Trolling, insulting/derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or electronic
+ address, without explicit permission
+* Other conduct which could reasonably be considered inappropriate in a
+ professional setting
+
+## Our Responsibilities
+
+Project maintainers are responsible for clarifying the standards of acceptable
+behavior and are expected to take appropriate and fair corrective action in
+response to any instances of unacceptable behavior.
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/)
+comments, commits, code, wiki edits, issues, and other contributions that are
+not aligned to this Code of Conduct, or to ban temporarily or permanently any
+contributor for other behaviors that they deem inappropriate, threatening,
+offensive, or harmful.
+
+## Scope
+
+This Code of Conduct applies both within project spaces and in public spaces
+when an individual is representing the project or its community. Examples of
+representing a project or community include using an official project e-mail
+address, posting via an official social media account, or acting as an appointed
+representative at an online or offline event. Representation of a project may be
+further defined and clarified by project maintainers.
+
+This Code of Conduct also applies outside the project spaces when the Project
+Steward has a reasonable belief that an individual's behavior may have a
+negative impact on the project or its community.
+
+## Conflict Resolution
+
+We do not believe that all conflict is bad; healthy debate and disagreement
+often yield positive results. However, it is never okay to be disrespectful or
+to engage in behavior that violates the project’s code of conduct.
+
+If you see someone violating the code of conduct, you are encouraged to address
+the behavior directly with those involved. Many issues can be resolved quickly
+and easily, and this gives people more control over the outcome of their
+dispute. If you are unable to resolve the matter for any reason, or if the
+behavior is threatening or harassing, report it. We are dedicated to providing
+an environment where participants feel welcome and safe.
+
+
+Reports should be directed to *googleapis-stewards@google.com*, the
+Project Steward(s) for *Google Cloud Client Libraries*. It is the Project Steward’s duty to
+receive and address reported violations of the code of conduct. They will then
+work with a committee consisting of representatives from the Open Source
+Programs Office and the Google Open Source Strategy team. If for any reason you
+are uncomfortable reaching out to the Project Steward, please email
+opensource@google.com.
+
+We will investigate every complaint, but you may not receive a direct response.
+We will use our discretion in determining when and how to follow up on reported
+incidents, which may range from not taking action to permanent expulsion from
+the project and project-sponsored spaces. We will notify the accused of the
+report and provide them an opportunity to discuss it before any action is taken.
+The identity of the reporter will be omitted from the details of the report
+supplied to the accused. In potentially harmful situations, such as ongoing
+harassment or threats to anyone's safety, we may take action without notice.
+
+## Attribution
+
+This Code of Conduct is adapted from the Contributor Covenant, version 1.4,
+available at
+https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
\ No newline at end of file
diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst
index 5d9a099ac..07ac8f218 100644
--- a/CONTRIBUTING.rst
+++ b/CONTRIBUTING.rst
@@ -21,8 +21,8 @@ In order to add a feature:
- The feature must be documented in both the API and narrative
documentation.
-- The feature must work fully on the following CPython versions: 2.7,
- 3.5, 3.6, 3.7 and 3.8 on both UNIX and Windows.
+- The feature must work fully on the following CPython versions:
+ 3.7, 3.8, 3.9, 3.10, 3.11, 3.12, 3.13 and 3.14 on both UNIX and Windows.
- The feature must not add unnecessary dependencies (where
"unnecessary" is of course subjective, but new dependencies should
@@ -50,9 +50,9 @@ You'll have to create a development environment using a Git checkout:
# Configure remotes such that you can pull changes from the googleapis/python-bigtable
# repository into your local repository.
$ git remote add upstream git@github.com:googleapis/python-bigtable.git
- # fetch and merge changes from upstream into master
+ # fetch and merge changes from upstream into main
$ git fetch upstream
- $ git merge upstream/master
+ $ git merge upstream/main
Now your local repo is set up such that you will push changes to your GitHub
repo, from which you can submit a pull request.
@@ -68,10 +68,12 @@ Using ``nox``
We use `nox `__ to instrument our tests.
- To test your changes, run unit tests with ``nox``::
+ $ nox -s unit
+
+- To run a single unit test::
+
+ $ nox -s unit-3.14 -- -k
- $ nox -s unit-2.7
- $ nox -s unit-3.7
- $ ...
.. note::
@@ -80,25 +82,6 @@ We use `nox `__ to instrument our tests.
.. nox: https://pypi.org/project/nox/
-Note on Editable Installs / Develop Mode
-========================================
-
-- As mentioned previously, using ``setuptools`` in `develop mode`_
- or a ``pip`` `editable install`_ is not possible with this
- library. This is because this library uses `namespace packages`_.
- For context see `Issue #2316`_ and the relevant `PyPA issue`_.
-
- Since ``editable`` / ``develop`` mode can't be used, packages
- need to be installed directly. Hence your changes to the source
- tree don't get incorporated into the **already installed**
- package.
-
-.. _namespace packages: https://www.python.org/dev/peps/pep-0420/
-.. _Issue #2316: https://github.com/GoogleCloudPlatform/google-cloud-python/issues/2316
-.. _PyPA issue: https://github.com/pypa/packaging-problems/issues/12
-.. _develop mode: https://setuptools.readthedocs.io/en/latest/setuptools.html#development-mode
-.. _editable install: https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs
-
*****************************************
I'm getting weird errors... Can you help?
*****************************************
@@ -112,8 +95,12 @@ On Debian/Ubuntu::
************
Coding Style
************
+- We use the automatic code formatter ``black``. You can run it using
+ the nox session ``blacken``. This will eliminate many lint errors. Run via::
-- PEP8 compliance, with exceptions defined in the linter configuration.
+ $ nox -s blacken
+
+- PEP8 compliance is required, with exceptions defined in the linter configuration.
If you have ``nox`` installed, you can test that you have not introduced
any non-compliant code via::
@@ -123,12 +110,22 @@ Coding Style
variables::
export GOOGLE_CLOUD_TESTING_REMOTE="upstream"
- export GOOGLE_CLOUD_TESTING_BRANCH="master"
+ export GOOGLE_CLOUD_TESTING_BRANCH="main"
By doing this, you are specifying the location of the most up-to-date
- version of ``python-bigtable``. The the suggested remote name ``upstream``
- should point to the official ``googleapis`` checkout and the
- the branch should be the main branch on that remote (``master``).
+ version of ``python-bigtable``. The
+ remote name ``upstream`` should point to the official ``googleapis``
+ checkout and the branch should be the default branch on that remote (``main``).
+
+- This repository contains configuration for the
+ `pre-commit `__ tool, which automates checking
+ our linters during a commit. If you have it installed on your ``$PATH``,
+ you can enable enforcing those checks via:
+
+.. code-block:: bash
+
+ $ pre-commit install
+ pre-commit installed at .git/hooks/pre-commit
Exceptions to PEP8:
@@ -142,34 +139,23 @@ Running System Tests
- To run system tests, you can execute::
- $ nox -s system-3.7
- $ nox -s system-2.7
+ # Run all system tests
+ $ nox -s system
+
+ # Run a single system test
+ $ nox -s system-3.9 -- -k
+
.. note::
- System tests are only configured to run under Python 2.7 and
- Python 3.7. For expediency, we do not run them in older versions
- of Python 3.
+ System tests are only configured to run under Python 3.9.
+ For expediency, we do not run them in older versions of Python 3.
This alone will not run the tests. You'll need to change some local
auth settings and change some configuration in your project to
run all the tests.
-- System tests will be run against an actual project and
- so you'll need to provide some environment variables to facilitate
- authentication to your project:
-
- - ``GOOGLE_APPLICATION_CREDENTIALS``: The path to a JSON key file;
- Such a file can be downloaded directly from the developer's console by clicking
- "Generate new JSON key". See private key
- `docs `__
- for more details.
-
-- Once you have downloaded your json keys, set the environment variable
- ``GOOGLE_APPLICATION_CREDENTIALS`` to the absolute path of the json file::
-
- $ export GOOGLE_APPLICATION_CREDENTIALS="/Users//path/to/app_credentials.json"
-
+- System tests will be run against an actual project. You should use local credentials from gcloud when possible. See `Best practices for application authentication `__. Some tests require a service account. For those tests see `Authenticating as a service account `__.
*************
Test Coverage
@@ -191,6 +177,30 @@ Build the docs via:
$ nox -s docs
+*************************
+Samples and code snippets
+*************************
+
+Code samples and snippets live in the `samples/` catalogue. Feel free to
+provide more examples, but make sure to write tests for those examples.
+Each folder containing example code requires its own `noxfile.py` script
+which automates testing. If you decide to create a new folder, you can
+base it on the `samples/snippets` folder (providing `noxfile.py` and
+the requirements files).
+
+The tests will run against a real Google Cloud Project, so you should
+configure them just like the System Tests.
+
+- To run sample tests, you can execute::
+
+ # Run all tests in a folder
+ $ cd samples/snippets
+ $ nox -s py-3.8
+
+ # Run a single sample test
+ $ cd samples/snippets
+ $ nox -s py-3.8 -- -k
+
********************************************
Note About ``README`` as it pertains to PyPI
********************************************
@@ -199,7 +209,7 @@ The `description on PyPI`_ for the project comes directly from the
``README``. Due to the reStructuredText (``rst``) parser used by
PyPI, relative links which will work on GitHub (e.g. ``CONTRIBUTING.rst``
instead of
-``https://github.com/googleapis/python-bigtable/blob/master/CONTRIBUTING.rst``)
+``https://github.com/googleapis/python-bigtable/blob/main/CONTRIBUTING.rst``)
may cause problems creating links or rendering the description.
.. _description on PyPI: https://pypi.org/project/google-cloud-bigtable
@@ -211,25 +221,32 @@ Supported Python Versions
We support:
-- `Python 3.5`_
-- `Python 3.6`_
- `Python 3.7`_
- `Python 3.8`_
+- `Python 3.9`_
+- `Python 3.10`_
+- `Python 3.11`_
+- `Python 3.12`_
+- `Python 3.13`_
+- `Python 3.14`_
-.. _Python 3.5: https://docs.python.org/3.5/
-.. _Python 3.6: https://docs.python.org/3.6/
.. _Python 3.7: https://docs.python.org/3.7/
.. _Python 3.8: https://docs.python.org/3.8/
+.. _Python 3.9: https://docs.python.org/3.9/
+.. _Python 3.10: https://docs.python.org/3.10/
+.. _Python 3.11: https://docs.python.org/3.11/
+.. _Python 3.12: https://docs.python.org/3.12/
+.. _Python 3.13: https://docs.python.org/3.13/
+.. _Python 3.14: https://docs.python.org/3.14/
Supported versions can be found in our ``noxfile.py`` `config`_.
-.. _config: https://github.com/googleapis/python-bigtable/blob/master/noxfile.py
+.. _config: https://github.com/googleapis/python-bigtable/blob/main/noxfile.py
-Python 2.7 support is deprecated. All code changes should maintain Python 2.7 compatibility until January 1, 2020.
-We also explicitly decided to support Python 3 beginning with version
-3.5. Reasons for this include:
+We also explicitly decided to support Python 3 beginning with version 3.7.
+Reasons for this include:
- Encouraging use of newest versions of Python 3
- Taking the lead of `prominent`_ open-source `projects`_
diff --git a/LICENSE b/LICENSE
index a8ee855de..d64569567 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,7 @@
- Apache License
+
+ Apache License
Version 2.0, January 2004
- https://www.apache.org/licenses/
+ http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
@@ -192,7 +193,7 @@
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
- https://www.apache.org/licenses/LICENSE-2.0
+ http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
diff --git a/MANIFEST.in b/MANIFEST.in
index e9e29d120..d6814cd60 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
-# Copyright 2020 Google LLC
+# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -16,10 +16,10 @@
# Generated by synthtool. DO NOT EDIT!
include README.rst LICENSE
-recursive-include google *.json *.proto
+recursive-include google *.json *.proto py.typed
recursive-include tests *
global-exclude *.py[co]
global-exclude __pycache__
# Exclude scripts for samples readmegen
-prune scripts/readme-gen
\ No newline at end of file
+prune scripts/readme-gen
diff --git a/README.rst b/README.rst
index 5330d2316..823b52c88 100644
--- a/README.rst
+++ b/README.rst
@@ -1,3 +1,7 @@
+:**NOTE**: **This github repository is archived. The repository contents and history have moved to** `google-cloud-python`_.
+
+.. _google-cloud-python: https://github.com/googleapis/google-cloud-python/tree/main/packages/google-cloud-bigtable
+
Python Client for Google Cloud Bigtable
=======================================
@@ -11,7 +15,7 @@ Analytics, Maps, and Gmail.
- `Product Documentation`_
.. |GA| image:: https://img.shields.io/badge/support-GA-gold.svg
- :target: https://github.com/googleapis/google-cloud-python/blob/master/README.rst#general-availability
+ :target: https://github.com/googleapis/google-cloud-python/blob/main/README.rst#general-availability
.. |pypi| image:: https://img.shields.io/pypi/v/google-cloud-bigtable.svg
:target: https://pypi.org/project/google-cloud-bigtable/
.. |versions| image:: https://img.shields.io/pypi/pyversions/google-cloud-bigtable.svg
@@ -20,6 +24,30 @@ Analytics, Maps, and Gmail.
.. _Client Library Documentation: https://googleapis.dev/python/bigtable/latest
.. _Product Documentation: https://cloud.google.com/bigtable/docs
+
+Async Data Client
+-------------------------
+
+:code:`v2.23.0` includes a release of the new :code:`BigtableDataClientAsync` client, accessible at the import path
+:code:`google.cloud.bigtable.data`.
+
+The new client brings a simplified API and increased performance using asyncio.
+The new client is focused on the data API (i.e. reading and writing Bigtable data), with admin operations
+remaining exclusively in the existing synchronous client.
+
+Feedback and bug reports are welcome at cbt-python-client-v3-feedback@google.com,
+or through the Github `issue tracker`_.
+
+
+ .. note::
+
+ It is generally not recommended to use the async client in an otherwise synchronous codebase. To make use of asyncio's
+ performance benefits, the codebase should be designed to be async from the ground up.
+
+
+.. _issue tracker: https://github.com/googleapis/python-bigtable/issues
+
+
Quick Start
-----------
@@ -51,12 +79,20 @@ dependencies.
Supported Python Versions
^^^^^^^^^^^^^^^^^^^^^^^^^
-Python >= 3.5
+
+Python >= 3.7
Deprecated Python Versions
^^^^^^^^^^^^^^^^^^^^^^^^^^
-Python == 2.7. Python 2.7 support will be removed on January 1, 2020.
+- Python 2.7: the last released version which supported Python 2.7 was
+ version 1.7.0, released 2021-02-09.
+
+- Python 3.5: the last released version which supported Python 3.5 was
+ version 1.7.0, released 2021-02-09.
+
+- Python 3.6: the last released version which supported Python 3.6 was
+ version v2.10.1, released 2022-06-03.
Mac/Linux
^^^^^^^^^
@@ -86,14 +122,3 @@ Next Steps
to see other available methods on the client.
- Read the `Product documentation`_ to learn
more about the product and see How-to Guides.
-
-``google-cloud-happybase``
---------------------------
-
-In addition to the core ``google-cloud-bigtable``, we provide a
-`google-cloud-happybase
-`__ library
-with the same interface as the popular `HappyBase
-`__ library. Unlike HappyBase,
-``google-cloud-happybase`` uses ``google-cloud-bigtable`` under the covers,
-rather than Apache HBase.
diff --git a/SECURITY.md b/SECURITY.md
new file mode 100644
index 000000000..8b58ae9c0
--- /dev/null
+++ b/SECURITY.md
@@ -0,0 +1,7 @@
+# Security Policy
+
+To report a security issue, please use [g.co/vulnz](https://g.co/vulnz).
+
+The Google Security Team will respond within 5 working days of your report on g.co/vulnz.
+
+We use g.co/vulnz for our intake, and do coordination and disclosure here using GitHub Security Advisory to privately discuss and fix the issue.
diff --git a/docs/_static/custom.css b/docs/_static/custom.css
index 0abaf229f..b0a295464 100644
--- a/docs/_static/custom.css
+++ b/docs/_static/custom.css
@@ -1,4 +1,20 @@
div#python2-eol {
border-color: red;
border-width: medium;
-}
\ No newline at end of file
+}
+
+/* Ensure minimum width for 'Parameters' / 'Returns' column */
+dl.field-list > dt {
+ min-width: 100px
+}
+
+/* Insert space between methods for readability */
+dl.method {
+ padding-top: 10px;
+ padding-bottom: 10px
+}
+
+/* Insert empty space between classes */
+dl.class {
+ padding-bottom: 50px
+}
diff --git a/docs/admin_client/admin_client_usage.rst b/docs/admin_client/admin_client_usage.rst
new file mode 100644
index 000000000..8c6f4a5dc
--- /dev/null
+++ b/docs/admin_client/admin_client_usage.rst
@@ -0,0 +1,11 @@
+Admin Client
+============
+.. toctree::
+ :maxdepth: 2
+
+ services_
+ types_
+
+..
+ This should be the only handwritten RST file in this directory.
+ Everything else should be autogenerated.
diff --git a/docs/admin_client/bigtable_instance_admin.rst b/docs/admin_client/bigtable_instance_admin.rst
new file mode 100644
index 000000000..42f7caad7
--- /dev/null
+++ b/docs/admin_client/bigtable_instance_admin.rst
@@ -0,0 +1,10 @@
+BigtableInstanceAdmin
+---------------------------------------
+
+.. automodule:: google.cloud.bigtable_admin_v2.services.bigtable_instance_admin
+ :members:
+ :inherited-members:
+
+.. automodule:: google.cloud.bigtable_admin_v2.services.bigtable_instance_admin.pagers
+ :members:
+ :inherited-members:
diff --git a/docs/admin_client/bigtable_table_admin.rst b/docs/admin_client/bigtable_table_admin.rst
new file mode 100644
index 000000000..0fa4b276a
--- /dev/null
+++ b/docs/admin_client/bigtable_table_admin.rst
@@ -0,0 +1,10 @@
+BigtableTableAdmin
+------------------------------------
+
+.. automodule:: google.cloud.bigtable_admin_v2.overlay.services.bigtable_table_admin
+ :members:
+ :inherited-members:
+
+.. automodule:: google.cloud.bigtable_admin_v2.services.bigtable_table_admin.pagers
+ :members:
+ :inherited-members:
diff --git a/docs/admin_client/services_.rst b/docs/admin_client/services_.rst
new file mode 100644
index 000000000..ea55c7da1
--- /dev/null
+++ b/docs/admin_client/services_.rst
@@ -0,0 +1,7 @@
+Services for Google Cloud Bigtable Admin v2 API
+===============================================
+.. toctree::
+ :maxdepth: 2
+
+ bigtable_instance_admin
+ bigtable_table_admin
diff --git a/docs/admin_client/types_.rst b/docs/admin_client/types_.rst
new file mode 100644
index 000000000..ef32b9684
--- /dev/null
+++ b/docs/admin_client/types_.rst
@@ -0,0 +1,10 @@
+Types for Google Cloud Bigtable Admin v2 API
+============================================
+
+.. automodule:: google.cloud.bigtable_admin_v2.types
+ :members:
+ :show-inheritance:
+
+.. automodule:: google.cloud.bigtable_admin_v2.overlay.types
+ :members:
+ :show-inheritance:
diff --git a/docs/classic_client/app-profile.rst b/docs/classic_client/app-profile.rst
new file mode 100644
index 000000000..5c9d426c2
--- /dev/null
+++ b/docs/classic_client/app-profile.rst
@@ -0,0 +1,6 @@
+App Profile
+~~~~~~~~~~~
+
+.. automodule:: google.cloud.bigtable.app_profile
+ :members:
+ :show-inheritance:
diff --git a/docs/classic_client/backup.rst b/docs/classic_client/backup.rst
new file mode 100644
index 000000000..e75abd431
--- /dev/null
+++ b/docs/classic_client/backup.rst
@@ -0,0 +1,6 @@
+Backup
+~~~~~~~~
+
+.. automodule:: google.cloud.bigtable.backup
+ :members:
+ :show-inheritance:
diff --git a/docs/classic_client/batcher.rst b/docs/classic_client/batcher.rst
new file mode 100644
index 000000000..9ac335be1
--- /dev/null
+++ b/docs/classic_client/batcher.rst
@@ -0,0 +1,6 @@
+Mutations Batching
+~~~~~~~~~~~~~~~~~~
+
+.. automodule:: google.cloud.bigtable.batcher
+ :members:
+ :show-inheritance:
diff --git a/docs/client-intro.rst b/docs/classic_client/client-intro.rst
similarity index 89%
rename from docs/client-intro.rst
rename to docs/classic_client/client-intro.rst
index 6a3843779..242068499 100644
--- a/docs/client-intro.rst
+++ b/docs/classic_client/client-intro.rst
@@ -86,5 +86,5 @@ one before you can interact with tables or data.
Head next to learn about the :doc:`instance-api`.
-.. _Instance Admin: https://github.com/GoogleCloudPlatform/cloud-bigtable-client/tree/master/bigtable-protos/src/main/proto/google/bigtable/admin/instance/v1
-.. _Table Admin: https://github.com/GoogleCloudPlatform/cloud-bigtable-client/tree/master/bigtable-protos/src/main/proto/google/bigtable/admin/table/v1
+.. _Instance Admin: https://github.com/googleapis/python-bigtable/blob/main/google/cloud/bigtable_admin_v2/proto/bigtable_instance_admin.proto
+.. _Table Admin: https://github.com/googleapis/python-bigtable/blob/main/google/cloud/bigtable_admin_v2/proto/bigtable_table_admin.proto
diff --git a/docs/client.rst b/docs/classic_client/client.rst
similarity index 100%
rename from docs/client.rst
rename to docs/classic_client/client.rst
diff --git a/docs/cluster.rst b/docs/classic_client/cluster.rst
similarity index 100%
rename from docs/cluster.rst
rename to docs/classic_client/cluster.rst
diff --git a/docs/column-family.rst b/docs/classic_client/column-family.rst
similarity index 100%
rename from docs/column-family.rst
rename to docs/classic_client/column-family.rst
diff --git a/docs/data-api.rst b/docs/classic_client/data-api.rst
similarity index 90%
rename from docs/data-api.rst
rename to docs/classic_client/data-api.rst
index b50995be7..9b50e9ec9 100644
--- a/docs/data-api.rst
+++ b/docs/classic_client/data-api.rst
@@ -1,6 +1,13 @@
Data API
========
+.. note::
+ This page describes how to use the Data API with the synchronous Bigtable client.
+ Examples for using the Data API with the async client can be found in the
+ `Getting Started Guide`_.
+
+.. _Getting Started Guide: https://cloud.google.com/bigtable/docs/samples-python-hello
+
After creating a :class:`Table ` and some
column families, you are ready to store and retrieve data.
@@ -337,8 +344,8 @@ Just as with reading, the stream can be canceled:
keys_iterator.cancel()
-.. _ReadRows: https://github.com/GoogleCloudPlatform/cloud-bigtable-client/blob/2aae624081f652427052fb652d3ae43d8ac5bf5a/bigtable-protos/src/main/proto/google/bigtable/v1/bigtable_service.proto#L36-L38
-.. _SampleRowKeys: https://github.com/GoogleCloudPlatform/cloud-bigtable-client/blob/2aae624081f652427052fb652d3ae43d8ac5bf5a/bigtable-protos/src/main/proto/google/bigtable/v1/bigtable_service.proto#L44-L46
-.. _MutateRow: https://github.com/GoogleCloudPlatform/cloud-bigtable-client/blob/2aae624081f652427052fb652d3ae43d8ac5bf5a/bigtable-protos/src/main/proto/google/bigtable/v1/bigtable_service.proto#L50-L52
-.. _CheckAndMutateRow: https://github.com/GoogleCloudPlatform/cloud-bigtable-client/blob/2aae624081f652427052fb652d3ae43d8ac5bf5a/bigtable-protos/src/main/proto/google/bigtable/v1/bigtable_service.proto#L62-L64
-.. _ReadModifyWriteRow: https://github.com/GoogleCloudPlatform/cloud-bigtable-client/blob/2aae624081f652427052fb652d3ae43d8ac5bf5a/bigtable-protos/src/main/proto/google/bigtable/v1/bigtable_service.proto#L70-L72
+.. _ReadRows: https://github.com/googleapis/python-bigtable/blob/d6bff70654b41e31d2ac83d307bdc6bbd111201e/google/cloud/bigtable_v2/types/bigtable.py#L42-L72
+.. _SampleRowKeys: https://github.com/googleapis/python-bigtable/blob/d6bff70654b41e31d2ac83d307bdc6bbd111201e/google/cloud/bigtable_v2/types/bigtable.py#L184-L199
+.. _MutateRow: https://github.com/googleapis/python-bigtable/blob/d6bff70654b41e31d2ac83d307bdc6bbd111201e/google/cloud/bigtable_v2/types/bigtable.py#L230-L256
+.. _CheckAndMutateRow: https://github.com/googleapis/python-bigtable/blob/d6bff70654b41e31d2ac83d307bdc6bbd111201e/google/cloud/bigtable_v2/types/bigtable.py#L339-L386
+.. _ReadModifyWriteRow: https://github.com/googleapis/python-bigtable/blob/d6bff70654b41e31d2ac83d307bdc6bbd111201e/google/cloud/bigtable_v2/types/bigtable.py#L401-L430
diff --git a/docs/classic_client/encryption-info.rst b/docs/classic_client/encryption-info.rst
new file mode 100644
index 000000000..46f19880f
--- /dev/null
+++ b/docs/classic_client/encryption-info.rst
@@ -0,0 +1,6 @@
+Encryption Info
+~~~~~~~~~~~~~~~
+
+.. automodule:: google.cloud.bigtable.encryption_info
+ :members:
+ :show-inheritance:
diff --git a/docs/instance-api.rst b/docs/classic_client/instance-api.rst
similarity index 69%
rename from docs/instance-api.rst
rename to docs/classic_client/instance-api.rst
index ab884a605..88b4eb4dc 100644
--- a/docs/instance-api.rst
+++ b/docs/classic_client/instance-api.rst
@@ -121,10 +121,10 @@ Now we go down the hierarchy from
Head next to learn about the :doc:`table-api`.
.. _Instance Admin API: https://cloud.google.com/bigtable/docs/creating-instance
-.. _CreateInstance: https://github.com/GoogleCloudPlatform/cloud-bigtable-client/blob/2aae624081f652427052fb652d3ae43d8ac5bf5a/bigtable-protos/src/main/proto/google/bigtable/admin/instance/v1/bigtable_instance_service.proto#L66-L68
-.. _GetInstance: https://github.com/GoogleCloudPlatform/cloud-bigtable-client/blob/2aae624081f652427052fb652d3ae43d8ac5bf5a/bigtable-protos/src/main/proto/google/bigtable/admin/instance/v1/bigtable_instance_service.proto#L38-L40
-.. _UpdateInstance: https://github.com/GoogleCloudPlatform/cloud-bigtable-client/blob/2aae624081f652427052fb652d3ae43d8ac5bf5a/bigtable-protos/src/main/proto/google/bigtable/admin/instance/v1/bigtable_instance_service.proto#L93-L95
-.. _DeleteInstance: https://github.com/GoogleCloudPlatform/cloud-bigtable-client/blob/2aae624081f652427052fb652d3ae43d8ac5bf5a/bigtable-protos/src/main/proto/google/bigtable/admin/instance/v1/bigtable_instance_service.proto#L109-L111
-.. _ListInstances: https://github.com/GoogleCloudPlatform/cloud-bigtable-client/blob/2aae624081f652427052fb652d3ae43d8ac5bf5a/bigtable-protos/src/main/proto/google/bigtable/admin/instance/v1/bigtable_instance_service.proto#L44-L46
-.. _GetOperation: https://github.com/GoogleCloudPlatform/cloud-bigtable-client/blob/2aae624081f652427052fb652d3ae43d8ac5bf5a/bigtable-protos/src/main/proto/google/longrunning/operations.proto#L43-L45
-.. _long-running operation: https://github.com/GoogleCloudPlatform/cloud-bigtable-client/blob/2aae624081f652427052fb652d3ae43d8ac5bf5a/bigtable-protos/src/main/proto/google/longrunning/operations.proto#L73-L102
+.. _CreateInstance: https://googleapis.dev/python/bigtable/latest/instance-api.html#create-a-new-instance
+.. _GetInstance: https://googleapis.dev/python/bigtable/latest/instance-api.html#get-metadata-for-an-existing-instance
+.. _UpdateInstance: https://googleapis.dev/python/bigtable/latest/instance-api.html#update-an-existing-instance
+.. _DeleteInstance: https://googleapis.dev/python/bigtable/latest/instance-api.html#delete-an-existing-instance
+.. _ListInstances: https://googleapis.dev/python/bigtable/latest/instance-api.html#list-instances
+.. _GetOperation: https://googleapis.dev/python/bigtable/latest/instance-api.html#check-on-current-operation
+.. _long-running operation: https://github.com/googleapis/googleapis/blob/main/google/longrunning/operations.proto#L128-L162
diff --git a/docs/instance.rst b/docs/classic_client/instance.rst
similarity index 100%
rename from docs/instance.rst
rename to docs/classic_client/instance.rst
diff --git a/docs/row-data.rst b/docs/classic_client/row-data.rst
similarity index 100%
rename from docs/row-data.rst
rename to docs/classic_client/row-data.rst
diff --git a/docs/row-filters.rst b/docs/classic_client/row-filters.rst
similarity index 92%
rename from docs/row-filters.rst
rename to docs/classic_client/row-filters.rst
index 292ae9dfb..9884ce400 100644
--- a/docs/row-filters.rst
+++ b/docs/classic_client/row-filters.rst
@@ -64,4 +64,4 @@ level. For example:
:members:
:show-inheritance:
-.. _RowFilter definition: https://github.com/GoogleCloudPlatform/cloud-bigtable-client/blob/1ff247c2e3b7cd0a2dd49071b2d95beaf6563092/bigtable-protos/src/main/proto/google/bigtable/v1/bigtable_data.proto#L195
+.. _RowFilter definition: https://googleapis.dev/python/bigtable/latest/row-filters.html?highlight=rowfilter#google.cloud.bigtable.row_filters.RowFilter
diff --git a/docs/classic_client/row-set.rst b/docs/classic_client/row-set.rst
new file mode 100644
index 000000000..5f7a16a02
--- /dev/null
+++ b/docs/classic_client/row-set.rst
@@ -0,0 +1,6 @@
+Row Set
+~~~~~~~~
+
+.. automodule:: google.cloud.bigtable.row_set
+ :members:
+ :show-inheritance:
diff --git a/docs/row.rst b/docs/classic_client/row.rst
similarity index 100%
rename from docs/row.rst
rename to docs/classic_client/row.rst
diff --git a/docs/snippets.py b/docs/classic_client/snippets.py
similarity index 79%
rename from docs/snippets.py
rename to docs/classic_client/snippets.py
index 850362b4a..c6059409d 100644
--- a/docs/snippets.py
+++ b/docs/classic_client/snippets.py
@@ -29,15 +29,17 @@
"""
-import datetime
+from datetime import datetime, timezone
import pytest
-from test_utils.system import unique_resource_id
-from test_utils.retry import RetryErrors
+from google.api_core.exceptions import DeadlineExceeded
from google.api_core.exceptions import NotFound
from google.api_core.exceptions import TooManyRequests
-from google.api_core.exceptions import DeadlineExceeded
-from google.cloud._helpers import UTC
+from google.api_core.exceptions import ServiceUnavailable
+from test_utils.system import unique_resource_id
+from test_utils.retry import RetryErrors
+
+
from google.cloud.bigtable import Client
from google.cloud.bigtable import enums
@@ -53,16 +55,16 @@
PRODUCTION = enums.Instance.Type.PRODUCTION
SERVER_NODES = 3
STORAGE_TYPE = enums.StorageType.SSD
-LABEL_KEY = u"python-snippet"
+LABEL_KEY = "python-snippet"
LABEL_STAMP = (
- datetime.datetime.utcnow()
- .replace(microsecond=0, tzinfo=UTC)
+ datetime.now(timezone.utc)
+ .replace(microsecond=0)
.strftime("%Y-%m-%dt%H-%M-%S")
)
LABELS = {LABEL_KEY: str(LABEL_STAMP)}
INSTANCES_TO_DELETE = []
-retry_429 = RetryErrors(TooManyRequests, max_tries=9)
+retry_429_503 = RetryErrors((ServiceUnavailable, TooManyRequests), max_tries=9)
retry_504 = RetryErrors(DeadlineExceeded, max_tries=4)
@@ -97,24 +99,24 @@ def setup_module():
def teardown_module():
- retry_429(Config.INSTANCE.delete)()
+ retry_429_503(Config.INSTANCE.delete)()
for instance in INSTANCES_TO_DELETE:
try:
- retry_429(instance.delete)()
+ retry_429_503(instance.delete)()
except NotFound:
pass
def test_bigtable_create_instance():
- # [START bigtable_create_prod_instance]
+ # [START bigtable_api_create_prod_instance]
from google.cloud.bigtable import Client
from google.cloud.bigtable import enums
my_instance_id = "inst-my-" + UNIQUE_SUFFIX
my_cluster_id = "clus-my-" + UNIQUE_SUFFIX
location_id = "us-central1-f"
- serve_nodes = 3
+ serve_nodes = 1
storage_type = enums.StorageType.SSD
production = enums.Instance.Type.PRODUCTION
labels = {"prod-label": "prod-label"}
@@ -132,16 +134,16 @@ def test_bigtable_create_instance():
# We want to make sure the operation completes.
operation.result(timeout=100)
- # [END bigtable_create_prod_instance]
+ # [END bigtable_api_create_prod_instance]
try:
assert instance.exists()
finally:
- retry_429(instance.delete)()
+ retry_429_503(instance.delete)()
def test_bigtable_create_additional_cluster():
- # [START bigtable_create_cluster]
+ # [START bigtable_api_create_cluster]
from google.cloud.bigtable import Client
from google.cloud.bigtable import enums
@@ -155,7 +157,7 @@ def test_bigtable_create_additional_cluster():
cluster_id = "clus-my-" + UNIQUE_SUFFIX
location_id = "us-central1-a"
- serve_nodes = 3
+ serve_nodes = 1
storage_type = enums.StorageType.SSD
cluster = instance.cluster(
@@ -167,18 +169,18 @@ def test_bigtable_create_additional_cluster():
operation = cluster.create()
# We want to make sure the operation completes.
operation.result(timeout=100)
- # [END bigtable_create_cluster]
+ # [END bigtable_api_create_cluster]
try:
assert cluster.exists()
finally:
- retry_429(cluster.delete)()
+ retry_429_503(cluster.delete)()
def test_bigtable_create_reload_delete_app_profile():
import re
- # [START bigtable_create_app_profile]
+ # [START bigtable_api_create_app_profile]
from google.cloud.bigtable import Client
from google.cloud.bigtable import enums
@@ -197,9 +199,9 @@ def test_bigtable_create_reload_delete_app_profile():
)
app_profile = app_profile.create(ignore_warnings=True)
- # [END bigtable_create_app_profile]
+ # [END bigtable_api_create_app_profile]
- # [START bigtable_app_profile_name]
+ # [START bigtable_api_app_profile_name]
from google.cloud.bigtable import Client
client = Client(admin=True)
@@ -207,7 +209,7 @@ def test_bigtable_create_reload_delete_app_profile():
app_profile = instance.app_profile(APP_PROFILE_ID)
app_profile_name = app_profile.name
- # [END bigtable_app_profile_name]
+ # [END bigtable_api_app_profile_name]
_profile_name_re = re.compile(
r"^projects/(?P[^/]+)/"
r"instances/(?P[^/]+)/"
@@ -216,7 +218,7 @@ def test_bigtable_create_reload_delete_app_profile():
)
assert _profile_name_re.match(app_profile_name)
- # [START bigtable_app_profile_exists]
+ # [START bigtable_api_app_profile_exists]
from google.cloud.bigtable import Client
client = Client(admin=True)
@@ -224,10 +226,10 @@ def test_bigtable_create_reload_delete_app_profile():
app_profile = instance.app_profile(APP_PROFILE_ID)
app_profile_exists = app_profile.exists()
- # [END bigtable_app_profile_exists]
+ # [END bigtable_api_app_profile_exists]
assert app_profile_exists
- # [START bigtable_reload_app_profile]
+ # [START bigtable_api_reload_app_profile]
from google.cloud.bigtable import Client
client = Client(admin=True)
@@ -235,10 +237,10 @@ def test_bigtable_create_reload_delete_app_profile():
app_profile = instance.app_profile(APP_PROFILE_ID)
app_profile.reload()
- # [END bigtable_reload_app_profile]
+ # [END bigtable_api_reload_app_profile]
assert app_profile.routing_policy_type == ROUTING_POLICY_TYPE
- # [START bigtable_update_app_profile]
+ # [START bigtable_api_update_app_profile]
from google.cloud.bigtable import Client
client = Client(admin=True)
@@ -249,10 +251,10 @@ def test_bigtable_create_reload_delete_app_profile():
description = "My new app profile"
app_profile.description = description
app_profile.update()
- # [END bigtable_update_app_profile]
+ # [END bigtable_api_update_app_profile]
assert app_profile.description == description
- # [START bigtable_delete_app_profile]
+ # [START bigtable_api_delete_app_profile]
from google.cloud.bigtable import Client
client = Client(admin=True)
@@ -261,40 +263,40 @@ def test_bigtable_create_reload_delete_app_profile():
app_profile.reload()
app_profile.delete(ignore_warnings=True)
- # [END bigtable_delete_app_profile]
+ # [END bigtable_api_delete_app_profile]
assert not app_profile.exists()
def test_bigtable_list_instances():
- # [START bigtable_list_instances]
+ # [START bigtable_api_list_instances]
from google.cloud.bigtable import Client
client = Client(admin=True)
(instances_list, failed_locations_list) = client.list_instances()
- # [END bigtable_list_instances]
+ # [END bigtable_api_list_instances]
assert len(instances_list) > 0
def test_bigtable_list_clusters_on_instance():
- # [START bigtable_list_clusters_on_instance]
+ # [START bigtable_api_list_clusters_on_instance]
from google.cloud.bigtable import Client
client = Client(admin=True)
instance = client.instance(INSTANCE_ID)
(clusters_list, failed_locations_list) = instance.list_clusters()
- # [END bigtable_list_clusters_on_instance]
+ # [END bigtable_api_list_clusters_on_instance]
assert len(clusters_list) > 0
def test_bigtable_list_clusters_in_project():
- # [START bigtable_list_clusters_in_project]
+ # [START bigtable_api_list_clusters_in_project]
from google.cloud.bigtable import Client
client = Client(admin=True)
(clusters_list, failed_locations_list) = client.list_clusters()
- # [END bigtable_list_clusters_in_project]
+ # [END bigtable_api_list_clusters_in_project]
assert len(clusters_list) > 0
@@ -306,73 +308,73 @@ def test_bigtable_list_app_profiles():
)
app_profile = app_profile.create(ignore_warnings=True)
- # [START bigtable_list_app_profiles]
+ # [START bigtable_api_list_app_profiles]
from google.cloud.bigtable import Client
client = Client(admin=True)
instance = client.instance(INSTANCE_ID)
app_profiles_list = instance.list_app_profiles()
- # [END bigtable_list_app_profiles]
+ # [END bigtable_api_list_app_profiles]
try:
assert len(app_profiles_list) > 0
finally:
- retry_429(app_profile.delete)(ignore_warnings=True)
+ retry_429_503(app_profile.delete)(ignore_warnings=True)
def test_bigtable_instance_exists():
- # [START bigtable_check_instance_exists]
+ # [START bigtable_api_check_instance_exists]
from google.cloud.bigtable import Client
client = Client(admin=True)
instance = client.instance(INSTANCE_ID)
instance_exists = instance.exists()
- # [END bigtable_check_instance_exists]
+ # [END bigtable_api_check_instance_exists]
assert instance_exists
def test_bigtable_cluster_exists():
- # [START bigtable_check_cluster_exists]
+ # [START bigtable_api_check_cluster_exists]
from google.cloud.bigtable import Client
client = Client(admin=True)
instance = client.instance(INSTANCE_ID)
cluster = instance.cluster(CLUSTER_ID)
cluster_exists = cluster.exists()
- # [END bigtable_check_cluster_exists]
+ # [END bigtable_api_check_cluster_exists]
assert cluster_exists
def test_bigtable_reload_instance():
- # [START bigtable_reload_instance]
+ # [START bigtable_api_reload_instance]
from google.cloud.bigtable import Client
client = Client(admin=True)
instance = client.instance(INSTANCE_ID)
instance.reload()
- # [END bigtable_reload_instance]
+ # [END bigtable_api_reload_instance]
assert instance.type_ == PRODUCTION.value
def test_bigtable_reload_cluster():
- # [START bigtable_reload_cluster]
+ # [START bigtable_api_reload_cluster]
from google.cloud.bigtable import Client
client = Client(admin=True)
instance = client.instance(INSTANCE_ID)
cluster = instance.cluster(CLUSTER_ID)
cluster.reload()
- # [END bigtable_reload_cluster]
+ # [END bigtable_api_reload_cluster]
assert cluster.serve_nodes == SERVER_NODES
def test_bigtable_update_instance():
- # [START bigtable_update_instance]
+ # [START bigtable_api_update_instance]
from google.cloud.bigtable import Client
client = Client(admin=True)
@@ -380,13 +382,13 @@ def test_bigtable_update_instance():
display_name = "My new instance"
instance.display_name = display_name
instance.update()
- # [END bigtable_update_instance]
+ # [END bigtable_api_update_instance]
assert instance.display_name == display_name
def test_bigtable_update_cluster():
- # [START bigtable_update_cluster]
+ # [START bigtable_api_update_cluster]
from google.cloud.bigtable import Client
client = Client(admin=True)
@@ -394,13 +396,32 @@ def test_bigtable_update_cluster():
cluster = instance.cluster(CLUSTER_ID)
cluster.serve_nodes = 4
cluster.update()
- # [END bigtable_update_cluster]
+ # [END bigtable_api_update_cluster]
+
+ assert cluster.serve_nodes == 4
+
+
+def test_bigtable_cluster_disable_autoscaling():
+ # [START bigtable_api_cluster_disable_autoscaling]
+ from google.cloud.bigtable import Client
+
+ client = Client(admin=True)
+ instance = client.instance(INSTANCE_ID)
+ # Create a cluster with autoscaling enabled
+ cluster = instance.cluster(
+ CLUSTER_ID, min_serve_nodes=1, max_serve_nodes=2, cpu_utilization_percent=10
+ )
+ instance.create(clusters=[cluster])
+
+ # Disable autoscaling
+ cluster.disable_autoscaling(serve_nodes=4)
+ # [END bigtable_api_cluster_disable_autoscaling]
assert cluster.serve_nodes == 4
def test_bigtable_create_table():
- # [START bigtable_create_table]
+ # [START bigtable_api_create_table]
from google.api_core import exceptions
from google.api_core import retry
from google.cloud.bigtable import Client
@@ -418,23 +439,22 @@ def test_bigtable_create_table():
retry_504 = retry.Retry(predicate_504)
retry_504(table.create)(column_families={"cf1": max_versions_rule})
- # [END bigtable_create_table]
+ # [END bigtable_api_create_table]
try:
assert table.exists()
finally:
- retry_429(table.delete)()
+ retry_429_503(table.delete)()
def test_bigtable_list_tables():
-
- # [START bigtable_list_tables]
+ # [START bigtable_api_list_tables]
from google.cloud.bigtable import Client
client = Client(admin=True)
instance = client.instance(INSTANCE_ID)
tables_list = instance.list_tables()
- # [END bigtable_list_tables]
+ # [END bigtable_api_list_tables]
# Check if returned list has expected table
table_names = [table.name for table in tables_list]
@@ -447,17 +467,18 @@ def test_bigtable_delete_cluster():
client = Client(admin=True)
instance = client.instance(INSTANCE_ID)
cluster_id = "clus-my-" + UNIQUE_SUFFIX
+ serve_nodes = 1
cluster = instance.cluster(
cluster_id,
location_id=ALT_LOCATION_ID,
- serve_nodes=SERVER_NODES,
+ serve_nodes=serve_nodes,
default_storage_type=STORAGE_TYPE,
)
operation = cluster.create()
# We want to make sure the operation completes.
operation.result(timeout=1000)
- # [START bigtable_delete_cluster]
+ # [START bigtable_api_delete_cluster]
from google.cloud.bigtable import Client
client = Client(admin=True)
@@ -465,7 +486,7 @@ def test_bigtable_delete_cluster():
cluster_to_delete = instance.cluster(cluster_id)
cluster_to_delete.delete()
- # [END bigtable_delete_cluster]
+ # [END bigtable_api_delete_cluster]
assert not cluster_to_delete.exists()
@@ -477,10 +498,11 @@ def test_bigtable_delete_instance():
instance_id = "snipt-inst-del" + UNIQUE_SUFFIX
instance = client.instance(instance_id, instance_type=PRODUCTION, labels=LABELS)
+ serve_nodes = 1
cluster = instance.cluster(
"clus-to-delete" + UNIQUE_SUFFIX,
location_id=ALT_LOCATION_ID,
- serve_nodes=1,
+ serve_nodes=serve_nodes,
default_storage_type=STORAGE_TYPE,
)
operation = instance.create(clusters=[cluster])
@@ -491,14 +513,14 @@ def test_bigtable_delete_instance():
# Make sure this instance gets deleted after the test case.
INSTANCES_TO_DELETE.append(instance)
- # [START bigtable_delete_instance]
+ # [START bigtable_api_delete_instance]
from google.cloud.bigtable import Client
client = Client(admin=True)
instance_to_delete = client.instance(instance_id)
instance_to_delete.delete()
- # [END bigtable_delete_instance]
+ # [END bigtable_api_delete_instance]
assert not instance_to_delete.exists()
@@ -507,7 +529,7 @@ def test_bigtable_delete_instance():
def test_bigtable_test_iam_permissions():
- # [START bigtable_test_iam_permissions]
+ # [START bigtable_api_test_iam_permissions]
from google.cloud.bigtable import Client
client = Client(admin=True)
@@ -515,7 +537,7 @@ def test_bigtable_test_iam_permissions():
instance.reload()
permissions = ["bigtable.clusters.create", "bigtable.tables.create"]
permissions_allowed = instance.test_iam_permissions(permissions)
- # [END bigtable_test_iam_permissions]
+ # [END bigtable_api_test_iam_permissions]
assert permissions_allowed == permissions
@@ -523,7 +545,7 @@ def test_bigtable_test_iam_permissions():
def test_bigtable_set_iam_policy_then_get_iam_policy():
service_account_email = Config.CLIENT._credentials.service_account_email
- # [START bigtable_set_iam_policy]
+ # [START bigtable_api_set_iam_policy]
from google.cloud.bigtable import Client
from google.cloud.bigtable.policy import Policy
from google.cloud.bigtable.policy import BIGTABLE_ADMIN_ROLE
@@ -535,17 +557,17 @@ def test_bigtable_set_iam_policy_then_get_iam_policy():
new_policy[BIGTABLE_ADMIN_ROLE] = [Policy.service_account(service_account_email)]
policy_latest = instance.set_iam_policy(new_policy)
- # [END bigtable_set_iam_policy]
+ # [END bigtable_api_set_iam_policy]
assert len(policy_latest.bigtable_admins) > 0
- # [START bigtable_get_iam_policy]
+ # [START bigtable_api_get_iam_policy]
from google.cloud.bigtable import Client
client = Client(admin=True)
instance = client.instance(INSTANCE_ID)
policy = instance.get_iam_policy()
- # [END bigtable_get_iam_policy]
+ # [END bigtable_api_get_iam_policy]
assert len(policy.bigtable_admins) > 0
@@ -553,45 +575,45 @@ def test_bigtable_set_iam_policy_then_get_iam_policy():
def test_bigtable_project_path():
import re
- # [START bigtable_project_path]
+ # [START bigtable_api_project_path]
from google.cloud.bigtable import Client
client = Client(admin=True)
project_path = client.project_path
- # [END bigtable_project_path]
+ # [END bigtable_api_project_path]
def test_bigtable_table_data_client():
- # [START bigtable_table_data_client]
+ # [START bigtable_api_table_data_client]
from google.cloud.bigtable import Client
client = Client(admin=True)
table_data_client = client.table_data_client
- # [END bigtable_table_data_client]
+ # [END bigtable_api_table_data_client]
def test_bigtable_table_admin_client():
- # [START bigtable_table_admin_client]
+ # [START bigtable_api_table_admin_client]
from google.cloud.bigtable import Client
client = Client(admin=True)
table_admin_client = client.table_admin_client
- # [END bigtable_table_admin_client]
+ # [END bigtable_api_table_admin_client]
def test_bigtable_instance_admin_client():
- # [START bigtable_instance_admin_client]
+ # [START bigtable_api_instance_admin_client]
from google.cloud.bigtable import Client
client = Client(admin=True)
instance_admin_client = client.instance_admin_client
- # [END bigtable_instance_admin_client]
+ # [END bigtable_api_instance_admin_client]
def test_bigtable_admins_policy():
service_account_email = Config.CLIENT._credentials.service_account_email
- # [START bigtable_admins_policy]
+ # [START bigtable_api_admins_policy]
from google.cloud.bigtable import Client
from google.cloud.bigtable.policy import Policy
from google.cloud.bigtable.policy import BIGTABLE_ADMIN_ROLE
@@ -604,7 +626,7 @@ def test_bigtable_admins_policy():
policy_latest = instance.set_iam_policy(new_policy)
policy = policy_latest.bigtable_admins
- # [END bigtable_admins_policy]
+ # [END bigtable_api_admins_policy]
assert len(policy) > 0
@@ -612,7 +634,7 @@ def test_bigtable_admins_policy():
def test_bigtable_readers_policy():
service_account_email = Config.CLIENT._credentials.service_account_email
- # [START bigtable_readers_policy]
+ # [START bigtable_api_readers_policy]
from google.cloud.bigtable import Client
from google.cloud.bigtable.policy import Policy
from google.cloud.bigtable.policy import BIGTABLE_READER_ROLE
@@ -625,7 +647,7 @@ def test_bigtable_readers_policy():
policy_latest = instance.set_iam_policy(new_policy)
policy = policy_latest.bigtable_readers
- # [END bigtable_readers_policy]
+ # [END bigtable_api_readers_policy]
assert len(policy) > 0
@@ -633,7 +655,7 @@ def test_bigtable_readers_policy():
def test_bigtable_users_policy():
service_account_email = Config.CLIENT._credentials.service_account_email
- # [START bigtable_users_policy]
+ # [START bigtable_api_users_policy]
from google.cloud.bigtable import Client
from google.cloud.bigtable.policy import Policy
from google.cloud.bigtable.policy import BIGTABLE_USER_ROLE
@@ -646,7 +668,7 @@ def test_bigtable_users_policy():
policy_latest = instance.set_iam_policy(new_policy)
policy = policy_latest.bigtable_users
- # [END bigtable_users_policy]
+ # [END bigtable_api_users_policy]
assert len(policy) > 0
@@ -654,7 +676,7 @@ def test_bigtable_users_policy():
def test_bigtable_viewers_policy():
service_account_email = Config.CLIENT._credentials.service_account_email
- # [START bigtable_viewers_policy]
+ # [START bigtable_api_viewers_policy]
from google.cloud.bigtable import Client
from google.cloud.bigtable.policy import Policy
from google.cloud.bigtable.policy import BIGTABLE_VIEWER_ROLE
@@ -667,7 +689,7 @@ def test_bigtable_viewers_policy():
policy_latest = instance.set_iam_policy(new_policy)
policy = policy_latest.bigtable_viewers
- # [END bigtable_viewers_policy]
+ # [END bigtable_api_viewers_policy]
assert len(policy) > 0
@@ -675,51 +697,51 @@ def test_bigtable_viewers_policy():
def test_bigtable_instance_name():
import re
- # [START bigtable_instance_name]
+ # [START bigtable_api_instance_name]
from google.cloud.bigtable import Client
client = Client(admin=True)
instance = client.instance(INSTANCE_ID)
instance_name = instance.name
- # [END bigtable_instance_name]
+ # [END bigtable_api_instance_name]
def test_bigtable_cluster_name():
import re
- # [START bigtable_cluster_name]
+ # [START bigtable_api_cluster_name]
from google.cloud.bigtable import Client
client = Client(admin=True)
instance = client.instance(INSTANCE_ID)
cluster = instance.cluster(CLUSTER_ID)
cluster_name = cluster.name
- # [END bigtable_cluster_name]
+ # [END bigtable_api_cluster_name]
def test_bigtable_instance_from_pb():
- # [START bigtable_instance_from_pb]
+ # [START bigtable_api_instance_from_pb]
from google.cloud.bigtable import Client
- from google.cloud.bigtable_admin_v2.types import instance_pb2
+ from google.cloud.bigtable_admin_v2.types import instance as data_v2_pb2
client = Client(admin=True)
instance = client.instance(INSTANCE_ID)
name = instance.name
- instance_pb = instance_pb2.Instance(
+ instance_pb = data_v2_pb2.Instance(
name=name, display_name=INSTANCE_ID, type=PRODUCTION, labels=LABELS
)
instance2 = instance.from_pb(instance_pb, client)
- # [END bigtable_instance_from_pb]
+ # [END bigtable_api_instance_from_pb]
assert instance2.name == instance.name
def test_bigtable_cluster_from_pb():
- # [START bigtable_cluster_from_pb]
+ # [START bigtable_api_cluster_from_pb]
from google.cloud.bigtable import Client
- from google.cloud.bigtable_admin_v2.types import instance_pb2
+ from google.cloud.bigtable_admin_v2.types import instance as data_v2_pb2
client = Client(admin=True)
instance = client.instance(INSTANCE_ID)
@@ -727,41 +749,42 @@ def test_bigtable_cluster_from_pb():
name = cluster.name
cluster_state = cluster.state
- cluster_pb = instance_pb2.Cluster(
+ serve_nodes = 1
+ cluster_pb = data_v2_pb2.Cluster(
name=name,
location=LOCATION_ID,
state=cluster_state,
- serve_nodes=SERVER_NODES,
+ serve_nodes=serve_nodes,
default_storage_type=STORAGE_TYPE,
)
cluster2 = cluster.from_pb(cluster_pb, instance)
- # [END bigtable_cluster_from_pb]
+ # [END bigtable_api_cluster_from_pb]
assert cluster2.name == cluster.name
def test_bigtable_instance_state():
- # [START bigtable_instance_state]
+ # [START bigtable_api_instance_state]
from google.cloud.bigtable import Client
client = Client(admin=True)
instance = client.instance(INSTANCE_ID)
instance_state = instance.state
- # [END bigtable_instance_state]
+ # [END bigtable_api_instance_state]
assert not instance_state
def test_bigtable_cluster_state():
- # [START bigtable_cluster_state]
+ # [START bigtable_api_cluster_state]
from google.cloud.bigtable import Client
client = Client(admin=True)
instance = client.instance(INSTANCE_ID)
cluster = instance.cluster(CLUSTER_ID)
cluster_state = cluster.state
- # [END bigtable_cluster_state]
+ # [END bigtable_api_cluster_state]
assert not cluster_state
diff --git a/docs/snippets_table.py b/docs/classic_client/snippets_table.py
similarity index 83%
rename from docs/snippets_table.py
rename to docs/classic_client/snippets_table.py
index 702cf31b1..1850e836b 100644
--- a/docs/snippets_table.py
+++ b/docs/classic_client/snippets_table.py
@@ -29,11 +29,14 @@
"""
-import datetime
+from datetime import datetime, timezone
import pytest
+from google.api_core.exceptions import TooManyRequests
+from google.api_core.exceptions import ServiceUnavailable
from test_utils.system import unique_resource_id
-from google.cloud._helpers import UTC
+from test_utils.retry import RetryErrors
+
from google.cloud.bigtable import Client
from google.cloud.bigtable import enums
from google.cloud.bigtable import column_family
@@ -48,10 +51,10 @@
PRODUCTION = enums.Instance.Type.PRODUCTION
SERVER_NODES = 3
STORAGE_TYPE = enums.StorageType.SSD
-LABEL_KEY = u"python-snippet"
+LABEL_KEY = "python-snippet"
LABEL_STAMP = (
- datetime.datetime.utcnow()
- .replace(microsecond=0, tzinfo=UTC)
+ datetime.now(timezone.utc)
+ .replace(microsecond=0)
.strftime("%Y-%m-%dt%H-%M-%S")
)
LABELS = {LABEL_KEY: str(LABEL_STAMP)}
@@ -64,6 +67,8 @@
CELL_VAL2 = b"cell-val2"
ROW_KEY2 = b"row_key_id2"
+retry_429_503 = RetryErrors((ServiceUnavailable, TooManyRequests), max_tries=9)
+
class Config(object):
"""Run-time configuration to be modified at set-up.
@@ -102,11 +107,11 @@ def setup_module():
def teardown_module():
- Config.INSTANCE.delete()
+ retry_429_503(Config.INSTANCE.delete)()
def test_bigtable_create_table():
- # [START bigtable_create_table]
+ # [START bigtable_api_create_table]
from google.cloud.bigtable import Client
from google.cloud.bigtable import column_family
@@ -123,7 +128,7 @@ def test_bigtable_create_table():
max_versions_rule = column_family.MaxVersionsGCRule(2)
table2.create(column_families={"cf1": max_versions_rule})
- # [END bigtable_create_table]
+ # [END bigtable_api_create_table]
assert table1.exists()
assert table2.exists()
table1.delete()
@@ -136,7 +141,7 @@ def test_bigtable_sample_row_keys():
table_sample.create(initial_split_keys=initial_split_keys)
assert table_sample.exists()
- # [START bigtable_sample_row_keys]
+ # [START bigtable_api_sample_row_keys]
from google.cloud.bigtable import Client
client = Client(admin=True)
@@ -145,14 +150,14 @@ def test_bigtable_sample_row_keys():
table = instance.table("table_id1_samplerow")
data = table.sample_row_keys()
actual_keys, offset = zip(*[(rk.row_key, rk.offset_bytes) for rk in data])
- # [END bigtable_sample_row_keys]
+ # [END bigtable_api_sample_row_keys]
initial_split_keys.append(b"")
assert list(actual_keys) == initial_split_keys
table.delete()
def test_bigtable_write_read_drop_truncate():
- # [START bigtable_mutate_rows]
+ # [START bigtable_api_mutate_rows]
from google.cloud.bigtable import Client
client = Client(admin=True)
@@ -173,7 +178,7 @@ def test_bigtable_write_read_drop_truncate():
value = "value_{}".format(i).encode()
row = table.row(row_key)
row.set_cell(
- COLUMN_FAMILY_ID, col_name, value, timestamp=datetime.datetime.utcnow()
+ COLUMN_FAMILY_ID, col_name, value, timestamp=datetime.now(timezone.utc)
)
rows.append(row)
response = table.mutate_rows(rows)
@@ -181,9 +186,9 @@ def test_bigtable_write_read_drop_truncate():
for i, status in enumerate(response):
if status.code != 0:
print("Row number {} failed to write".format(i))
- # [END bigtable_mutate_rows]
+ # [END bigtable_api_mutate_rows]
assert len(response) == len(rows)
- # [START bigtable_read_row]
+ # [START bigtable_api_read_row]
from google.cloud.bigtable import Client
client = Client(admin=True)
@@ -191,9 +196,9 @@ def test_bigtable_write_read_drop_truncate():
table = instance.table(TABLE_ID)
row_key = "row_key_1"
row = table.read_row(row_key)
- # [END bigtable_read_row]
+ # [END bigtable_api_read_row]
assert row.row_key.decode("utf-8") == row_key
- # [START bigtable_read_rows]
+ # [START bigtable_api_read_rows]
from google.cloud.bigtable import Client
client = Client(admin=True)
@@ -202,10 +207,16 @@ def test_bigtable_write_read_drop_truncate():
# Read full table
partial_rows = table.read_rows()
- read_rows = [row for row in partial_rows]
- # [END bigtable_read_rows]
- assert len(read_rows) == len(rows)
- # [START bigtable_drop_by_prefix]
+
+ # Read row's value
+ total_rows = []
+ for row in partial_rows:
+ cell = row.cells[COLUMN_FAMILY_ID][col_name][0]
+ print(cell.value.decode("utf-8"))
+ total_rows.append(cell)
+ # [END bigtable_api_read_rows]
+ assert len(total_rows) == len(rows)
+ # [START bigtable_api_drop_by_prefix]
from google.cloud.bigtable import Client
client = Client(admin=True)
@@ -213,19 +224,19 @@ def test_bigtable_write_read_drop_truncate():
table = instance.table(TABLE_ID)
row_key_prefix = b"row_key_2"
table.drop_by_prefix(row_key_prefix, timeout=200)
- # [END bigtable_drop_by_prefix]
+ # [END bigtable_api_drop_by_prefix]
dropped_row_keys = [b"row_key_2", b"row_key_20", b"row_key_22", b"row_key_200"]
for row in table.read_rows():
assert row.row_key.decode("utf-8") not in dropped_row_keys
- # [START bigtable_truncate_table]
+ # [START bigtable_api_truncate_table]
from google.cloud.bigtable import Client
client = Client(admin=True)
instance = client.instance(INSTANCE_ID)
table = instance.table(TABLE_ID)
table.truncate(timeout=200)
- # [END bigtable_truncate_table]
+ # [END bigtable_api_truncate_table]
rows_data_after_truncate = []
for row in table.read_rows():
rows_data_after_truncate.append(row.row_key)
@@ -233,14 +244,14 @@ def test_bigtable_write_read_drop_truncate():
def test_bigtable_mutations_batcher():
- # [START bigtable_mutations_batcher]
+ # [START bigtable_api_mutations_batcher]
from google.cloud.bigtable import Client
client = Client(admin=True)
instance = client.instance(INSTANCE_ID)
table = instance.table(TABLE_ID)
batcher = table.mutations_batcher()
- # [END bigtable_mutations_batcher]
+ # [END bigtable_api_mutations_batcher]
# Below code will be used while creating batcher.py snippets.
# So not removing this code as of now.
@@ -258,7 +269,7 @@ def test_bigtable_mutations_batcher():
row_key = row_keys[0]
row = table.row(row_key)
row.set_cell(
- COLUMN_FAMILY_ID, column_name, "value-0", timestamp=datetime.datetime.utcnow()
+ COLUMN_FAMILY_ID, column_name, "value-0", timestamp=datetime.now(timezone.utc)
)
batcher.mutate(row)
# Add a collections of rows
@@ -267,7 +278,7 @@ def test_bigtable_mutations_batcher():
row = table.row(row_keys[i])
value = "value_{}".format(i).encode()
row.set_cell(
- COLUMN_FAMILY_ID, column_name, value, timestamp=datetime.datetime.utcnow()
+ COLUMN_FAMILY_ID, column_name, value, timestamp=datetime.now(timezone.utc)
)
rows.append(row)
batcher.mutate_rows(rows)
@@ -284,7 +295,7 @@ def test_bigtable_mutations_batcher():
def test_bigtable_table_column_family():
- # [START bigtable_table_column_family]
+ # [START bigtable_api_table_column_family]
from google.cloud.bigtable import Client
client = Client(admin=True)
@@ -292,26 +303,26 @@ def test_bigtable_table_column_family():
table = instance.table(TABLE_ID)
column_family_obj = table.column_family(COLUMN_FAMILY_ID)
- # [END bigtable_table_column_family]
+ # [END bigtable_api_table_column_family]
assert column_family_obj.column_family_id == COLUMN_FAMILY_ID
def test_bigtable_list_tables():
- # [START bigtable_list_tables]
+ # [START bigtable_api_list_tables]
from google.cloud.bigtable import Client
client = Client(admin=True)
instance = client.instance(INSTANCE_ID)
tables_list = instance.list_tables()
- # [END bigtable_list_tables]
+ # [END bigtable_api_list_tables]
assert len(tables_list) != 0
def test_bigtable_table_name():
import re
- # [START bigtable_table_name]
+ # [START bigtable_api_table_name]
from google.cloud.bigtable import Client
client = Client(admin=True)
@@ -319,7 +330,7 @@ def test_bigtable_table_name():
table = instance.table(TABLE_ID)
table_name = table.name
- # [END bigtable_table_name]
+ # [END bigtable_api_table_name]
_table_name_re = re.compile(
r"^projects/(?P[^/]+)/"
r"instances/(?P[^/]+)/tables/"
@@ -329,7 +340,7 @@ def test_bigtable_table_name():
def test_bigtable_list_column_families():
- # [START bigtable_list_column_families]
+ # [START bigtable_api_list_column_families]
from google.cloud.bigtable import Client
client = Client(admin=True)
@@ -337,13 +348,13 @@ def test_bigtable_list_column_families():
table = instance.table(TABLE_ID)
column_family_list = table.list_column_families()
- # [END bigtable_list_column_families]
+ # [END bigtable_api_list_column_families]
assert len(column_family_list) > 0
def test_bigtable_get_cluster_states():
- # [START bigtable_get_cluster_states]
+ # [START bigtable_api_get_cluster_states]
from google.cloud.bigtable import Client
client = Client(admin=True)
@@ -351,7 +362,7 @@ def test_bigtable_get_cluster_states():
table = instance.table(TABLE_ID)
get_cluster_states = table.get_cluster_states()
- # [END bigtable_get_cluster_states]
+ # [END bigtable_api_get_cluster_states]
assert CLUSTER_ID in get_cluster_states
@@ -361,7 +372,7 @@ def test_bigtable_table_test_iam_permissions():
table_policy.create()
assert table_policy.exists
- # [START bigtable_table_test_iam_permissions]
+ # [START bigtable_api_table_test_iam_permissions]
from google.cloud.bigtable import Client
client = Client(admin=True)
@@ -370,7 +381,7 @@ def test_bigtable_table_test_iam_permissions():
permissions = ["bigtable.tables.mutateRows", "bigtable.tables.readRows"]
permissions_allowed = table.test_iam_permissions(permissions)
- # [END bigtable_table_test_iam_permissions]
+ # [END bigtable_api_table_test_iam_permissions]
assert permissions_allowed == permissions
@@ -379,7 +390,7 @@ def test_bigtable_table_set_iam_policy_then_get_iam_policy():
assert table_policy.exists
service_account_email = Config.CLIENT._credentials.service_account_email
- # [START bigtable_table_set_iam_policy]
+ # [START bigtable_api_table_set_iam_policy]
from google.cloud.bigtable import Client
from google.cloud.bigtable.policy import Policy
from google.cloud.bigtable.policy import BIGTABLE_ADMIN_ROLE
@@ -391,29 +402,29 @@ def test_bigtable_table_set_iam_policy_then_get_iam_policy():
new_policy[BIGTABLE_ADMIN_ROLE] = [Policy.service_account(service_account_email)]
policy_latest = table.set_iam_policy(new_policy)
- # [END bigtable_table_set_iam_policy]
+ # [END bigtable_api_table_set_iam_policy]
assert len(policy_latest.bigtable_admins) > 0
- # [START bigtable_table_get_iam_policy]
+ # [START bigtable_api_table_get_iam_policy]
from google.cloud.bigtable import Client
client = Client(admin=True)
instance = client.instance(INSTANCE_ID)
table = instance.table("table_id_iam_policy")
policy = table.get_iam_policy()
- # [END bigtable_table_get_iam_policy]
+ # [END bigtable_api_table_get_iam_policy]
assert len(policy.bigtable_admins) > 0
def test_bigtable_table_exists():
- # [START bigtable_check_table_exists]
+ # [START bigtable_api_check_table_exists]
from google.cloud.bigtable import Client
client = Client(admin=True)
instance = client.instance(INSTANCE_ID)
table = instance.table(TABLE_ID)
table_exists = table.exists()
- # [END bigtable_check_table_exists]
+ # [END bigtable_api_check_table_exists]
assert table_exists
@@ -422,7 +433,7 @@ def test_bigtable_delete_table():
table_del.create()
assert table_del.exists()
- # [START bigtable_delete_table]
+ # [START bigtable_api_delete_table]
from google.cloud.bigtable import Client
client = Client(admin=True)
@@ -430,12 +441,12 @@ def test_bigtable_delete_table():
table = instance.table("table_id_del")
table.delete()
- # [END bigtable_delete_table]
+ # [END bigtable_api_delete_table]
assert not table.exists()
def test_bigtable_table_row():
- # [START bigtable_table_row]
+ # [START bigtable_api_table_row]
from google.cloud.bigtable import Client
client = Client(admin=True)
@@ -445,7 +456,7 @@ def test_bigtable_table_row():
row_keys = [b"row_key_1", b"row_key_2"]
row1_obj = table.row(row_keys[0])
row2_obj = table.row(row_keys[1])
- # [END bigtable_table_row]
+ # [END bigtable_api_table_row]
row1_obj.set_cell(COLUMN_FAMILY_ID, COL_NAME1, CELL_VAL1)
row1_obj.commit()
@@ -462,7 +473,7 @@ def test_bigtable_table_row():
def test_bigtable_table_append_row():
- # [START bigtable_table_append_row]
+ # [START bigtable_api_table_append_row]
from google.cloud.bigtable import Client
client = Client(admin=True)
@@ -472,7 +483,7 @@ def test_bigtable_table_append_row():
row_keys = [b"row_key_1", b"row_key_2"]
row1_obj = table.append_row(row_keys[0])
row2_obj = table.append_row(row_keys[1])
- # [END bigtable_table_append_row]
+ # [END bigtable_api_table_append_row]
row1_obj.append_cell_value(COLUMN_FAMILY_ID, COL_NAME1, CELL_VAL1)
row1_obj.commit()
@@ -489,7 +500,7 @@ def test_bigtable_table_append_row():
def test_bigtable_table_direct_row():
- # [START bigtable_table_direct_row]
+ # [START bigtable_api_table_direct_row]
from google.cloud.bigtable import Client
client = Client(admin=True)
@@ -499,7 +510,7 @@ def test_bigtable_table_direct_row():
row_keys = [b"row_key_1", b"row_key_2"]
row1_obj = table.direct_row(row_keys[0])
row2_obj = table.direct_row(row_keys[1])
- # [END bigtable_table_direct_row]
+ # [END bigtable_api_table_direct_row]
row1_obj.set_cell(COLUMN_FAMILY_ID, COL_NAME1, CELL_VAL1)
row1_obj.commit()
@@ -516,7 +527,7 @@ def test_bigtable_table_direct_row():
def test_bigtable_table_conditional_row():
- # [START bigtable_table_conditional_row]
+ # [START bigtable_api_table_conditional_row]
from google.cloud.bigtable import Client
from google.cloud.bigtable.row_filters import PassAllFilter
@@ -528,7 +539,7 @@ def test_bigtable_table_conditional_row():
filter_ = PassAllFilter(True)
row1_obj = table.conditional_row(row_keys[0], filter_=filter_)
row2_obj = table.conditional_row(row_keys[1], filter_=filter_)
- # [END bigtable_table_conditional_row]
+ # [END bigtable_api_table_conditional_row]
row1_obj.set_cell(COLUMN_FAMILY_ID, COL_NAME1, CELL_VAL1, state=False)
row1_obj.commit()
@@ -545,7 +556,7 @@ def test_bigtable_table_conditional_row():
def test_bigtable_column_family_name():
- # [START bigtable_column_family_name]
+ # [START bigtable_api_column_family_name]
from google.cloud.bigtable import Client
client = Client(admin=True)
@@ -555,7 +566,7 @@ def test_bigtable_column_family_name():
column_families = table.list_column_families()
column_family_obj = column_families[COLUMN_FAMILY_ID]
column_family_name = column_family_obj.name
- # [END bigtable_column_family_name]
+ # [END bigtable_api_column_family_name]
import re
_cf_name_re = re.compile(
@@ -568,7 +579,7 @@ def test_bigtable_column_family_name():
def test_bigtable_create_update_delete_column_family():
- # [START bigtable_create_column_family]
+ # [START bigtable_api_create_column_family]
from google.cloud.bigtable import Client
from google.cloud.bigtable import column_family
@@ -581,11 +592,11 @@ def test_bigtable_create_update_delete_column_family():
column_family_obj = table.column_family(column_family_id, gc_rule=gc_rule)
column_family_obj.create()
- # [END bigtable_create_column_family]
+ # [END bigtable_api_create_column_family]
column_families = table.list_column_families()
assert column_families[column_family_id].gc_rule == gc_rule
- # [START bigtable_update_column_family]
+ # [START bigtable_api_update_column_family]
from google.cloud.bigtable import Client
from google.cloud.bigtable import column_family
@@ -599,12 +610,12 @@ def test_bigtable_create_update_delete_column_family():
max_age_rule = column_family.MaxAgeGCRule(datetime.timedelta(days=5))
column_family_obj = table.column_family(column_family_id, gc_rule=max_age_rule)
column_family_obj.update()
- # [END bigtable_update_column_family]
+ # [END bigtable_api_update_column_family]
updated_families = table.list_column_families()
assert updated_families[column_family_id].gc_rule == max_age_rule
- # [START bigtable_delete_column_family]
+ # [START bigtable_api_delete_column_family]
from google.cloud.bigtable import Client
from google.cloud.bigtable import column_family
@@ -615,7 +626,7 @@ def test_bigtable_create_update_delete_column_family():
column_family_id = "column_family_id1"
column_family_obj = table.column_family(column_family_id)
column_family_obj.delete()
- # [END bigtable_delete_column_family]
+ # [END bigtable_api_delete_column_family]
column_families = table.list_column_families()
assert column_family_id not in column_families
@@ -640,7 +651,7 @@ def test_bigtable_add_row_add_row_range_add_row_range_from_keys():
rows.append(row)
Config.TABLE.mutate_rows(rows)
- # [START bigtable_add_row_key]
+ # [START bigtable_api_add_row_key]
from google.cloud.bigtable import Client
from google.cloud.bigtable.row_set import RowSet
@@ -650,14 +661,14 @@ def test_bigtable_add_row_add_row_range_add_row_range_from_keys():
row_set = RowSet()
row_set.add_row_key(b"row_key_5")
- # [END bigtable_add_row_key]
+ # [END bigtable_api_add_row_key]
read_rows = table.read_rows(row_set=row_set)
expected_row_keys = [b"row_key_5"]
found_row_keys = [row.row_key for row in read_rows]
assert found_row_keys == expected_row_keys
- # [START bigtable_add_row_range]
+ # [START bigtable_api_add_row_range]
from google.cloud.bigtable import Client
from google.cloud.bigtable.row_set import RowSet
from google.cloud.bigtable.row_set import RowRange
@@ -668,14 +679,14 @@ def test_bigtable_add_row_add_row_range_add_row_range_from_keys():
row_set = RowSet()
row_set.add_row_range(RowRange(start_key=b"row_key_3", end_key=b"row_key_7"))
- # [END bigtable_add_row_range]
+ # [END bigtable_api_add_row_range]
read_rows = table.read_rows(row_set=row_set)
expected_row_keys = [b"row_key_3", b"row_key_4", b"row_key_5", b"row_key_6"]
found_row_keys = [row.row_key for row in read_rows]
assert found_row_keys == expected_row_keys
- # [START bigtable_row_range_from_keys]
+ # [START bigtable_api_row_range_from_keys]
from google.cloud.bigtable import Client
from google.cloud.bigtable.row_set import RowSet
@@ -685,18 +696,56 @@ def test_bigtable_add_row_add_row_range_add_row_range_from_keys():
row_set = RowSet()
row_set.add_row_range_from_keys(start_key=b"row_key_3", end_key=b"row_key_7")
- # [END bigtable_row_range_from_keys]
+ # [END bigtable_api_row_range_from_keys]
read_rows = table.read_rows(row_set=row_set)
expected_row_keys = [b"row_key_3", b"row_key_4", b"row_key_5", b"row_key_6"]
found_row_keys = [row.row_key for row in read_rows]
assert found_row_keys == expected_row_keys
+ table.truncate(timeout=200)
+
+
+def test_bigtable_add_row_range_with_prefix():
+ row_keys = [
+ b"row_key_1",
+ b"row_key_2",
+ b"row_key_3",
+ b"sample_row_key_1",
+ b"sample_row_key_2",
+ ]
+
+ rows = []
+ for row_key in row_keys:
+ row = Config.TABLE.row(row_key)
+ row.set_cell(COLUMN_FAMILY_ID, COL_NAME1, CELL_VAL1)
+ rows.append(row)
+ Config.TABLE.mutate_rows(rows)
+ # [START bigtable_api_add_row_range_with_prefix]
+ from google.cloud.bigtable import Client
+ from google.cloud.bigtable.row_set import RowSet
+
+ client = Client(admin=True)
+ instance = client.instance(INSTANCE_ID)
+ table = instance.table(TABLE_ID)
+
+ row_set = RowSet()
+ row_set.add_row_range_with_prefix("row")
+ # [END bigtable_api_add_row_range_with_prefix]
+
+ read_rows = table.read_rows(row_set=row_set)
+ expected_row_keys = [
+ b"row_key_1",
+ b"row_key_2",
+ b"row_key_3",
+ ]
+ found_row_keys = [row.row_key for row in read_rows]
+ assert found_row_keys == expected_row_keys
table.truncate(timeout=200)
def test_bigtable_batcher_mutate_flush_mutate_rows():
- # [START bigtable_batcher_mutate]
+ # [START bigtable_api_batcher_mutate]
from google.cloud.bigtable import Client
client = Client(admin=True)
@@ -709,16 +758,16 @@ def test_bigtable_batcher_mutate_flush_mutate_rows():
row_key = b"row_key_1"
row = table.row(row_key)
row.set_cell(
- COLUMN_FAMILY_ID, COL_NAME1, "value-0", timestamp=datetime.datetime.utcnow()
+ COLUMN_FAMILY_ID, COL_NAME1, "value-0", timestamp=datetime.now(timezone.utc)
)
# In batcher, mutate will flush current batch if it
# reaches the max_row_bytes
batcher.mutate(row)
batcher.flush()
- # [END bigtable_batcher_mutate]
+ # [END bigtable_api_batcher_mutate]
- # [START bigtable_batcher_flush]
+ # [START bigtable_api_batcher_flush]
from google.cloud.bigtable import Client
client = Client(admin=True)
@@ -736,7 +785,7 @@ def test_bigtable_batcher_mutate_flush_mutate_rows():
# reaches the max_row_bytes
batcher.mutate(row)
batcher.flush()
- # [END bigtable_batcher_flush]
+ # [END bigtable_api_batcher_flush]
rows_on_table = []
for row in table.read_rows():
@@ -744,7 +793,7 @@ def test_bigtable_batcher_mutate_flush_mutate_rows():
assert len(rows_on_table) == 2
table.truncate(timeout=200)
- # [START bigtable_batcher_mutate_rows]
+ # [START bigtable_api_batcher_mutate_rows]
from google.cloud.bigtable import Client
client = Client(admin=True)
@@ -768,7 +817,7 @@ def test_bigtable_batcher_mutate_flush_mutate_rows():
# reaches the max flush_count
# Manually send the current batch to Cloud Bigtable
batcher.flush()
- # [END bigtable_batcher_mutate_rows]
+ # [END bigtable_api_batcher_mutate_rows]
rows_on_table = []
for row in table.read_rows():
@@ -778,7 +827,7 @@ def test_bigtable_batcher_mutate_flush_mutate_rows():
def test_bigtable_create_family_gc_max_age():
- # [START bigtable_create_family_gc_max_age]
+ # [START bigtable_api_create_family_gc_max_age]
from google.cloud.bigtable import Client
from google.cloud.bigtable import column_family
@@ -792,7 +841,7 @@ def test_bigtable_create_family_gc_max_age():
column_family_obj = table.column_family("cf1", max_age_rule)
column_family_obj.create()
- # [END bigtable_create_family_gc_max_age]
+ # [END bigtable_api_create_family_gc_max_age]
rule = str(column_family_obj.to_pb())
assert "max_age" in rule
assert "seconds: 432000" in rule
@@ -800,7 +849,7 @@ def test_bigtable_create_family_gc_max_age():
def test_bigtable_create_family_gc_max_versions():
- # [START bigtable_create_family_gc_max_versions]
+ # [START bigtable_api_create_family_gc_max_versions]
from google.cloud.bigtable import Client
from google.cloud.bigtable import column_family
@@ -814,14 +863,14 @@ def test_bigtable_create_family_gc_max_versions():
column_family_obj = table.column_family("cf2", max_versions_rule)
column_family_obj.create()
- # [END bigtable_create_family_gc_max_versions]
+ # [END bigtable_api_create_family_gc_max_versions]
rule = str(column_family_obj.to_pb())
assert "max_num_versions: 2" in rule
column_family_obj.delete()
def test_bigtable_create_family_gc_union():
- # [START bigtable_create_family_gc_union]
+ # [START bigtable_api_create_family_gc_union]
from google.cloud.bigtable import Client
from google.cloud.bigtable import column_family
@@ -837,7 +886,7 @@ def test_bigtable_create_family_gc_union():
column_family_obj = table.column_family("cf3", union_rule)
column_family_obj.create()
- # [END bigtable_create_family_gc_union]
+ # [END bigtable_api_create_family_gc_union]
rule = str(column_family_obj.to_pb())
assert "union" in rule
assert "max_age" in rule
@@ -847,7 +896,7 @@ def test_bigtable_create_family_gc_union():
def test_bigtable_create_family_gc_intersection():
- # [START bigtable_create_family_gc_intersection]
+ # [START bigtable_api_create_family_gc_intersection]
from google.cloud.bigtable import Client
from google.cloud.bigtable import column_family
@@ -865,7 +914,7 @@ def test_bigtable_create_family_gc_intersection():
column_family_obj = table.column_family("cf4", intersection_rule)
column_family_obj.create()
- # [END bigtable_create_family_gc_intersection]
+ # [END bigtable_api_create_family_gc_intersection]
rule = str(column_family_obj.to_pb())
assert "intersection" in rule
@@ -876,7 +925,7 @@ def test_bigtable_create_family_gc_intersection():
def test_bigtable_create_family_gc_nested():
- # [START bigtable_create_family_gc_nested]
+ # [START bigtable_api_create_family_gc_nested]
from google.cloud.bigtable import Client
from google.cloud.bigtable import column_family
@@ -903,7 +952,7 @@ def test_bigtable_create_family_gc_nested():
column_family_obj = table.column_family("cf5", nested_rule)
column_family_obj.create()
- # [END bigtable_create_family_gc_nested]
+ # [END bigtable_api_create_family_gc_nested]
rule = str(column_family_obj.to_pb())
assert "intersection" in rule
@@ -914,20 +963,19 @@ def test_bigtable_create_family_gc_nested():
def test_bigtable_row_data_cells_cell_value_cell_values():
-
value = b"value_in_col1"
row = Config.TABLE.row(b"row_key_1")
row.set_cell(
- COLUMN_FAMILY_ID, COL_NAME1, value, timestamp=datetime.datetime.utcnow()
+ COLUMN_FAMILY_ID, COL_NAME1, value, timestamp=datetime.now(timezone.utc)
)
row.commit()
row.set_cell(
- COLUMN_FAMILY_ID, COL_NAME1, value, timestamp=datetime.datetime.utcnow()
+ COLUMN_FAMILY_ID, COL_NAME1, value, timestamp=datetime.now(timezone.utc)
)
row.commit()
- # [START bigtable_row_data_cells]
+ # [START bigtable_api_row_data_cells]
from google.cloud.bigtable import Client
client = Client(admin=True)
@@ -937,12 +985,12 @@ def test_bigtable_row_data_cells_cell_value_cell_values():
row_data = table.read_row(row_key)
cells = row_data.cells
- # [END bigtable_row_data_cells]
+ # [END bigtable_api_row_data_cells]
actual_cell_value = cells[COLUMN_FAMILY_ID][COL_NAME1][0].value
assert actual_cell_value == value
- # [START bigtable_row_cell_value]
+ # [START bigtable_api_row_cell_value]
from google.cloud.bigtable import Client
client = Client(admin=True)
@@ -952,10 +1000,10 @@ def test_bigtable_row_data_cells_cell_value_cell_values():
row_data = table.read_row(row_key)
cell_value = row_data.cell_value(COLUMN_FAMILY_ID, COL_NAME1)
- # [END bigtable_row_cell_value]
+ # [END bigtable_api_row_cell_value]
assert cell_value == value
- # [START bigtable_row_cell_values]
+ # [START bigtable_api_row_cell_values]
from google.cloud.bigtable import Client
client = Client(admin=True)
@@ -965,7 +1013,7 @@ def test_bigtable_row_data_cells_cell_value_cell_values():
row_data = table.read_row(row_key)
cell_values = row_data.cell_values(COLUMN_FAMILY_ID, COL_NAME1)
- # [END bigtable_row_cell_values]
+ # [END bigtable_api_row_cell_values]
for actual_value, timestamp in cell_values:
assert actual_value == value
@@ -974,7 +1022,7 @@ def test_bigtable_row_data_cells_cell_value_cell_values():
row.set_cell(COLUMN_FAMILY_ID, COL_NAME2, value2)
row.commit()
- # [START bigtable_row_find_cells]
+ # [START bigtable_api_row_find_cells]
from google.cloud.bigtable import Client
client = Client(admin=True)
@@ -984,14 +1032,14 @@ def test_bigtable_row_data_cells_cell_value_cell_values():
row = table.read_row(row_key)
cells = row.find_cells(COLUMN_FAMILY_ID, COL_NAME2)
- # [END bigtable_row_find_cells]
+ # [END bigtable_api_row_find_cells]
assert cells[0].value == value2
table.truncate(timeout=200)
def test_bigtable_row_setcell_rowkey():
- # [START bigtable_row_set_cell]
+ # [START bigtable_api_row_set_cell]
from google.cloud.bigtable import Client
client = Client(admin=True)
@@ -1001,16 +1049,16 @@ def test_bigtable_row_setcell_rowkey():
cell_val = b"cell-val"
row.set_cell(
- COLUMN_FAMILY_ID, COL_NAME1, cell_val, timestamp=datetime.datetime.utcnow()
+ COLUMN_FAMILY_ID, COL_NAME1, cell_val, timestamp=datetime.now(timezone.utc)
)
- # [END bigtable_row_set_cell]
+ # [END bigtable_api_row_set_cell]
response = table.mutate_rows([row])
# validate that all rows written successfully
for i, status in enumerate(response):
assert status.code == 0
- # [START bigtable_row_row_key]
+ # [START bigtable_api_row_row_key]
from google.cloud.bigtable import Client
client = Client(admin=True)
@@ -1019,10 +1067,10 @@ def test_bigtable_row_setcell_rowkey():
row = table.row(ROW_KEY1)
row_key = row.row_key
- # [END bigtable_row_row_key]
+ # [END bigtable_api_row_row_key]
assert row_key == ROW_KEY1
- # [START bigtable_row_table]
+ # [START bigtable_api_row_table]
from google.cloud.bigtable import Client
client = Client(admin=True)
@@ -1031,7 +1079,7 @@ def test_bigtable_row_setcell_rowkey():
row = table.row(ROW_KEY1)
table1 = row.table
- # [END bigtable_row_table]
+ # [END bigtable_api_row_table]
assert table1 == table
table.truncate(timeout=200)
@@ -1047,7 +1095,7 @@ def test_bigtable_row_delete():
written_row_keys.append(row.row_key)
assert written_row_keys == [b"row_key_1"]
- # [START bigtable_row_delete]
+ # [START bigtable_api_row_delete]
from google.cloud.bigtable import Client
client = Client(admin=True)
@@ -1059,7 +1107,7 @@ def test_bigtable_row_delete():
row_obj.delete()
row_obj.commit()
- # [END bigtable_row_delete]
+ # [END bigtable_api_row_delete]
written_row_keys = []
for row in table.read_rows():
@@ -1079,7 +1127,7 @@ def test_bigtable_row_delete_cell():
written_row_keys.append(row.row_key)
assert written_row_keys == [row_key1]
- # [START bigtable_row_delete_cell]
+ # [START bigtable_api_row_delete_cell]
from google.cloud.bigtable import Client
client = Client(admin=True)
@@ -1091,7 +1139,7 @@ def test_bigtable_row_delete_cell():
row_obj.delete_cell(COLUMN_FAMILY_ID, COL_NAME1)
row_obj.commit()
- # [END bigtable_row_delete_cell]
+ # [END bigtable_api_row_delete_cell]
for row in table.read_rows():
assert not row.row_key
@@ -1112,7 +1160,7 @@ def test_bigtable_row_delete_cells():
written_row_keys.append(row.row_key)
assert written_row_keys == [row_key1]
- # [START bigtable_row_delete_cells]
+ # [START bigtable_api_row_delete_cells]
from google.cloud.bigtable import Client
client = Client(admin=True)
@@ -1124,7 +1172,7 @@ def test_bigtable_row_delete_cells():
row_obj.delete_cells(COLUMN_FAMILY_ID, [COL_NAME1, COL_NAME2])
row_obj.commit()
- # [END bigtable_row_delete_cells]
+ # [END bigtable_api_row_delete_cells]
for row in table.read_rows():
assert not row.row_key
@@ -1138,7 +1186,7 @@ def test_bigtable_row_clear():
mutation_size = row_obj.get_mutations_size()
assert mutation_size > 0
- # [START bigtable_row_clear]
+ # [START bigtable_api_row_clear]
from google.cloud.bigtable import Client
client = Client(admin=True)
@@ -1150,14 +1198,14 @@ def test_bigtable_row_clear():
row_obj.set_cell(COLUMN_FAMILY_ID, COL_NAME1, b"cell-val")
row_obj.clear()
- # [END bigtable_row_clear]
+ # [END bigtable_api_row_clear]
mutation_size = row_obj.get_mutations_size()
assert mutation_size == 0
def test_bigtable_row_clear_get_mutations_size():
- # [START bigtable_row_get_mutations_size]
+ # [START bigtable_api_row_get_mutations_size]
from google.cloud.bigtable import Client
client = Client(admin=True)
@@ -1168,7 +1216,7 @@ def test_bigtable_row_clear_get_mutations_size():
row_obj = table.row(row_key_id)
mutation_size = row_obj.get_mutations_size()
- # [END bigtable_row_get_mutations_size]
+ # [END bigtable_api_row_get_mutations_size]
row_obj.set_cell(COLUMN_FAMILY_ID, COL_NAME1, b"cell-val")
mutation_size = row_obj.get_mutations_size()
assert mutation_size > 0
@@ -1179,7 +1227,7 @@ def test_bigtable_row_clear_get_mutations_size():
def test_bigtable_row_setcell_commit_rowkey():
- # [START bigtable_row_set_cell]
+ # [START bigtable_api_row_set_cell]
from google.cloud.bigtable import Client
client = Client(admin=True)
@@ -1190,10 +1238,10 @@ def test_bigtable_row_setcell_commit_rowkey():
cell_val = b"cell-val"
row_obj = table.row(row_key)
row_obj.set_cell(COLUMN_FAMILY_ID, COL_NAME1, cell_val)
- # [END bigtable_row_set_cell]
+ # [END bigtable_api_row_set_cell]
row_obj.commit()
- # [START bigtable_row_commit]
+ # [START bigtable_api_row_commit]
from google.cloud.bigtable import Client
client = Client(admin=True)
@@ -1205,7 +1253,7 @@ def test_bigtable_row_setcell_commit_rowkey():
row_obj = table.row(row_key)
row_obj.set_cell(COLUMN_FAMILY_ID, COL_NAME1, cell_val)
row_obj.commit()
- # [END bigtable_row_commit]
+ # [END bigtable_api_row_commit]
written_row_keys = []
for row in table.read_rows():
@@ -1213,7 +1261,7 @@ def test_bigtable_row_setcell_commit_rowkey():
assert written_row_keys == [b"row_key_1", b"row_key_2"]
- # [START bigtable_row_row_key]
+ # [START bigtable_api_row_row_key]
from google.cloud.bigtable import Client
client = Client(admin=True)
@@ -1223,7 +1271,7 @@ def test_bigtable_row_setcell_commit_rowkey():
row_key_id = b"row_key_2"
row_obj = table.row(row_key_id)
row_key = row_obj.row_key
- # [END bigtable_row_row_key]
+ # [END bigtable_api_row_row_key]
assert row_key == row_key_id
table.truncate(timeout=300)
@@ -1235,7 +1283,7 @@ def test_bigtable_row_append_cell_value():
row.set_cell(COLUMN_FAMILY_ID, COL_NAME1, cell_val1)
row.commit()
- # [START bigtable_row_append_cell_value]
+ # [START bigtable_api_row_append_cell_value]
from google.cloud.bigtable import Client
client = Client(admin=True)
@@ -1245,14 +1293,14 @@ def test_bigtable_row_append_cell_value():
cell_val2 = b"2"
row.append_cell_value(COLUMN_FAMILY_ID, COL_NAME1, cell_val2)
- # [END bigtable_row_append_cell_value]
+ # [END bigtable_api_row_append_cell_value]
row.commit()
row_data = table.read_row(ROW_KEY1)
actual_value = row_data.cell_value(COLUMN_FAMILY_ID, COL_NAME1)
assert actual_value == cell_val1 + cell_val2
- # [START bigtable_row_commit]
+ # [START bigtable_api_row_commit]
from google.cloud.bigtable import Client
client = Client(admin=True)
@@ -1262,9 +1310,9 @@ def test_bigtable_row_append_cell_value():
cell_val = 1
row.set_cell(COLUMN_FAMILY_ID, COL_NAME1, cell_val)
row.commit()
- # [END bigtable_row_commit]
+ # [END bigtable_api_row_commit]
- # [START bigtable_row_increment_cell_value]
+ # [START bigtable_api_row_increment_cell_value]
from google.cloud.bigtable import Client
client = Client(admin=True)
@@ -1274,7 +1322,7 @@ def test_bigtable_row_append_cell_value():
int_val = 3
row.increment_cell_value(COLUMN_FAMILY_ID, COL_NAME1, int_val)
- # [END bigtable_row_increment_cell_value]
+ # [END bigtable_api_row_increment_cell_value]
row.commit()
row_data = table.read_row(ROW_KEY2)
diff --git a/docs/table-api.rst b/docs/classic_client/table-api.rst
similarity index 69%
rename from docs/table-api.rst
rename to docs/classic_client/table-api.rst
index 5168aad49..1bbf85146 100644
--- a/docs/table-api.rst
+++ b/docs/classic_client/table-api.rst
@@ -143,12 +143,11 @@ data directly via a :class:`Table `.
Head next to learn about the :doc:`data-api`.
-.. _ListTables: https://github.com/GoogleCloudPlatform/cloud-bigtable-client/blob/2aae624081f652427052fb652d3ae43d8ac5bf5a/bigtable-protos/src/main/proto/google/bigtable/admin/table/v1/bigtable_table_service.proto#L40-L42
-.. _CreateTable: https://github.com/GoogleCloudPlatform/cloud-bigtable-client/blob/2aae624081f652427052fb652d3ae43d8ac5bf5a/bigtable-protos/src/main/proto/google/bigtable/admin/table/v1/bigtable_table_service.proto#L35-L37
-.. _DeleteTable: https://github.com/GoogleCloudPlatform/cloud-bigtable-client/blob/2aae624081f652427052fb652d3ae43d8ac5bf5a/bigtable-protos/src/main/proto/google/bigtable/admin/table/v1/bigtable_table_service.proto#L50-L52
-.. _RenameTable: https://github.com/GoogleCloudPlatform/cloud-bigtable-client/blob/2aae624081f652427052fb652d3ae43d8ac5bf5a/bigtable-protos/src/main/proto/google/bigtable/admin/table/v1/bigtable_table_service.proto#L56-L58
-.. _GetTable: https://github.com/GoogleCloudPlatform/cloud-bigtable-client/blob/2aae624081f652427052fb652d3ae43d8ac5bf5a/bigtable-protos/src/main/proto/google/bigtable/admin/table/v1/bigtable_table_service.proto#L45-L47
-.. _CreateColumnFamily: https://github.com/GoogleCloudPlatform/cloud-bigtable-client/blob/2aae624081f652427052fb652d3ae43d8ac5bf5a/bigtable-protos/src/main/proto/google/bigtable/admin/table/v1/bigtable_table_service.proto#L61-L63
-.. _UpdateColumnFamily: https://github.com/GoogleCloudPlatform/cloud-bigtable-client/blob/2aae624081f652427052fb652d3ae43d8ac5bf5a/bigtable-protos/src/main/proto/google/bigtable/admin/table/v1/bigtable_table_service.proto#L66-L68
-.. _DeleteColumnFamily: https://github.com/GoogleCloudPlatform/cloud-bigtable-client/blob/2aae624081f652427052fb652d3ae43d8ac5bf5a/bigtable-protos/src/main/proto/google/bigtable/admin/table/v1/bigtable_table_service.proto#L71-L73
+.. _ListTables: https://googleapis.dev/python/bigtable/latest/table-api.html#list-tables
+.. _CreateTable: https://googleapis.dev/python/bigtable/latest/table-api.html#create-a-new-table
+.. _DeleteTable: https://googleapis.dev/python/bigtable/latest/table-api.html#delete-an-existing-table
+.. _GetTable: https://github.com/googleapis/python-bigtable/blob/main/google/cloud/bigtable_admin_v2/proto/bigtable_table_admin.proto#L97-L102
+.. _CreateColumnFamily: https://googleapis.dev/python/bigtable/latest/table-api.html?highlight=gettable#create-a-new-column-family
+.. _UpdateColumnFamily: https://googleapis.dev/python/bigtable/latest/table-api.html?highlight=gettable#update-an-existing-column-family
+.. _DeleteColumnFamily: https://googleapis.dev/python/bigtable/latest/table-api.html?highlight=gettable#delete-an-existing-column-family
.. _column families: https://cloud.google.com/bigtable/docs/schema-design#column_families_and_column_qualifiers
diff --git a/docs/table.rst b/docs/classic_client/table.rst
similarity index 100%
rename from docs/table.rst
rename to docs/classic_client/table.rst
diff --git a/docs/usage.rst b/docs/classic_client/usage.rst
similarity index 84%
rename from docs/usage.rst
rename to docs/classic_client/usage.rst
index aa8d899d5..7a47f4d4a 100644
--- a/docs/usage.rst
+++ b/docs/classic_client/usage.rst
@@ -1,18 +1,28 @@
-Using the API
-=============
+Classic Client
+==============
.. toctree::
:maxdepth: 2
client-intro
+
+ instance-api
+ table-api
+ data-api
+
client
cluster
instance
table
+ app-profile
+ backup
column-family
+ encryption-info
row
row-data
row-filters
+ row-set
+ batcher
In the hierarchy of API concepts
diff --git a/docs/conf.py b/docs/conf.py
index a33e54fc2..d8f0352cd 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -1,4 +1,17 @@
# -*- coding: utf-8 -*-
+# Copyright 2024 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
#
# google-cloud-bigtable documentation build configuration file
#
@@ -20,12 +33,16 @@
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath(".."))
+# For plugins that can not read conf.py.
+# See also: https://github.com/docascode/sphinx-docfx-yaml/issues/85
+sys.path.insert(0, os.path.abspath("."))
+
__version__ = ""
# -- General configuration ------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
-needs_sphinx = "1.6.3"
+needs_sphinx = "1.5.5"
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
@@ -35,6 +52,7 @@
"sphinx.ext.autosummary",
"sphinx.ext.intersphinx",
"sphinx.ext.coverage",
+ "sphinx.ext.doctest",
"sphinx.ext.napoleon",
"sphinx.ext.todo",
"sphinx.ext.viewcode",
@@ -58,13 +76,13 @@
# The encoding of source files.
# source_encoding = 'utf-8-sig'
-# The master toctree document.
-master_doc = "index"
+# The root toctree document.
+root_doc = "index"
# General information about the project.
-project = u"google-cloud-bigtable"
-copyright = u"2019, Google"
-author = u"Google APIs"
+project = "google-cloud-bigtable"
+copyright = "2019, Google"
+author = "Google APIs"
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
@@ -90,7 +108,13 @@
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
-exclude_patterns = ["_build"]
+exclude_patterns = [
+ "_build",
+ "**/.nox/**/*",
+ "samples/AUTHORING_GUIDE.md",
+ "samples/CONTRIBUTING.md",
+ "samples/snippets/README.rst",
+]
# The reST default role (used for this markup: `text`) to use for all
# documents.
@@ -256,9 +280,9 @@
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(
- master_doc,
+ root_doc,
"google-cloud-bigtable.tex",
- u"google-cloud-bigtable Documentation",
+ "google-cloud-bigtable Documentation",
author,
"manual",
)
@@ -291,9 +315,9 @@
# (source start file, name, description, authors, manual section).
man_pages = [
(
- master_doc,
+ root_doc,
"google-cloud-bigtable",
- u"google-cloud-bigtable Documentation",
+ "google-cloud-bigtable Documentation",
[author],
1,
)
@@ -310,9 +334,9 @@
# dir menu entry, description, category)
texinfo_documents = [
(
- master_doc,
+ root_doc,
"google-cloud-bigtable",
- u"google-cloud-bigtable Documentation",
+ "google-cloud-bigtable Documentation",
author,
"google-cloud-bigtable",
"google-cloud-bigtable Library",
@@ -335,10 +359,15 @@
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {
- "python": ("http://python.readthedocs.org/en/latest/", None),
- "google-auth": ("https://google-auth.readthedocs.io/en/stable", None),
- "google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None,),
- "grpc": ("https://grpc.io/grpc/python/", None),
+ "python": ("https://python.readthedocs.org/en/latest/", None),
+ "google-auth": ("https://googleapis.dev/python/google-auth/latest/", None),
+ "google.api_core": (
+ "https://googleapis.dev/python/google-api-core/latest/",
+ None,
+ ),
+ "grpc": ("https://grpc.github.io/grpc/python/", None),
+ "proto-plus": ("https://proto-plus-python.readthedocs.io/en/latest/", None),
+ "protobuf": ("https://googleapis.dev/python/protobuf/latest/", None),
}
diff --git a/docs/data_client/async_data_authorized_view.rst b/docs/data_client/async_data_authorized_view.rst
new file mode 100644
index 000000000..7d7312970
--- /dev/null
+++ b/docs/data_client/async_data_authorized_view.rst
@@ -0,0 +1,11 @@
+Authorized View Async
+~~~~~~~~~~~~~~~~~~~~~
+
+ .. note::
+
+ It is generally not recommended to use the async client in an otherwise synchronous codebase. To make use of asyncio's
+ performance benefits, the codebase should be designed to be async from the ground up.
+
+.. autoclass:: google.cloud.bigtable.data._async.client.AuthorizedViewAsync
+ :members:
+ :inherited-members:
diff --git a/docs/data_client/async_data_client.rst b/docs/data_client/async_data_client.rst
new file mode 100644
index 000000000..2ddcc090c
--- /dev/null
+++ b/docs/data_client/async_data_client.rst
@@ -0,0 +1,12 @@
+Bigtable Data Client Async
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ .. note::
+
+ It is generally not recommended to use the async client in an otherwise synchronous codebase. To make use of asyncio's
+ performance benefits, the codebase should be designed to be async from the ground up.
+
+
+.. autoclass:: google.cloud.bigtable.data.BigtableDataClientAsync
+ :members:
+ :show-inheritance:
diff --git a/docs/data_client/async_data_execute_query_iterator.rst b/docs/data_client/async_data_execute_query_iterator.rst
new file mode 100644
index 000000000..b911fab7f
--- /dev/null
+++ b/docs/data_client/async_data_execute_query_iterator.rst
@@ -0,0 +1,6 @@
+Execute Query Iterator Async
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. autoclass:: google.cloud.bigtable.data.execute_query.ExecuteQueryIteratorAsync
+ :members:
+ :show-inheritance:
diff --git a/docs/data_client/async_data_mutations_batcher.rst b/docs/data_client/async_data_mutations_batcher.rst
new file mode 100644
index 000000000..3e81f885a
--- /dev/null
+++ b/docs/data_client/async_data_mutations_batcher.rst
@@ -0,0 +1,6 @@
+Mutations Batcher Async
+~~~~~~~~~~~~~~~~~~~~~~~
+
+.. automodule:: google.cloud.bigtable.data._async.mutations_batcher
+ :members:
+ :show-inheritance:
diff --git a/docs/data_client/async_data_table.rst b/docs/data_client/async_data_table.rst
new file mode 100644
index 000000000..37c396570
--- /dev/null
+++ b/docs/data_client/async_data_table.rst
@@ -0,0 +1,11 @@
+Table Async
+~~~~~~~~~~~
+
+ .. note::
+
+ It is generally not recommended to use the async client in an otherwise synchronous codebase. To make use of asyncio's
+ performance benefits, the codebase should be designed to be async from the ground up.
+
+.. autoclass:: google.cloud.bigtable.data._async.client.TableAsync
+ :members:
+ :inherited-members:
diff --git a/docs/data_client/common_data_exceptions.rst b/docs/data_client/common_data_exceptions.rst
new file mode 100644
index 000000000..6180ef222
--- /dev/null
+++ b/docs/data_client/common_data_exceptions.rst
@@ -0,0 +1,6 @@
+Custom Exceptions
+~~~~~~~~~~~~~~~~~
+
+.. automodule:: google.cloud.bigtable.data.exceptions
+ :members:
+ :show-inheritance:
diff --git a/docs/data_client/common_data_execute_query_metadata.rst b/docs/data_client/common_data_execute_query_metadata.rst
new file mode 100644
index 000000000..69add630d
--- /dev/null
+++ b/docs/data_client/common_data_execute_query_metadata.rst
@@ -0,0 +1,6 @@
+Execute Query Metadata
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. automodule:: google.cloud.bigtable.data.execute_query.metadata
+ :members:
+ :show-inheritance:
diff --git a/docs/data_client/common_data_execute_query_values.rst b/docs/data_client/common_data_execute_query_values.rst
new file mode 100644
index 000000000..6c4fb71c1
--- /dev/null
+++ b/docs/data_client/common_data_execute_query_values.rst
@@ -0,0 +1,6 @@
+Execute Query Values
+~~~~~~~~~~~~~~~~~~~~
+
+.. automodule:: google.cloud.bigtable.data.execute_query.values
+ :members:
+ :show-inheritance:
diff --git a/docs/data_client/common_data_mutations.rst b/docs/data_client/common_data_mutations.rst
new file mode 100644
index 000000000..9d7a9eab2
--- /dev/null
+++ b/docs/data_client/common_data_mutations.rst
@@ -0,0 +1,6 @@
+Mutations
+~~~~~~~~~
+
+.. automodule:: google.cloud.bigtable.data.mutations
+ :members:
+ :show-inheritance:
diff --git a/docs/data_client/common_data_read_modify_write_rules.rst b/docs/data_client/common_data_read_modify_write_rules.rst
new file mode 100644
index 000000000..2f28ddf3f
--- /dev/null
+++ b/docs/data_client/common_data_read_modify_write_rules.rst
@@ -0,0 +1,6 @@
+Read Modify Write Rules
+~~~~~~~~~~~~~~~~~~~~~~~
+
+.. automodule:: google.cloud.bigtable.data.read_modify_write_rules
+ :members:
+ :show-inheritance:
diff --git a/docs/data_client/common_data_read_rows_query.rst b/docs/data_client/common_data_read_rows_query.rst
new file mode 100644
index 000000000..4e3e796d9
--- /dev/null
+++ b/docs/data_client/common_data_read_rows_query.rst
@@ -0,0 +1,6 @@
+Read Rows Query
+~~~~~~~~~~~~~~~
+
+.. automodule:: google.cloud.bigtable.data.read_rows_query
+ :members:
+ :show-inheritance:
diff --git a/docs/data_client/common_data_row.rst b/docs/data_client/common_data_row.rst
new file mode 100644
index 000000000..63bc71143
--- /dev/null
+++ b/docs/data_client/common_data_row.rst
@@ -0,0 +1,6 @@
+Rows and Cells
+~~~~~~~~~~~~~~
+
+.. automodule:: google.cloud.bigtable.data.row
+ :members:
+ :show-inheritance:
diff --git a/docs/data_client/common_data_row_filters.rst b/docs/data_client/common_data_row_filters.rst
new file mode 100644
index 000000000..22bda8a26
--- /dev/null
+++ b/docs/data_client/common_data_row_filters.rst
@@ -0,0 +1,62 @@
+Bigtable Row Filters
+====================
+
+It is possible to use a
+:class:`RowFilter `
+when constructing a :class:`ReadRowsQuery `
+
+The following basic filters
+are provided:
+
+* :class:`SinkFilter <.data.row_filters.SinkFilter>`
+* :class:`PassAllFilter <.data.row_filters.PassAllFilter>`
+* :class:`BlockAllFilter <.data.row_filters.BlockAllFilter>`
+* :class:`RowKeyRegexFilter <.data.row_filters.RowKeyRegexFilter>`
+* :class:`RowSampleFilter <.data.row_filters.RowSampleFilter>`
+* :class:`FamilyNameRegexFilter <.data.row_filters.FamilyNameRegexFilter>`
+* :class:`ColumnQualifierRegexFilter <.data.row_filters.ColumnQualifierRegexFilter>`
+* :class:`TimestampRangeFilter <.data.row_filters.TimestampRangeFilter>`
+* :class:`ColumnRangeFilter <.data.row_filters.ColumnRangeFilter>`
+* :class:`ValueRegexFilter <.data.row_filters.ValueRegexFilter>`
+* :class:`ValueRangeFilter <.data.row_filters.ValueRangeFilter>`
+* :class:`CellsRowOffsetFilter <.data.row_filters.CellsRowOffsetFilter>`
+* :class:`CellsRowLimitFilter <.data.row_filters.CellsRowLimitFilter>`
+* :class:`CellsColumnLimitFilter <.data.row_filters.CellsColumnLimitFilter>`
+* :class:`StripValueTransformerFilter <.data.row_filters.StripValueTransformerFilter>`
+* :class:`ApplyLabelFilter <.data.row_filters.ApplyLabelFilter>`
+
+In addition, these filters can be combined into composite filters with
+
+* :class:`RowFilterChain <.data.row_filters.RowFilterChain>`
+* :class:`RowFilterUnion <.data.row_filters.RowFilterUnion>`
+* :class:`ConditionalRowFilter <.data.row_filters.ConditionalRowFilter>`
+
+These rules can be nested arbitrarily, with a basic filter at the lowest
+level. For example:
+
+.. code:: python
+
+ # Filter in a specified column (matching any column family).
+ col1_filter = ColumnQualifierRegexFilter(b'columnbia')
+
+ # Create a filter to label results.
+ label1 = u'label-red'
+ label1_filter = ApplyLabelFilter(label1)
+
+ # Combine the filters to label all the cells in columnbia.
+ chain1 = RowFilterChain(filters=[col1_filter, label1_filter])
+
+ # Create a similar filter to label cells blue.
+ col2_filter = ColumnQualifierRegexFilter(b'columnseeya')
+ label2 = u'label-blue'
+ label2_filter = ApplyLabelFilter(label2)
+ chain2 = RowFilterChain(filters=[col2_filter, label2_filter])
+
+ # Bring our two labeled columns together.
+ row_filter = RowFilterUnion(filters=[chain1, chain2])
+
+----
+
+.. automodule:: google.cloud.bigtable.data.row_filters
+ :members:
+ :show-inheritance:
diff --git a/docs/data_client/data_client_usage.rst b/docs/data_client/data_client_usage.rst
new file mode 100644
index 000000000..708dafc62
--- /dev/null
+++ b/docs/data_client/data_client_usage.rst
@@ -0,0 +1,41 @@
+Data Client
+===========
+
+Sync Surface
+------------
+
+.. toctree::
+ :maxdepth: 3
+
+ sync_data_client
+ sync_data_table
+ sync_data_authorized_view
+ sync_data_mutations_batcher
+ sync_data_execute_query_iterator
+
+Async Surface
+-------------
+
+.. toctree::
+ :maxdepth: 3
+
+ async_data_client
+ async_data_table
+ async_data_authorized_view
+ async_data_mutations_batcher
+ async_data_execute_query_iterator
+
+Common Classes
+--------------
+
+.. toctree::
+ :maxdepth: 3
+
+ common_data_read_rows_query
+ common_data_row
+ common_data_row_filters
+ common_data_mutations
+ common_data_read_modify_write_rules
+ common_data_exceptions
+ common_data_execute_query_values
+ common_data_execute_query_metadata
diff --git a/docs/data_client/sync_data_authorized_view.rst b/docs/data_client/sync_data_authorized_view.rst
new file mode 100644
index 000000000..c0ac29721
--- /dev/null
+++ b/docs/data_client/sync_data_authorized_view.rst
@@ -0,0 +1,6 @@
+Authorized View
+~~~~~~~~~~~~~~~
+
+.. autoclass:: google.cloud.bigtable.data._sync_autogen.client.AuthorizedView
+ :members:
+ :inherited-members:
diff --git a/docs/data_client/sync_data_client.rst b/docs/data_client/sync_data_client.rst
new file mode 100644
index 000000000..cf7c00dad
--- /dev/null
+++ b/docs/data_client/sync_data_client.rst
@@ -0,0 +1,6 @@
+Bigtable Data Client
+~~~~~~~~~~~~~~~~~~~~
+
+.. autoclass:: google.cloud.bigtable.data.BigtableDataClient
+ :members:
+ :show-inheritance:
diff --git a/docs/data_client/sync_data_execute_query_iterator.rst b/docs/data_client/sync_data_execute_query_iterator.rst
new file mode 100644
index 000000000..6eb9f84db
--- /dev/null
+++ b/docs/data_client/sync_data_execute_query_iterator.rst
@@ -0,0 +1,6 @@
+Execute Query Iterator
+~~~~~~~~~~~~~~~~~~~~~~
+
+.. autoclass:: google.cloud.bigtable.data.execute_query.ExecuteQueryIterator
+ :members:
+ :show-inheritance:
diff --git a/docs/data_client/sync_data_mutations_batcher.rst b/docs/data_client/sync_data_mutations_batcher.rst
new file mode 100644
index 000000000..2b7d1bfe0
--- /dev/null
+++ b/docs/data_client/sync_data_mutations_batcher.rst
@@ -0,0 +1,6 @@
+Mutations Batcher
+~~~~~~~~~~~~~~~~~
+
+.. automodule:: google.cloud.bigtable.data._sync_autogen.mutations_batcher
+ :members:
+ :show-inheritance:
diff --git a/docs/data_client/sync_data_table.rst b/docs/data_client/sync_data_table.rst
new file mode 100644
index 000000000..95c91eb27
--- /dev/null
+++ b/docs/data_client/sync_data_table.rst
@@ -0,0 +1,6 @@
+Table
+~~~~~
+
+.. autoclass:: google.cloud.bigtable.data.Table
+ :members:
+ :show-inheritance:
diff --git a/docs/index.rst b/docs/index.rst
index b1c8f0574..0694c8bb0 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -2,30 +2,26 @@
.. include:: multiprocessing.rst
-Using the API
+Client Types
-------------
.. toctree::
- :maxdepth: 2
-
- usage
-
-
-API Reference
--------------
-.. toctree::
- :maxdepth: 2
-
- instance-api
- table-api
- data-api
+ :maxdepth: 3
+ data_client/data_client_usage
+ classic_client/usage
+ admin_client/admin_client_usage
Changelog
---------
-For a list of all ``google-cloud-datastore`` releases:
+For a list of all ``google-cloud-bigtable`` releases:
.. toctree::
:maxdepth: 2
changelog
+
+.. toctree::
+ :hidden:
+
+ summary_overview.md
diff --git a/docs/multiprocessing.rst b/docs/multiprocessing.rst
index 1cb29d4ca..536d17b2e 100644
--- a/docs/multiprocessing.rst
+++ b/docs/multiprocessing.rst
@@ -1,7 +1,7 @@
.. note::
- Because this client uses :mod:`grpcio` library, it is safe to
+ Because this client uses :mod:`grpc` library, it is safe to
share instances across threads. In multiprocessing scenarios, the best
practice is to create client instances *after* the invocation of
- :func:`os.fork` by :class:`multiprocessing.Pool` or
+ :func:`os.fork` by :class:`multiprocessing.pool.Pool` or
:class:`multiprocessing.Process`.
diff --git a/docs/scripts/patch_devsite_toc.py b/docs/scripts/patch_devsite_toc.py
new file mode 100644
index 000000000..fbb753daf
--- /dev/null
+++ b/docs/scripts/patch_devsite_toc.py
@@ -0,0 +1,277 @@
+# Copyright 2024 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+"""
+This script will run after ``nox -s docfx`` is run. docfx is the api doc format used by
+google cloud. It is described here: https://github.com/googleapis/docuploader?tab=readme-ov-file#requirements-for-docfx-yaml-tarballs.
+
+One of the file used by docfx is toc.yml which is used to generate the table of contents sidebar.
+This script will patch file to create subfolders for each of the clients
+"""
+
+
+import glob
+import yaml
+import os
+import shutil
+
+# set working directory to /docs
+os.chdir(f"{os.path.dirname(os.path.abspath(__file__))}/{os.pardir}")
+
+
+def add_sections(toc_file_path, section_list, output_file_path=None):
+ """
+ Add new sections to the autogenerated docfx table of contents file
+
+ Takes in a list of TocSection objects, which should point to a directory of rst files
+ within the main /docs directory, which represents a self-contained section of content
+
+ :param toc_file_path: path to the autogenerated toc file
+ :param section_list: list of TocSection objects to add
+ :param output_file_path: path to save the updated toc file. If None, save to the input file
+ """
+ # remove any sections that are already in the toc
+ remove_sections(toc_file_path, [section.title for section in section_list])
+ # add new sections
+ current_toc = yaml.safe_load(open(toc_file_path, "r"))
+ for section in section_list:
+ print(f"Adding section {section.title}...")
+ current_toc[0]["items"].insert(-1, section.to_dict())
+ section.copy_markdown()
+ # save file
+ if output_file_path is None:
+ output_file_path = toc_file_path
+ with open(output_file_path, "w") as f:
+ yaml.dump(current_toc, f)
+
+
+def remove_sections(toc_file_path, section_list, output_file_path=None):
+ """
+ Remove sections from the autogenerated docfx table of contents file
+
+ Takes in a list of string section names to remove from the toc file
+
+ :param toc_file_path: path to the autogenerated toc file
+ :param section_list: list of section names to remove
+ :param output_file_path: path to save the updated toc file. If None, save to the input file
+ """
+ current_toc = yaml.safe_load(open(toc_file_path, "r"))
+ print(f"Removing sections {section_list}...")
+ new_items = [d for d in current_toc[0]["items"] if d["name"] not in section_list]
+ current_toc[0]["items"] = new_items
+ # save file
+ if output_file_path is None:
+ output_file_path = toc_file_path
+ with open(output_file_path, "w") as f:
+ yaml.dump(current_toc, f)
+
+
+class TocSection:
+ def __init__(self, dir_name, index_file_name):
+ """
+ :param dir_name: name of the directory containing the rst files
+ :param index_file_name: name of an index file within dir_name. This file
+ will not be included in the table of contents, but provides an ordered
+ list of the other files which should be included
+ """
+ self.dir_name = dir_name
+ self.index_file_name = index_file_name
+ index_file_path = os.path.join(dir_name, index_file_name)
+ # find set of files referenced by the index file
+ with open(index_file_path, "r") as f:
+ self.title = None
+ in_toc = False
+ self.items = []
+ for line in f:
+ # ignore empty lines
+ if not line.strip():
+ continue
+ # add files explictly included in the toc
+ if line.startswith(".. include::"):
+ file_base = os.path.splitext(line.split("::")[1].strip())[0]
+ self.items.append(
+ self.extract_toc_entry(
+ file_base, file_title=file_base.capitalize()
+ )
+ )
+ continue
+ if line.startswith(".. toctree::"):
+ in_toc = True
+ continue
+ # ignore directives
+ if ":" in line:
+ continue
+ # set tile as first line with no directive
+ if self.title is None:
+ self.title = line.strip()
+ if not in_toc:
+ continue
+ # bail when toc indented block is done
+ if not line.startswith(" ") and not line.startswith("\t"):
+ in_toc = False
+ continue
+ # extract entries
+ self.items.append(self.extract_toc_entry(line.strip()))
+
+ def extract_toc_entry(self, file_name, file_title=None):
+ """
+ Given the name of a file, extract the title and href for the toc entry,
+ and return as a dictionary
+ """
+ # load the file to get the title
+ with open(f"{self.dir_name}/{file_name}.rst", "r") as f2:
+ if file_title is None:
+ # use first line as title if not provided
+ file_title = f2.readline().strip()
+ return {"name": file_title, "href": f"{file_name}.md"}
+
+ def to_dict(self):
+ """
+ Convert the TocSection object to a dictionary that can be written to a yaml file
+ """
+ return {"name": self.title, "items": self.items}
+
+ def copy_markdown(self):
+ """
+ Copy markdown files from _build/markdown/dir_name to _build/html/docfx_yaml
+
+ This is necessary because the markdown files in sub-directories
+ are not copied over by the docfx build by default
+ """
+ for file in os.listdir("_build/markdown/" + self.dir_name):
+ shutil.copy(
+ f"_build/markdown/{self.dir_name}/{file}",
+ f"_build/html/docfx_yaml",
+ )
+
+ def validate_section(self, toc):
+ # Make sure each rst file is listed in the toc.
+ items_in_toc = [
+ d["items"] for d in toc[0]["items"] if d["name"] == self.title and ".rst"
+ ][0]
+ items_in_dir = [f for f in os.listdir(self.dir_name) if f.endswith(".rst")]
+ # subtract 1 for index
+ assert len(items_in_toc) == len(items_in_dir) - 1
+ for file in items_in_dir:
+ if file != self.index_file_name:
+ base_name, _ = os.path.splitext(file)
+ assert any(d["href"] == f"{base_name}.md" for d in items_in_toc)
+ # make sure the markdown files are present in the docfx_yaml directory
+ md_files = [d["href"] for d in items_in_toc]
+ for file in md_files:
+ assert os.path.exists(f"_build/html/docfx_yaml/{file}")
+
+
+class UIDFilteredTocSection(TocSection):
+ def __init__(self, toc_file_path, section_name, title, uid_prefix):
+ """Creates a filtered section denoted by section_name in the toc_file_path to items with the given UID prefix.
+
+ The section is then renamed to the title.
+ """
+ current_toc = yaml.safe_load(open(toc_file_path, "r"))
+ self.uid_prefix = uid_prefix
+
+ # Since we are looking for a specific section_name there should only
+ # be one match.
+ section_items = [
+ d for d in current_toc[0]["items"] if d["name"] == section_name
+ ][0]["items"]
+ filtered_items = [d for d in section_items if d["uid"].startswith(uid_prefix)]
+ self.items = filtered_items
+ self.title = title
+
+ def copy_markdown(self):
+ """
+ No-op because we are filtering on UIDs, not markdown files.
+ """
+ pass
+
+ def validate_section(self, toc):
+ uids_in_toc = set()
+
+ # A UID-filtered TOC tree looks like the following:
+ # - items:
+ # items:
+ # name:
+ # uid:
+ #
+ # Walk through the TOC tree to find all UIDs recursively.
+ def find_uids_in_items(items):
+ uids_in_toc.add(items["uid"])
+ for subitem in items.get("items", []):
+ find_uids_in_items(subitem)
+
+ items_in_toc = [d["items"] for d in toc[0]["items"] if d["name"] == self.title][
+ 0
+ ]
+ for item in items_in_toc:
+ find_uids_in_items(item)
+
+ # Now that we have all the UIDs, first match all of them
+ # with corresponding .yml files.
+ for uid in uids_in_toc:
+ assert os.path.exists(f"_build/html/docfx_yaml/{uid}.yml")
+
+ # Also validate that every uid yml file that starts with the uid_prefix
+ # exists in the section.
+ for filename in glob.glob(
+ f"{self.uid_prefix}*.yml", root_dir="_build/html/docfx_yaml"
+ ):
+ assert filename[:-4] in uids_in_toc
+
+
+def validate_toc(toc_file_path, expected_section_list, added_sections):
+ current_toc = yaml.safe_load(open(toc_file_path, "r"))
+ # make sure the set of sections matches what we expect
+ found_sections = [d["name"] for d in current_toc[0]["items"]]
+ assert (
+ found_sections == expected_section_list
+ ), f"Expected {expected_section_list}, found {found_sections}"
+ # make sure each customs ection is in the toc
+ for section in added_sections:
+ assert section.title in found_sections
+ section.validate_section(current_toc)
+ print("Toc validation passed")
+
+
+if __name__ == "__main__":
+ # Add secrtions for the async_data_client and classic_client directories
+ toc_path = "_build/html/docfx_yaml/toc.yml"
+
+ custom_sections = [
+ TocSection(dir_name="data_client", index_file_name="data_client_usage.rst"),
+ UIDFilteredTocSection(
+ toc_file_path=toc_path,
+ section_name="Bigtable Admin V2",
+ title="Admin Client",
+ uid_prefix="google.cloud.bigtable_admin_v2",
+ ),
+ TocSection(dir_name="classic_client", index_file_name="usage.rst"),
+ ]
+ add_sections(toc_path, custom_sections)
+ # Remove the Bigtable section, since it has duplicated data
+ remove_sections(toc_path, ["Bigtable", "Bigtable Admin V2"])
+ # run validation to make sure yaml is structured as we expect
+ validate_toc(
+ toc_file_path=toc_path,
+ expected_section_list=[
+ "Overview",
+ "bigtable APIs",
+ "Changelog",
+ "Multiprocessing",
+ "Data Client",
+ "Admin Client",
+ "Classic Client",
+ ],
+ added_sections=custom_sections,
+ )
diff --git a/docs/summary_overview.md b/docs/summary_overview.md
new file mode 100644
index 000000000..2379e8b6b
--- /dev/null
+++ b/docs/summary_overview.md
@@ -0,0 +1,22 @@
+[
+This is a templated file. Adding content to this file may result in it being
+reverted. Instead, if you want to place additional content, create an
+"overview_content.md" file in `docs/` directory. The Sphinx tool will
+pick up on the content and merge the content.
+]: #
+
+# Cloud Bigtable API
+
+Overview of the APIs available for Cloud Bigtable API.
+
+## All entries
+
+Classes, methods and properties & attributes for
+Cloud Bigtable API.
+
+[classes](https://cloud.google.com/python/docs/reference/bigtable/latest/summary_class.html)
+
+[methods](https://cloud.google.com/python/docs/reference/bigtable/latest/summary_method.html)
+
+[properties and
+attributes](https://cloud.google.com/python/docs/reference/bigtable/latest/summary_property.html)
diff --git a/google/cloud/__init__.py b/google/cloud/__init__.py
deleted file mode 100644
index 2f4b4738a..000000000
--- a/google/cloud/__init__.py
+++ /dev/null
@@ -1,8 +0,0 @@
-try:
- import pkg_resources
-
- pkg_resources.declare_namespace(__name__)
-except ImportError:
- import pkgutil
-
- __path__ = pkgutil.extend_path(__path__, __name__)
diff --git a/google/cloud/bigtable/__init__.py b/google/cloud/bigtable/__init__.py
index 75b765a8a..7331ff241 100644
--- a/google/cloud/bigtable/__init__.py
+++ b/google/cloud/bigtable/__init__.py
@@ -14,12 +14,12 @@
"""Google Cloud Bigtable API package."""
+from google.cloud.bigtable.client import Client
-from pkg_resources import get_distribution
-
-__version__ = get_distribution("google-cloud-bigtable").version
+from google.cloud.bigtable import gapic_version as package_version
-from google.cloud.bigtable.client import Client
+__version__: str
+__version__ = package_version.__version__
__all__ = ["__version__", "Client"]
diff --git a/google/cloud/bigtable/app_profile.py b/google/cloud/bigtable/app_profile.py
index cb04ebfc7..8cde66146 100644
--- a/google/cloud/bigtable/app_profile.py
+++ b/google/cloud/bigtable/app_profile.py
@@ -18,7 +18,7 @@
import re
from google.cloud.bigtable.enums import RoutingPolicyType
-from google.cloud.bigtable_admin_v2.types import instance_pb2
+from google.cloud.bigtable_admin_v2.types import instance
from google.protobuf import field_mask_pb2
from google.api_core.exceptions import NotFound
@@ -59,6 +59,11 @@ class AppProfile(object):
when routing_policy_type is
ROUTING_POLICY_TYPE_SINGLE.
+ :type: multi_cluster_ids: list
+ :param: multi_cluster_ids: (Optional) The set of clusters to route to.
+ The order is ignored; clusters will be tried in order of distance.
+ If left empty, all clusters are eligible.
+
:type: allow_transactional_writes: bool
:param: allow_transactional_writes: (Optional) If true, allow
transactional writes for
@@ -72,6 +77,7 @@ def __init__(
routing_policy_type=None,
description=None,
cluster_id=None,
+ multi_cluster_ids=None,
allow_transactional_writes=None,
):
self.app_profile_id = app_profile_id
@@ -79,6 +85,7 @@ def __init__(
self.routing_policy_type = routing_policy_type
self.description = description
self.cluster_id = cluster_id
+ self.multi_cluster_ids = multi_cluster_ids
self.allow_transactional_writes = allow_transactional_writes
@property
@@ -93,8 +100,9 @@ def name(self):
For example:
.. literalinclude:: snippets.py
- :start-after: [START bigtable_app_profile_name]
- :end-before: [END bigtable_app_profile_name]
+ :start-after: [START bigtable_api_app_profile_name]
+ :end-before: [END bigtable_api_app_profile_name]
+ :dedent: 4
The AppProfile name is of the form
``"projects/../instances/../app_profile/{app_profile_id}"``
@@ -137,7 +145,7 @@ def __ne__(self, other):
def from_pb(cls, app_profile_pb, instance):
"""Creates an instance app_profile from a protobuf.
- :type app_profile_pb: :class:`instance_pb2.app_profile_pb`
+ :type app_profile_pb: :class:`instance.app_profile_pb`
:param app_profile_pb: An instance protobuf object.
:type instance: :class:`google.cloud.bigtable.instance.Instance`
@@ -183,13 +191,17 @@ def _update_from_pb(self, app_profile_pb):
self.routing_policy_type = None
self.allow_transactional_writes = None
self.cluster_id = None
-
+ self.multi_cluster_ids = None
self.description = app_profile_pb.description
routing_policy_type = None
- if app_profile_pb.HasField("multi_cluster_routing_use_any"):
+ if app_profile_pb._pb.HasField("multi_cluster_routing_use_any"):
routing_policy_type = RoutingPolicyType.ANY
self.allow_transactional_writes = False
+ if app_profile_pb.multi_cluster_routing_use_any.cluster_ids:
+ self.multi_cluster_ids = (
+ app_profile_pb.multi_cluster_routing_use_any.cluster_ids
+ )
else:
routing_policy_type = RoutingPolicyType.SINGLE
self.cluster_id = app_profile_pb.single_cluster_routing.cluster_id
@@ -200,7 +212,7 @@ def _update_from_pb(self, app_profile_pb):
def _to_pb(self):
"""Create an AppProfile proto buff message for API calls
- :rtype: :class:`.instance_pb2.AppProfile`
+ :rtype: :class:`.instance.AppProfile`
:returns: The converted current object.
:raises: :class:`ValueError ` if the AppProfile
@@ -214,15 +226,17 @@ def _to_pb(self):
if self.routing_policy_type == RoutingPolicyType.ANY:
multi_cluster_routing_use_any = (
- instance_pb2.AppProfile.MultiClusterRoutingUseAny()
+ instance.AppProfile.MultiClusterRoutingUseAny(
+ cluster_ids=self.multi_cluster_ids
+ )
)
else:
- single_cluster_routing = instance_pb2.AppProfile.SingleClusterRouting(
+ single_cluster_routing = instance.AppProfile.SingleClusterRouting(
cluster_id=self.cluster_id,
allow_transactional_writes=self.allow_transactional_writes,
)
- app_profile_pb = instance_pb2.AppProfile(
+ app_profile_pb = instance.AppProfile(
name=self.name,
description=self.description,
multi_cluster_routing_use_any=multi_cluster_routing_use_any,
@@ -236,11 +250,14 @@ def reload(self):
For example:
.. literalinclude:: snippets.py
- :start-after: [START bigtable_reload_app_profile]
- :end-before: [END bigtable_reload_app_profile]
+ :start-after: [START bigtable_api_reload_app_profile]
+ :end-before: [END bigtable_api_reload_app_profile]
+ :dedent: 4
"""
- app_profile_pb = self.instance_admin_client.get_app_profile(self.name)
+ app_profile_pb = self.instance_admin_client.get_app_profile(
+ request={"name": self.name}
+ )
# NOTE: _update_from_pb does not check that the project and
# app_profile ID on the response match the request.
@@ -252,14 +269,15 @@ def exists(self):
For example:
.. literalinclude:: snippets.py
- :start-after: [START bigtable_app_profile_exists]
- :end-before: [END bigtable_app_profile_exists]
+ :start-after: [START bigtable_api_app_profile_exists]
+ :end-before: [END bigtable_api_app_profile_exists]
+ :dedent: 4
:rtype: bool
:returns: True if the AppProfile exists, else False.
"""
try:
- self.instance_admin_client.get_app_profile(self.name)
+ self.instance_admin_client.get_app_profile(request={"name": self.name})
return True
# NOTE: There could be other exceptions that are returned to the user.
except NotFound:
@@ -278,8 +296,9 @@ def create(self, ignore_warnings=None):
For example:
.. literalinclude:: snippets.py
- :start-after: [START bigtable_create_app_profile]
- :end-before: [END bigtable_create_app_profile]
+ :start-after: [START bigtable_api_create_app_profile]
+ :end-before: [END bigtable_api_create_app_profile]
+ :dedent: 4
:type: ignore_warnings: bool
:param: ignore_warnings: (Optional) If true, ignore safety checks when
@@ -287,10 +306,12 @@ def create(self, ignore_warnings=None):
"""
return self.from_pb(
self.instance_admin_client.create_app_profile(
- parent=self._instance.name,
- app_profile_id=self.app_profile_id,
- app_profile=self._to_pb(),
- ignore_warnings=ignore_warnings,
+ request={
+ "parent": self._instance.name,
+ "app_profile_id": self.app_profile_id,
+ "app_profile": self._to_pb(),
+ "ignore_warnings": ignore_warnings,
+ }
),
self._instance,
)
@@ -304,13 +325,15 @@ def update(self, ignore_warnings=None):
``routing_policy_type``
``description``
``cluster_id``
+ ``multi_cluster_ids``
``allow_transactional_writes``
For example:
.. literalinclude:: snippets.py
- :start-after: [START bigtable_update_app_profile]
- :end-before: [END bigtable_update_app_profile]
+ :start-after: [START bigtable_api_update_app_profile]
+ :end-before: [END bigtable_api_update_app_profile]
+ :dedent: 4
"""
update_mask_pb = field_mask_pb2.FieldMask()
@@ -323,9 +346,11 @@ def update(self, ignore_warnings=None):
update_mask_pb.paths.append("single_cluster_routing")
return self.instance_admin_client.update_app_profile(
- app_profile=self._to_pb(),
- update_mask=update_mask_pb,
- ignore_warnings=ignore_warnings,
+ request={
+ "app_profile": self._to_pb(),
+ "update_mask": update_mask_pb,
+ "ignore_warnings": ignore_warnings,
+ }
)
def delete(self, ignore_warnings=None):
@@ -334,8 +359,9 @@ def delete(self, ignore_warnings=None):
For example:
.. literalinclude:: snippets.py
- :start-after: [START bigtable_delete_app_profile]
- :end-before: [END bigtable_delete_app_profile]
+ :start-after: [START bigtable_api_delete_app_profile]
+ :end-before: [END bigtable_api_delete_app_profile]
+ :dedent: 4
:type: ignore_warnings: bool
:param: ignore_warnings: If true, ignore safety checks when deleting
@@ -346,4 +372,6 @@ def delete(self, ignore_warnings=None):
If the request failed due to a retryable error and retry
attempts failed. ValueError: If the parameters are invalid.
"""
- self.instance_admin_client.delete_app_profile(self.name, ignore_warnings)
+ self.instance_admin_client.delete_app_profile(
+ request={"name": self.name, "ignore_warnings": ignore_warnings}
+ )
diff --git a/google/cloud/bigtable/backup.py b/google/cloud/bigtable/backup.py
new file mode 100644
index 000000000..f6fa24421
--- /dev/null
+++ b/google/cloud/bigtable/backup.py
@@ -0,0 +1,489 @@
+# 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.
+
+"""A user-friendly wrapper for a Google Cloud Bigtable Backup."""
+
+import re
+
+from google.cloud._helpers import _datetime_to_pb_timestamp # type: ignore
+from google.cloud.bigtable_admin_v2 import BaseBigtableTableAdminClient
+from google.cloud.bigtable_admin_v2.types import table
+from google.cloud.bigtable.encryption_info import EncryptionInfo
+from google.cloud.bigtable.policy import Policy
+from google.cloud.exceptions import NotFound # type: ignore
+from google.protobuf import field_mask_pb2
+
+_BACKUP_NAME_RE = re.compile(
+ r"^projects/(?P[^/]+)/"
+ r"instances/(?P[a-z][-a-z0-9]*)/"
+ r"clusters/(?P[a-z][-a-z0-9]*)/"
+ r"backups/(?P[_a-zA-Z0-9][-_.a-zA-Z0-9]*)$"
+)
+
+_TABLE_NAME_RE = re.compile(
+ r"^projects/(?P[^/]+)/"
+ r"instances/(?P[a-z][-a-z0-9]*)/"
+ r"tables/(?P[_a-zA-Z0-9][-_.a-zA-Z0-9]*)$"
+)
+
+
+class Backup(object):
+ """Representation of a Google Cloud Bigtable Backup.
+
+ A :class: `Backup` can be used to:
+
+ * :meth:`create` the backup
+ * :meth:`update` the backup
+ * :meth:`delete` the backup
+
+ :type backup_id: str
+ :param backup_id: The ID of the backup.
+
+ :type instance: :class:`~google.cloud.bigtable.instance.Instance`
+ :param instance: The Instance that owns this Backup.
+
+ :type cluster_id: str
+ :param cluster_id: (Optional) The ID of the Cluster that contains this Backup.
+ Required for calling 'delete', 'exists' etc. methods.
+
+ :type table_id: str
+ :param table_id: (Optional) The ID of the Table that the Backup is for.
+ Required if the 'create' method will be called.
+
+ :type expire_time: :class:`datetime.datetime`
+ :param expire_time: (Optional) The expiration time after which the Backup
+ will be automatically deleted. Required if the `create`
+ method will be called.
+ """
+
+ def __init__(
+ self,
+ backup_id,
+ instance,
+ cluster_id=None,
+ table_id=None,
+ expire_time=None,
+ encryption_info=None,
+ ):
+ self.backup_id = backup_id
+ self._instance = instance
+ self._cluster = cluster_id
+ self.table_id = table_id
+ self._expire_time = expire_time
+ self._encryption_info = encryption_info
+
+ self._parent = None
+ self._source_table = None
+ self._start_time = None
+ self._end_time = None
+ self._size_bytes = None
+ self._state = None
+
+ @property
+ def name(self):
+ """Backup name used in requests.
+
+ The Backup name is of the form
+
+ ``"projects/../instances/../clusters/../backups/{backup_id}"``
+
+ :rtype: str
+ :returns: The Backup name.
+
+ :raises: ValueError: If the 'cluster' has not been set.
+ """
+ if not self._cluster:
+ raise ValueError('"cluster" parameter must be set')
+
+ return BaseBigtableTableAdminClient.backup_path(
+ project=self._instance._client.project,
+ instance=self._instance.instance_id,
+ cluster=self._cluster,
+ backup=self.backup_id,
+ )
+
+ @property
+ def cluster(self):
+ """The ID of the [parent] cluster used in requests.
+
+ :rtype: str
+ :returns: The ID of the cluster containing the Backup.
+ """
+ return self._cluster
+
+ @cluster.setter
+ def cluster(self, cluster_id):
+ self._cluster = cluster_id
+
+ @property
+ def parent(self):
+ """Name of the parent cluster used in requests.
+
+ .. note::
+ This property will return None if ``cluster`` is not set.
+
+ The parent name is of the form
+
+ ``"projects/{project}/instances/{instance_id}/clusters/{cluster}"``
+
+ :rtype: str
+ :returns: A full path to the parent cluster.
+ """
+ if not self._parent and self._cluster:
+ self._parent = BaseBigtableTableAdminClient.cluster_path(
+ project=self._instance._client.project,
+ instance=self._instance.instance_id,
+ cluster=self._cluster,
+ )
+ return self._parent
+
+ @property
+ def source_table(self):
+ """The full name of the Table from which this Backup is created.
+
+ .. note::
+ This property will return None if ``table_id`` is not set.
+
+ The table name is of the form
+
+ ``"projects/../instances/../tables/{source_table}"``
+
+ :rtype: str
+ :returns: The Table name.
+ """
+ if not self._source_table and self.table_id:
+ self._source_table = BaseBigtableTableAdminClient.table_path(
+ project=self._instance._client.project,
+ instance=self._instance.instance_id,
+ table=self.table_id,
+ )
+ return self._source_table
+
+ @property
+ def expire_time(self):
+ """Expiration time used in the creation requests.
+
+ :rtype: :class:`datetime.datetime`
+ :returns: A 'datetime' object representing the expiration time of
+ this Backup.
+ """
+ return self._expire_time
+
+ @expire_time.setter
+ def expire_time(self, new_expire_time):
+ self._expire_time = new_expire_time
+
+ @property
+ def encryption_info(self):
+ """Encryption info for this Backup.
+
+ :rtype: :class:`google.cloud.bigtable.encryption.EncryptionInfo`
+ :returns: The encryption information for this backup.
+ """
+ return self._encryption_info
+
+ @property
+ def start_time(self):
+ """The time this Backup was started.
+
+ :rtype: :class:`datetime.datetime`
+ :returns: A 'datetime' object representing the time when the creation
+ of this Backup had started.
+ """
+ return self._start_time
+
+ @property
+ def end_time(self):
+ """The time this Backup was finished.
+
+ :rtype: :class:`datetime.datetime`
+ :returns: A 'datetime' object representing the time when the creation
+ of this Backup was finished.
+ """
+ return self._end_time
+
+ @property
+ def size_bytes(self):
+ """The size of this Backup, in bytes.
+
+ :rtype: int
+ :returns: The size of this Backup, in bytes.
+ """
+ return self._size_bytes
+
+ @property
+ def state(self):
+ """The current state of this Backup.
+
+ :rtype: :class:`~google.cloud.bigtable_admin_v2.types.table.Backup.State`
+ :returns: The current state of this Backup.
+ """
+ return self._state
+
+ @classmethod
+ def from_pb(cls, backup_pb, instance):
+ """Creates a Backup instance from a protobuf message.
+
+ :type backup_pb: :class:`table.Backup`
+ :param backup_pb: A Backup protobuf object.
+
+ :type instance: :class:`Instance `
+ :param instance: The Instance that owns the Backup.
+
+ :rtype: :class:`~google.cloud.bigtable.backup.Backup`
+ :returns: The backup parsed from the protobuf response.
+ :raises: ValueError: If the backup name does not match the expected
+ format or the parsed project ID does not match the
+ project ID on the Instance's client, or if the
+ parsed instance ID does not match the Instance ID.
+ """
+ match = _BACKUP_NAME_RE.match(backup_pb.name)
+ if match is None:
+ raise ValueError(
+ "Backup protobuf name was not in the expected format.", backup_pb.name
+ )
+ if match.group("project") != instance._client.project:
+ raise ValueError(
+ "Project ID of the Backup does not match the Project ID "
+ "of the instance's client"
+ )
+
+ instance_id = match.group("instance_id")
+ if instance_id != instance.instance_id:
+ raise ValueError(
+ "Instance ID of the Backup does not match the Instance ID "
+ "of the instance"
+ )
+ backup_id = match.group("backup_id")
+ cluster_id = match.group("cluster_id")
+
+ match = _TABLE_NAME_RE.match(backup_pb.source_table)
+ table_id = match.group("table_id") if match else None
+
+ expire_time = backup_pb._pb.expire_time
+ encryption_info = EncryptionInfo._from_pb(backup_pb.encryption_info)
+
+ backup = cls(
+ backup_id,
+ instance,
+ cluster_id=cluster_id,
+ table_id=table_id,
+ expire_time=expire_time,
+ encryption_info=encryption_info,
+ )
+ backup._start_time = backup_pb._pb.start_time
+ backup._end_time = backup_pb._pb.end_time
+ backup._size_bytes = backup_pb._pb.size_bytes
+ backup._state = backup_pb._pb.state
+
+ return backup
+
+ def __eq__(self, other):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return other.backup_id == self.backup_id and other._instance == self._instance
+
+ def __ne__(self, other):
+ return not self == other
+
+ def create(self, cluster_id=None):
+ """Creates this backup within its instance.
+
+ :type cluster_id: str
+ :param cluster_id: (Optional) The ID of the Cluster for the newly
+ created Backup.
+
+ :rtype: :class:`~google.api_core.operation.Operation`
+ :returns: A future to be used to poll the status of the 'create' request
+ :raises Conflict: if the Backup already exists
+ :raises NotFound: if the Instance owning the Backup does not exist
+ :raises BadRequest: if the `table` or `expire_time` values are invalid,
+ or `expire_time` is not set
+ """
+ if not self._expire_time:
+ raise ValueError('"expire_time" parameter must be set')
+ # TODO: Consider implementing a method that sets a default value of
+ # `expire_time`, e.g. 1 week from the creation of the Backup.
+ if not self.table_id:
+ raise ValueError('"table" parameter must be set')
+
+ if cluster_id:
+ self._cluster = cluster_id
+
+ if not self._cluster:
+ raise ValueError('"cluster" parameter must be set')
+
+ backup = table.Backup(
+ source_table=self.source_table,
+ expire_time=_datetime_to_pb_timestamp(self.expire_time),
+ )
+
+ api = self._instance._client.table_admin_client
+ return api.create_backup(
+ request={
+ "parent": self.parent,
+ "backup_id": self.backup_id,
+ "backup": backup,
+ }
+ )
+
+ def get(self):
+ """Retrieves metadata of a pending or completed Backup.
+
+ :returns: An instance of
+ :class:`~google.cloud.bigtable_admin_v2.types.Backup`
+
+ :raises google.api_core.exceptions.GoogleAPICallError: If the request
+ failed for any reason.
+ :raises google.api_core.exceptions.RetryError: If the request failed
+ due to a retryable error and retry attempts failed.
+ :raises ValueError: If the parameters are invalid.
+ """
+ api = self._instance._client.table_admin_client
+ try:
+ return api.get_backup(request={"name": self.name})
+ except NotFound:
+ return None
+
+ def reload(self):
+ """Refreshes the stored backup properties."""
+ backup = self.get()
+ self._source_table = backup.source_table
+ self._expire_time = backup._pb.expire_time
+ self._start_time = backup._pb.start_time
+ self._end_time = backup._pb.end_time
+ self._size_bytes = backup._pb.size_bytes
+ self._state = backup._pb.state
+
+ def exists(self):
+ """Tests whether this Backup exists.
+
+ :rtype: bool
+ :returns: True if the Backup exists, else False.
+ """
+ return self.get() is not None
+
+ def update_expire_time(self, new_expire_time):
+ """Update the expire time of this Backup.
+
+ :type new_expire_time: :class:`datetime.datetime`
+ :param new_expire_time: the new expiration time timestamp
+ """
+ backup_update = table.Backup(
+ name=self.name,
+ expire_time=_datetime_to_pb_timestamp(new_expire_time),
+ )
+ update_mask = field_mask_pb2.FieldMask(paths=["expire_time"])
+ api = self._instance._client.table_admin_client
+ api.update_backup(request={"backup": backup_update, "update_mask": update_mask})
+ self._expire_time = new_expire_time
+
+ def delete(self):
+ """Delete this Backup."""
+ self._instance._client.table_admin_client.delete_backup(
+ request={"name": self.name}
+ )
+
+ def restore(self, table_id, instance_id=None):
+ """Creates a new Table by restoring from this Backup. The new Table
+ can be created in the same Instance as the Instance containing the
+ Backup, or another Instance whose ID can be specified in the arguments.
+ The returned Table ``long-running operation`` can be used to track the
+ progress of the operation and to cancel it. The ``response`` type is
+ ``Table``, if successful.
+
+ :type table_id: str
+ :param table_id: The ID of the Table to create and restore to.
+ This Table must not already exist.
+
+ :type instance_id: str
+ :param instance_id: (Optional) The ID of the Instance to restore the
+ backup into, if different from the current one.
+
+ :rtype: :class:`~google.api_core.operation.Operation`
+ :returns: A future to be used to poll the status of the 'restore'
+ request.
+
+ :raises: google.api_core.exceptions.AlreadyExists: If the table
+ already exists.
+ :raises: google.api_core.exceptions.GoogleAPICallError: If the request
+ failed for any reason.
+ :raises: google.api_core.exceptions.RetryError: If the request failed
+ due to a retryable error and retry attempts failed.
+ :raises: ValueError: If the parameters are invalid.
+ """
+ api = self._instance._client.table_admin_client
+ if instance_id:
+ parent = BaseBigtableTableAdminClient.instance_path(
+ project=self._instance._client.project,
+ instance=instance_id,
+ )
+ else:
+ parent = self._instance.name
+
+ return api._restore_table(
+ request={"parent": parent, "table_id": table_id, "backup": self.name}
+ )
+
+ def get_iam_policy(self):
+ """Gets the IAM access control policy for this backup.
+
+ :rtype: :class:`google.cloud.bigtable.policy.Policy`
+ :returns: The current IAM policy of this backup.
+ """
+ table_api = self._instance._client.table_admin_client
+ response = table_api.get_iam_policy(request={"resource": self.name})
+ return Policy.from_pb(response)
+
+ def set_iam_policy(self, policy):
+ """Sets the IAM access control policy for this backup. Replaces any
+ existing policy.
+
+ For more information about policy, please see documentation of
+ class `google.cloud.bigtable.policy.Policy`
+
+ :type policy: :class:`google.cloud.bigtable.policy.Policy`
+ :param policy: A new IAM policy to replace the current IAM policy
+ of this backup.
+
+ :rtype: :class:`google.cloud.bigtable.policy.Policy`
+ :returns: The current IAM policy of this backup.
+ """
+ table_api = self._instance._client.table_admin_client
+ response = table_api.set_iam_policy(
+ request={"resource": self.name, "policy": policy.to_pb()}
+ )
+ return Policy.from_pb(response)
+
+ def test_iam_permissions(self, permissions):
+ """Tests whether the caller has the given permissions for this backup.
+ Returns the permissions that the caller has.
+
+ :type permissions: list
+ :param permissions: The set of permissions to check for
+ the ``resource``. Permissions with wildcards (such as '*'
+ or 'storage.*') are not allowed. For more information see
+ `IAM Overview
+ `_.
+ `Bigtable Permissions
+ `_.
+
+ :rtype: list
+ :returns: A List(string) of permissions allowed on the backup.
+ """
+ table_api = self._instance._client.table_admin_client
+ response = table_api.test_iam_permissions(
+ request={"resource": self.name, "permissions": permissions}
+ )
+ return list(response.permissions)
diff --git a/google/cloud/bigtable/batcher.py b/google/cloud/bigtable/batcher.py
index 3a649049b..f9b85386d 100644
--- a/google/cloud/bigtable/batcher.py
+++ b/google/cloud/bigtable/batcher.py
@@ -13,131 +13,402 @@
# limitations under the License.
"""User friendly container for Google Cloud Bigtable MutationBatcher."""
+import threading
+import queue
+import concurrent.futures
+import atexit
-FLUSH_COUNT = 1000
-MAX_MUTATIONS = 100000
-MAX_ROW_BYTES = 5242880 # 5MB
+from google.api_core.exceptions import from_grpc_status
+from dataclasses import dataclass
-class MaxMutationsError(ValueError):
- """The number of mutations for bulk request is too big."""
+FLUSH_COUNT = 100 # after this many elements, send out the batch
+
+MAX_MUTATION_SIZE = 20 * 1024 * 1024 # 20MB # after this many bytes, send out the batch
+
+MAX_OUTSTANDING_BYTES = 100 * 1024 * 1024 # 100MB # max inflight byte size.
+
+MAX_OUTSTANDING_ELEMENTS = 100000 # max inflight mutations.
+
+
+class MutationsBatchError(Exception):
+ """Error in the batch request"""
+
+ def __init__(self, message, exc):
+ self.exc = exc
+ self.message = message
+ super().__init__(self.message)
+
+
+class _MutationsBatchQueue(object):
+ """Private Threadsafe Queue to hold rows for batching."""
+
+ def __init__(self, max_mutation_bytes=MAX_MUTATION_SIZE, flush_count=FLUSH_COUNT):
+ """Specify the queue constraints"""
+ self._queue = queue.Queue()
+ self.total_mutation_count = 0
+ self.total_size = 0
+ self.max_mutation_bytes = max_mutation_bytes
+ self.flush_count = flush_count
+
+ def get(self):
+ """
+ Retrieve an item from the queue. Recalculate queue size.
+
+ If the queue is empty, return None.
+ """
+ try:
+ row = self._queue.get_nowait()
+ mutation_size = row.get_mutations_size()
+ self.total_mutation_count -= len(row._get_mutations())
+ self.total_size -= mutation_size
+ return row
+ except queue.Empty:
+ return None
+
+ def put(self, item):
+ """Insert an item to the queue. Recalculate queue size."""
+
+ mutation_count = len(item._get_mutations())
+
+ self._queue.put(item)
+
+ self.total_size += item.get_mutations_size()
+ self.total_mutation_count += mutation_count
+
+ def full(self):
+ """Check if the queue is full."""
+ if (
+ self.total_mutation_count >= self.flush_count
+ or self.total_size >= self.max_mutation_bytes
+ ):
+ return True
+ return False
+
+
+@dataclass
+class _BatchInfo:
+ """Keeping track of size of a batch"""
+
+ mutations_count: int = 0
+ rows_count: int = 0
+ mutations_size: int = 0
+
+
+class _FlowControl(object):
+ def __init__(
+ self,
+ max_mutations=MAX_OUTSTANDING_ELEMENTS,
+ max_mutation_bytes=MAX_OUTSTANDING_BYTES,
+ ):
+ """Control the inflight requests. Keep track of the mutations, row bytes and row counts.
+ As requests to backend are being made, adjust the number of mutations being processed.
+
+ If threshold is reached, block the flow.
+ Reopen the flow as requests are finished.
+ """
+ self.max_mutations = max_mutations
+ self.max_mutation_bytes = max_mutation_bytes
+ self.inflight_mutations = 0
+ self.inflight_size = 0
+ self.event = threading.Event()
+ self.event.set()
+ self._lock = threading.Lock()
+
+ def is_blocked(self):
+ """Returns True if:
+
+ - inflight mutations >= max_mutations, or
+ - inflight bytes size >= max_mutation_bytes, or
+ """
+
+ return (
+ self.inflight_mutations >= self.max_mutations
+ or self.inflight_size >= self.max_mutation_bytes
+ )
+
+ def control_flow(self, batch_info):
+ """
+ Calculate the resources used by this batch
+ """
+
+ with self._lock:
+ self.inflight_mutations += batch_info.mutations_count
+ self.inflight_size += batch_info.mutations_size
+ self.set_flow_control_status()
+
+ def wait(self):
+ """
+ Wait until flow control pushback has been released.
+ It awakens as soon as `event` is set.
+ """
+ self.event.wait()
+
+ def set_flow_control_status(self):
+ """Check the inflight mutations and size.
+
+ If values exceed the allowed threshold, block the event.
+ """
+ if self.is_blocked():
+ self.event.clear() # sleep
+ else:
+ self.event.set() # awaken the threads
+
+ def release(self, batch_info):
+ """
+ Release the resources.
+ Decrement the row size to allow enqueued mutations to be run.
+ """
+ with self._lock:
+ self.inflight_mutations -= batch_info.mutations_count
+ self.inflight_size -= batch_info.mutations_size
+ self.set_flow_control_status()
class MutationsBatcher(object):
- """ A MutationsBatcher is used in batch cases where the number of mutations
- is large or unknown. It will store DirectRows in memory until one of the
- size limits is reached, or an explicit call to flush() is performed. When
- a flush event occurs, the DirectRows in memory will be sent to Cloud
+ """A MutationsBatcher is used in batch cases where the number of mutations
+ is large or unknown. It will store :class:`DirectRow` in memory until one of the
+ size limits is reached, or an explicit call to :func:`flush()` is performed. When
+ a flush event occurs, the :class:`DirectRow` in memory will be sent to Cloud
Bigtable. Batching mutations is more efficient than sending individual
request.
This class is not suited for usage in systems where each mutation
- needs to guaranteed to be sent, since calling mutate may only result in an
- in-memory change. In a case of a system crash, any DirectRows remaining in
+ must be guaranteed to be sent, since calling mutate may only result in an
+ in-memory change. In a case of a system crash, any :class:`DirectRow` remaining in
memory will not necessarily be sent to the service, even after the
- completion of the mutate() method.
+ completion of the :func:`mutate()` method.
- TODO: Performance would dramatically improve if this class had the
- capability of asynchronous, parallel RPCs.
+ Note on thread safety: The same :class:`MutationBatcher` cannot be shared by multiple end-user threads.
:type table: class
:param table: class:`~google.cloud.bigtable.table.Table`.
:type flush_count: int
:param flush_count: (Optional) Max number of rows to flush. If it
- reaches the max number of rows it calls finish_batch() to mutate the
- current row batch. Default is FLUSH_COUNT (1000 rows).
+ reaches the max number of rows it calls finish_batch() to mutate the
+ current row batch. Default is FLUSH_COUNT (1000 rows).
:type max_row_bytes: int
:param max_row_bytes: (Optional) Max number of row mutations size to
- flush. If it reaches the max number of row mutations size it calls
- finish_batch() to mutate the current row batch. Default is MAX_ROW_BYTES
- (5 MB).
+ flush. If it reaches the max number of row mutations size it calls
+ finish_batch() to mutate the current row batch. Default is MAX_ROW_BYTES
+ (5 MB).
+
+ :type flush_interval: float
+ :param flush_interval: (Optional) The interval (in seconds) between asynchronous flush.
+ Default is 1 second.
+
+ :type batch_completed_callback: Callable[list:[`~google.rpc.status_pb2.Status`]] = None
+ :param batch_completed_callback: (Optional) A callable for handling responses
+ after the current batch is sent. The callable function expect a list of grpc
+ Status.
"""
- def __init__(self, table, flush_count=FLUSH_COUNT, max_row_bytes=MAX_ROW_BYTES):
- self.rows = []
- self.total_mutation_count = 0
- self.total_size = 0
+ def __init__(
+ self,
+ table,
+ flush_count=FLUSH_COUNT,
+ max_row_bytes=MAX_MUTATION_SIZE,
+ flush_interval=1,
+ batch_completed_callback=None,
+ ):
+ self._rows = _MutationsBatchQueue(
+ max_mutation_bytes=max_row_bytes, flush_count=flush_count
+ )
self.table = table
- self.flush_count = flush_count
- self.max_row_bytes = max_row_bytes
+ self._executor = concurrent.futures.ThreadPoolExecutor()
+ atexit.register(self.close)
+ self._timer = threading.Timer(flush_interval, self.flush)
+ self._timer.start()
+ self.flow_control = _FlowControl(
+ max_mutations=MAX_OUTSTANDING_ELEMENTS,
+ max_mutation_bytes=MAX_OUTSTANDING_BYTES,
+ )
+ self.futures_mapping = {}
+ self.exceptions = queue.Queue()
+ self._user_batch_completed_callback = batch_completed_callback
+
+ @property
+ def flush_count(self):
+ return self._rows.flush_count
+
+ @property
+ def max_row_bytes(self):
+ return self._rows.max_mutation_bytes
+
+ def __enter__(self):
+ """Starting the MutationsBatcher as a context manager"""
+ return self
def mutate(self, row):
- """ Add a row to the batch. If the current batch meets one of the size
- limits, the batch is sent synchronously.
+ """Add a row to the batch. If the current batch meets one of the size
+ limits, the batch is sent asynchronously.
For example:
- .. literalinclude:: snippets.py
- :start-after: [START bigtable_batcher_mutate]
- :end-before: [END bigtable_batcher_mutate]
+ .. literalinclude:: snippets_table.py
+ :start-after: [START bigtable_api_batcher_mutate]
+ :end-before: [END bigtable_api_batcher_mutate]
+ :dedent: 4
:type row: class
- :param row: class:`~google.cloud.bigtable.row.DirectRow`.
+ :param row: :class:`~google.cloud.bigtable.row.DirectRow`.
:raises: One of the following:
- * :exc:`~.table._BigtableRetryableError` if any
- row returned a transient error.
- * :exc:`RuntimeError` if the number of responses doesn't
- match the number of rows that were retried
- * :exc:`.batcher.MaxMutationsError` if any row exceeds max
- mutations count.
- """
- mutation_count = len(row._get_mutations())
- if mutation_count > MAX_MUTATIONS:
- raise MaxMutationsError(
- "The row key {} exceeds the number of mutations {}.".format(
- row.row_key, mutation_count
- )
- )
-
- if (self.total_mutation_count + mutation_count) >= MAX_MUTATIONS:
- self.flush()
-
- self.rows.append(row)
- self.total_mutation_count += mutation_count
- self.total_size += row.get_mutations_size()
+ * :exc:`~.table._BigtableRetryableError` if any row returned a transient error.
+ * :exc:`RuntimeError` if the number of responses doesn't match the number of rows that were retried
+ """
+ self._rows.put(row)
- if self.total_size >= self.max_row_bytes or len(self.rows) >= self.flush_count:
- self.flush()
+ if self._rows.full():
+ self._flush_async()
def mutate_rows(self, rows):
- """ Add a row to the batch. If the current batch meets one of the size
- limits, the batch is sent synchronously.
+ """Add multiple rows to the batch. If the current batch meets one of the size
+ limits, the batch is sent asynchronously.
For example:
- .. literalinclude:: snippets.py
- :start-after: [START bigtable_batcher_mutate_rows]
- :end-before: [END bigtable_batcher_mutate_rows]
+ .. literalinclude:: snippets_table.py
+ :start-after: [START bigtable_api_batcher_mutate_rows]
+ :end-before: [END bigtable_api_batcher_mutate_rows]
+ :dedent: 4
:type rows: list:[`~google.cloud.bigtable.row.DirectRow`]
:param rows: list:[`~google.cloud.bigtable.row.DirectRow`].
:raises: One of the following:
- * :exc:`~.table._BigtableRetryableError` if any
- row returned a transient error.
- * :exc:`RuntimeError` if the number of responses doesn't
- match the number of rows that were retried
- * :exc:`.batcher.MaxMutationsError` if any row exceeds max
- mutations count.
+ * :exc:`~.table._BigtableRetryableError` if any row returned a transient error.
+ * :exc:`RuntimeError` if the number of responses doesn't match the number of rows that were retried
"""
for row in rows:
self.mutate(row)
def flush(self):
- """ Sends the current. batch to Cloud Bigtable.
+ """Sends the current batch to Cloud Bigtable synchronously.
For example:
- .. literalinclude:: snippets.py
- :start-after: [START bigtable_batcher_flush]
- :end-before: [END bigtable_batcher_flush]
+ .. literalinclude:: snippets_table.py
+ :start-after: [START bigtable_api_batcher_flush]
+ :end-before: [END bigtable_api_batcher_flush]
+ :dedent: 4
+
+ :raises:
+ * :exc:`.batcherMutationsBatchError` if there's any error in the mutations.
+ """
+ rows_to_flush = []
+ row = self._rows.get()
+ while row is not None:
+ rows_to_flush.append(row)
+ row = self._rows.get()
+ response = self._flush_rows(rows_to_flush)
+ return response
+
+ def _flush_async(self):
+ """Sends the current batch to Cloud Bigtable asynchronously.
+
+ :raises:
+ * :exc:`.batcherMutationsBatchError` if there's any error in the mutations.
+ """
+ next_row = self._rows.get()
+ while next_row is not None:
+ # start a new batch
+ rows_to_flush = [next_row]
+ batch_info = _BatchInfo(
+ mutations_count=len(next_row._get_mutations()),
+ rows_count=1,
+ mutations_size=next_row.get_mutations_size(),
+ )
+ # fill up batch with rows
+ next_row = self._rows.get()
+ while next_row is not None and self._row_fits_in_batch(
+ next_row, batch_info
+ ):
+ rows_to_flush.append(next_row)
+ batch_info.mutations_count += len(next_row._get_mutations())
+ batch_info.rows_count += 1
+ batch_info.mutations_size += next_row.get_mutations_size()
+ next_row = self._rows.get()
+ # send batch over network
+ # wait for resources to become available
+ self.flow_control.wait()
+ # once unblocked, submit the batch
+ # event flag will be set by control_flow to block subsequent thread, but not blocking this one
+ self.flow_control.control_flow(batch_info)
+ future = self._executor.submit(self._flush_rows, rows_to_flush)
+ # schedule release of resources from flow control
+ self.futures_mapping[future] = batch_info
+ future.add_done_callback(self._batch_completed_callback)
+
+ def _batch_completed_callback(self, future):
+ """Callback for when the mutation has finished to clean up the current batch
+ and release items from the flow controller.
+ Raise exceptions if there's any.
+ Release the resources locked by the flow control and allow enqueued tasks to be run.
+ """
+ processed_rows = self.futures_mapping[future]
+ self.flow_control.release(processed_rows)
+ del self.futures_mapping[future]
+
+ def _row_fits_in_batch(self, row, batch_info):
+ """Checks if a row can fit in the current batch.
+
+ :type row: class
+ :param row: :class:`~google.cloud.bigtable.row.DirectRow`.
+
+ :type batch_info: :class:`_BatchInfo`
+ :param batch_info: Information about the current batch.
+
+ :rtype: bool
+ :returns: True if the row can fit in the current batch.
+ """
+ new_rows_count = batch_info.rows_count + 1
+ new_mutations_count = batch_info.mutations_count + len(row._get_mutations())
+ new_mutations_size = batch_info.mutations_size + row.get_mutations_size()
+ return (
+ new_rows_count <= self.flush_count
+ and new_mutations_size <= self.max_row_bytes
+ and new_mutations_count <= self.flow_control.max_mutations
+ and new_mutations_size <= self.flow_control.max_mutation_bytes
+ )
+
+ def _flush_rows(self, rows_to_flush):
+ """Mutate the specified rows.
+
+ :raises:
+ * :exc:`.batcherMutationsBatchError` if there's any error in the mutations.
+ """
+ responses = []
+ if len(rows_to_flush) > 0:
+ response = self.table.mutate_rows(rows_to_flush)
+
+ if self._user_batch_completed_callback:
+ self._user_batch_completed_callback(response)
+
+ for result in response:
+ if result.code != 0:
+ exc = from_grpc_status(result.code, result.message)
+ self.exceptions.put(exc)
+ responses.append(result)
+
+ return responses
+
+ def __exit__(self, exc_type, exc_value, exc_traceback):
+ """Clean up resources. Flush and shutdown the ThreadPoolExecutor."""
+ self.close()
+
+ def close(self):
+ """Clean up resources. Flush and shutdown the ThreadPoolExecutor.
+ Any errors will be raised.
+ :raises:
+ * :exc:`.batcherMutationsBatchError` if there's any error in the mutations.
"""
- if len(self.rows) != 0:
- self.table.mutate_rows(self.rows)
- self.total_mutation_count = 0
- self.total_size = 0
- self.rows = []
+ self.flush()
+ self._executor.shutdown(wait=True)
+ atexit.unregister(self.close)
+ if self.exceptions.qsize() > 0:
+ exc = list(self.exceptions.queue)
+ raise MutationsBatchError("Errors in batch mutations.", exc=exc)
diff --git a/google/cloud/bigtable/client.py b/google/cloud/bigtable/client.py
index 8a8315623..37de10b6e 100644
--- a/google/cloud/bigtable/client.py
+++ b/google/cloud/bigtable/client.py
@@ -29,28 +29,35 @@
"""
import os
import warnings
-import grpc
+import grpc # type: ignore
-from google.api_core.gapic_v1 import client_info
+from google.api_core.gapic_v1 import client_info as client_info_lib
+from google.auth.credentials import AnonymousCredentials # type: ignore
from google.cloud import bigtable_v2
from google.cloud import bigtable_admin_v2
-
-from google.cloud.bigtable import __version__
+from google.cloud.bigtable_v2.services.bigtable.transports import BigtableGrpcTransport
+from google.cloud.bigtable_admin_v2.services.bigtable_instance_admin.transports import (
+ BigtableInstanceAdminGrpcTransport,
+)
+from google.cloud.bigtable_admin_v2.services.bigtable_table_admin.transports import (
+ BigtableTableAdminGrpcTransport,
+)
+
+from google.cloud import bigtable
from google.cloud.bigtable.instance import Instance
from google.cloud.bigtable.cluster import Cluster
-from google.cloud.client import ClientWithProject
+from google.cloud.client import ClientWithProject # type: ignore
-from google.cloud.bigtable_admin_v2 import enums
+from google.cloud.bigtable_admin_v2.types import instance
from google.cloud.bigtable.cluster import _CLUSTER_NAME_RE
-from google.cloud.environment_vars import BIGTABLE_EMULATOR
+from google.cloud.environment_vars import BIGTABLE_EMULATOR # type: ignore
-INSTANCE_TYPE_PRODUCTION = enums.Instance.Type.PRODUCTION
-INSTANCE_TYPE_DEVELOPMENT = enums.Instance.Type.DEVELOPMENT
-INSTANCE_TYPE_UNSPECIFIED = enums.Instance.Type.TYPE_UNSPECIFIED
-_CLIENT_INFO = client_info.ClientInfo(client_library_version=__version__)
+INSTANCE_TYPE_PRODUCTION = instance.Instance.Type.PRODUCTION
+INSTANCE_TYPE_DEVELOPMENT = instance.Instance.Type.DEVELOPMENT
+INSTANCE_TYPE_UNSPECIFIED = instance.Instance.Type.TYPE_UNSPECIFIED
SPANNER_ADMIN_SCOPE = "https://www.googleapis.com/auth/spanner.admin"
ADMIN_SCOPE = "https://www.googleapis.com/auth/bigtable.admin"
"""Scope for interacting with the Cluster Admin and Table Admin APIs."""
@@ -59,19 +66,23 @@
READ_ONLY_SCOPE = "https://www.googleapis.com/auth/bigtable.data.readonly"
"""Scope for reading table data."""
+_DEFAULT_BIGTABLE_EMULATOR_CLIENT = "google-cloud-bigtable-emulator"
+_GRPC_CHANNEL_OPTIONS = (
+ ("grpc.max_send_message_length", -1),
+ ("grpc.max_receive_message_length", -1),
+ ("grpc.keepalive_time_ms", 30000),
+ ("grpc.keepalive_timeout_ms", 10000),
+)
+
-def _create_gapic_client(client_class, client_options=None):
+def _create_gapic_client(client_class, client_options=None, transport=None):
def inner(self):
- if self._emulator_host is None:
- return client_class(
- credentials=self._credentials,
- client_info=self._client_info,
- client_options=client_options,
- )
- else:
- return client_class(
- channel=self._emulator_channel, client_info=self._client_info
- )
+ return client_class(
+ credentials=None,
+ client_info=self._client_info,
+ client_options=client_options,
+ transport=transport,
+ )
return inner
@@ -142,11 +153,15 @@ def __init__(
credentials=None,
read_only=False,
admin=False,
- client_info=_CLIENT_INFO,
+ client_info=None,
client_options=None,
admin_client_options=None,
channel=None,
):
+ if client_info is None:
+ client_info = client_info_lib.ClientInfo(
+ client_library_version=bigtable.__version__,
+ )
if read_only and admin:
raise ValueError(
"A read-only client cannot also perform" "administrative actions."
@@ -158,10 +173,12 @@ def __init__(
self._admin = bool(admin)
self._client_info = client_info
self._emulator_host = os.getenv(BIGTABLE_EMULATOR)
- self._emulator_channel = None
if self._emulator_host is not None:
- self._emulator_channel = grpc.insecure_channel(self._emulator_host)
+ if credentials is None:
+ credentials = AnonymousCredentials()
+ if project is None:
+ project = _DEFAULT_BIGTABLE_EMULATOR_CLIENT
if channel is not None:
warnings.warn(
@@ -174,7 +191,11 @@ def __init__(
self._admin_client_options = admin_client_options
self._channel = channel
self.SCOPE = self._get_scopes()
- super(Client, self).__init__(project=project, credentials=credentials)
+ super(Client, self).__init__(
+ project=project,
+ credentials=credentials,
+ client_options=client_options,
+ )
def _get_scopes(self):
"""Get the scopes corresponding to admin / read-only state.
@@ -192,6 +213,44 @@ def _get_scopes(self):
return scopes
+ def _emulator_channel(self, transport, options):
+ """Create a channel for use with the Bigtable emulator.
+
+ Insecure channels are used for the emulator as secure channels
+ cannot be used to communicate on some environments.
+ https://github.com/googleapis/python-firestore/issues/359
+
+ Returns:
+ grpc.Channel or grpc.aio.Channel
+ """
+ # Note: this code also exists in the firestore client.
+ if "GrpcAsyncIOTransport" in str(transport.__name__):
+ channel_fn = grpc.aio.insecure_channel
+ else:
+ channel_fn = grpc.insecure_channel
+ return channel_fn(self._emulator_host, options=options)
+
+ def _create_gapic_client_channel(self, client_class, grpc_transport):
+ if self._emulator_host is not None:
+ api_endpoint = self._emulator_host
+ elif self._client_options and self._client_options.api_endpoint:
+ api_endpoint = self._client_options.api_endpoint
+ else:
+ api_endpoint = client_class.DEFAULT_ENDPOINT
+
+ if self._emulator_host is not None:
+ channel = self._emulator_channel(
+ transport=grpc_transport,
+ options=_GRPC_CHANNEL_OPTIONS,
+ )
+ else:
+ channel = grpc_transport.create_channel(
+ host=api_endpoint,
+ credentials=self._credentials,
+ options=_GRPC_CHANNEL_OPTIONS,
+ )
+ return grpc_transport(channel=channel, host=api_endpoint)
+
@property
def project_path(self):
"""Project name to be used with Instance Admin API.
@@ -204,8 +263,9 @@ def project_path(self):
For example:
.. literalinclude:: snippets.py
- :start-after: [START bigtable_project_path]
- :end-before: [END bigtable_project_path]
+ :start-after: [START bigtable_api_project_path]
+ :end-before: [END bigtable_api_project_path]
+ :dedent: 4
The project name is of the form
@@ -214,7 +274,7 @@ def project_path(self):
:rtype: str
:returns: Return a fully-qualified project string.
"""
- return self.instance_admin_client.project_path(self.project)
+ return self.instance_admin_client.common_project_path(self.project)
@property
def table_data_client(self):
@@ -223,15 +283,22 @@ def table_data_client(self):
For example:
.. literalinclude:: snippets.py
- :start-after: [START bigtable_table_data_client]
- :end-before: [END bigtable_table_data_client]
+ :start-after: [START bigtable_api_table_data_client]
+ :end-before: [END bigtable_api_table_data_client]
+ :dedent: 4
:rtype: :class:`.bigtable_v2.BigtableClient`
:returns: A BigtableClient object.
"""
if self._table_data_client is None:
+ transport = self._create_gapic_client_channel(
+ bigtable_v2.BigtableClient,
+ BigtableGrpcTransport,
+ )
klass = _create_gapic_client(
- bigtable_v2.BigtableClient, client_options=self._client_options
+ bigtable_v2.BigtableClient,
+ client_options=self._client_options,
+ transport=transport,
)
self._table_data_client = klass(self)
return self._table_data_client
@@ -243,8 +310,9 @@ def table_admin_client(self):
For example:
.. literalinclude:: snippets.py
- :start-after: [START bigtable_table_admin_client]
- :end-before: [END bigtable_table_admin_client]
+ :start-after: [START bigtable_api_table_admin_client]
+ :end-before: [END bigtable_api_table_admin_client]
+ :dedent: 4
:rtype: :class:`.bigtable_admin_pb2.BigtableTableAdmin`
:returns: A BigtableTableAdmin instance.
@@ -255,9 +323,15 @@ def table_admin_client(self):
if self._table_admin_client is None:
if not self._admin:
raise ValueError("Client is not an admin client.")
+
+ transport = self._create_gapic_client_channel(
+ bigtable_admin_v2.BaseBigtableTableAdminClient,
+ BigtableTableAdminGrpcTransport,
+ )
klass = _create_gapic_client(
- bigtable_admin_v2.BigtableTableAdminClient,
+ bigtable_admin_v2.BaseBigtableTableAdminClient,
client_options=self._admin_client_options,
+ transport=transport,
)
self._table_admin_client = klass(self)
return self._table_admin_client
@@ -269,8 +343,9 @@ def instance_admin_client(self):
For example:
.. literalinclude:: snippets.py
- :start-after: [START bigtable_instance_admin_client]
- :end-before: [END bigtable_instance_admin_client]
+ :start-after: [START bigtable_api_instance_admin_client]
+ :end-before: [END bigtable_api_instance_admin_client]
+ :dedent: 4
:rtype: :class:`.bigtable_admin_pb2.BigtableInstanceAdmin`
:returns: A BigtableInstanceAdmin instance.
@@ -281,9 +356,15 @@ def instance_admin_client(self):
if self._instance_admin_client is None:
if not self._admin:
raise ValueError("Client is not an admin client.")
+
+ transport = self._create_gapic_client_channel(
+ bigtable_admin_v2.BigtableInstanceAdminClient,
+ BigtableInstanceAdminGrpcTransport,
+ )
klass = _create_gapic_client(
bigtable_admin_v2.BigtableInstanceAdminClient,
client_options=self._admin_client_options,
+ transport=transport,
)
self._instance_admin_client = klass(self)
return self._instance_admin_client
@@ -294,8 +375,9 @@ def instance(self, instance_id, display_name=None, instance_type=None, labels=No
For example:
.. literalinclude:: snippets.py
- :start-after: [START bigtable_create_prod_instance]
- :end-before: [END bigtable_create_prod_instance]
+ :start-after: [START bigtable_api_create_prod_instance]
+ :end-before: [END bigtable_api_create_prod_instance]
+ :dedent: 4
:type instance_id: str
:param instance_id: The ID of the instance.
@@ -310,10 +392,10 @@ def instance(self, instance_id, display_name=None, instance_type=None, labels=No
:param instance_type: (Optional) The type of the instance.
Possible values are represented
by the following constants:
- :data:`google.cloud.bigtable.enums.InstanceType.PRODUCTION`.
- :data:`google.cloud.bigtable.enums.InstanceType.DEVELOPMENT`,
+ :data:`google.cloud.bigtable.instance.InstanceType.PRODUCTION`.
+ :data:`google.cloud.bigtable.instance.InstanceType.DEVELOPMENT`,
Defaults to
- :data:`google.cloud.bigtable.enums.InstanceType.UNSPECIFIED`.
+ :data:`google.cloud.bigtable.instance.InstanceType.UNSPECIFIED`.
:type labels: dict
:param labels: (Optional) Labels are a flexible and lightweight
@@ -343,8 +425,9 @@ def list_instances(self):
For example:
.. literalinclude:: snippets.py
- :start-after: [START bigtable_list_instances]
- :end-before: [END bigtable_list_instances]
+ :start-after: [START bigtable_api_list_instances]
+ :end-before: [END bigtable_api_list_instances]
+ :dedent: 4
:rtype: tuple
:returns:
@@ -353,7 +436,9 @@ def list_instances(self):
'failed_locations' is a list of locations which could not
be resolved.
"""
- resp = self.instance_admin_client.list_instances(self.project_path)
+ resp = self.instance_admin_client.list_instances(
+ request={"parent": self.project_path}
+ )
instances = [Instance.from_pb(instance, self) for instance in resp.instances]
return instances, resp.failed_locations
@@ -363,8 +448,9 @@ def list_clusters(self):
For example:
.. literalinclude:: snippets.py
- :start-after: [START bigtable_list_clusters_in_project]
- :end-before: [END bigtable_list_clusters_in_project]
+ :start-after: [START bigtable_api_list_clusters_in_project]
+ :end-before: [END bigtable_api_list_clusters_in_project]
+ :dedent: 4
:rtype: tuple
:returns:
@@ -374,7 +460,9 @@ def list_clusters(self):
locations which could not be resolved.
"""
resp = self.instance_admin_client.list_clusters(
- self.instance_admin_client.instance_path(self.project, "-")
+ request={
+ "parent": self.instance_admin_client.instance_path(self.project, "-")
+ }
)
clusters = []
instances = {}
diff --git a/google/cloud/bigtable/cluster.py b/google/cloud/bigtable/cluster.py
index b573705c0..967ec707e 100644
--- a/google/cloud/bigtable/cluster.py
+++ b/google/cloud/bigtable/cluster.py
@@ -16,8 +16,9 @@
import re
-from google.cloud.bigtable_admin_v2.types import instance_pb2
+from google.cloud.bigtable_admin_v2.types import instance
from google.api_core.exceptions import NotFound
+from google.protobuf import field_mask_pb2
_CLUSTER_NAME_RE = re.compile(
@@ -36,6 +37,7 @@ class Cluster(object):
* :meth:`create` itself
* :meth:`update` itself
* :meth:`delete` itself
+ * :meth:`disable_autoscaling` itself
:type cluster_id: str
:param cluster_id: The ID of the cluster.
@@ -52,17 +54,32 @@ class Cluster(object):
https://cloud.google.com/bigtable/docs/locations
:type serve_nodes: int
- :param serve_nodes: (Optional) The number of nodes in the cluster.
+ :param serve_nodes: (Optional) The number of nodes in the cluster for manual scaling. If any of the
+ autoscaling configuration are specified, then the autoscaling
+ configuration will take precedent.
:type default_storage_type: int
:param default_storage_type: (Optional) The type of storage
Possible values are represented by the
following constants:
:data:`google.cloud.bigtable.enums.StorageType.SSD`.
- :data:`google.cloud.bigtable.enums.StorageType.SHD`,
+ :data:`google.cloud.bigtable.enums.StorageType.HDD`,
Defaults to
:data:`google.cloud.bigtable.enums.StorageType.UNSPECIFIED`.
+ :type kms_key_name: str
+ :param kms_key_name: (Optional, Creation Only) The name of the KMS customer managed
+ encryption key (CMEK) to use for at-rest encryption of data in
+ this cluster. If omitted, Google's default encryption will be
+ used. If specified, the requirements for this key are:
+
+ 1) The Cloud Bigtable service account associated with the
+ project that contains the cluster must be granted the
+ ``cloudkms.cryptoKeyEncrypterDecrypter`` role on the CMEK.
+ 2) Only regional keys can be used and the region of the CMEK
+ key must match the region of the cluster.
+ 3) All clusters within an instance must use the same CMEK key.
+
:type _state: int
:param _state: (`OutputOnly`)
The current state of the cluster.
@@ -72,6 +89,27 @@ class Cluster(object):
:data:`google.cloud.bigtable.enums.Cluster.State.CREATING`.
:data:`google.cloud.bigtable.enums.Cluster.State.RESIZING`.
:data:`google.cloud.bigtable.enums.Cluster.State.DISABLED`.
+
+ :type min_serve_nodes: int
+ :param min_serve_nodes: (Optional) The minimum number of nodes to be set in the cluster for autoscaling.
+ Must be 1 or greater.
+ If specified, this configuration takes precedence over
+ ``serve_nodes``.
+ If specified, then
+ ``max_serve_nodes`` and ``cpu_utilization_percent`` must be
+ specified too.
+
+ :type max_serve_nodes: int
+ :param max_serve_nodes: (Optional) The maximum number of nodes to be set in the cluster for autoscaling.
+ If specified, this configuration
+ takes precedence over ``serve_nodes``. If specified, then
+ ``min_serve_nodes`` and ``cpu_utilization_percent`` must be
+ specified too.
+
+ :param cpu_utilization_percent: (Optional) The CPU utilization target for the cluster's workload for autoscaling.
+ If specified, this configuration takes precedence over ``serve_nodes``. If specified, then
+ ``min_serve_nodes`` and ``max_serve_nodes`` must be
+ specified too.
"""
def __init__(
@@ -81,26 +119,35 @@ def __init__(
location_id=None,
serve_nodes=None,
default_storage_type=None,
+ kms_key_name=None,
_state=None,
+ min_serve_nodes=None,
+ max_serve_nodes=None,
+ cpu_utilization_percent=None,
):
self.cluster_id = cluster_id
self._instance = instance
self.location_id = location_id
self.serve_nodes = serve_nodes
self.default_storage_type = default_storage_type
+ self._kms_key_name = kms_key_name
self._state = _state
+ self.min_serve_nodes = min_serve_nodes
+ self.max_serve_nodes = max_serve_nodes
+ self.cpu_utilization_percent = cpu_utilization_percent
@classmethod
def from_pb(cls, cluster_pb, instance):
- """Creates an cluster instance from a protobuf.
+ """Creates a cluster instance from a protobuf.
For example:
.. literalinclude:: snippets.py
- :start-after: [START bigtable_cluster_from_pb]
- :end-before: [END bigtable_cluster_from_pb]
+ :start-after: [START bigtable_api_cluster_from_pb]
+ :end-before: [END bigtable_api_cluster_from_pb]
+ :dedent: 4
- :type cluster_pb: :class:`instance_pb2.Cluster`
+ :type cluster_pb: :class:`instance.Cluster`
:param cluster_pb: An instance protobuf object.
:type instance: :class:`google.cloud.bigtable.instance.Instance`
@@ -143,7 +190,22 @@ def _update_from_pb(self, cluster_pb):
self.location_id = cluster_pb.location.split("/")[-1]
self.serve_nodes = cluster_pb.serve_nodes
+
+ self.min_serve_nodes = (
+ cluster_pb.cluster_config.cluster_autoscaling_config.autoscaling_limits.min_serve_nodes
+ )
+ self.max_serve_nodes = (
+ cluster_pb.cluster_config.cluster_autoscaling_config.autoscaling_limits.max_serve_nodes
+ )
+ self.cpu_utilization_percent = (
+ cluster_pb.cluster_config.cluster_autoscaling_config.autoscaling_targets.cpu_utilization_percent
+ )
+
self.default_storage_type = cluster_pb.default_storage_type
+ if cluster_pb.encryption_config:
+ self._kms_key_name = cluster_pb.encryption_config.kms_key_name
+ else:
+ self._kms_key_name = None
self._state = cluster_pb.state
@property
@@ -157,8 +219,9 @@ def name(self):
For example:
.. literalinclude:: snippets.py
- :start-after: [START bigtable_cluster_name]
- :end-before: [END bigtable_cluster_name]
+ :start-after: [START bigtable_api_cluster_name]
+ :end-before: [END bigtable_api_cluster_name]
+ :dedent: 4
The cluster name is of the form
@@ -178,12 +241,54 @@ def state(self):
For example:
.. literalinclude:: snippets.py
- :start-after: [START bigtable_cluster_state]
- :end-before: [END bigtable_cluster_state]
+ :start-after: [START bigtable_api_cluster_state]
+ :end-before: [END bigtable_api_cluster_state]
+ :dedent: 4
"""
return self._state
+ @property
+ def kms_key_name(self):
+ """str: Customer managed encryption key for the cluster."""
+ return self._kms_key_name
+
+ def _validate_scaling_config(self):
+ """Validate auto/manual scaling configuration before creating or updating."""
+
+ if (
+ not self.serve_nodes
+ and not self.min_serve_nodes
+ and not self.max_serve_nodes
+ and not self.cpu_utilization_percent
+ ):
+ raise ValueError(
+ "Must specify either serve_nodes or all of the autoscaling configurations (min_serve_nodes, max_serve_nodes, and cpu_utilization_percent)."
+ )
+ if self.serve_nodes and (
+ self.max_serve_nodes or self.min_serve_nodes or self.cpu_utilization_percent
+ ):
+ raise ValueError(
+ "Cannot specify both serve_nodes and autoscaling configurations (min_serve_nodes, max_serve_nodes, and cpu_utilization_percent)."
+ )
+ if (
+ (
+ self.min_serve_nodes
+ and (not self.max_serve_nodes or not self.cpu_utilization_percent)
+ )
+ or (
+ self.max_serve_nodes
+ and (not self.min_serve_nodes or not self.cpu_utilization_percent)
+ )
+ or (
+ self.cpu_utilization_percent
+ and (not self.min_serve_nodes or not self.max_serve_nodes)
+ )
+ ):
+ raise ValueError(
+ "All of autoscaling configurations must be specified at the same time (min_serve_nodes, max_serve_nodes, and cpu_utilization_percent)."
+ )
+
def __eq__(self, other):
if not isinstance(other, self.__class__):
return NotImplemented
@@ -204,10 +309,13 @@ def reload(self):
For example:
.. literalinclude:: snippets.py
- :start-after: [START bigtable_reload_cluster]
- :end-before: [END bigtable_reload_cluster]
+ :start-after: [START bigtable_api_reload_cluster]
+ :end-before: [END bigtable_api_reload_cluster]
+ :dedent: 4
"""
- cluster_pb = self._instance._client.instance_admin_client.get_cluster(self.name)
+ cluster_pb = self._instance._client.instance_admin_client.get_cluster(
+ request={"name": self.name}
+ )
# NOTE: _update_from_pb does not check that the project and
# cluster ID on the response match the request.
@@ -219,15 +327,16 @@ def exists(self):
For example:
.. literalinclude:: snippets.py
- :start-after: [START bigtable_check_cluster_exists]
- :end-before: [END bigtable_check_cluster_exists]
+ :start-after: [START bigtable_api_check_cluster_exists]
+ :end-before: [END bigtable_api_check_cluster_exists]
+ :dedent: 4
:rtype: bool
:returns: True if the table exists, else False.
"""
client = self._instance._client
try:
- client.instance_admin_client.get_cluster(name=self.name)
+ client.instance_admin_client.get_cluster(request={"name": self.name})
return True
# NOTE: There could be other exceptions that are returned to the user.
except NotFound:
@@ -239,8 +348,9 @@ def create(self):
For example:
.. literalinclude:: snippets.py
- :start-after: [START bigtable_create_cluster]
- :end-before: [END bigtable_create_cluster]
+ :start-after: [START bigtable_api_create_cluster]
+ :end-before: [END bigtable_api_create_cluster]
+ :dedent: 4
.. note::
@@ -258,12 +368,24 @@ def create(self):
:rtype: :class:`~google.api_core.operation.Operation`
:returns: The long-running operation corresponding to the
create operation.
+
+ :raises: :class:`ValueError ` if the both ``serve_nodes`` and autoscaling configurations
+ are set at the same time or if none of the ``serve_nodes`` or autoscaling configurations are set
+ or if the autoscaling configurations are only partially set.
+
"""
+
+ self._validate_scaling_config()
+
client = self._instance._client
cluster_pb = self._to_pb()
return client.instance_admin_client.create_cluster(
- self._instance.name, self.cluster_id, cluster_pb
+ request={
+ "parent": self._instance.name,
+ "cluster_id": self.cluster_id,
+ "cluster": cluster_pb,
+ }
)
def update(self):
@@ -272,8 +394,9 @@ def update(self):
For example:
.. literalinclude:: snippets.py
- :start-after: [START bigtable_update_cluster]
- :end-before: [END bigtable_update_cluster]
+ :start-after: [START bigtable_api_update_cluster]
+ :end-before: [END bigtable_api_update_cluster]
+ :dedent: 4
.. note::
@@ -286,16 +409,73 @@ def update(self):
before calling :meth:`update`.
+ If autoscaling is already enabled, manual scaling will be silently ignored.
+ To disable autoscaling and enable manual scaling, use the :meth:`disable_autoscaling` instead.
+
:rtype: :class:`Operation`
:returns: The long-running operation corresponding to the
update operation.
+
+ """
+
+ client = self._instance._client
+
+ update_mask_pb = field_mask_pb2.FieldMask()
+
+ if self.serve_nodes:
+ update_mask_pb.paths.append("serve_nodes")
+
+ if self.min_serve_nodes:
+ update_mask_pb.paths.append(
+ "cluster_config.cluster_autoscaling_config.autoscaling_limits.min_serve_nodes"
+ )
+ if self.max_serve_nodes:
+ update_mask_pb.paths.append(
+ "cluster_config.cluster_autoscaling_config.autoscaling_limits.max_serve_nodes"
+ )
+ if self.cpu_utilization_percent:
+ update_mask_pb.paths.append(
+ "cluster_config.cluster_autoscaling_config.autoscaling_targets.cpu_utilization_percent"
+ )
+
+ cluster_pb = self._to_pb()
+ cluster_pb.name = self.name
+
+ return client.instance_admin_client.partial_update_cluster(
+ request={"cluster": cluster_pb, "update_mask": update_mask_pb}
+ )
+
+ def disable_autoscaling(self, serve_nodes):
+ """
+ Disable autoscaling by specifying the number of nodes.
+
+ For example:
+
+ .. literalinclude:: snippets.py
+ :start-after: [START bigtable_api_cluster_disable_autoscaling]
+ :end-before: [END bigtable_api_cluster_disable_autoscaling]
+ :dedent: 4
+
+ :type serve_nodes: int
+ :param serve_nodes: The number of nodes in the cluster.
"""
+
client = self._instance._client
- # We are passing `None` for third argument location.
- # Location is set only at the time of creation of a cluster
- # and can not be changed after cluster has been created.
- return client.instance_admin_client.update_cluster(
- name=self.name, serve_nodes=self.serve_nodes, location=None
+
+ update_mask_pb = field_mask_pb2.FieldMask()
+
+ self.serve_nodes = serve_nodes
+ self.min_serve_nodes = 0
+ self.max_serve_nodes = 0
+ self.cpu_utilization_percent = 0
+
+ update_mask_pb.paths.append("serve_nodes")
+ update_mask_pb.paths.append("cluster_config.cluster_autoscaling_config")
+ cluster_pb = self._to_pb()
+ cluster_pb.name = self.name
+
+ return client.instance_admin_client.partial_update_cluster(
+ request={"cluster": cluster_pb, "update_mask": update_mask_pb}
)
def delete(self):
@@ -304,8 +484,9 @@ def delete(self):
For example:
.. literalinclude:: snippets.py
- :start-after: [START bigtable_delete_cluster]
- :end-before: [END bigtable_delete_cluster]
+ :start-after: [START bigtable_api_delete_cluster]
+ :end-before: [END bigtable_api_delete_cluster]
+ :dedent: 4
Marks a cluster and all of its tables for permanent deletion in 7 days.
@@ -325,17 +506,38 @@ def delete(self):
permanently deleted.
"""
client = self._instance._client
- client.instance_admin_client.delete_cluster(self.name)
+ client.instance_admin_client.delete_cluster(request={"name": self.name})
def _to_pb(self):
- """ Create cluster proto buff message for API calls """
+ """Create cluster proto buff message for API calls"""
client = self._instance._client
- location = client.instance_admin_client.location_path(
- client.project, self.location_id
- )
- cluster_pb = instance_pb2.Cluster(
+ location = None
+ if self.location_id:
+ location = client.instance_admin_client.common_location_path(
+ client.project, self.location_id
+ )
+
+ cluster_pb = instance.Cluster(
location=location,
serve_nodes=self.serve_nodes,
default_storage_type=self.default_storage_type,
)
+ if self._kms_key_name:
+ cluster_pb.encryption_config = instance.Cluster.EncryptionConfig(
+ kms_key_name=self._kms_key_name,
+ )
+
+ if self.min_serve_nodes:
+ cluster_pb.cluster_config.cluster_autoscaling_config.autoscaling_limits.min_serve_nodes = (
+ self.min_serve_nodes
+ )
+ if self.max_serve_nodes:
+ cluster_pb.cluster_config.cluster_autoscaling_config.autoscaling_limits.max_serve_nodes = (
+ self.max_serve_nodes
+ )
+ if self.cpu_utilization_percent:
+ cluster_pb.cluster_config.cluster_autoscaling_config.autoscaling_targets.cpu_utilization_percent = (
+ self.cpu_utilization_percent
+ )
+
return cluster_pb
diff --git a/google/cloud/bigtable/column_family.py b/google/cloud/bigtable/column_family.py
index 8b536992f..80232958d 100644
--- a/google/cloud/bigtable/column_family.py
+++ b/google/cloud/bigtable/column_family.py
@@ -16,10 +16,11 @@
from google.cloud import _helpers
-from google.cloud.bigtable_admin_v2.proto import table_pb2 as table_v2_pb2
-from google.cloud.bigtable_admin_v2.proto import (
- bigtable_table_admin_pb2 as table_admin_v2_pb2,
+from google.cloud.bigtable_admin_v2.types import table as table_v2_pb2
+from google.cloud.bigtable_admin_v2.types import (
+ bigtable_table_admin as table_admin_v2_pb2,
)
+from google.api_core.gapic_v1.method import DEFAULT
class GarbageCollectionRule(object):
@@ -46,8 +47,9 @@ class MaxVersionsGCRule(GarbageCollectionRule):
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_create_family_gc_max_versions]
- :end-before: [END bigtable_create_family_gc_max_versions]
+ :start-after: [START bigtable_api_create_family_gc_max_versions]
+ :end-before: [END bigtable_api_create_family_gc_max_versions]
+ :dedent: 4
:type max_num_versions: int
:param max_num_versions: The maximum number of versions
@@ -79,8 +81,9 @@ class MaxAgeGCRule(GarbageCollectionRule):
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_create_family_gc_max_age]
- :end-before: [END bigtable_create_family_gc_max_age]
+ :start-after: [START bigtable_api_create_family_gc_max_age]
+ :end-before: [END bigtable_api_create_family_gc_max_age]
+ :dedent: 4
:type max_age: :class:`datetime.timedelta`
:param max_age: The maximum age allowed for a cell in the table.
@@ -113,8 +116,9 @@ class GCRuleUnion(GarbageCollectionRule):
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_create_family_gc_union]
- :end-before: [END bigtable_create_family_gc_union]
+ :start-after: [START bigtable_api_create_family_gc_union]
+ :end-before: [END bigtable_api_create_family_gc_union]
+ :dedent: 4
:type rules: list
:param rules: List of :class:`GarbageCollectionRule`.
@@ -147,8 +151,9 @@ class GCRuleIntersection(GarbageCollectionRule):
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_create_family_gc_intersection]
- :end-before: [END bigtable_create_family_gc_intersection]
+ :start-after: [START bigtable_api_create_family_gc_intersection]
+ :end-before: [END bigtable_api_create_family_gc_intersection]
+ :dedent: 4
:type rules: list
:param rules: List of :class:`GarbageCollectionRule`.
@@ -210,8 +215,9 @@ def name(self):
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_column_family_name]
- :end-before: [END bigtable_column_family_name]
+ :start-after: [START bigtable_api_column_family_name]
+ :end-before: [END bigtable_api_column_family_name]
+ :dedent: 4
.. note::
@@ -256,8 +262,9 @@ def create(self):
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_create_column_family]
- :end-before: [END bigtable_create_column_family]
+ :start-after: [START bigtable_api_create_column_family]
+ :end-before: [END bigtable_api_create_column_family]
+ :dedent: 4
"""
column_family = self.to_pb()
@@ -269,7 +276,8 @@ def create(self):
# data it contains are the GC rule and the column family ID already
# stored on this instance.
client.table_admin_client.modify_column_families(
- self._table.name, [modification]
+ request={"name": self._table.name, "modifications": [modification]},
+ timeout=DEFAULT,
)
def update(self):
@@ -278,8 +286,9 @@ def update(self):
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_update_column_family]
- :end-before: [END bigtable_update_column_family]
+ :start-after: [START bigtable_api_update_column_family]
+ :end-before: [END bigtable_api_update_column_family]
+ :dedent: 4
.. note::
@@ -295,7 +304,8 @@ def update(self):
# data it contains are the GC rule and the column family ID already
# stored on this instance.
client.table_admin_client.modify_column_families(
- self._table.name, [modification]
+ request={"name": self._table.name, "modifications": [modification]},
+ timeout=DEFAULT,
)
def delete(self):
@@ -304,8 +314,9 @@ def delete(self):
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_delete_column_family]
- :end-before: [END bigtable_delete_column_family]
+ :start-after: [START bigtable_api_delete_column_family]
+ :end-before: [END bigtable_api_delete_column_family]
+ :dedent: 4
"""
modification = table_admin_v2_pb2.ModifyColumnFamiliesRequest.Modification(
@@ -316,7 +327,8 @@ def delete(self):
# data it contains are the GC rule and the column family ID already
# stored on this instance.
client.table_admin_client.modify_column_families(
- self._table.name, [modification]
+ request={"name": self._table.name, "modifications": [modification]},
+ timeout=DEFAULT,
)
@@ -333,15 +345,14 @@ def _gc_rule_from_pb(gc_rule_pb):
:raises: :class:`ValueError ` if the rule name
is unexpected.
"""
- rule_name = gc_rule_pb.WhichOneof("rule")
+ rule_name = gc_rule_pb._pb.WhichOneof("rule")
if rule_name is None:
return None
if rule_name == "max_num_versions":
return MaxVersionsGCRule(gc_rule_pb.max_num_versions)
elif rule_name == "max_age":
- max_age = _helpers._duration_pb_to_timedelta(gc_rule_pb.max_age)
- return MaxAgeGCRule(max_age)
+ return MaxAgeGCRule(gc_rule_pb.max_age)
elif rule_name == "union":
return GCRuleUnion([_gc_rule_from_pb(rule) for rule in gc_rule_pb.union.rules])
elif rule_name == "intersection":
diff --git a/google/cloud/bigtable/data/README.rst b/google/cloud/bigtable/data/README.rst
new file mode 100644
index 000000000..8142cc34d
--- /dev/null
+++ b/google/cloud/bigtable/data/README.rst
@@ -0,0 +1,9 @@
+Async Data Client
+=================
+
+Synchronous API surface and usage examples coming soon
+
+Feedback and bug reports are welcome at cbt-python-client-v3-feedback@google.com,
+or through the Github `issue tracker`_.
+
+.. _issue tracker: https://github.com/googleapis/python-bigtable/issues
diff --git a/google/cloud/bigtable/data/__init__.py b/google/cloud/bigtable/data/__init__.py
new file mode 100644
index 000000000..c18eae683
--- /dev/null
+++ b/google/cloud/bigtable/data/__init__.py
@@ -0,0 +1,109 @@
+# -*- coding: utf-8 -*-
+# Copyright 2023 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 google.cloud.bigtable import gapic_version as package_version
+
+from google.cloud.bigtable.data._async.client import BigtableDataClientAsync
+from google.cloud.bigtable.data._async.client import TableAsync
+from google.cloud.bigtable.data._async.client import AuthorizedViewAsync
+from google.cloud.bigtable.data._async.mutations_batcher import MutationsBatcherAsync
+from google.cloud.bigtable.data._sync_autogen.client import BigtableDataClient
+from google.cloud.bigtable.data._sync_autogen.client import Table
+from google.cloud.bigtable.data._sync_autogen.client import AuthorizedView
+from google.cloud.bigtable.data._sync_autogen.mutations_batcher import MutationsBatcher
+
+from google.cloud.bigtable.data.read_rows_query import ReadRowsQuery
+from google.cloud.bigtable.data.read_rows_query import RowRange
+from google.cloud.bigtable.data.row import Row
+from google.cloud.bigtable.data.row import Cell
+
+from google.cloud.bigtable.data.mutations import Mutation
+from google.cloud.bigtable.data.mutations import RowMutationEntry
+from google.cloud.bigtable.data.mutations import AddToCell
+from google.cloud.bigtable.data.mutations import SetCell
+from google.cloud.bigtable.data.mutations import DeleteRangeFromColumn
+from google.cloud.bigtable.data.mutations import DeleteAllFromFamily
+from google.cloud.bigtable.data.mutations import DeleteAllFromRow
+
+from google.cloud.bigtable.data.exceptions import InvalidChunk
+from google.cloud.bigtable.data.exceptions import FailedMutationEntryError
+from google.cloud.bigtable.data.exceptions import FailedQueryShardError
+
+from google.cloud.bigtable.data.exceptions import RetryExceptionGroup
+from google.cloud.bigtable.data.exceptions import MutationsExceptionGroup
+from google.cloud.bigtable.data.exceptions import ShardedReadRowsExceptionGroup
+from google.cloud.bigtable.data.exceptions import ParameterTypeInferenceFailed
+
+from google.cloud.bigtable.data._helpers import TABLE_DEFAULT
+from google.cloud.bigtable.data._helpers import RowKeySamples
+from google.cloud.bigtable.data._helpers import ShardedQuery
+
+# setup custom CrossSync mappings for library
+from google.cloud.bigtable_v2.services.bigtable.async_client import (
+ BigtableAsyncClient,
+)
+from google.cloud.bigtable.data._async._read_rows import _ReadRowsOperationAsync
+from google.cloud.bigtable.data._async._mutate_rows import _MutateRowsOperationAsync
+
+from google.cloud.bigtable_v2.services.bigtable.client import (
+ BigtableClient,
+)
+from google.cloud.bigtable.data._sync_autogen._read_rows import _ReadRowsOperation
+from google.cloud.bigtable.data._sync_autogen._mutate_rows import _MutateRowsOperation
+
+from google.cloud.bigtable.data._cross_sync import CrossSync
+
+CrossSync.add_mapping("GapicClient", BigtableAsyncClient)
+CrossSync._Sync_Impl.add_mapping("GapicClient", BigtableClient)
+CrossSync.add_mapping("_ReadRowsOperation", _ReadRowsOperationAsync)
+CrossSync._Sync_Impl.add_mapping("_ReadRowsOperation", _ReadRowsOperation)
+CrossSync.add_mapping("_MutateRowsOperation", _MutateRowsOperationAsync)
+CrossSync._Sync_Impl.add_mapping("_MutateRowsOperation", _MutateRowsOperation)
+CrossSync.add_mapping("MutationsBatcher", MutationsBatcherAsync)
+CrossSync._Sync_Impl.add_mapping("MutationsBatcher", MutationsBatcher)
+
+__version__: str = package_version.__version__
+
+__all__ = (
+ "BigtableDataClientAsync",
+ "TableAsync",
+ "AuthorizedViewAsync",
+ "MutationsBatcherAsync",
+ "BigtableDataClient",
+ "Table",
+ "AuthorizedView",
+ "MutationsBatcher",
+ "RowKeySamples",
+ "ReadRowsQuery",
+ "RowRange",
+ "Mutation",
+ "RowMutationEntry",
+ "AddToCell",
+ "SetCell",
+ "DeleteRangeFromColumn",
+ "DeleteAllFromFamily",
+ "DeleteAllFromRow",
+ "Row",
+ "Cell",
+ "InvalidChunk",
+ "FailedMutationEntryError",
+ "FailedQueryShardError",
+ "RetryExceptionGroup",
+ "MutationsExceptionGroup",
+ "ShardedReadRowsExceptionGroup",
+ "ParameterTypeInferenceFailed",
+ "ShardedQuery",
+ "TABLE_DEFAULT",
+)
diff --git a/google/cloud/bigtable/data/_async/__init__.py b/google/cloud/bigtable/data/_async/__init__.py
new file mode 100644
index 000000000..e13c9acb7
--- /dev/null
+++ b/google/cloud/bigtable/data/_async/__init__.py
@@ -0,0 +1,25 @@
+# Copyright 2023 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 google.cloud.bigtable.data._async.client import BigtableDataClientAsync
+from google.cloud.bigtable.data._async.client import TableAsync
+
+from google.cloud.bigtable.data._async.mutations_batcher import MutationsBatcherAsync
+
+
+__all__ = [
+ "BigtableDataClientAsync",
+ "TableAsync",
+ "MutationsBatcherAsync",
+]
diff --git a/google/cloud/bigtable/data/_async/_mutate_rows.py b/google/cloud/bigtable/data/_async/_mutate_rows.py
new file mode 100644
index 000000000..8e6833bca
--- /dev/null
+++ b/google/cloud/bigtable/data/_async/_mutate_rows.py
@@ -0,0 +1,229 @@
+# Copyright 2024 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+from __future__ import annotations
+
+from typing import Sequence, TYPE_CHECKING
+
+from google.api_core import exceptions as core_exceptions
+from google.api_core import retry as retries
+import google.cloud.bigtable_v2.types.bigtable as types_pb
+import google.cloud.bigtable.data.exceptions as bt_exceptions
+from google.cloud.bigtable.data._helpers import _attempt_timeout_generator
+from google.cloud.bigtable.data._helpers import _retry_exception_factory
+
+# mutate_rows requests are limited to this number of mutations
+from google.cloud.bigtable.data.mutations import _MUTATE_ROWS_REQUEST_MUTATION_LIMIT
+from google.cloud.bigtable.data.mutations import _EntryWithProto
+
+from google.cloud.bigtable.data._cross_sync import CrossSync
+
+if TYPE_CHECKING:
+ from google.cloud.bigtable.data.mutations import RowMutationEntry
+
+ if CrossSync.is_async:
+ from google.cloud.bigtable_v2.services.bigtable.async_client import (
+ BigtableAsyncClient as GapicClientType,
+ )
+ from google.cloud.bigtable.data._async.client import ( # type: ignore
+ _DataApiTargetAsync as TargetType,
+ )
+ else:
+ from google.cloud.bigtable_v2.services.bigtable.client import ( # type: ignore
+ BigtableClient as GapicClientType,
+ )
+ from google.cloud.bigtable.data._sync_autogen.client import ( # type: ignore
+ _DataApiTarget as TargetType,
+ )
+
+__CROSS_SYNC_OUTPUT__ = "google.cloud.bigtable.data._sync_autogen._mutate_rows"
+
+
+@CrossSync.convert_class("_MutateRowsOperation")
+class _MutateRowsOperationAsync:
+ """
+ MutateRowsOperation manages the logic of sending a set of row mutations,
+ and retrying on failed entries. It manages this using the _run_attempt
+ function, which attempts to mutate all outstanding entries, and raises
+ _MutateRowsIncomplete if any retryable errors are encountered.
+
+ Errors are exposed as a MutationsExceptionGroup, which contains a list of
+ exceptions organized by the related failed mutation entries.
+
+ Args:
+ gapic_client: the client to use for the mutate_rows call
+ target: the table or view associated with the request
+ mutation_entries: a list of RowMutationEntry objects to send to the server
+ operation_timeout: the timeout to use for the entire operation, in seconds.
+ attempt_timeout: the timeout to use for each mutate_rows attempt, in seconds.
+ If not specified, the request will run until operation_timeout is reached.
+ """
+
+ @CrossSync.convert
+ def __init__(
+ self,
+ gapic_client: GapicClientType,
+ target: TargetType,
+ mutation_entries: list["RowMutationEntry"],
+ operation_timeout: float,
+ attempt_timeout: float | None,
+ retryable_exceptions: Sequence[type[Exception]] = (),
+ ):
+ # check that mutations are within limits
+ total_mutations = sum(len(entry.mutations) for entry in mutation_entries)
+ if total_mutations > _MUTATE_ROWS_REQUEST_MUTATION_LIMIT:
+ raise ValueError(
+ "mutate_rows requests can contain at most "
+ f"{_MUTATE_ROWS_REQUEST_MUTATION_LIMIT} mutations across "
+ f"all entries. Found {total_mutations}."
+ )
+ self._target = target
+ self._gapic_fn = gapic_client.mutate_rows
+ # create predicate for determining which errors are retryable
+ self.is_retryable = retries.if_exception_type(
+ # RPC level errors
+ *retryable_exceptions,
+ # Entry level errors
+ bt_exceptions._MutateRowsIncomplete,
+ )
+ sleep_generator = retries.exponential_sleep_generator(0.01, 2, 60)
+ self._operation = lambda: CrossSync.retry_target(
+ self._run_attempt,
+ self.is_retryable,
+ sleep_generator,
+ operation_timeout,
+ exception_factory=_retry_exception_factory,
+ )
+ # initialize state
+ self.timeout_generator = _attempt_timeout_generator(
+ attempt_timeout, operation_timeout
+ )
+ self.mutations = [_EntryWithProto(m, m._to_pb()) for m in mutation_entries]
+ self.remaining_indices = list(range(len(self.mutations)))
+ self.errors: dict[int, list[Exception]] = {}
+
+ @CrossSync.convert
+ async def start(self):
+ """
+ Start the operation, and run until completion
+
+ Raises:
+ MutationsExceptionGroup: if any mutations failed
+ """
+ try:
+ # trigger mutate_rows
+ await self._operation()
+ except Exception as exc:
+ # exceptions raised by retryable are added to the list of exceptions for all unfinalized mutations
+ incomplete_indices = self.remaining_indices.copy()
+ for idx in incomplete_indices:
+ self._handle_entry_error(idx, exc)
+ finally:
+ # raise exception detailing incomplete mutations
+ all_errors: list[Exception] = []
+ for idx, exc_list in self.errors.items():
+ if len(exc_list) == 0:
+ raise core_exceptions.ClientError(
+ f"Mutation {idx} failed with no associated errors"
+ )
+ elif len(exc_list) == 1:
+ cause_exc = exc_list[0]
+ else:
+ cause_exc = bt_exceptions.RetryExceptionGroup(exc_list)
+ entry = self.mutations[idx].entry
+ all_errors.append(
+ bt_exceptions.FailedMutationEntryError(idx, entry, cause_exc)
+ )
+ if all_errors:
+ raise bt_exceptions.MutationsExceptionGroup(
+ all_errors, len(self.mutations)
+ )
+
+ @CrossSync.convert
+ async def _run_attempt(self):
+ """
+ Run a single attempt of the mutate_rows rpc.
+
+ Raises:
+ _MutateRowsIncomplete: if there are failed mutations eligible for
+ retry after the attempt is complete
+ GoogleAPICallError: if the gapic rpc fails
+ """
+ request_entries = [self.mutations[idx].proto for idx in self.remaining_indices]
+ # track mutations in this request that have not been finalized yet
+ active_request_indices = {
+ req_idx: orig_idx for req_idx, orig_idx in enumerate(self.remaining_indices)
+ }
+ self.remaining_indices = []
+ if not request_entries:
+ # no more mutations. return early
+ return
+ # make gapic request
+ try:
+ result_generator = await self._gapic_fn(
+ request=types_pb.MutateRowsRequest(
+ entries=request_entries,
+ app_profile_id=self._target.app_profile_id,
+ **self._target._request_path,
+ ),
+ timeout=next(self.timeout_generator),
+ retry=None,
+ )
+ async for result_list in result_generator:
+ for result in result_list.entries:
+ # convert sub-request index to global index
+ orig_idx = active_request_indices[result.index]
+ entry_error = core_exceptions.from_grpc_status(
+ result.status.code,
+ result.status.message,
+ details=result.status.details,
+ )
+ if result.status.code != 0:
+ # mutation failed; update error list (and remaining_indices if retryable)
+ self._handle_entry_error(orig_idx, entry_error)
+ elif orig_idx in self.errors:
+ # mutation succeeded; remove from error list
+ del self.errors[orig_idx]
+ # remove processed entry from active list
+ del active_request_indices[result.index]
+ except Exception as exc:
+ # add this exception to list for each mutation that wasn't
+ # already handled, and update remaining_indices if mutation is retryable
+ for idx in active_request_indices.values():
+ self._handle_entry_error(idx, exc)
+ # bubble up exception to be handled by retry wrapper
+ raise
+ # check if attempt succeeded, or needs to be retried
+ if self.remaining_indices:
+ # unfinished work; raise exception to trigger retry
+ raise bt_exceptions._MutateRowsIncomplete
+
+ def _handle_entry_error(self, idx: int, exc: Exception):
+ """
+ Add an exception to the list of exceptions for a given mutation index,
+ and add the index to the list of remaining indices if the exception is
+ retryable.
+
+ Args:
+ idx: the index of the mutation that failed
+ exc: the exception to add to the list
+ """
+ entry = self.mutations[idx].entry
+ self.errors.setdefault(idx, []).append(exc)
+ if (
+ entry.is_idempotent()
+ and self.is_retryable(exc)
+ and idx not in self.remaining_indices
+ ):
+ self.remaining_indices.append(idx)
diff --git a/google/cloud/bigtable/data/_async/_read_rows.py b/google/cloud/bigtable/data/_async/_read_rows.py
new file mode 100644
index 000000000..8787bfa71
--- /dev/null
+++ b/google/cloud/bigtable/data/_async/_read_rows.py
@@ -0,0 +1,365 @@
+# Copyright 2024 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+from __future__ import annotations
+
+from typing import Sequence, TYPE_CHECKING
+
+from google.cloud.bigtable_v2.types import ReadRowsRequest as ReadRowsRequestPB
+from google.cloud.bigtable_v2.types import ReadRowsResponse as ReadRowsResponsePB
+from google.cloud.bigtable_v2.types import RowSet as RowSetPB
+from google.cloud.bigtable_v2.types import RowRange as RowRangePB
+
+from google.cloud.bigtable.data.row import Row, Cell
+from google.cloud.bigtable.data.read_rows_query import ReadRowsQuery
+from google.cloud.bigtable.data.exceptions import InvalidChunk
+from google.cloud.bigtable.data.exceptions import _RowSetComplete
+from google.cloud.bigtable.data.exceptions import _ResetRow
+from google.cloud.bigtable.data._helpers import _attempt_timeout_generator
+from google.cloud.bigtable.data._helpers import _retry_exception_factory
+
+from google.api_core import retry as retries
+from google.api_core.retry import exponential_sleep_generator
+
+from google.cloud.bigtable.data._cross_sync import CrossSync
+
+if TYPE_CHECKING:
+ if CrossSync.is_async:
+ from google.cloud.bigtable.data._async.client import (
+ _DataApiTargetAsync as TargetType,
+ )
+ else:
+ from google.cloud.bigtable.data._sync_autogen.client import _DataApiTarget as TargetType # type: ignore
+
+__CROSS_SYNC_OUTPUT__ = "google.cloud.bigtable.data._sync_autogen._read_rows"
+
+
+@CrossSync.convert_class("_ReadRowsOperation")
+class _ReadRowsOperationAsync:
+ """
+ ReadRowsOperation handles the logic of merging chunks from a ReadRowsResponse stream
+ into a stream of Row objects.
+
+ ReadRowsOperation.merge_row_response_stream takes in a stream of ReadRowsResponse
+ and turns them into a stream of Row objects using an internal
+ StateMachine.
+
+ ReadRowsOperation(request, client) handles row merging logic end-to-end, including
+ performing retries on stream errors.
+
+ Args:
+ query: The query to execute
+ target: The table or view to send the request to
+ operation_timeout: The total time to allow for the operation, in seconds
+ attempt_timeout: The time to allow for each individual attempt, in seconds
+ retryable_exceptions: A list of exceptions that should trigger a retry
+ """
+
+ __slots__ = (
+ "attempt_timeout_gen",
+ "operation_timeout",
+ "request",
+ "target",
+ "_predicate",
+ "_last_yielded_row_key",
+ "_remaining_count",
+ )
+
+ def __init__(
+ self,
+ query: ReadRowsQuery,
+ target: TargetType,
+ operation_timeout: float,
+ attempt_timeout: float,
+ retryable_exceptions: Sequence[type[Exception]] = (),
+ ):
+ self.attempt_timeout_gen = _attempt_timeout_generator(
+ attempt_timeout, operation_timeout
+ )
+ self.operation_timeout = operation_timeout
+ if isinstance(query, dict):
+ self.request = ReadRowsRequestPB(
+ **query,
+ **target._request_path,
+ app_profile_id=target.app_profile_id,
+ )
+ else:
+ self.request = query._to_pb(target)
+ self.target = target
+ self._predicate = retries.if_exception_type(*retryable_exceptions)
+ self._last_yielded_row_key: bytes | None = None
+ self._remaining_count: int | None = self.request.rows_limit or None
+
+ def start_operation(self) -> CrossSync.Iterable[Row]:
+ """
+ Start the read_rows operation, retrying on retryable errors.
+
+ Yields:
+ Row: The next row in the stream
+ """
+ return CrossSync.retry_target_stream(
+ self._read_rows_attempt,
+ self._predicate,
+ exponential_sleep_generator(0.01, 60, multiplier=2),
+ self.operation_timeout,
+ exception_factory=_retry_exception_factory,
+ )
+
+ def _read_rows_attempt(self) -> CrossSync.Iterable[Row]:
+ """
+ Attempt a single read_rows rpc call.
+ This function is intended to be wrapped by retry logic,
+ which will call this function until it succeeds or
+ a non-retryable error is raised.
+
+ Yields:
+ Row: The next row in the stream
+ """
+ # revise request keys and ranges between attempts
+ if self._last_yielded_row_key is not None:
+ # if this is a retry, try to trim down the request to avoid ones we've already processed
+ try:
+ self.request.rows = self._revise_request_rowset(
+ row_set=self.request.rows,
+ last_seen_row_key=self._last_yielded_row_key,
+ )
+ except _RowSetComplete:
+ # if we've already seen all the rows, we're done
+ return self.merge_rows(None)
+ # revise the limit based on number of rows already yielded
+ if self._remaining_count is not None:
+ self.request.rows_limit = self._remaining_count
+ if self._remaining_count == 0:
+ return self.merge_rows(None)
+ # create and return a new row merger
+ gapic_stream = self.target.client._gapic_client.read_rows(
+ self.request,
+ timeout=next(self.attempt_timeout_gen),
+ retry=None,
+ )
+ chunked_stream = self.chunk_stream(gapic_stream)
+ return self.merge_rows(chunked_stream)
+
+ @CrossSync.convert()
+ async def chunk_stream(
+ self, stream: CrossSync.Awaitable[CrossSync.Iterable[ReadRowsResponsePB]]
+ ) -> CrossSync.Iterable[ReadRowsResponsePB.CellChunk]:
+ """
+ process chunks out of raw read_rows stream
+
+ Args:
+ stream: the raw read_rows stream from the gapic client
+ Yields:
+ ReadRowsResponsePB.CellChunk: the next chunk in the stream
+ """
+ async for resp in await stream:
+ # extract proto from proto-plus wrapper
+ resp = resp._pb
+
+ # handle last_scanned_row_key packets, sent when server
+ # has scanned past the end of the row range
+ if resp.last_scanned_row_key:
+ if (
+ self._last_yielded_row_key is not None
+ and resp.last_scanned_row_key <= self._last_yielded_row_key
+ ):
+ raise InvalidChunk("last scanned out of order")
+ self._last_yielded_row_key = resp.last_scanned_row_key
+
+ current_key = None
+ # process each chunk in the response
+ for c in resp.chunks:
+ if current_key is None:
+ current_key = c.row_key
+ if current_key is None:
+ raise InvalidChunk("first chunk is missing a row key")
+ elif (
+ self._last_yielded_row_key
+ and current_key <= self._last_yielded_row_key
+ ):
+ raise InvalidChunk("row keys should be strictly increasing")
+
+ yield c
+
+ if c.reset_row:
+ current_key = None
+ elif c.commit_row:
+ # update row state after each commit
+ self._last_yielded_row_key = current_key
+ if self._remaining_count is not None:
+ self._remaining_count -= 1
+ if self._remaining_count < 0:
+ raise InvalidChunk("emit count exceeds row limit")
+ current_key = None
+
+ @staticmethod
+ @CrossSync.convert(
+ replace_symbols={"__aiter__": "__iter__", "__anext__": "__next__"},
+ )
+ async def merge_rows(
+ chunks: CrossSync.Iterable[ReadRowsResponsePB.CellChunk] | None,
+ ) -> CrossSync.Iterable[Row]:
+ """
+ Merge chunks into rows
+
+ Args:
+ chunks: the chunk stream to merge
+ Yields:
+ Row: the next row in the stream
+ """
+ if chunks is None:
+ return
+ it = chunks.__aiter__()
+ # For each row
+ while True:
+ try:
+ c = await it.__anext__()
+ except CrossSync.StopIteration:
+ # stream complete
+ return
+ row_key = c.row_key
+
+ if not row_key:
+ raise InvalidChunk("first row chunk is missing key")
+
+ cells = []
+
+ # shared per cell storage
+ family: str | None = None
+ qualifier: bytes | None = None
+
+ try:
+ # for each cell
+ while True:
+ if c.reset_row:
+ raise _ResetRow(c)
+ k = c.row_key
+ f = c.family_name.value
+ q = c.qualifier.value if c.HasField("qualifier") else None
+ if k and k != row_key:
+ raise InvalidChunk("unexpected new row key")
+ if f:
+ family = f
+ if q is not None:
+ qualifier = q
+ else:
+ raise InvalidChunk("new family without qualifier")
+ elif family is None:
+ raise InvalidChunk("missing family")
+ elif q is not None:
+ if family is None:
+ raise InvalidChunk("new qualifier without family")
+ qualifier = q
+ elif qualifier is None:
+ raise InvalidChunk("missing qualifier")
+
+ ts = c.timestamp_micros
+ labels = c.labels if c.labels else []
+ value = c.value
+
+ # merge split cells
+ if c.value_size > 0:
+ buffer = [value]
+ while c.value_size > 0:
+ # throws when premature end
+ c = await it.__anext__()
+
+ t = c.timestamp_micros
+ cl = c.labels
+ k = c.row_key
+ if (
+ c.HasField("family_name")
+ and c.family_name.value != family
+ ):
+ raise InvalidChunk("family changed mid cell")
+ if (
+ c.HasField("qualifier")
+ and c.qualifier.value != qualifier
+ ):
+ raise InvalidChunk("qualifier changed mid cell")
+ if t and t != ts:
+ raise InvalidChunk("timestamp changed mid cell")
+ if cl and cl != labels:
+ raise InvalidChunk("labels changed mid cell")
+ if k and k != row_key:
+ raise InvalidChunk("row key changed mid cell")
+
+ if c.reset_row:
+ raise _ResetRow(c)
+ buffer.append(c.value)
+ value = b"".join(buffer)
+ cells.append(
+ Cell(value, row_key, family, qualifier, ts, list(labels))
+ )
+ if c.commit_row:
+ yield Row(row_key, cells)
+ break
+ c = await it.__anext__()
+ except _ResetRow as e:
+ c = e.chunk
+ if (
+ c.row_key
+ or c.HasField("family_name")
+ or c.HasField("qualifier")
+ or c.timestamp_micros
+ or c.labels
+ or c.value
+ ):
+ raise InvalidChunk("reset row with data")
+ continue
+ except CrossSync.StopIteration:
+ raise InvalidChunk("premature end of stream")
+
+ @staticmethod
+ def _revise_request_rowset(
+ row_set: RowSetPB,
+ last_seen_row_key: bytes,
+ ) -> RowSetPB:
+ """
+ Revise the rows in the request to avoid ones we've already processed.
+
+ Args:
+ row_set: the row set from the request
+ last_seen_row_key: the last row key encountered
+ Returns:
+ RowSetPB: the new rowset after adusting for the last seen key
+ Raises:
+ _RowSetComplete: if there are no rows left to process after the revision
+ """
+ # if user is doing a whole table scan, start a new one with the last seen key
+ if row_set is None or (not row_set.row_ranges and not row_set.row_keys):
+ last_seen = last_seen_row_key
+ return RowSetPB(row_ranges=[RowRangePB(start_key_open=last_seen)])
+ # remove seen keys from user-specific key list
+ adjusted_keys: list[bytes] = [
+ k for k in row_set.row_keys if k > last_seen_row_key
+ ]
+ # adjust ranges to ignore keys before last seen
+ adjusted_ranges: list[RowRangePB] = []
+ for row_range in row_set.row_ranges:
+ end_key = row_range.end_key_closed or row_range.end_key_open or None
+ if end_key is None or end_key > last_seen_row_key:
+ # end range is after last seen key
+ new_range = RowRangePB(row_range)
+ start_key = row_range.start_key_closed or row_range.start_key_open
+ if start_key is None or start_key <= last_seen_row_key:
+ # replace start key with last seen
+ new_range.start_key_open = last_seen_row_key
+ adjusted_ranges.append(new_range)
+ if len(adjusted_keys) == 0 and len(adjusted_ranges) == 0:
+ # if the query is empty after revision, raise an exception
+ # this will avoid an unwanted full table scan
+ raise _RowSetComplete()
+ return RowSetPB(row_keys=adjusted_keys, row_ranges=adjusted_ranges)
diff --git a/google/cloud/bigtable/data/_async/_swappable_channel.py b/google/cloud/bigtable/data/_async/_swappable_channel.py
new file mode 100644
index 000000000..bbc9a0d47
--- /dev/null
+++ b/google/cloud/bigtable/data/_async/_swappable_channel.py
@@ -0,0 +1,139 @@
+# Copyright 2023 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 annotations
+
+from typing import Callable
+
+from google.cloud.bigtable.data._cross_sync import CrossSync
+
+from grpc import ChannelConnectivity
+
+if CrossSync.is_async:
+ from grpc.aio import Channel
+else:
+ from grpc import Channel
+
+__CROSS_SYNC_OUTPUT__ = "google.cloud.bigtable.data._sync_autogen._swappable_channel"
+
+
+@CrossSync.convert_class(sync_name="_WrappedChannel", rm_aio=True)
+class _AsyncWrappedChannel(Channel):
+ """
+ A wrapper around a gRPC channel. All methods are passed
+ through to the underlying channel.
+ """
+
+ def __init__(self, channel: Channel):
+ self._channel = channel
+
+ def unary_unary(self, *args, **kwargs):
+ return self._channel.unary_unary(*args, **kwargs)
+
+ def unary_stream(self, *args, **kwargs):
+ return self._channel.unary_stream(*args, **kwargs)
+
+ def stream_unary(self, *args, **kwargs):
+ return self._channel.stream_unary(*args, **kwargs)
+
+ def stream_stream(self, *args, **kwargs):
+ return self._channel.stream_stream(*args, **kwargs)
+
+ async def channel_ready(self):
+ return await self._channel.channel_ready()
+
+ @CrossSync.convert(
+ sync_name="__enter__", replace_symbols={"__aenter__": "__enter__"}
+ )
+ async def __aenter__(self):
+ await self._channel.__aenter__()
+ return self
+
+ @CrossSync.convert(sync_name="__exit__", replace_symbols={"__aexit__": "__exit__"})
+ async def __aexit__(self, exc_type, exc_val, exc_tb):
+ return await self._channel.__aexit__(exc_type, exc_val, exc_tb)
+
+ def get_state(self, try_to_connect: bool = False) -> ChannelConnectivity:
+ return self._channel.get_state(try_to_connect=try_to_connect)
+
+ async def wait_for_state_change(self, last_observed_state):
+ return await self._channel.wait_for_state_change(last_observed_state)
+
+ def __getattr__(self, name):
+ return getattr(self._channel, name)
+
+ async def close(self, grace=None):
+ if CrossSync.is_async:
+ return await self._channel.close(grace=grace)
+ else:
+ # grace not supported by sync version
+ return self._channel.close()
+
+ if not CrossSync.is_async:
+ # add required sync methods
+
+ def subscribe(self, callback, try_to_connect=False):
+ return self._channel.subscribe(callback, try_to_connect)
+
+ def unsubscribe(self, callback):
+ return self._channel.unsubscribe(callback)
+
+
+@CrossSync.convert_class(
+ sync_name="SwappableChannel",
+ replace_symbols={"_AsyncWrappedChannel": "_WrappedChannel"},
+)
+class AsyncSwappableChannel(_AsyncWrappedChannel):
+ """
+ Provides a grpc channel wrapper, that allows the internal channel to be swapped out
+
+ Args:
+ - channel_fn: a nullary function that returns a new channel instance.
+ It should be a partial with all channel configuration arguments built-in
+ """
+
+ def __init__(self, channel_fn: Callable[[], Channel]):
+ self._channel_fn = channel_fn
+ self._channel = channel_fn()
+
+ def create_channel(self) -> Channel:
+ """
+ Create a fresh channel using the stored `channel_fn` partial
+ """
+ new_channel = self._channel_fn()
+ if CrossSync.is_async:
+ # copy over interceptors
+ # this is needed because of how gapic attaches the LoggingClientAIOInterceptor
+ # sync channels add interceptors by wrapping, so this step isn't needed
+ new_channel._unary_unary_interceptors = (
+ self._channel._unary_unary_interceptors
+ )
+ new_channel._unary_stream_interceptors = (
+ self._channel._unary_stream_interceptors
+ )
+ new_channel._stream_unary_interceptors = (
+ self._channel._stream_unary_interceptors
+ )
+ new_channel._stream_stream_interceptors = (
+ self._channel._stream_stream_interceptors
+ )
+ return new_channel
+
+ def swap_channel(self, new_channel: Channel) -> Channel:
+ """
+ Replace the wrapped channel with a new instance. Typically created using `create_channel`
+ """
+ old_channel = self._channel
+ self._channel = new_channel
+ return old_channel
diff --git a/google/cloud/bigtable/data/_async/client.py b/google/cloud/bigtable/data/_async/client.py
new file mode 100644
index 000000000..f86c886f0
--- /dev/null
+++ b/google/cloud/bigtable/data/_async/client.py
@@ -0,0 +1,1890 @@
+# Copyright 2024 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+from __future__ import annotations
+
+from typing import (
+ cast,
+ Any,
+ AsyncIterable,
+ Callable,
+ Optional,
+ Set,
+ Sequence,
+ TYPE_CHECKING,
+)
+
+import abc
+import time
+import warnings
+import random
+import os
+import concurrent.futures
+
+from functools import partial
+from grpc import Channel
+
+from google.cloud.bigtable.data.execute_query.values import ExecuteQueryValueType
+from google.cloud.bigtable.data.execute_query.metadata import (
+ SqlType,
+ _pb_metadata_to_metadata_types,
+)
+from google.cloud.bigtable.data.execute_query._parameters_formatting import (
+ _format_execute_query_params,
+ _to_param_types,
+)
+from google.cloud.bigtable_v2.services.bigtable.transports.base import (
+ DEFAULT_CLIENT_INFO,
+)
+from google.cloud.bigtable_v2.types.bigtable import PingAndWarmRequest
+from google.cloud.bigtable_v2.types.bigtable import SampleRowKeysRequest
+from google.cloud.bigtable_v2.types.bigtable import MutateRowRequest
+from google.cloud.bigtable_v2.types.bigtable import CheckAndMutateRowRequest
+from google.cloud.bigtable_v2.types.bigtable import ReadModifyWriteRowRequest
+from google.cloud.client import ClientWithProject
+from google.cloud.environment_vars import BIGTABLE_EMULATOR # type: ignore
+from google.api_core import retry as retries
+from google.api_core.exceptions import DeadlineExceeded
+from google.api_core.exceptions import ServiceUnavailable
+from google.api_core.exceptions import Aborted
+from google.api_core.exceptions import Cancelled
+from google.protobuf.message import Message
+from google.protobuf.internal.enum_type_wrapper import EnumTypeWrapper
+
+import google.auth.credentials
+import google.auth._default
+from google.api_core import client_options as client_options_lib
+from google.cloud.bigtable.client import _DEFAULT_BIGTABLE_EMULATOR_CLIENT
+from google.cloud.bigtable.data.row import Row
+from google.cloud.bigtable.data.read_rows_query import ReadRowsQuery
+from google.cloud.bigtable.data.exceptions import FailedQueryShardError
+from google.cloud.bigtable.data.exceptions import ShardedReadRowsExceptionGroup
+
+from google.cloud.bigtable.data._helpers import TABLE_DEFAULT, _align_timeouts
+from google.cloud.bigtable.data._helpers import _WarmedInstanceKey
+from google.cloud.bigtable.data._helpers import _CONCURRENCY_LIMIT
+from google.cloud.bigtable.data._helpers import _retry_exception_factory
+from google.cloud.bigtable.data._helpers import _validate_timeouts
+from google.cloud.bigtable.data._helpers import _get_error_type
+from google.cloud.bigtable.data._helpers import _get_retryable_errors
+from google.cloud.bigtable.data._helpers import _get_timeouts
+from google.cloud.bigtable.data._helpers import _attempt_timeout_generator
+from google.cloud.bigtable.data.mutations import Mutation, RowMutationEntry
+
+from google.cloud.bigtable.data.read_modify_write_rules import ReadModifyWriteRule
+from google.cloud.bigtable.data.row_filters import RowFilter
+from google.cloud.bigtable.data.row_filters import StripValueTransformerFilter
+from google.cloud.bigtable.data.row_filters import CellsRowLimitFilter
+from google.cloud.bigtable.data.row_filters import RowFilterChain
+from google.cloud.bigtable.data._metrics import BigtableClientSideMetricsController
+
+from google.cloud.bigtable.data._cross_sync import CrossSync
+
+if CrossSync.is_async:
+ from grpc.aio import insecure_channel
+ from google.cloud.bigtable_v2.services.bigtable.transports import (
+ BigtableGrpcAsyncIOTransport as TransportType,
+ )
+ from google.cloud.bigtable_v2.services.bigtable import (
+ BigtableAsyncClient as GapicClient,
+ )
+ from google.cloud.bigtable.data._async.mutations_batcher import _MB_SIZE
+ from google.cloud.bigtable.data._async._swappable_channel import (
+ AsyncSwappableChannel as SwappableChannelType,
+ )
+ from google.cloud.bigtable.data._async.metrics_interceptor import (
+ AsyncBigtableMetricsInterceptor as MetricsInterceptorType,
+ )
+else:
+ from typing import Iterable # noqa: F401
+ from grpc import insecure_channel
+ from grpc import intercept_channel
+ from google.cloud.bigtable_v2.services.bigtable.transports import BigtableGrpcTransport as TransportType # type: ignore
+ from google.cloud.bigtable_v2.services.bigtable import BigtableClient as GapicClient # type: ignore
+ from google.cloud.bigtable.data._sync_autogen.mutations_batcher import _MB_SIZE
+ from google.cloud.bigtable.data._sync_autogen._swappable_channel import ( # noqa: F401
+ SwappableChannel as SwappableChannelType,
+ )
+ from google.cloud.bigtable.data._sync_autogen.metrics_interceptor import ( # noqa: F401
+ BigtableMetricsInterceptor as MetricsInterceptorType,
+ )
+
+if TYPE_CHECKING:
+ from google.cloud.bigtable.data._helpers import RowKeySamples
+ from google.cloud.bigtable.data._helpers import ShardedQuery
+
+ if CrossSync.is_async:
+ from google.cloud.bigtable.data._async.mutations_batcher import (
+ MutationsBatcherAsync,
+ )
+ from google.cloud.bigtable.data.execute_query._async.execute_query_iterator import (
+ ExecuteQueryIteratorAsync,
+ )
+ else:
+ from google.cloud.bigtable.data._sync_autogen.mutations_batcher import ( # noqa: F401
+ MutationsBatcher,
+ )
+ from google.cloud.bigtable.data.execute_query._sync_autogen.execute_query_iterator import ( # noqa: F401
+ ExecuteQueryIterator,
+ )
+
+
+__CROSS_SYNC_OUTPUT__ = "google.cloud.bigtable.data._sync_autogen.client"
+
+
+@CrossSync.convert_class(
+ sync_name="BigtableDataClient",
+ add_mapping_for_name="DataClient",
+)
+class BigtableDataClientAsync(ClientWithProject):
+ @CrossSync.convert(
+ docstring_format_vars={
+ "LOOP_MESSAGE": (
+ "Client should be created within an async context (running event loop)",
+ None,
+ ),
+ "RAISE_NO_LOOP": (
+ "RuntimeError: if called outside of an async context (no running event loop)",
+ None,
+ ),
+ }
+ )
+ def __init__(
+ self,
+ *,
+ project: str | None = None,
+ credentials: google.auth.credentials.Credentials | None = None,
+ client_options: dict[str, Any]
+ | "google.api_core.client_options.ClientOptions"
+ | None = None,
+ **kwargs,
+ ):
+ """
+ Create a client instance for the Bigtable Data API
+
+ {LOOP_MESSAGE}
+
+ Args:
+ project: the project which the client acts on behalf of.
+ If not passed, falls back to the default inferred
+ from the environment.
+ credentials:
+ Thehe OAuth2 Credentials to use for this
+ client. If not passed (and if no ``_http`` object is
+ passed), falls back to the default inferred from the
+ environment.
+ client_options:
+ Client options used to set user options
+ on the client. API Endpoint should be set through client_options.
+ Raises:
+ {RAISE_NO_LOOP}
+ """
+ if "pool_size" in kwargs:
+ warnings.warn("pool_size no longer supported")
+ # set up client info headers for veneer library
+ self.client_info = DEFAULT_CLIENT_INFO
+ self.client_info.client_library_version = self._client_version()
+ # parse client options
+ if type(client_options) is dict:
+ client_options = client_options_lib.from_dict(client_options)
+ client_options = cast(
+ Optional[client_options_lib.ClientOptions], client_options
+ )
+ self._emulator_host = os.getenv(BIGTABLE_EMULATOR)
+ if self._emulator_host is not None:
+ warnings.warn(
+ "Connecting to Bigtable emulator at {}".format(self._emulator_host),
+ RuntimeWarning,
+ stacklevel=2,
+ )
+ # use insecure channel if emulator is set
+ if credentials is None:
+ credentials = google.auth.credentials.AnonymousCredentials()
+ if project is None:
+ project = _DEFAULT_BIGTABLE_EMULATOR_CLIENT
+ self._metrics_interceptor = MetricsInterceptorType()
+ # initialize client
+ ClientWithProject.__init__(
+ self,
+ credentials=credentials,
+ project=project,
+ client_options=client_options,
+ )
+ self._gapic_client = GapicClient(
+ credentials=credentials,
+ client_options=client_options,
+ client_info=self.client_info,
+ transport=lambda *args, **kwargs: TransportType(
+ *args, **kwargs, channel=self._build_grpc_channel
+ ),
+ )
+ if (
+ credentials
+ and credentials.universe_domain != self.universe_domain
+ and self._emulator_host is None
+ ):
+ # validate that the universe domain of the credentials matches the
+ # universe domain configured in client_options
+ raise ValueError(
+ f"The configured universe domain ({self.universe_domain}) does "
+ "not match the universe domain found in the credentials "
+ f"({self._credentials.universe_domain}). If you haven't "
+ "configured the universe domain explicitly, `googleapis.com` "
+ "is the default."
+ )
+ self._is_closed = CrossSync.Event()
+ self.transport = cast(TransportType, self._gapic_client.transport)
+ # keep track of active instances to for warmup on channel refresh
+ self._active_instances: Set[_WarmedInstanceKey] = set()
+ # keep track of _DataApiTarget objects associated with each instance
+ # only remove instance from _active_instances when all associated targets are closed
+ self._instance_owners: dict[_WarmedInstanceKey, Set[int]] = {}
+ self._channel_init_time = time.monotonic()
+ self._channel_refresh_task: CrossSync.Task[None] | None = None
+ self._executor: concurrent.futures.ThreadPoolExecutor | None = (
+ concurrent.futures.ThreadPoolExecutor() if not CrossSync.is_async else None
+ )
+ if self._emulator_host is None:
+ # attempt to start background channel refresh tasks
+ try:
+ self._start_background_channel_refresh()
+ except RuntimeError:
+ warnings.warn(
+ f"{self.__class__.__name__} should be started in an "
+ "asyncio event loop. Channel refresh will not be started",
+ RuntimeWarning,
+ stacklevel=2,
+ )
+
+ def _build_grpc_channel(self, *args, **kwargs) -> SwappableChannelType:
+ """
+ This method is called by the gapic transport to create a grpc channel.
+
+ The init arguments passed down are captured in a partial used by SwappableChannel
+ to create new channel instances in the future, as part of the channel refresh logic
+
+ Emulators always use an inseucre channel
+
+ Args:
+ - *args: positional arguments passed by the gapic layer to create a new channel with
+ - **kwargs: keyword arguments passed by the gapic layer to create a new channel with
+ Returns:
+ a custom wrapped swappable channel
+ """
+ create_channel_fn: Callable[[], Channel]
+ if self._emulator_host is not None:
+ # Emulators use insecure channels
+ create_channel_fn = partial(insecure_channel, self._emulator_host)
+ elif CrossSync.is_async:
+ # For async client, use the default create_channel.
+ create_channel_fn = partial(TransportType.create_channel, *args, **kwargs)
+ else:
+ # For sync client, wrap create_channel with interceptors.
+ def sync_create_channel_fn():
+ return intercept_channel(
+ TransportType.create_channel(*args, **kwargs),
+ self._metrics_interceptor,
+ )
+
+ create_channel_fn = sync_create_channel_fn
+
+ # Instantiate SwappableChannelType with the determined creation function.
+ new_channel = SwappableChannelType(create_channel_fn)
+ if CrossSync.is_async:
+ # Attach async interceptors to the channel instance itself.
+ new_channel._unary_unary_interceptors.append(self._metrics_interceptor)
+ new_channel._unary_stream_interceptors.append(self._metrics_interceptor)
+ return new_channel
+
+ @property
+ def universe_domain(self) -> str:
+ """Return the universe domain used by the client instance.
+
+ Returns:
+ str: The universe domain used by the client instance.
+ """
+ return self._gapic_client.universe_domain
+
+ @property
+ def api_endpoint(self) -> str:
+ """Return the API endpoint used by the client instance.
+
+ Returns:
+ str: The API endpoint used by the client instance.
+ """
+ return self._gapic_client.api_endpoint
+
+ @staticmethod
+ def _client_version() -> str:
+ """
+ Helper function to return the client version string for this client
+ """
+ version_str = f"{google.cloud.bigtable.__version__}-data"
+ if CrossSync.is_async:
+ version_str += "-async"
+ return version_str
+
+ @CrossSync.convert(
+ docstring_format_vars={
+ "RAISE_NO_LOOP": (
+ "RuntimeError: if not called in an asyncio event loop",
+ "None",
+ )
+ }
+ )
+ def _start_background_channel_refresh(self) -> None:
+ """
+ Starts a background task to ping and warm grpc channel
+
+ Raises:
+ {RAISE_NO_LOOP}
+ """
+ if (
+ not self._channel_refresh_task
+ and not self._emulator_host
+ and not self._is_closed.is_set()
+ ):
+ # raise error if not in an event loop in async client
+ CrossSync.verify_async_event_loop()
+ self._channel_refresh_task = CrossSync.create_task(
+ self._manage_channel,
+ sync_executor=self._executor,
+ task_name=f"{self.__class__.__name__} channel refresh",
+ )
+
+ @CrossSync.convert
+ async def close(self, timeout: float | None = 2.0):
+ """
+ Cancel all background tasks
+ """
+ self._is_closed.set()
+ if self._channel_refresh_task is not None:
+ self._channel_refresh_task.cancel()
+ await CrossSync.wait([self._channel_refresh_task], timeout=timeout)
+ await self.transport.close()
+ if self._executor:
+ self._executor.shutdown(wait=False)
+ self._channel_refresh_task = None
+
+ @CrossSync.convert
+ async def _ping_and_warm_instances(
+ self,
+ instance_key: _WarmedInstanceKey | None = None,
+ channel: Channel | None = None,
+ ) -> list[BaseException | None]:
+ """
+ Prepares the backend for requests on a channel
+
+ Pings each Bigtable instance registered in `_active_instances` on the client
+
+ Args:
+ instance_key: if provided, only warm the instance associated with the key
+ channel: grpc channel to warm. If none, warms `self.transport.grpc_channel`
+ Returns:
+ list[BaseException | None]: sequence of results or exceptions from the ping requests
+ """
+ channel = channel or self.transport.grpc_channel
+ instance_list = (
+ [instance_key] if instance_key is not None else self._active_instances
+ )
+ ping_rpc = channel.unary_unary(
+ "/google.bigtable.v2.Bigtable/PingAndWarm",
+ request_serializer=PingAndWarmRequest.serialize,
+ )
+ # prepare list of coroutines to run
+ partial_list = [
+ partial(
+ ping_rpc,
+ request={"name": instance_name, "app_profile_id": app_profile_id},
+ metadata=[
+ (
+ "x-goog-request-params",
+ f"name={instance_name}&app_profile_id={app_profile_id}",
+ )
+ ],
+ wait_for_ready=True,
+ )
+ for (instance_name, app_profile_id) in instance_list
+ ]
+ result_list = await CrossSync.gather_partials(
+ partial_list, return_exceptions=True, sync_executor=self._executor
+ )
+ return [r or None for r in result_list]
+
+ def _invalidate_channel_stubs(self):
+ """Helper to reset the cached stubs. Needed when changing out the grpc channel"""
+ self.transport._stubs = {}
+ self.transport._prep_wrapped_messages(self.client_info)
+
+ @CrossSync.convert
+ async def _manage_channel(
+ self,
+ refresh_interval_min: float = 60 * 35,
+ refresh_interval_max: float = 60 * 45,
+ grace_period: float = 60 * 10,
+ ) -> None:
+ """
+ Background task that periodically refreshes and warms a grpc channel
+
+ The backend will automatically close channels after 60 minutes, so
+ `refresh_interval` + `grace_period` should be < 60 minutes
+
+ Runs continuously until the client is closed
+
+ Args:
+ refresh_interval_min: minimum interval before initiating refresh
+ process in seconds. Actual interval will be a random value
+ between `refresh_interval_min` and `refresh_interval_max`
+ refresh_interval_max: maximum interval before initiating refresh
+ process in seconds. Actual interval will be a random value
+ between `refresh_interval_min` and `refresh_interval_max`
+ grace_period: time to allow previous channel to serve existing
+ requests before closing, in seconds
+ """
+ if not isinstance(self.transport.grpc_channel, SwappableChannelType):
+ warnings.warn("Channel does not support auto-refresh.")
+ return
+ super_channel: SwappableChannelType = self.transport.grpc_channel
+ first_refresh = self._channel_init_time + random.uniform(
+ refresh_interval_min, refresh_interval_max
+ )
+ next_sleep = max(first_refresh - time.monotonic(), 0)
+ if next_sleep > 0:
+ # warm the current channel immediately
+ await self._ping_and_warm_instances(channel=super_channel)
+ # continuously refresh the channel every `refresh_interval` seconds
+ while not self._is_closed.is_set():
+ await CrossSync.event_wait(
+ self._is_closed,
+ next_sleep,
+ async_break_early=False, # no need to interrupt sleep. Task will be cancelled on close
+ )
+ if self._is_closed.is_set():
+ # don't refresh if client is closed
+ break
+ start_timestamp = time.monotonic()
+ # prepare new channel for use
+ new_channel = super_channel.create_channel()
+ await self._ping_and_warm_instances(channel=new_channel)
+ # cycle channel out of use, with long grace window before closure
+ old_channel = super_channel.swap_channel(new_channel)
+ self._invalidate_channel_stubs()
+ # give old_channel a chance to complete existing rpcs
+ if grace_period:
+ await CrossSync.event_wait(
+ self._is_closed, grace_period, async_break_early=False
+ )
+ await old_channel.close()
+ # subtract the time spent waiting for the channel to be replaced
+ next_refresh = random.uniform(refresh_interval_min, refresh_interval_max)
+ next_sleep = max(next_refresh - (time.monotonic() - start_timestamp), 0)
+
+ @CrossSync.convert(
+ replace_symbols={
+ "TableAsync": "Table",
+ "ExecuteQueryIteratorAsync": "ExecuteQueryIterator",
+ "_DataApiTargetAsync": "_DataApiTarget",
+ }
+ )
+ async def _register_instance(
+ self,
+ instance_id: str,
+ app_profile_id: Optional[str],
+ owner_id: int,
+ ) -> None:
+ """
+ Registers an instance with the client, and warms the channel for the instance
+ The client will periodically refresh grpc channel used to make
+ requests, and new channels will be warmed for each registered instance
+ Channels will not be refreshed unless at least one instance is registered
+
+ Args:
+ instance_id: id of the instance to register.
+ app_profile_id: id of the app profile calling the instance.
+ owner_id: integer id of the object owning the instance. Owners will be tracked in
+ _instance_owners, and instances will only be unregistered when all
+ owners call _remove_instance_registration. Can be obtained by calling
+ `id` identity funcion, using `id(owner)`
+ """
+ instance_name = self._gapic_client.instance_path(self.project, instance_id)
+ instance_key = _WarmedInstanceKey(instance_name, app_profile_id)
+ self._instance_owners.setdefault(instance_key, set()).add(owner_id)
+ if instance_key not in self._active_instances:
+ self._active_instances.add(instance_key)
+ if self._channel_refresh_task:
+ # refresh tasks already running
+ # call ping and warm on all existing channels
+ await self._ping_and_warm_instances(instance_key)
+ else:
+ # refresh tasks aren't active. start them as background tasks
+ self._start_background_channel_refresh()
+
+ @CrossSync.convert(
+ replace_symbols={
+ "TableAsync": "Table",
+ "ExecuteQueryIteratorAsync": "ExecuteQueryIterator",
+ "_DataApiTargetAsync": "_DataApiTarget",
+ }
+ )
+ def _remove_instance_registration(
+ self,
+ instance_id: str,
+ app_profile_id: Optional[str],
+ owner_id: int,
+ ) -> bool:
+ """
+ Removes an instance from the client's registered instances, to prevent
+ warming new channels for the instance
+
+ If instance_id is not registered, or is still in use by other tables, returns False
+
+ Args:
+ instance_id: id of the instance to remove
+ app_profile_id: id of the app profile calling the instance.
+ owner_id: integer id of the object owning the instance. Can be
+ obtained by the `id` identity funcion, using `id(owner)`.
+ Returns:
+ bool: True if instance was removed, else False
+ """
+ instance_name = self._gapic_client.instance_path(self.project, instance_id)
+ instance_key = _WarmedInstanceKey(instance_name, app_profile_id)
+ owner_list = self._instance_owners.get(instance_key, set())
+ try:
+ owner_list.remove(owner_id)
+ if len(owner_list) == 0:
+ self._active_instances.remove(instance_key)
+ return True
+ except KeyError:
+ return False
+
+ @CrossSync.convert(
+ replace_symbols={"TableAsync": "Table"},
+ docstring_format_vars={
+ "LOOP_MESSAGE": (
+ "Must be created within an async context (running event loop)",
+ "",
+ ),
+ "RAISE_NO_LOOP": (
+ "RuntimeError: if called outside of an async context (no running event loop)",
+ "None",
+ ),
+ },
+ )
+ def get_table(self, instance_id: str, table_id: str, *args, **kwargs) -> TableAsync:
+ """
+ Returns a table instance for making data API requests. All arguments are passed
+ directly to the TableAsync constructor.
+
+ {LOOP_MESSAGE}
+
+ Args:
+ instance_id: The Bigtable instance ID to associate with this client.
+ instance_id is combined with the client's project to fully
+ specify the instance
+ table_id: The ID of the table. table_id is combined with the
+ instance_id and the client's project to fully specify the table
+ app_profile_id: The app profile to associate with requests.
+ https://cloud.google.com/bigtable/docs/app-profiles
+ default_read_rows_operation_timeout: The default timeout for read rows
+ operations, in seconds. If not set, defaults to 600 seconds (10 minutes)
+ default_read_rows_attempt_timeout: The default timeout for individual
+ read rows rpc requests, in seconds. If not set, defaults to 20 seconds
+ default_mutate_rows_operation_timeout: The default timeout for mutate rows
+ operations, in seconds. If not set, defaults to 600 seconds (10 minutes)
+ default_mutate_rows_attempt_timeout: The default timeout for individual
+ mutate rows rpc requests, in seconds. If not set, defaults to 60 seconds
+ default_operation_timeout: The default timeout for all other operations, in
+ seconds. If not set, defaults to 60 seconds
+ default_attempt_timeout: The default timeout for all other individual rpc
+ requests, in seconds. If not set, defaults to 20 seconds
+ default_read_rows_retryable_errors: a list of errors that will be retried
+ if encountered during read_rows and related operations.
+ Defaults to 4 (DeadlineExceeded), 14 (ServiceUnavailable), and 10 (Aborted)
+ default_mutate_rows_retryable_errors: a list of errors that will be retried
+ if encountered during mutate_rows and related operations.
+ Defaults to 4 (DeadlineExceeded) and 14 (ServiceUnavailable)
+ default_retryable_errors: a list of errors that will be retried if
+ encountered during all other operations.
+ Defaults to 4 (DeadlineExceeded) and 14 (ServiceUnavailable)
+ Returns:
+ TableAsync: a table instance for making data API requests
+ Raises:
+ {RAISE_NO_LOOP}
+ """
+ return TableAsync(self, instance_id, table_id, *args, **kwargs)
+
+ @CrossSync.convert(
+ replace_symbols={"AuthorizedViewAsync": "AuthorizedView"},
+ docstring_format_vars={
+ "LOOP_MESSAGE": (
+ "Must be created within an async context (running event loop)",
+ "",
+ ),
+ "RAISE_NO_LOOP": (
+ "RuntimeError: if called outside of an async context (no running event loop)",
+ "None",
+ ),
+ },
+ )
+ def get_authorized_view(
+ self, instance_id: str, table_id: str, authorized_view_id: str, *args, **kwargs
+ ) -> AuthorizedViewAsync:
+ """
+ Returns an authorized view instance for making data API requests. All arguments are passed
+ directly to the AuthorizedViewAsync constructor.
+
+ {LOOP_MESSAGE}
+
+ Args:
+ instance_id: The Bigtable instance ID to associate with this client.
+ instance_id is combined with the client's project to fully
+ specify the instance
+ table_id: The ID of the table. table_id is combined with the
+ instance_id and the client's project to fully specify the table
+ authorized_view_id: The id for the authorized view to use for requests
+ app_profile_id: The app profile to associate with requests.
+ https://cloud.google.com/bigtable/docs/app-profiles
+ default_read_rows_operation_timeout: The default timeout for read rows
+ operations, in seconds. If not set, defaults to Table's value
+ default_read_rows_attempt_timeout: The default timeout for individual
+ read rows rpc requests, in seconds. If not set, defaults Table's value
+ default_mutate_rows_operation_timeout: The default timeout for mutate rows
+ operations, in seconds. If not set, defaults to Table's value
+ default_mutate_rows_attempt_timeout: The default timeout for individual
+ mutate rows rpc requests, in seconds. If not set, defaults Table's value
+ default_operation_timeout: The default timeout for all other operations, in
+ seconds. If not set, defaults to Table's value
+ default_attempt_timeout: The default timeout for all other individual rpc
+ requests, in seconds. If not set, defaults to Table's value
+ default_read_rows_retryable_errors: a list of errors that will be retried
+ if encountered during read_rows and related operations. If not set,
+ defaults to Table's value
+ default_mutate_rows_retryable_errors: a list of errors that will be retried
+ if encountered during mutate_rows and related operations. If not set,
+ defaults to Table's value
+ default_retryable_errors: a list of errors that will be retried if
+ encountered during all other operations. If not set, defaults to
+ Table's value
+ Returns:
+ AuthorizedViewAsync: a table instance for making data API requests
+ Raises:
+ {RAISE_NO_LOOP}
+ """
+ return CrossSync.AuthorizedView(
+ self,
+ instance_id,
+ table_id,
+ authorized_view_id,
+ *args,
+ **kwargs,
+ )
+
+ @CrossSync.convert(
+ replace_symbols={"ExecuteQueryIteratorAsync": "ExecuteQueryIterator"}
+ )
+ async def execute_query(
+ self,
+ query: str,
+ instance_id: str,
+ *,
+ parameters: dict[str, ExecuteQueryValueType] | None = None,
+ parameter_types: dict[str, SqlType.Type] | None = None,
+ app_profile_id: str | None = None,
+ operation_timeout: float = 600,
+ attempt_timeout: float | None = 20,
+ retryable_errors: Sequence[type[Exception]] = (
+ DeadlineExceeded,
+ ServiceUnavailable,
+ Aborted,
+ ),
+ prepare_operation_timeout: float = 60,
+ prepare_attempt_timeout: float | None = 20,
+ prepare_retryable_errors: Sequence[type[Exception]] = (
+ DeadlineExceeded,
+ ServiceUnavailable,
+ ),
+ column_info: dict[str, Message | EnumTypeWrapper] | None = None,
+ ) -> "ExecuteQueryIteratorAsync":
+ """
+ Executes an SQL query on an instance.
+ Returns an iterator to asynchronously stream back columns from selected rows.
+
+ Failed requests within operation_timeout will be retried based on the
+ retryable_errors list until operation_timeout is reached.
+
+ Note that this makes two requests, one to ``PrepareQuery`` and one to ``ExecuteQuery``.
+ These have separate retry configurations. ``ExecuteQuery`` is where the bulk of the
+ work happens.
+
+ Args:
+ query: Query to be run on Bigtable instance. The query can use ``@param``
+ placeholders to use parameter interpolation on the server. Values for all
+ parameters should be provided in ``parameters``. Types of parameters are
+ inferred but should be provided in ``parameter_types`` if the inference is
+ not possible (i.e. when value can be None, an empty list or an empty dict).
+ instance_id: The Bigtable instance ID to perform the query on.
+ instance_id is combined with the client's project to fully
+ specify the instance.
+ parameters: Dictionary with values for all parameters used in the ``query``.
+ parameter_types: Dictionary with types of parameters used in the ``query``.
+ Required to contain entries only for parameters whose type cannot be
+ detected automatically (i.e. the value can be None, an empty list or
+ an empty dict).
+ app_profile_id: The app profile to associate with requests.
+ https://cloud.google.com/bigtable/docs/app-profiles
+ operation_timeout: the time budget for the entire executeQuery operation, in seconds.
+ Failed requests will be retried within the budget.
+ Defaults to 600 seconds.
+ attempt_timeout: the time budget for an individual executeQuery network request, in seconds.
+ If it takes longer than this time to complete, the request will be cancelled with
+ a DeadlineExceeded exception, and a retry will be attempted.
+ Defaults to the 20 seconds.
+ If None, defaults to operation_timeout.
+ retryable_errors: a list of errors that will be retried if encountered during executeQuery.
+ Defaults to 4 (DeadlineExceeded), 14 (ServiceUnavailable), and 10 (Aborted)
+ prepare_operation_timeout: the time budget for the entire prepareQuery operation, in seconds.
+ Failed requests will be retried within the budget.
+ Defaults to 60 seconds.
+ prepare_attempt_timeout: the time budget for an individual prepareQuery network request, in seconds.
+ If it takes longer than this time to complete, the request will be cancelled with
+ a DeadlineExceeded exception, and a retry will be attempted.
+ Defaults to the 20 seconds.
+ If None, defaults to prepare_operation_timeout.
+ prepare_retryable_errors: a list of errors that will be retried if encountered during prepareQuery.
+ Defaults to 4 (DeadlineExceeded) and 14 (ServiceUnavailable)
+ column_info: (Optional) A dictionary mapping column names to Protobuf message classes or EnumTypeWrapper objects.
+ This dictionary provides the necessary type information for deserializing PROTO and
+ ENUM column values from the query results. When an entry is provided
+ for a PROTO or ENUM column, the client library will attempt to deserialize the raw data.
+
+ - For PROTO columns: The value in the dictionary should be the
+ Protobuf Message class (e.g., ``my_pb2.MyMessage``).
+ - For ENUM columns: The value should be the Protobuf EnumTypeWrapper
+ object (e.g., ``my_pb2.MyEnum``).
+
+ Example::
+
+ import my_pb2
+
+ column_info = {
+ "my_proto_column": my_pb2.MyMessage,
+ "my_enum_column": my_pb2.MyEnum
+ }
+
+ If ``column_info`` is not provided, or if a specific column name is not found
+ in the dictionary:
+
+ - PROTO columns will be returned as raw bytes.
+ - ENUM columns will be returned as integers.
+
+ Note for Nested PROTO or ENUM Fields:
+
+ To specify types for PROTO or ENUM fields within STRUCTs or MAPs, use a dot-separated
+ path from the top-level column name.
+
+ - For STRUCTs: ``struct_column_name.field_name``
+ - For MAPs: ``map_column_name.key`` or ``map_column_name.value`` to specify types
+ for the map keys or values, respectively.
+
+ Example::
+
+ import my_pb2
+
+ column_info = {
+ # Top-level column
+ "my_proto_column": my_pb2.MyMessage,
+ "my_enum_column": my_pb2.MyEnum,
+
+ # Nested field in a STRUCT column named 'my_struct'
+ "my_struct.nested_proto_field": my_pb2.OtherMessage,
+ "my_struct.nested_enum_field": my_pb2.AnotherEnum,
+
+ # Nested field in a MAP column named 'my_map'
+ "my_map.key": my_pb2.MapKeyEnum, # If map keys were enums
+ "my_map.value": my_pb2.MapValueMessage,
+
+ # PROTO field inside a STRUCT, where the STRUCT is the value in a MAP column
+ "struct_map.value.nested_proto_field": my_pb2.DeeplyNestedProto,
+ "struct_map.value.nested_enum_field": my_pb2.DeeplyNestedEnum
+ }
+
+ Returns:
+ ExecuteQueryIteratorAsync: an asynchronous iterator that yields rows returned by the query
+ Raises:
+ google.api_core.exceptions.DeadlineExceeded: raised after operation timeout
+ will be chained with a RetryExceptionGroup containing GoogleAPIError exceptions
+ from any retries that failed
+ google.api_core.exceptions.GoogleAPIError: raised if the request encounters an unrecoverable error
+ google.cloud.bigtable.data.exceptions.ParameterTypeInferenceFailed: Raised if
+ a parameter is passed without an explicit type, and the type cannot be infered
+ google.protobuf.message.DecodeError: raised if the deserialization of a PROTO/ENUM value fails.
+ """
+ instance_name = self._gapic_client.instance_path(self.project, instance_id)
+ converted_param_types = _to_param_types(parameters, parameter_types)
+ prepare_request = {
+ "instance_name": instance_name,
+ "query": query,
+ "app_profile_id": app_profile_id,
+ "param_types": converted_param_types,
+ "proto_format": {},
+ }
+ prepare_predicate = retries.if_exception_type(
+ *[_get_error_type(e) for e in prepare_retryable_errors]
+ )
+ prepare_operation_timeout, prepare_attempt_timeout = _align_timeouts(
+ prepare_operation_timeout, prepare_attempt_timeout
+ )
+ prepare_sleep_generator = retries.exponential_sleep_generator(0.01, 2, 60)
+
+ target = partial(
+ self._gapic_client.prepare_query,
+ request=prepare_request,
+ timeout=prepare_attempt_timeout,
+ retry=None,
+ )
+ prepare_result = await CrossSync.retry_target(
+ target,
+ prepare_predicate,
+ prepare_sleep_generator,
+ prepare_operation_timeout,
+ exception_factory=_retry_exception_factory,
+ )
+
+ prepare_metadata = _pb_metadata_to_metadata_types(prepare_result.metadata)
+
+ retryable_excs = [_get_error_type(e) for e in retryable_errors]
+
+ pb_params = _format_execute_query_params(parameters, parameter_types)
+
+ request_body = {
+ "instance_name": instance_name,
+ "app_profile_id": app_profile_id,
+ "prepared_query": prepare_result.prepared_query,
+ "params": pb_params,
+ }
+ operation_timeout, attempt_timeout = _align_timeouts(
+ operation_timeout, attempt_timeout
+ )
+
+ return CrossSync.ExecuteQueryIterator(
+ self,
+ instance_id,
+ app_profile_id,
+ request_body,
+ prepare_metadata,
+ attempt_timeout,
+ operation_timeout,
+ retryable_excs=retryable_excs,
+ column_info=column_info,
+ )
+
+ @CrossSync.convert(sync_name="__enter__")
+ async def __aenter__(self):
+ self._start_background_channel_refresh()
+ return self
+
+ @CrossSync.convert(sync_name="__exit__", replace_symbols={"__aexit__": "__exit__"})
+ async def __aexit__(self, exc_type, exc_val, exc_tb):
+ await self.close()
+ await self._gapic_client.__aexit__(exc_type, exc_val, exc_tb)
+
+
+@CrossSync.convert_class(sync_name="_DataApiTarget")
+class _DataApiTargetAsync(abc.ABC):
+ """
+ Abstract class containing API surface for BigtableDataClient. Should not be created directly
+
+ Can be instantiated as a Table or an AuthorizedView
+ """
+
+ @CrossSync.convert(
+ replace_symbols={"BigtableDataClientAsync": "BigtableDataClient"},
+ docstring_format_vars={
+ "LOOP_MESSAGE": (
+ "Must be created within an async context (running event loop)",
+ "",
+ ),
+ "RAISE_NO_LOOP": (
+ "RuntimeError: if called outside of an async context (no running event loop)",
+ "None",
+ ),
+ },
+ )
+ def __init__(
+ self,
+ client: BigtableDataClientAsync,
+ instance_id: str,
+ table_id: str,
+ app_profile_id: str | None = None,
+ *,
+ default_read_rows_operation_timeout: float = 600,
+ default_read_rows_attempt_timeout: float | None = 20,
+ default_mutate_rows_operation_timeout: float = 600,
+ default_mutate_rows_attempt_timeout: float | None = 60,
+ default_operation_timeout: float = 60,
+ default_attempt_timeout: float | None = 20,
+ default_read_rows_retryable_errors: Sequence[type[Exception]] = (
+ DeadlineExceeded,
+ ServiceUnavailable,
+ Aborted,
+ Cancelled,
+ ),
+ default_mutate_rows_retryable_errors: Sequence[type[Exception]] = (
+ DeadlineExceeded,
+ ServiceUnavailable,
+ ),
+ default_retryable_errors: Sequence[type[Exception]] = (
+ DeadlineExceeded,
+ ServiceUnavailable,
+ ),
+ ):
+ """
+ Initialize a Table instance
+
+ {LOOP_MESSAGE}
+
+ Args:
+ instance_id: The Bigtable instance ID to associate with this client.
+ instance_id is combined with the client's project to fully
+ specify the instance
+ table_id: The ID of the table. table_id is combined with the
+ instance_id and the client's project to fully specify the table
+ app_profile_id: The app profile to associate with requests.
+ https://cloud.google.com/bigtable/docs/app-profiles
+ default_read_rows_operation_timeout: The default timeout for read rows
+ operations, in seconds. If not set, defaults to 600 seconds (10 minutes)
+ default_read_rows_attempt_timeout: The default timeout for individual
+ read rows rpc requests, in seconds. If not set, defaults to 20 seconds
+ default_mutate_rows_operation_timeout: The default timeout for mutate rows
+ operations, in seconds. If not set, defaults to 600 seconds (10 minutes)
+ default_mutate_rows_attempt_timeout: The default timeout for individual
+ mutate rows rpc requests, in seconds. If not set, defaults to 60 seconds
+ default_operation_timeout: The default timeout for all other operations, in
+ seconds. If not set, defaults to 60 seconds
+ default_attempt_timeout: The default timeout for all other individual rpc
+ requests, in seconds. If not set, defaults to 20 seconds
+ default_read_rows_retryable_errors: a list of errors that will be retried
+ if encountered during read_rows and related operations.
+ Defaults to 4 (DeadlineExceeded), 14 (ServiceUnavailable), and 10 (Aborted)
+ default_mutate_rows_retryable_errors: a list of errors that will be retried
+ if encountered during mutate_rows and related operations.
+ Defaults to 4 (DeadlineExceeded) and 14 (ServiceUnavailable)
+ default_retryable_errors: a list of errors that will be retried if
+ encountered during all other operations.
+ Defaults to 4 (DeadlineExceeded) and 14 (ServiceUnavailable)
+ Raises:
+ {RAISE_NO_LOOP}
+ """
+ # NOTE: any changes to the signature of this method should also be reflected
+ # in client.get_table()
+ # validate timeouts
+ _validate_timeouts(
+ default_operation_timeout, default_attempt_timeout, allow_none=True
+ )
+ _validate_timeouts(
+ default_read_rows_operation_timeout,
+ default_read_rows_attempt_timeout,
+ allow_none=True,
+ )
+ _validate_timeouts(
+ default_mutate_rows_operation_timeout,
+ default_mutate_rows_attempt_timeout,
+ allow_none=True,
+ )
+
+ self.client = client
+ self.instance_id = instance_id
+ self.instance_name = self.client._gapic_client.instance_path(
+ self.client.project, instance_id
+ )
+ self.table_id = table_id
+ self.table_name = self.client._gapic_client.table_path(
+ self.client.project, instance_id, table_id
+ )
+ self.app_profile_id: str | None = app_profile_id
+
+ self.default_operation_timeout: float = default_operation_timeout
+ self.default_attempt_timeout: float | None = default_attempt_timeout
+ self.default_read_rows_operation_timeout: float = (
+ default_read_rows_operation_timeout
+ )
+ self.default_read_rows_attempt_timeout: float | None = (
+ default_read_rows_attempt_timeout
+ )
+ self.default_mutate_rows_operation_timeout: float = (
+ default_mutate_rows_operation_timeout
+ )
+ self.default_mutate_rows_attempt_timeout: float | None = (
+ default_mutate_rows_attempt_timeout
+ )
+
+ self.default_read_rows_retryable_errors: Sequence[type[Exception]] = (
+ default_read_rows_retryable_errors or ()
+ )
+ self.default_mutate_rows_retryable_errors: Sequence[type[Exception]] = (
+ default_mutate_rows_retryable_errors or ()
+ )
+ self.default_retryable_errors: Sequence[type[Exception]] = (
+ default_retryable_errors or ()
+ )
+
+ self._metrics = BigtableClientSideMetricsController()
+
+ try:
+ self._register_instance_future = CrossSync.create_task(
+ self.client._register_instance,
+ self.instance_id,
+ self.app_profile_id,
+ id(self),
+ sync_executor=self.client._executor,
+ )
+ except RuntimeError as e:
+ raise RuntimeError(
+ f"{self.__class__.__name__} must be created within an async event loop context."
+ ) from e
+
+ @property
+ @abc.abstractmethod
+ def _request_path(self) -> dict[str, str]:
+ """
+ Used to populate table_name or authorized_view_name for rpc requests, depending on the subclass
+
+ Unimplemented in base class
+ """
+ raise NotImplementedError
+
+ def __str__(self):
+ path_str = list(self._request_path.values())[0] if self._request_path else ""
+ return f"{self.__class__.__name__}<{path_str!r}>"
+
+ @CrossSync.convert(replace_symbols={"AsyncIterable": "Iterable"})
+ async def read_rows_stream(
+ self,
+ query: ReadRowsQuery,
+ *,
+ operation_timeout: float | TABLE_DEFAULT = TABLE_DEFAULT.READ_ROWS,
+ attempt_timeout: float | None | TABLE_DEFAULT = TABLE_DEFAULT.READ_ROWS,
+ retryable_errors: Sequence[type[Exception]]
+ | TABLE_DEFAULT = TABLE_DEFAULT.READ_ROWS,
+ ) -> AsyncIterable[Row]:
+ """
+ Read a set of rows from the table, based on the specified query.
+ Returns an iterator to asynchronously stream back row data.
+
+ Failed requests within operation_timeout will be retried based on the
+ retryable_errors list until operation_timeout is reached.
+
+ Args:
+ query: contains details about which rows to return
+ operation_timeout: the time budget for the entire operation, in seconds.
+ Failed requests will be retried within the budget.
+ Defaults to the Table's default_read_rows_operation_timeout
+ attempt_timeout: the time budget for an individual network request, in seconds.
+ If it takes longer than this time to complete, the request will be cancelled with
+ a DeadlineExceeded exception, and a retry will be attempted.
+ Defaults to the Table's default_read_rows_attempt_timeout.
+ If None, defaults to operation_timeout.
+ retryable_errors: a list of errors that will be retried if encountered.
+ Defaults to the Table's default_read_rows_retryable_errors
+ Returns:
+ AsyncIterable[Row]: an asynchronous iterator that yields rows returned by the query
+ Raises:
+ google.api_core.exceptions.DeadlineExceeded: raised after operation timeout
+ will be chained with a RetryExceptionGroup containing GoogleAPIError exceptions
+ from any retries that failed
+ google.api_core.exceptions.GoogleAPIError: raised if the request encounters an unrecoverable error
+ """
+ operation_timeout, attempt_timeout = _get_timeouts(
+ operation_timeout, attempt_timeout, self
+ )
+ retryable_excs = _get_retryable_errors(retryable_errors, self)
+
+ row_merger = CrossSync._ReadRowsOperation(
+ query,
+ self,
+ operation_timeout=operation_timeout,
+ attempt_timeout=attempt_timeout,
+ retryable_exceptions=retryable_excs,
+ )
+ return row_merger.start_operation()
+
+ @CrossSync.convert
+ async def read_rows(
+ self,
+ query: ReadRowsQuery,
+ *,
+ operation_timeout: float | TABLE_DEFAULT = TABLE_DEFAULT.READ_ROWS,
+ attempt_timeout: float | None | TABLE_DEFAULT = TABLE_DEFAULT.READ_ROWS,
+ retryable_errors: Sequence[type[Exception]]
+ | TABLE_DEFAULT = TABLE_DEFAULT.READ_ROWS,
+ ) -> list[Row]:
+ """
+ Read a set of rows from the table, based on the specified query.
+ Retruns results as a list of Row objects when the request is complete.
+ For streamed results, use read_rows_stream.
+
+ Failed requests within operation_timeout will be retried based on the
+ retryable_errors list until operation_timeout is reached.
+
+ Args:
+ query: contains details about which rows to return
+ operation_timeout: the time budget for the entire operation, in seconds.
+ Failed requests will be retried within the budget.
+ Defaults to the Table's default_read_rows_operation_timeout
+ attempt_timeout: the time budget for an individual network request, in seconds.
+ If it takes longer than this time to complete, the request will be cancelled with
+ a DeadlineExceeded exception, and a retry will be attempted.
+ Defaults to the Table's default_read_rows_attempt_timeout.
+ If None, defaults to operation_timeout.
+ If None, defaults to the Table's default_read_rows_attempt_timeout,
+ or the operation_timeout if that is also None.
+ retryable_errors: a list of errors that will be retried if encountered.
+ Defaults to the Table's default_read_rows_retryable_errors.
+ Returns:
+ list[Row]: a list of Rows returned by the query
+ Raises:
+ google.api_core.exceptions.DeadlineExceeded: raised after operation timeout
+ will be chained with a RetryExceptionGroup containing GoogleAPIError exceptions
+ from any retries that failed
+ google.api_core.exceptions.GoogleAPIError: raised if the request encounters an unrecoverable error
+ """
+ row_generator = await self.read_rows_stream(
+ query,
+ operation_timeout=operation_timeout,
+ attempt_timeout=attempt_timeout,
+ retryable_errors=retryable_errors,
+ )
+ return [row async for row in row_generator]
+
+ @CrossSync.convert
+ async def read_row(
+ self,
+ row_key: str | bytes,
+ *,
+ row_filter: RowFilter | None = None,
+ operation_timeout: float | TABLE_DEFAULT = TABLE_DEFAULT.READ_ROWS,
+ attempt_timeout: float | None | TABLE_DEFAULT = TABLE_DEFAULT.READ_ROWS,
+ retryable_errors: Sequence[type[Exception]]
+ | TABLE_DEFAULT = TABLE_DEFAULT.READ_ROWS,
+ ) -> Row | None:
+ """
+ Read a single row from the table, based on the specified key.
+
+ Failed requests within operation_timeout will be retried based on the
+ retryable_errors list until operation_timeout is reached.
+
+ Args:
+ query: contains details about which rows to return
+ operation_timeout: the time budget for the entire operation, in seconds.
+ Failed requests will be retried within the budget.
+ Defaults to the Table's default_read_rows_operation_timeout
+ attempt_timeout: the time budget for an individual network request, in seconds.
+ If it takes longer than this time to complete, the request will be cancelled with
+ a DeadlineExceeded exception, and a retry will be attempted.
+ Defaults to the Table's default_read_rows_attempt_timeout.
+ If None, defaults to operation_timeout.
+ retryable_errors: a list of errors that will be retried if encountered.
+ Defaults to the Table's default_read_rows_retryable_errors.
+ Returns:
+ Row | None: a Row object if the row exists, otherwise None
+ Raises:
+ google.api_core.exceptions.DeadlineExceeded: raised after operation timeout
+ will be chained with a RetryExceptionGroup containing GoogleAPIError exceptions
+ from any retries that failed
+ google.api_core.exceptions.GoogleAPIError: raised if the request encounters an unrecoverable error
+ """
+ if row_key is None:
+ raise ValueError("row_key must be string or bytes")
+ query = ReadRowsQuery(row_keys=row_key, row_filter=row_filter, limit=1)
+ results = await self.read_rows(
+ query,
+ operation_timeout=operation_timeout,
+ attempt_timeout=attempt_timeout,
+ retryable_errors=retryable_errors,
+ )
+ if len(results) == 0:
+ return None
+ return results[0]
+
+ @CrossSync.convert
+ async def read_rows_sharded(
+ self,
+ sharded_query: ShardedQuery,
+ *,
+ operation_timeout: float | TABLE_DEFAULT = TABLE_DEFAULT.READ_ROWS,
+ attempt_timeout: float | None | TABLE_DEFAULT = TABLE_DEFAULT.READ_ROWS,
+ retryable_errors: Sequence[type[Exception]]
+ | TABLE_DEFAULT = TABLE_DEFAULT.READ_ROWS,
+ ) -> list[Row]:
+ """
+ Runs a sharded query in parallel, then return the results in a single list.
+ Results will be returned in the order of the input queries.
+
+ This function is intended to be run on the results on a query.shard() call.
+ For example::
+
+ table_shard_keys = await table.sample_row_keys()
+ query = ReadRowsQuery(...)
+ shard_queries = query.shard(table_shard_keys)
+ results = await table.read_rows_sharded(shard_queries)
+
+ Args:
+ sharded_query: a sharded query to execute
+ operation_timeout: the time budget for the entire operation, in seconds.
+ Failed requests will be retried within the budget.
+ Defaults to the Table's default_read_rows_operation_timeout
+ attempt_timeout: the time budget for an individual network request, in seconds.
+ If it takes longer than this time to complete, the request will be cancelled with
+ a DeadlineExceeded exception, and a retry will be attempted.
+ Defaults to the Table's default_read_rows_attempt_timeout.
+ If None, defaults to operation_timeout.
+ retryable_errors: a list of errors that will be retried if encountered.
+ Defaults to the Table's default_read_rows_retryable_errors.
+ Returns:
+ list[Row]: a list of Rows returned by the query
+ Raises:
+ ShardedReadRowsExceptionGroup: if any of the queries failed
+ ValueError: if the query_list is empty
+ """
+ if not sharded_query:
+ raise ValueError("empty sharded_query")
+ operation_timeout, attempt_timeout = _get_timeouts(
+ operation_timeout, attempt_timeout, self
+ )
+ # make sure each rpc stays within overall operation timeout
+ rpc_timeout_generator = _attempt_timeout_generator(
+ operation_timeout, operation_timeout
+ )
+
+ # limit the number of concurrent requests using a semaphore
+ concurrency_sem = CrossSync.Semaphore(_CONCURRENCY_LIMIT)
+
+ @CrossSync.convert
+ async def read_rows_with_semaphore(query):
+ async with concurrency_sem:
+ # calculate new timeout based on time left in overall operation
+ shard_timeout = next(rpc_timeout_generator)
+ if shard_timeout <= 0:
+ raise DeadlineExceeded(
+ "Operation timeout exceeded before starting query"
+ )
+ return await self.read_rows(
+ query,
+ operation_timeout=shard_timeout,
+ attempt_timeout=min(attempt_timeout, shard_timeout),
+ retryable_errors=retryable_errors,
+ )
+
+ routine_list = [
+ partial(read_rows_with_semaphore, query) for query in sharded_query
+ ]
+ batch_result = await CrossSync.gather_partials(
+ routine_list,
+ return_exceptions=True,
+ sync_executor=self.client._executor,
+ )
+
+ # collect results and errors
+ error_dict = {}
+ shard_idx = 0
+ results_list = []
+ for result in batch_result:
+ if isinstance(result, Exception):
+ error_dict[shard_idx] = result
+ elif isinstance(result, BaseException):
+ # BaseException not expected; raise immediately
+ raise result
+ else:
+ results_list.extend(result)
+ shard_idx += 1
+ if error_dict:
+ # if any sub-request failed, raise an exception instead of returning results
+ raise ShardedReadRowsExceptionGroup(
+ [
+ FailedQueryShardError(idx, sharded_query[idx], e)
+ for idx, e in error_dict.items()
+ ],
+ results_list,
+ len(sharded_query),
+ )
+ return results_list
+
+ @CrossSync.convert
+ async def row_exists(
+ self,
+ row_key: str | bytes,
+ *,
+ operation_timeout: float | TABLE_DEFAULT = TABLE_DEFAULT.READ_ROWS,
+ attempt_timeout: float | None | TABLE_DEFAULT = TABLE_DEFAULT.READ_ROWS,
+ retryable_errors: Sequence[type[Exception]]
+ | TABLE_DEFAULT = TABLE_DEFAULT.READ_ROWS,
+ ) -> bool:
+ """
+ Return a boolean indicating whether the specified row exists in the table.
+ uses the filters: chain(limit cells per row = 1, strip value)
+
+ Args:
+ row_key: the key of the row to check
+ operation_timeout: the time budget for the entire operation, in seconds.
+ Failed requests will be retried within the budget.
+ Defaults to the Table's default_read_rows_operation_timeout
+ attempt_timeout: the time budget for an individual network request, in seconds.
+ If it takes longer than this time to complete, the request will be cancelled with
+ a DeadlineExceeded exception, and a retry will be attempted.
+ Defaults to the Table's default_read_rows_attempt_timeout.
+ If None, defaults to operation_timeout.
+ retryable_errors: a list of errors that will be retried if encountered.
+ Defaults to the Table's default_read_rows_retryable_errors.
+ Returns:
+ bool: a bool indicating whether the row exists
+ Raises:
+ google.api_core.exceptions.DeadlineExceeded: raised after operation timeout
+ will be chained with a RetryExceptionGroup containing GoogleAPIError exceptions
+ from any retries that failed
+ google.api_core.exceptions.GoogleAPIError: raised if the request encounters an unrecoverable error
+ """
+ if row_key is None:
+ raise ValueError("row_key must be string or bytes")
+
+ strip_filter = StripValueTransformerFilter(flag=True)
+ limit_filter = CellsRowLimitFilter(1)
+ chain_filter = RowFilterChain(filters=[limit_filter, strip_filter])
+ query = ReadRowsQuery(row_keys=row_key, limit=1, row_filter=chain_filter)
+ results = await self.read_rows(
+ query,
+ operation_timeout=operation_timeout,
+ attempt_timeout=attempt_timeout,
+ retryable_errors=retryable_errors,
+ )
+ return len(results) > 0
+
+ @CrossSync.convert
+ async def sample_row_keys(
+ self,
+ *,
+ operation_timeout: float | TABLE_DEFAULT = TABLE_DEFAULT.DEFAULT,
+ attempt_timeout: float | None | TABLE_DEFAULT = TABLE_DEFAULT.DEFAULT,
+ retryable_errors: Sequence[type[Exception]]
+ | TABLE_DEFAULT = TABLE_DEFAULT.DEFAULT,
+ ) -> RowKeySamples:
+ """
+ Return a set of RowKeySamples that delimit contiguous sections of the table of
+ approximately equal size
+
+ RowKeySamples output can be used with ReadRowsQuery.shard() to create a sharded query that
+ can be parallelized across multiple backend nodes read_rows and read_rows_stream
+ requests will call sample_row_keys internally for this purpose when sharding is enabled
+
+ RowKeySamples is simply a type alias for list[tuple[bytes, int]]; a list of
+ row_keys, along with offset positions in the table
+
+ Args:
+ operation_timeout: the time budget for the entire operation, in seconds.
+ Failed requests will be retried within the budget.i
+ Defaults to the Table's default_operation_timeout
+ attempt_timeout: the time budget for an individual network request, in seconds.
+ If it takes longer than this time to complete, the request will be cancelled with
+ a DeadlineExceeded exception, and a retry will be attempted.
+ Defaults to the Table's default_attempt_timeout.
+ If None, defaults to operation_timeout.
+ retryable_errors: a list of errors that will be retried if encountered.
+ Defaults to the Table's default_retryable_errors.
+ Returns:
+ RowKeySamples: a set of RowKeySamples the delimit contiguous sections of the table
+ Raises:
+ google.api_core.exceptions.DeadlineExceeded: raised after operation timeout
+ will be chained with a RetryExceptionGroup containing GoogleAPIError exceptions
+ from any retries that failed
+ google.api_core.exceptions.GoogleAPIError: raised if the request encounters an unrecoverable error
+ """
+ # prepare timeouts
+ operation_timeout, attempt_timeout = _get_timeouts(
+ operation_timeout, attempt_timeout, self
+ )
+ attempt_timeout_gen = _attempt_timeout_generator(
+ attempt_timeout, operation_timeout
+ )
+ # prepare retryable
+ retryable_excs = _get_retryable_errors(retryable_errors, self)
+ predicate = retries.if_exception_type(*retryable_excs)
+
+ sleep_generator = retries.exponential_sleep_generator(0.01, 2, 60)
+
+ @CrossSync.convert
+ async def execute_rpc():
+ results = await self.client._gapic_client.sample_row_keys(
+ request=SampleRowKeysRequest(
+ app_profile_id=self.app_profile_id, **self._request_path
+ ),
+ timeout=next(attempt_timeout_gen),
+ retry=None,
+ )
+ return [(s.row_key, s.offset_bytes) async for s in results]
+
+ return await CrossSync.retry_target(
+ execute_rpc,
+ predicate,
+ sleep_generator,
+ operation_timeout,
+ exception_factory=_retry_exception_factory,
+ )
+
+ @CrossSync.convert(replace_symbols={"MutationsBatcherAsync": "MutationsBatcher"})
+ def mutations_batcher(
+ self,
+ *,
+ flush_interval: float | None = 5,
+ flush_limit_mutation_count: int | None = 1000,
+ flush_limit_bytes: int = 20 * _MB_SIZE,
+ flow_control_max_mutation_count: int = 100_000,
+ flow_control_max_bytes: int = 100 * _MB_SIZE,
+ batch_operation_timeout: float | TABLE_DEFAULT = TABLE_DEFAULT.MUTATE_ROWS,
+ batch_attempt_timeout: float | None | TABLE_DEFAULT = TABLE_DEFAULT.MUTATE_ROWS,
+ batch_retryable_errors: Sequence[type[Exception]]
+ | TABLE_DEFAULT = TABLE_DEFAULT.MUTATE_ROWS,
+ ) -> "MutationsBatcherAsync":
+ """
+ Returns a new mutations batcher instance.
+
+ Can be used to iteratively add mutations that are flushed as a group,
+ to avoid excess network calls
+
+ Args:
+ flush_interval: Automatically flush every flush_interval seconds. If None,
+ a table default will be used
+ flush_limit_mutation_count: Flush immediately after flush_limit_mutation_count
+ mutations are added across all entries. If None, this limit is ignored.
+ flush_limit_bytes: Flush immediately after flush_limit_bytes bytes are added.
+ flow_control_max_mutation_count: Maximum number of inflight mutations.
+ flow_control_max_bytes: Maximum number of inflight bytes.
+ batch_operation_timeout: timeout for each mutate_rows operation, in seconds.
+ Defaults to the Table's default_mutate_rows_operation_timeout
+ batch_attempt_timeout: timeout for each individual request, in seconds.
+ Defaults to the Table's default_mutate_rows_attempt_timeout.
+ If None, defaults to batch_operation_timeout.
+ batch_retryable_errors: a list of errors that will be retried if encountered.
+ Defaults to the Table's default_mutate_rows_retryable_errors.
+ Returns:
+ MutationsBatcherAsync: a MutationsBatcherAsync context manager that can batch requests
+ """
+ return CrossSync.MutationsBatcher(
+ self,
+ flush_interval=flush_interval,
+ flush_limit_mutation_count=flush_limit_mutation_count,
+ flush_limit_bytes=flush_limit_bytes,
+ flow_control_max_mutation_count=flow_control_max_mutation_count,
+ flow_control_max_bytes=flow_control_max_bytes,
+ batch_operation_timeout=batch_operation_timeout,
+ batch_attempt_timeout=batch_attempt_timeout,
+ batch_retryable_errors=batch_retryable_errors,
+ )
+
+ @CrossSync.convert
+ async def mutate_row(
+ self,
+ row_key: str | bytes,
+ mutations: list[Mutation] | Mutation,
+ *,
+ operation_timeout: float | TABLE_DEFAULT = TABLE_DEFAULT.DEFAULT,
+ attempt_timeout: float | None | TABLE_DEFAULT = TABLE_DEFAULT.DEFAULT,
+ retryable_errors: Sequence[type[Exception]]
+ | TABLE_DEFAULT = TABLE_DEFAULT.DEFAULT,
+ ):
+ """
+ Mutates a row atomically.
+
+ Cells already present in the row are left unchanged unless explicitly changed
+ by ``mutation``.
+
+ Idempotent operations (i.e, all mutations have an explicit timestamp) will be
+ retried on server failure. Non-idempotent operations will not.
+
+ Args:
+ row_key: the row to apply mutations to
+ mutations: the set of mutations to apply to the row
+ operation_timeout: the time budget for the entire operation, in seconds.
+ Failed requests will be retried within the budget.
+ Defaults to the Table's default_operation_timeout
+ attempt_timeout: the time budget for an individual network request, in seconds.
+ If it takes longer than this time to complete, the request will be cancelled with
+ a DeadlineExceeded exception, and a retry will be attempted.
+ Defaults to the Table's default_attempt_timeout.
+ If None, defaults to operation_timeout.
+ retryable_errors: a list of errors that will be retried if encountered.
+ Only idempotent mutations will be retried. Defaults to the Table's
+ default_retryable_errors.
+ Raises:
+ google.api_core.exceptions.DeadlineExceeded: raised after operation timeout
+ will be chained with a RetryExceptionGroup containing all
+ GoogleAPIError exceptions from any retries that failed
+ google.api_core.exceptions.GoogleAPIError: raised on non-idempotent operations that cannot be
+ safely retried.
+ ValueError: if invalid arguments are provided
+ """
+ operation_timeout, attempt_timeout = _get_timeouts(
+ operation_timeout, attempt_timeout, self
+ )
+
+ if not mutations:
+ raise ValueError("No mutations provided")
+ mutations_list = mutations if isinstance(mutations, list) else [mutations]
+
+ if all(mutation.is_idempotent() for mutation in mutations_list):
+ # mutations are all idempotent and safe to retry
+ predicate = retries.if_exception_type(
+ *_get_retryable_errors(retryable_errors, self)
+ )
+ else:
+ # mutations should not be retried
+ predicate = retries.if_exception_type()
+
+ sleep_generator = retries.exponential_sleep_generator(0.01, 2, 60)
+
+ target = partial(
+ self.client._gapic_client.mutate_row,
+ request=MutateRowRequest(
+ row_key=row_key.encode("utf-8")
+ if isinstance(row_key, str)
+ else row_key,
+ mutations=[mutation._to_pb() for mutation in mutations_list],
+ app_profile_id=self.app_profile_id,
+ **self._request_path,
+ ),
+ timeout=attempt_timeout,
+ retry=None,
+ )
+ return await CrossSync.retry_target(
+ target,
+ predicate,
+ sleep_generator,
+ operation_timeout,
+ exception_factory=_retry_exception_factory,
+ )
+
+ @CrossSync.convert
+ async def bulk_mutate_rows(
+ self,
+ mutation_entries: list[RowMutationEntry],
+ *,
+ operation_timeout: float | TABLE_DEFAULT = TABLE_DEFAULT.MUTATE_ROWS,
+ attempt_timeout: float | None | TABLE_DEFAULT = TABLE_DEFAULT.MUTATE_ROWS,
+ retryable_errors: Sequence[type[Exception]]
+ | TABLE_DEFAULT = TABLE_DEFAULT.MUTATE_ROWS,
+ ):
+ """
+ Applies mutations for multiple rows in a single batched request.
+
+ Each individual RowMutationEntry is applied atomically, but separate entries
+ may be applied in arbitrary order (even for entries targetting the same row)
+ In total, the row_mutations can contain at most 100000 individual mutations
+ across all entries
+
+ Idempotent entries (i.e., entries with mutations with explicit timestamps)
+ will be retried on failure. Non-idempotent will not, and will reported in a
+ raised exception group
+
+ Args:
+ mutation_entries: the batches of mutations to apply
+ Each entry will be applied atomically, but entries will be applied
+ in arbitrary order
+ operation_timeout: the time budget for the entire operation, in seconds.
+ Failed requests will be retried within the budget.
+ Defaults to the Table's default_mutate_rows_operation_timeout
+ attempt_timeout: the time budget for an individual network request, in seconds.
+ If it takes longer than this time to complete, the request will be cancelled with
+ a DeadlineExceeded exception, and a retry will be attempted.
+ Defaults to the Table's default_mutate_rows_attempt_timeout.
+ If None, defaults to operation_timeout.
+ retryable_errors: a list of errors that will be retried if encountered.
+ Defaults to the Table's default_mutate_rows_retryable_errors
+ Raises:
+ MutationsExceptionGroup: if one or more mutations fails
+ Contains details about any failed entries in .exceptions
+ ValueError: if invalid arguments are provided
+ """
+ operation_timeout, attempt_timeout = _get_timeouts(
+ operation_timeout, attempt_timeout, self
+ )
+ retryable_excs = _get_retryable_errors(retryable_errors, self)
+
+ operation = CrossSync._MutateRowsOperation(
+ self.client._gapic_client,
+ self,
+ mutation_entries,
+ operation_timeout,
+ attempt_timeout,
+ retryable_exceptions=retryable_excs,
+ )
+ await operation.start()
+
+ @CrossSync.convert
+ async def check_and_mutate_row(
+ self,
+ row_key: str | bytes,
+ predicate: RowFilter | None,
+ *,
+ true_case_mutations: Mutation | list[Mutation] | None = None,
+ false_case_mutations: Mutation | list[Mutation] | None = None,
+ operation_timeout: float | TABLE_DEFAULT = TABLE_DEFAULT.DEFAULT,
+ ) -> bool:
+ """
+ Mutates a row atomically based on the output of a predicate filter
+
+ Non-idempotent operation: will not be retried
+
+ Args:
+ row_key: the key of the row to mutate
+ predicate: the filter to be applied to the contents of the specified row.
+ Depending on whether or not any results are yielded,
+ either true_case_mutations or false_case_mutations will be executed.
+ If None, checks that the row contains any values at all.
+ true_case_mutations:
+ Changes to be atomically applied to the specified row if
+ predicate yields at least one cell when
+ applied to row_key. Entries are applied in order,
+ meaning that earlier mutations can be masked by later
+ ones. Must contain at least one entry if
+ false_case_mutations is empty, and at most 100000.
+ false_case_mutations:
+ Changes to be atomically applied to the specified row if
+ predicate_filter does not yield any cells when
+ applied to row_key. Entries are applied in order,
+ meaning that earlier mutations can be masked by later
+ ones. Must contain at least one entry if
+ `true_case_mutations` is empty, and at most 100000.
+ operation_timeout: the time budget for the entire operation, in seconds.
+ Failed requests will not be retried. Defaults to the Table's default_operation_timeout
+ Returns:
+ bool indicating whether the predicate was true or false
+ Raises:
+ google.api_core.exceptions.GoogleAPIError: exceptions from grpc call
+ """
+ operation_timeout, _ = _get_timeouts(operation_timeout, None, self)
+ if true_case_mutations is not None and not isinstance(
+ true_case_mutations, list
+ ):
+ true_case_mutations = [true_case_mutations]
+ true_case_list = [m._to_pb() for m in true_case_mutations or []]
+ if false_case_mutations is not None and not isinstance(
+ false_case_mutations, list
+ ):
+ false_case_mutations = [false_case_mutations]
+ false_case_list = [m._to_pb() for m in false_case_mutations or []]
+ result = await self.client._gapic_client.check_and_mutate_row(
+ request=CheckAndMutateRowRequest(
+ true_mutations=true_case_list,
+ false_mutations=false_case_list,
+ predicate_filter=predicate._to_pb() if predicate is not None else None,
+ row_key=row_key.encode("utf-8")
+ if isinstance(row_key, str)
+ else row_key,
+ app_profile_id=self.app_profile_id,
+ **self._request_path,
+ ),
+ timeout=operation_timeout,
+ retry=None,
+ )
+ return result.predicate_matched
+
+ @CrossSync.convert
+ async def read_modify_write_row(
+ self,
+ row_key: str | bytes,
+ rules: ReadModifyWriteRule | list[ReadModifyWriteRule],
+ *,
+ operation_timeout: float | TABLE_DEFAULT = TABLE_DEFAULT.DEFAULT,
+ ) -> Row:
+ """
+ Reads and modifies a row atomically according to input ReadModifyWriteRules,
+ and returns the contents of all modified cells
+
+ The new value for the timestamp is the greater of the existing timestamp or
+ the current server time.
+
+ Non-idempotent operation: will not be retried
+
+ Args:
+ row_key: the key of the row to apply read/modify/write rules to
+ rules: A rule or set of rules to apply to the row.
+ Rules are applied in order, meaning that earlier rules will affect the
+ results of later ones.
+ operation_timeout: the time budget for the entire operation, in seconds.
+ Failed requests will not be retried.
+ Defaults to the Table's default_operation_timeout.
+ Returns:
+ Row: a Row containing cell data that was modified as part of the operation
+ Raises:
+ google.api_core.exceptions.GoogleAPIError: exceptions from grpc call
+ ValueError: if invalid arguments are provided
+ """
+ operation_timeout, _ = _get_timeouts(operation_timeout, None, self)
+ if operation_timeout <= 0:
+ raise ValueError("operation_timeout must be greater than 0")
+ if rules is not None and not isinstance(rules, list):
+ rules = [rules]
+ if not rules:
+ raise ValueError("rules must contain at least one item")
+ result = await self.client._gapic_client.read_modify_write_row(
+ request=ReadModifyWriteRowRequest(
+ rules=[rule._to_pb() for rule in rules],
+ row_key=row_key.encode("utf-8")
+ if isinstance(row_key, str)
+ else row_key,
+ app_profile_id=self.app_profile_id,
+ **self._request_path,
+ ),
+ timeout=operation_timeout,
+ retry=None,
+ )
+ # construct Row from result
+ return Row._from_pb(result.row)
+
+ @CrossSync.convert
+ async def close(self):
+ """
+ Called to close the Table instance and release any resources held by it.
+ """
+ self._metrics.close()
+ if self._register_instance_future:
+ self._register_instance_future.cancel()
+ self.client._remove_instance_registration(
+ self.instance_id, self.app_profile_id, id(self)
+ )
+
+ @CrossSync.convert(sync_name="__enter__")
+ async def __aenter__(self):
+ """
+ Implement async context manager protocol
+
+ Ensure registration task has time to run, so that
+ grpc channels will be warmed for the specified instance
+ """
+ if self._register_instance_future:
+ await self._register_instance_future
+ return self
+
+ @CrossSync.convert(sync_name="__exit__")
+ async def __aexit__(self, exc_type, exc_val, exc_tb):
+ """
+ Implement async context manager protocol
+
+ Unregister this instance with the client, so that
+ grpc channels will no longer be warmed
+ """
+ await self.close()
+
+
+@CrossSync.convert_class(
+ sync_name="Table",
+ add_mapping_for_name="Table",
+ replace_symbols={"_DataApiTargetAsync": "_DataApiTarget"},
+)
+class TableAsync(_DataApiTargetAsync):
+ """
+ Main Data API surface for interacting with a Bigtable table.
+
+ Table object maintains table_id, and app_profile_id context, and passes them with
+ each call
+ """
+
+ @property
+ def _request_path(self) -> dict[str, str]:
+ return {"table_name": self.table_name}
+
+
+@CrossSync.convert_class(
+ sync_name="AuthorizedView",
+ add_mapping_for_name="AuthorizedView",
+ replace_symbols={"_DataApiTargetAsync": "_DataApiTarget"},
+)
+class AuthorizedViewAsync(_DataApiTargetAsync):
+ """
+ Provides access to an authorized view of a table.
+
+ An authorized view is a subset of a table that you configure to include specific table data.
+ Then you grant access to the authorized view separately from access to the table.
+
+ AuthorizedView object maintains table_id, app_profile_id, and authorized_view_id context,
+ and passed them with each call
+ """
+
+ @CrossSync.convert(
+ docstring_format_vars={
+ "LOOP_MESSAGE": (
+ "Must be created within an async context (running event loop)",
+ "",
+ ),
+ "RAISE_NO_LOOP": (
+ "RuntimeError: if called outside of an async context (no running event loop)",
+ "None",
+ ),
+ }
+ )
+ def __init__(
+ self,
+ client,
+ instance_id,
+ table_id,
+ authorized_view_id,
+ app_profile_id: str | None = None,
+ **kwargs,
+ ):
+ """
+ Initialize an AuthorizedView instance
+
+ {LOOP_MESSAGE}
+
+ Args:
+ instance_id: The Bigtable instance ID to associate with this client.
+ instance_id is combined with the client's project to fully
+ specify the instance
+ table_id: The ID of the table. table_id is combined with the
+ instance_id and the client's project to fully specify the table
+ authorized_view_id: The id for the authorized view to use for requests
+ app_profile_id: The app profile to associate with requests.
+ https://cloud.google.com/bigtable/docs/app-profiles
+ default_read_rows_operation_timeout: The default timeout for read rows
+ operations, in seconds. If not set, defaults to 600 seconds (10 minutes)
+ default_read_rows_attempt_timeout: The default timeout for individual
+ read rows rpc requests, in seconds. If not set, defaults to 20 seconds
+ default_mutate_rows_operation_timeout: The default timeout for mutate rows
+ operations, in seconds. If not set, defaults to 600 seconds (10 minutes)
+ default_mutate_rows_attempt_timeout: The default timeout for individual
+ mutate rows rpc requests, in seconds. If not set, defaults to 60 seconds
+ default_operation_timeout: The default timeout for all other operations, in
+ seconds. If not set, defaults to 60 seconds
+ default_attempt_timeout: The default timeout for all other individual rpc
+ requests, in seconds. If not set, defaults to 20 seconds
+ default_read_rows_retryable_errors: a list of errors that will be retried
+ if encountered during read_rows and related operations.
+ Defaults to 4 (DeadlineExceeded), 14 (ServiceUnavailable), and 10 (Aborted)
+ default_mutate_rows_retryable_errors: a list of errors that will be retried
+ if encountered during mutate_rows and related operations.
+ Defaults to 4 (DeadlineExceeded) and 14 (ServiceUnavailable)
+ default_retryable_errors: a list of errors that will be retried if
+ encountered during all other operations.
+ Defaults to 4 (DeadlineExceeded) and 14 (ServiceUnavailable)
+ Raises:
+ {RAISE_NO_LOOP}
+ """
+ super().__init__(client, instance_id, table_id, app_profile_id, **kwargs)
+ self.authorized_view_id = authorized_view_id
+ self.authorized_view_name: str = self.client._gapic_client.authorized_view_path(
+ self.client.project, instance_id, table_id, authorized_view_id
+ )
+
+ @property
+ def _request_path(self) -> dict[str, str]:
+ return {"authorized_view_name": self.authorized_view_name}
diff --git a/google/cloud/bigtable/data/_async/metrics_interceptor.py b/google/cloud/bigtable/data/_async/metrics_interceptor.py
new file mode 100644
index 000000000..249dcdcc9
--- /dev/null
+++ b/google/cloud/bigtable/data/_async/metrics_interceptor.py
@@ -0,0 +1,172 @@
+# Copyright 2025 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 annotations
+
+from typing import Sequence
+
+import time
+from functools import wraps
+
+from google.cloud.bigtable.data._metrics.data_model import ActiveOperationMetric
+from google.cloud.bigtable.data._metrics.data_model import OperationState
+from google.cloud.bigtable.data._metrics.data_model import OperationType
+
+from google.cloud.bigtable.data._cross_sync import CrossSync
+
+if CrossSync.is_async:
+ from grpc.aio import UnaryUnaryClientInterceptor
+ from grpc.aio import UnaryStreamClientInterceptor
+ from grpc.aio import AioRpcError
+else:
+ from grpc import UnaryUnaryClientInterceptor
+ from grpc import UnaryStreamClientInterceptor
+
+
+__CROSS_SYNC_OUTPUT__ = "google.cloud.bigtable.data._sync_autogen.metrics_interceptor"
+
+
+def _with_active_operation(func):
+ """
+ Decorator for interceptor methods to extract the active operation associated with the
+ in-scope contextvars, and pass it to the decorated function.
+ """
+
+ @wraps(func)
+ def wrapper(self, continuation, client_call_details, request):
+ operation: ActiveOperationMetric | None = ActiveOperationMetric.from_context()
+
+ if operation:
+ # start a new attempt if not started
+ if (
+ operation.state == OperationState.CREATED
+ or operation.state == OperationState.BETWEEN_ATTEMPTS
+ ):
+ operation.start_attempt()
+ # wrap continuation in logic to process the operation
+ return func(self, operation, continuation, client_call_details, request)
+ else:
+ # if operation not found, return unwrapped continuation
+ return continuation(client_call_details, request)
+
+ return wrapper
+
+
+@CrossSync.convert
+async def _get_metadata(source) -> dict[str, str | bytes] | None:
+ """Helper to extract metadata from a call or RpcError"""
+ try:
+ metadata: Sequence[tuple[str, str | bytes]]
+ if CrossSync.is_async:
+ # grpc.aio returns metadata in Metadata objects
+ if isinstance(source, AioRpcError):
+ metadata = list(source.trailing_metadata()) + list(
+ source.initial_metadata()
+ )
+ else:
+ metadata = list(await source.trailing_metadata()) + list(
+ await source.initial_metadata()
+ )
+ else:
+ # sync grpc returns metadata as a sequence of tuples
+ metadata = source.trailing_metadata() + source.initial_metadata()
+ # convert metadata to dict format
+ return {k: v for (k, v) in metadata}
+ except Exception:
+ # ignore errors while fetching metadata
+ return None
+
+
+@CrossSync.convert_class(sync_name="BigtableMetricsInterceptor")
+class AsyncBigtableMetricsInterceptor(
+ UnaryUnaryClientInterceptor, UnaryStreamClientInterceptor
+):
+ """
+ An async gRPC interceptor to add client metadata and print server metadata.
+ """
+
+ @CrossSync.convert
+ @_with_active_operation
+ async def intercept_unary_unary(
+ self, operation, continuation, client_call_details, request
+ ):
+ """
+ Interceptor for unary rpcs:
+ - MutateRow
+ - CheckAndMutateRow
+ - ReadModifyWriteRow
+ """
+ metadata = None
+ try:
+ call = await continuation(client_call_details, request)
+ metadata = await _get_metadata(call)
+ return call
+ except Exception as rpc_error:
+ metadata = await _get_metadata(rpc_error)
+ raise rpc_error
+ finally:
+ if metadata is not None:
+ operation.add_response_metadata(metadata)
+
+ @CrossSync.convert
+ @_with_active_operation
+ async def intercept_unary_stream(
+ self, operation, continuation, client_call_details, request
+ ):
+ """
+ Interceptor for streaming rpcs:
+ - ReadRows
+ - MutateRows
+ - SampleRowKeys
+ """
+ try:
+ return self._streaming_generator_wrapper(
+ operation, await continuation(client_call_details, request)
+ )
+ except Exception as rpc_error:
+ # handle errors while intializing stream
+ metadata = await _get_metadata(rpc_error)
+ if metadata is not None:
+ operation.add_response_metadata(metadata)
+ raise rpc_error
+
+ @staticmethod
+ @CrossSync.convert
+ async def _streaming_generator_wrapper(operation, call):
+ """
+ Wrapped generator to be returned by intercept_unary_stream.
+ """
+ # only track has_first response for READ_ROWS
+ has_first_response = (
+ operation.first_response_latency_ns is not None
+ or operation.op_type != OperationType.READ_ROWS
+ )
+ encountered_exc = None
+ try:
+ async for response in call:
+ # record time to first response. Currently only used for READ_ROWs
+ if not has_first_response:
+ operation.first_response_latency_ns = (
+ time.monotonic_ns() - operation.start_time_ns
+ )
+ has_first_response = True
+ yield response
+ except Exception as e:
+ # handle errors while processing stream
+ encountered_exc = e
+ raise
+ finally:
+ if call is not None:
+ metadata = await _get_metadata(encountered_exc or call)
+ if metadata is not None:
+ operation.add_response_metadata(metadata)
diff --git a/google/cloud/bigtable/data/_async/mutations_batcher.py b/google/cloud/bigtable/data/_async/mutations_batcher.py
new file mode 100644
index 000000000..a8e99ea9e
--- /dev/null
+++ b/google/cloud/bigtable/data/_async/mutations_batcher.py
@@ -0,0 +1,536 @@
+# Copyright 2024 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+from __future__ import annotations
+
+from typing import Sequence, TYPE_CHECKING, cast
+import atexit
+import warnings
+from collections import deque
+import concurrent.futures
+
+from google.cloud.bigtable.data.exceptions import MutationsExceptionGroup
+from google.cloud.bigtable.data.exceptions import FailedMutationEntryError
+from google.cloud.bigtable.data._helpers import _get_retryable_errors
+from google.cloud.bigtable.data._helpers import _get_timeouts
+from google.cloud.bigtable.data._helpers import TABLE_DEFAULT
+
+from google.cloud.bigtable.data.mutations import (
+ _MUTATE_ROWS_REQUEST_MUTATION_LIMIT,
+)
+from google.cloud.bigtable.data.mutations import Mutation
+
+from google.cloud.bigtable.data._cross_sync import CrossSync
+
+if TYPE_CHECKING:
+ from google.cloud.bigtable.data.mutations import RowMutationEntry
+
+ if CrossSync.is_async:
+ from google.cloud.bigtable.data._async.client import (
+ _DataApiTargetAsync as TargetType,
+ )
+ else:
+ from google.cloud.bigtable.data._sync_autogen.client import _DataApiTarget as TargetType # type: ignore
+
+__CROSS_SYNC_OUTPUT__ = "google.cloud.bigtable.data._sync_autogen.mutations_batcher"
+
+# used to make more readable default values
+_MB_SIZE = 1024 * 1024
+
+
+@CrossSync.convert_class(sync_name="_FlowControl", add_mapping_for_name="_FlowControl")
+class _FlowControlAsync:
+ """
+ Manages flow control for batched mutations. Mutations are registered against
+ the FlowControl object before being sent, which will block if size or count
+ limits have reached capacity. As mutations completed, they are removed from
+ the FlowControl object, which will notify any blocked requests that there
+ is additional capacity.
+
+ Flow limits are not hard limits. If a single mutation exceeds the configured
+ limits, it will be allowed as a single batch when the capacity is available.
+
+ Args:
+ max_mutation_count: maximum number of mutations to send in a single rpc.
+ This corresponds to individual mutations in a single RowMutationEntry.
+ max_mutation_bytes: maximum number of bytes to send in a single rpc.
+ Raises:
+ ValueError: if max_mutation_count or max_mutation_bytes is less than 0
+ """
+
+ def __init__(
+ self,
+ max_mutation_count: int,
+ max_mutation_bytes: int,
+ ):
+ self._max_mutation_count = max_mutation_count
+ self._max_mutation_bytes = max_mutation_bytes
+ if self._max_mutation_count < 1:
+ raise ValueError("max_mutation_count must be greater than 0")
+ if self._max_mutation_bytes < 1:
+ raise ValueError("max_mutation_bytes must be greater than 0")
+ self._capacity_condition = CrossSync.Condition()
+ self._in_flight_mutation_count = 0
+ self._in_flight_mutation_bytes = 0
+
+ def _has_capacity(self, additional_count: int, additional_size: int) -> bool:
+ """
+ Checks if there is capacity to send a new entry with the given size and count
+
+ FlowControl limits are not hard limits. If a single mutation exceeds
+ the configured flow limits, it will be sent in a single batch when
+ previous batches have completed.
+
+ Args:
+ additional_count: number of mutations in the pending entry
+ additional_size: size of the pending entry
+ Returns:
+ bool: True if there is capacity to send the pending entry, False otherwise
+ """
+ # adjust limits to allow overly large mutations
+ acceptable_size = max(self._max_mutation_bytes, additional_size)
+ acceptable_count = max(self._max_mutation_count, additional_count)
+ # check if we have capacity for new mutation
+ new_size = self._in_flight_mutation_bytes + additional_size
+ new_count = self._in_flight_mutation_count + additional_count
+ return new_size <= acceptable_size and new_count <= acceptable_count
+
+ @CrossSync.convert
+ async def remove_from_flow(
+ self, mutations: RowMutationEntry | list[RowMutationEntry]
+ ) -> None:
+ """
+ Removes mutations from flow control. This method should be called once
+ for each mutation that was sent to add_to_flow, after the corresponding
+ operation is complete.
+
+ Args:
+ mutations: mutation or list of mutations to remove from flow control
+ """
+ if not isinstance(mutations, list):
+ mutations = [mutations]
+ total_count = sum(len(entry.mutations) for entry in mutations)
+ total_size = sum(entry.size() for entry in mutations)
+ self._in_flight_mutation_count -= total_count
+ self._in_flight_mutation_bytes -= total_size
+ # notify any blocked requests that there is additional capacity
+ async with self._capacity_condition:
+ self._capacity_condition.notify_all()
+
+ @CrossSync.convert
+ async def add_to_flow(self, mutations: RowMutationEntry | list[RowMutationEntry]):
+ """
+ Generator function that registers mutations with flow control. As mutations
+ are accepted into the flow control, they are yielded back to the caller,
+ to be sent in a batch. If the flow control is at capacity, the generator
+ will block until there is capacity available.
+
+ Args:
+ mutations: list mutations to break up into batches
+ Yields:
+ list[RowMutationEntry]:
+ list of mutations that have reserved space in the flow control.
+ Each batch contains at least one mutation.
+ """
+ if not isinstance(mutations, list):
+ mutations = [mutations]
+ start_idx = 0
+ end_idx = 0
+ while end_idx < len(mutations):
+ start_idx = end_idx
+ batch_mutation_count = 0
+ # fill up batch until we hit capacity
+ async with self._capacity_condition:
+ while end_idx < len(mutations):
+ next_entry = mutations[end_idx]
+ next_size = next_entry.size()
+ next_count = len(next_entry.mutations)
+ if (
+ self._has_capacity(next_count, next_size)
+ # make sure not to exceed per-request mutation count limits
+ and (batch_mutation_count + next_count)
+ <= _MUTATE_ROWS_REQUEST_MUTATION_LIMIT
+ ):
+ # room for new mutation; add to batch
+ end_idx += 1
+ batch_mutation_count += next_count
+ self._in_flight_mutation_bytes += next_size
+ self._in_flight_mutation_count += next_count
+ elif start_idx != end_idx:
+ # we have at least one mutation in the batch, so send it
+ break
+ else:
+ # batch is empty. Block until we have capacity
+ await self._capacity_condition.wait_for(
+ lambda: self._has_capacity(next_count, next_size)
+ )
+ yield mutations[start_idx:end_idx]
+
+
+@CrossSync.convert_class(sync_name="MutationsBatcher")
+class MutationsBatcherAsync:
+ """
+ Allows users to send batches using context manager API.
+
+ Runs mutate_row, mutate_rows, and check_and_mutate_row internally, combining
+ to use as few network requests as required
+
+ Will automatically flush the batcher:
+ - every flush_interval seconds
+ - after queue size reaches flush_limit_mutation_count
+ - after queue reaches flush_limit_bytes
+ - when batcher is closed or destroyed
+
+ Args:
+ table: table or autrhorized_view used to preform rpc calls
+ flush_interval: Automatically flush every flush_interval seconds.
+ If None, no time-based flushing is performed.
+ flush_limit_mutation_count: Flush immediately after flush_limit_mutation_count
+ mutations are added across all entries. If None, this limit is ignored.
+ flush_limit_bytes: Flush immediately after flush_limit_bytes bytes are added.
+ flow_control_max_mutation_count: Maximum number of inflight mutations.
+ flow_control_max_bytes: Maximum number of inflight bytes.
+ batch_operation_timeout: timeout for each mutate_rows operation, in seconds.
+ If TABLE_DEFAULT, defaults to the Table's default_mutate_rows_operation_timeout.
+ batch_attempt_timeout: timeout for each individual request, in seconds.
+ If TABLE_DEFAULT, defaults to the Table's default_mutate_rows_attempt_timeout.
+ If None, defaults to batch_operation_timeout.
+ batch_retryable_errors: a list of errors that will be retried if encountered.
+ Defaults to the Table's default_mutate_rows_retryable_errors.
+ """
+
+ def __init__(
+ self,
+ table: TargetType,
+ *,
+ flush_interval: float | None = 5,
+ flush_limit_mutation_count: int | None = 1000,
+ flush_limit_bytes: int = 20 * _MB_SIZE,
+ flow_control_max_mutation_count: int = 100_000,
+ flow_control_max_bytes: int = 100 * _MB_SIZE,
+ batch_operation_timeout: float | TABLE_DEFAULT = TABLE_DEFAULT.MUTATE_ROWS,
+ batch_attempt_timeout: float | None | TABLE_DEFAULT = TABLE_DEFAULT.MUTATE_ROWS,
+ batch_retryable_errors: Sequence[type[Exception]]
+ | TABLE_DEFAULT = TABLE_DEFAULT.MUTATE_ROWS,
+ ):
+ self._operation_timeout, self._attempt_timeout = _get_timeouts(
+ batch_operation_timeout, batch_attempt_timeout, table
+ )
+ self._retryable_errors: list[type[Exception]] = _get_retryable_errors(
+ batch_retryable_errors, table
+ )
+
+ self._closed = CrossSync.Event()
+ self._target = table
+ self._staged_entries: list[RowMutationEntry] = []
+ self._staged_count, self._staged_bytes = 0, 0
+ self._flow_control = CrossSync._FlowControl(
+ flow_control_max_mutation_count, flow_control_max_bytes
+ )
+ self._flush_limit_bytes = flush_limit_bytes
+ self._flush_limit_count = (
+ flush_limit_mutation_count
+ if flush_limit_mutation_count is not None
+ else float("inf")
+ )
+ # used by sync class to run mutate_rows operations
+ self._sync_rpc_executor = (
+ concurrent.futures.ThreadPoolExecutor(max_workers=8)
+ if not CrossSync.is_async
+ else None
+ )
+ # used by sync class to manage flush_internal tasks
+ self._sync_flush_executor = (
+ concurrent.futures.ThreadPoolExecutor(max_workers=4)
+ if not CrossSync.is_async
+ else None
+ )
+ self._flush_timer = CrossSync.create_task(
+ self._timer_routine, flush_interval, sync_executor=self._sync_flush_executor
+ )
+ self._flush_jobs: set[CrossSync.Future[None]] = set()
+ # MutationExceptionGroup reports number of successful entries along with failures
+ self._entries_processed_since_last_raise: int = 0
+ self._exceptions_since_last_raise: int = 0
+ # keep track of the first and last _exception_list_limit exceptions
+ self._exception_list_limit: int = 10
+ self._oldest_exceptions: list[Exception] = []
+ self._newest_exceptions: deque[Exception] = deque(
+ maxlen=self._exception_list_limit
+ )
+ # clean up on program exit
+ atexit.register(self._on_exit)
+
+ @CrossSync.convert
+ async def _timer_routine(self, interval: float | None) -> None:
+ """
+ Set up a background task to flush the batcher every interval seconds
+
+ If interval is None, an empty future is returned
+
+ Args:
+ flush_interval: Automatically flush every flush_interval seconds.
+ If None, no time-based flushing is performed.
+ """
+ if not interval or interval <= 0:
+ return None
+ while not self._closed.is_set():
+ # wait until interval has passed, or until closed
+ await CrossSync.event_wait(
+ self._closed, timeout=interval, async_break_early=False
+ )
+ if not self._closed.is_set() and self._staged_entries:
+ self._schedule_flush()
+
+ @CrossSync.convert
+ async def append(self, mutation_entry: RowMutationEntry):
+ """
+ Add a new set of mutations to the internal queue
+
+ Args:
+ mutation_entry: new entry to add to flush queue
+ Raises:
+ RuntimeError: if batcher is closed
+ ValueError: if an invalid mutation type is added
+ """
+ # TODO: return a future to track completion of this entry
+ if self._closed.is_set():
+ raise RuntimeError("Cannot append to closed MutationsBatcher")
+ if isinstance(cast(Mutation, mutation_entry), Mutation):
+ raise ValueError(
+ f"invalid mutation type: {type(mutation_entry).__name__}. Only RowMutationEntry objects are supported by batcher"
+ )
+ self._staged_entries.append(mutation_entry)
+ # start a new flush task if limits exceeded
+ self._staged_count += len(mutation_entry.mutations)
+ self._staged_bytes += mutation_entry.size()
+ if (
+ self._staged_count >= self._flush_limit_count
+ or self._staged_bytes >= self._flush_limit_bytes
+ ):
+ self._schedule_flush()
+ # yield to the event loop to allow flush to run
+ await CrossSync.yield_to_event_loop()
+
+ def _schedule_flush(self) -> CrossSync.Future[None] | None:
+ """
+ Update the flush task to include the latest staged entries
+
+ Returns:
+ Future[None] | None:
+ future representing the background task, if started
+ """
+ if self._staged_entries:
+ entries, self._staged_entries = self._staged_entries, []
+ self._staged_count, self._staged_bytes = 0, 0
+ new_task = CrossSync.create_task(
+ self._flush_internal, entries, sync_executor=self._sync_flush_executor
+ )
+ if not new_task.done():
+ self._flush_jobs.add(new_task)
+ new_task.add_done_callback(self._flush_jobs.remove)
+ return new_task
+ return None
+
+ @CrossSync.convert
+ async def _flush_internal(self, new_entries: list[RowMutationEntry]):
+ """
+ Flushes a set of mutations to the server, and updates internal state
+
+ Args:
+ new_entries list of RowMutationEntry objects to flush
+ """
+ # flush new entries
+ in_process_requests: list[CrossSync.Future[list[FailedMutationEntryError]]] = []
+ async for batch in self._flow_control.add_to_flow(new_entries):
+ batch_task = CrossSync.create_task(
+ self._execute_mutate_rows, batch, sync_executor=self._sync_rpc_executor
+ )
+ in_process_requests.append(batch_task)
+ # wait for all inflight requests to complete
+ found_exceptions = await self._wait_for_batch_results(*in_process_requests)
+ # update exception data to reflect any new errors
+ self._entries_processed_since_last_raise += len(new_entries)
+ self._add_exceptions(found_exceptions)
+
+ @CrossSync.convert
+ async def _execute_mutate_rows(
+ self, batch: list[RowMutationEntry]
+ ) -> list[FailedMutationEntryError]:
+ """
+ Helper to execute mutation operation on a batch
+
+ Args:
+ batch: list of RowMutationEntry objects to send to server
+ timeout: timeout in seconds. Used as operation_timeout and attempt_timeout.
+ If not given, will use table defaults
+ Returns:
+ list[FailedMutationEntryError]:
+ list of FailedMutationEntryError objects for mutations that failed.
+ FailedMutationEntryError objects will not contain index information
+ """
+ try:
+ operation = CrossSync._MutateRowsOperation(
+ self._target.client._gapic_client,
+ self._target,
+ batch,
+ operation_timeout=self._operation_timeout,
+ attempt_timeout=self._attempt_timeout,
+ retryable_exceptions=self._retryable_errors,
+ )
+ await operation.start()
+ except MutationsExceptionGroup as e:
+ # strip index information from exceptions, since it is not useful in a batch context
+ for subexc in e.exceptions:
+ subexc.index = None
+ return list(e.exceptions)
+ finally:
+ # mark batch as complete in flow control
+ await self._flow_control.remove_from_flow(batch)
+ return []
+
+ def _add_exceptions(self, excs: list[Exception]):
+ """
+ Add new list of exceptions to internal store. To avoid unbounded memory,
+ the batcher will store the first and last _exception_list_limit exceptions,
+ and discard any in between.
+
+ Args:
+ excs: list of exceptions to add to the internal store
+ """
+ self._exceptions_since_last_raise += len(excs)
+ if excs and len(self._oldest_exceptions) < self._exception_list_limit:
+ # populate oldest_exceptions with found_exceptions
+ addition_count = self._exception_list_limit - len(self._oldest_exceptions)
+ self._oldest_exceptions.extend(excs[:addition_count])
+ excs = excs[addition_count:]
+ if excs:
+ # populate newest_exceptions with remaining found_exceptions
+ self._newest_exceptions.extend(excs[-self._exception_list_limit :])
+
+ def _raise_exceptions(self):
+ """
+ Raise any unreported exceptions from background flush operations
+
+ Raises:
+ MutationsExceptionGroup: exception group with all unreported exceptions
+ """
+ if self._oldest_exceptions or self._newest_exceptions:
+ oldest, self._oldest_exceptions = self._oldest_exceptions, []
+ newest = list(self._newest_exceptions)
+ self._newest_exceptions.clear()
+ entry_count, self._entries_processed_since_last_raise = (
+ self._entries_processed_since_last_raise,
+ 0,
+ )
+ exc_count, self._exceptions_since_last_raise = (
+ self._exceptions_since_last_raise,
+ 0,
+ )
+ raise MutationsExceptionGroup.from_truncated_lists(
+ first_list=oldest,
+ last_list=newest,
+ total_excs=exc_count,
+ entry_count=entry_count,
+ )
+
+ @CrossSync.convert(sync_name="__enter__")
+ async def __aenter__(self):
+ """Allow use of context manager API"""
+ return self
+
+ @CrossSync.convert(sync_name="__exit__")
+ async def __aexit__(self, exc_type, exc, tb):
+ """
+ Allow use of context manager API.
+
+ Flushes the batcher and cleans up resources.
+ """
+ await self.close()
+
+ @property
+ def closed(self) -> bool:
+ """
+ Returns:
+ - True if the batcher is closed, False otherwise
+ """
+ return self._closed.is_set()
+
+ @CrossSync.convert
+ async def close(self):
+ """
+ Flush queue and clean up resources
+ """
+ self._closed.set()
+ self._flush_timer.cancel()
+ self._schedule_flush()
+ # shut down executors
+ if self._sync_flush_executor:
+ with self._sync_flush_executor:
+ self._sync_flush_executor.shutdown(wait=True)
+ if self._sync_rpc_executor:
+ with self._sync_rpc_executor:
+ self._sync_rpc_executor.shutdown(wait=True)
+ await CrossSync.wait([*self._flush_jobs, self._flush_timer])
+ atexit.unregister(self._on_exit)
+ # raise unreported exceptions
+ self._raise_exceptions()
+
+ def _on_exit(self):
+ """
+ Called when program is exited. Raises warning if unflushed mutations remain
+ """
+ if not self._closed.is_set() and self._staged_entries:
+ warnings.warn(
+ f"MutationsBatcher for target {self._target!r} was not closed. "
+ f"{len(self._staged_entries)} Unflushed mutations will not be sent to the server."
+ )
+
+ @staticmethod
+ @CrossSync.convert
+ async def _wait_for_batch_results(
+ *tasks: CrossSync.Future[list[FailedMutationEntryError]]
+ | CrossSync.Future[None],
+ ) -> list[Exception]:
+ """
+ Takes in a list of futures representing _execute_mutate_rows tasks,
+ waits for them to complete, and returns a list of errors encountered.
+
+ Args:
+ *tasks: futures representing _execute_mutate_rows or _flush_internal tasks
+ Returns:
+ list[Exception]:
+ list of Exceptions encountered by any of the tasks. Errors are expected
+ to be FailedMutationEntryError, representing a failed mutation operation.
+ If a task fails with a different exception, it will be included in the
+ output list. Successful tasks will not be represented in the output list.
+ """
+ if not tasks:
+ return []
+ exceptions: list[Exception] = []
+ for task in tasks:
+ if CrossSync.is_async:
+ # futures don't need to be awaited in sync mode
+ await task
+ try:
+ exc_list = task.result()
+ if exc_list:
+ # expect a list of FailedMutationEntryError objects
+ for exc in exc_list:
+ # strip index information
+ exc.index = None
+ exceptions.extend(exc_list)
+ except Exception as e:
+ exceptions.append(e)
+ return exceptions
diff --git a/google/__init__.py b/google/cloud/bigtable/data/_cross_sync/__init__.py
similarity index 69%
rename from google/__init__.py
rename to google/cloud/bigtable/data/_cross_sync/__init__.py
index abc370893..77a9ddae9 100644
--- a/google/__init__.py
+++ b/google/cloud/bigtable/data/_cross_sync/__init__.py
@@ -1,4 +1,4 @@
-# Copyright 2015 Google LLC
+# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -12,14 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-"""Google Cloud Bigtable API package."""
+from .cross_sync import CrossSync
-try:
- import pkg_resources
-
- pkg_resources.declare_namespace(__name__)
-except ImportError:
- import pkgutil
-
- __path__ = pkgutil.extend_path(__path__, __name__)
+__all__ = [
+ "CrossSync",
+]
diff --git a/google/cloud/bigtable/data/_cross_sync/_decorators.py b/google/cloud/bigtable/data/_cross_sync/_decorators.py
new file mode 100644
index 000000000..a0dd140dd
--- /dev/null
+++ b/google/cloud/bigtable/data/_cross_sync/_decorators.py
@@ -0,0 +1,448 @@
+# Copyright 2024 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+"""
+Contains a set of AstDecorator classes, which define the behavior of CrossSync decorators.
+Each AstDecorator class is used through @CrossSync.
+"""
+from __future__ import annotations
+from typing import TYPE_CHECKING, Iterable
+
+if TYPE_CHECKING:
+ import ast
+ from typing import Callable, Any
+
+
+class AstDecorator:
+ """
+ Helper class for CrossSync decorators used for guiding ast transformations.
+
+ AstDecorators are accessed in two ways:
+ 1. The decorations are used directly as method decorations in the async client,
+ wrapping existing classes and methods
+ 2. The decorations are read back when processing the AST transformations when
+ generating sync code.
+
+ This class allows the same decorator to be used in both contexts.
+
+ Typically, AstDecorators act as a no-op in async code, and the arguments simply
+ provide configuration guidance for the sync code generation.
+ """
+
+ @classmethod
+ def decorator(cls, *args, **kwargs) -> Callable[..., Any]:
+ """
+ Provides a callable that can be used as a decorator function in async code
+
+ AstDecorator.decorate is called by CrossSync when attaching decorators to
+ the CrossSync class.
+
+ This method creates a new instance of the class, using the arguments provided
+ to the decorator, and defers to the async_decorator method of the instance
+ to build the wrapper function.
+
+ Arguments:
+ *args: arguments to the decorator
+ **kwargs: keyword arguments to the decorator
+ """
+ # decorators with no arguments will provide the function to be wrapped
+ # as the first argument. Pull it out if it exists
+ func = None
+ if len(args) == 1 and callable(args[0]):
+ func = args[0]
+ args = args[1:]
+ # create new AstDecorator instance from given decorator arguments
+ new_instance = cls(*args, **kwargs)
+ # build wrapper
+ wrapper = new_instance.async_decorator()
+ if wrapper is None:
+ # if no wrapper, return no-op decorator
+ return func or (lambda f: f)
+ elif func:
+ # if we can, return single wrapped function
+ return wrapper(func)
+ else:
+ # otherwise, return decorator function
+ return wrapper
+
+ def async_decorator(self) -> Callable[..., Any] | None:
+ """
+ Decorator to apply the async_impl decorator to the wrapped function
+
+ Default implementation is a no-op
+ """
+ return None
+
+ def sync_ast_transform(
+ self, wrapped_node: ast.AST, transformers_globals: dict[str, Any]
+ ) -> ast.AST | None:
+ """
+ When this decorator is encountered in the ast during sync generation, this method is called
+ to transform the wrapped node.
+
+ If None is returned, the node will be dropped from the output file.
+
+ Args:
+ wrapped_node: ast node representing the wrapped function or class that is being wrapped
+ transformers_globals: the set of globals() from the transformers module. This is used to access
+ ast transformer classes that live outside the main codebase
+ Returns:
+ transformed ast node, or None if the node should be dropped
+ """
+ return wrapped_node
+
+ @classmethod
+ def get_for_node(cls, node: ast.Call | ast.Attribute | ast.Name) -> "AstDecorator":
+ """
+ Build an AstDecorator instance from an ast decorator node
+
+ The right subclass is found by comparing the string representation of the
+ decorator name to the class name. (Both names are converted to lowercase and
+ underscores are removed for comparison). If a matching subclass is found,
+ a new instance is created with the provided arguments.
+
+ Args:
+ node: ast.Call node representing the decorator
+ Returns:
+ AstDecorator instance corresponding to the decorator
+ Raises:
+ ValueError: if the decorator cannot be parsed
+ """
+ import ast
+
+ # expect decorators in format @CrossSync.
+ # (i.e. should be an ast.Call or an ast.Attribute)
+ root_attr = node.func if isinstance(node, ast.Call) else node
+ if not isinstance(root_attr, ast.Attribute):
+ raise ValueError("Unexpected decorator format")
+ # extract the module and decorator names
+ if "CrossSync" in ast.dump(root_attr):
+ decorator_name = root_attr.attr
+ got_kwargs: dict[str, Any] = (
+ {str(kw.arg): cls._convert_ast_to_py(kw.value) for kw in node.keywords}
+ if hasattr(node, "keywords")
+ else {}
+ )
+ got_args = (
+ [cls._convert_ast_to_py(arg) for arg in node.args]
+ if hasattr(node, "args")
+ else []
+ )
+ # convert to standardized representation
+ formatted_name = decorator_name.replace("_", "").lower()
+ for subclass in cls.get_subclasses():
+ if subclass.__name__.lower() == formatted_name:
+ return subclass(*got_args, **got_kwargs)
+ raise ValueError(f"Unknown decorator encountered: {decorator_name}")
+ else:
+ raise ValueError("Not a CrossSync decorator")
+
+ @classmethod
+ def get_subclasses(cls) -> Iterable[type["AstDecorator"]]:
+ """
+ Get all subclasses of AstDecorator
+
+ Returns:
+ list of all subclasses of AstDecorator
+ """
+ for subclass in cls.__subclasses__():
+ yield from subclass.get_subclasses()
+ yield subclass
+
+ @classmethod
+ def _convert_ast_to_py(cls, ast_node: ast.expr | None) -> Any:
+ """
+ Helper to convert ast primitives to python primitives. Used when unwrapping arguments
+ """
+ import ast
+
+ if ast_node is None:
+ return None
+ if isinstance(ast_node, ast.Constant):
+ return ast_node.value
+ if isinstance(ast_node, ast.List):
+ return [cls._convert_ast_to_py(node) for node in ast_node.elts]
+ if isinstance(ast_node, ast.Tuple):
+ return tuple(cls._convert_ast_to_py(node) for node in ast_node.elts)
+ if isinstance(ast_node, ast.Dict):
+ return {
+ cls._convert_ast_to_py(k): cls._convert_ast_to_py(v)
+ for k, v in zip(ast_node.keys, ast_node.values)
+ }
+ # unsupported node type
+ return ast_node
+
+
+class ConvertClass(AstDecorator):
+ """
+ Class decorator for guiding generation of sync classes
+
+ Args:
+ sync_name: use a new name for the sync class
+ replace_symbols: a dict of symbols and replacements to use when generating sync class
+ docstring_format_vars: a dict of variables to replace in the docstring
+ rm_aio: if True, automatically strip all asyncio keywords from method. If false,
+ only keywords wrapped in CrossSync.rm_aio() calls to be removed.
+ add_mapping_for_name: when given, will add a new attribute to CrossSync,
+ so the original class and its sync version can be accessed from CrossSync.
+ """
+
+ def __init__(
+ self,
+ sync_name: str | None = None,
+ *,
+ replace_symbols: dict[str, str] | None = None,
+ docstring_format_vars: dict[str, tuple[str | None, str | None]] | None = None,
+ rm_aio: bool = False,
+ add_mapping_for_name: str | None = None,
+ ):
+ self.sync_name = sync_name
+ self.replace_symbols = replace_symbols
+ docstring_format_vars = docstring_format_vars or {}
+ self.async_docstring_format_vars = {
+ k: v[0] or "" for k, v in docstring_format_vars.items()
+ }
+ self.sync_docstring_format_vars = {
+ k: v[1] or "" for k, v in docstring_format_vars.items()
+ }
+ self.rm_aio = rm_aio
+ self.add_mapping_for_name = add_mapping_for_name
+
+ def async_decorator(self):
+ """
+ Use async decorator as a hook to update CrossSync mappings
+ """
+ from .cross_sync import CrossSync
+
+ if not self.add_mapping_for_name and not self.async_docstring_format_vars:
+ # return None if no changes needed
+ return None
+
+ new_mapping = self.add_mapping_for_name
+
+ def decorator(cls):
+ if new_mapping:
+ CrossSync.add_mapping(new_mapping, cls)
+ if self.async_docstring_format_vars:
+ cls.__doc__ = cls.__doc__.format(**self.async_docstring_format_vars)
+ return cls
+
+ return decorator
+
+ def sync_ast_transform(self, wrapped_node, transformers_globals):
+ """
+ Transform async class into sync copy
+ """
+ import ast
+ import copy
+
+ # copy wrapped node
+ wrapped_node = copy.deepcopy(wrapped_node)
+ # update name
+ if self.sync_name:
+ wrapped_node.name = self.sync_name
+ # strip CrossSync decorators
+ if hasattr(wrapped_node, "decorator_list"):
+ wrapped_node.decorator_list = [
+ d for d in wrapped_node.decorator_list if "CrossSync" not in ast.dump(d)
+ ]
+ else:
+ wrapped_node.decorator_list = []
+ # strip async keywords if specified
+ if self.rm_aio:
+ wrapped_node = transformers_globals["AsyncToSync"]().visit(wrapped_node)
+ # add mapping decorator if needed
+ if self.add_mapping_for_name:
+ wrapped_node.decorator_list.append(
+ ast.Call(
+ func=ast.Attribute(
+ value=ast.Name(id="CrossSync", ctx=ast.Load()),
+ attr="add_mapping_decorator",
+ ctx=ast.Load(),
+ ),
+ args=[
+ ast.Constant(value=self.add_mapping_for_name),
+ ],
+ keywords=[],
+ )
+ )
+ # replace symbols if specified
+ if self.replace_symbols:
+ wrapped_node = transformers_globals["SymbolReplacer"](
+ self.replace_symbols
+ ).visit(wrapped_node)
+ # update docstring if specified
+ if self.sync_docstring_format_vars:
+ docstring = ast.get_docstring(wrapped_node)
+ if docstring:
+ wrapped_node.body[0].value = ast.Constant(
+ value=docstring.format(**self.sync_docstring_format_vars)
+ )
+ return wrapped_node
+
+
+class Convert(ConvertClass):
+ """
+ Method decorator to mark async methods to be converted to sync methods
+
+ Args:
+ sync_name: use a new name for the sync method
+ replace_symbols: a dict of symbols and replacements to use when generating sync method
+ docstring_format_vars: a dict of variables to replace in the docstring
+ rm_aio: if True, automatically strip all asyncio keywords from method. If False,
+ only the signature `async def` is stripped. Other keywords must be wrapped in
+ CrossSync.rm_aio() calls to be removed.
+ """
+
+ def __init__(
+ self,
+ sync_name: str | None = None,
+ *,
+ replace_symbols: dict[str, str] | None = None,
+ docstring_format_vars: dict[str, tuple[str | None, str | None]] | None = None,
+ rm_aio: bool = True,
+ ):
+ super().__init__(
+ sync_name=sync_name,
+ replace_symbols=replace_symbols,
+ docstring_format_vars=docstring_format_vars,
+ rm_aio=rm_aio,
+ add_mapping_for_name=None,
+ )
+
+ def sync_ast_transform(self, wrapped_node, transformers_globals):
+ """
+ Transform async method into sync
+ """
+ import ast
+
+ # replace async function with sync function
+ converted = ast.copy_location(
+ ast.FunctionDef(
+ wrapped_node.name,
+ wrapped_node.args,
+ wrapped_node.body,
+ wrapped_node.decorator_list
+ if hasattr(wrapped_node, "decorator_list")
+ else [],
+ wrapped_node.returns if hasattr(wrapped_node, "returns") else None,
+ ),
+ wrapped_node,
+ )
+ # transform based on arguments
+ return super().sync_ast_transform(converted, transformers_globals)
+
+
+class Drop(AstDecorator):
+ """
+ Method decorator to drop methods or classes from the sync output
+ """
+
+ def sync_ast_transform(self, wrapped_node, transformers_globals):
+ """
+ Drop from sync output
+ """
+ return None
+
+
+class Pytest(AstDecorator):
+ """
+ Used in place of pytest.mark.asyncio to mark tests
+
+ When generating sync version, also runs rm_aio to remove async keywords from
+ entire test function
+
+ Args:
+ rm_aio: if True, automatically strip all asyncio keywords from test code.
+ Defaults to True, to simplify test code generation.
+ """
+
+ def __init__(self, rm_aio=True):
+ self.rm_aio = rm_aio
+
+ def async_decorator(self):
+ import pytest
+
+ return pytest.mark.asyncio
+
+ def sync_ast_transform(self, wrapped_node, transformers_globals):
+ """
+ convert async to sync
+ """
+ import ast
+
+ # always convert method to sync
+ converted = ast.copy_location(
+ ast.FunctionDef(
+ wrapped_node.name,
+ wrapped_node.args,
+ wrapped_node.body,
+ wrapped_node.decorator_list
+ if hasattr(wrapped_node, "decorator_list")
+ else [],
+ wrapped_node.returns if hasattr(wrapped_node, "returns") else None,
+ ),
+ wrapped_node,
+ )
+ # convert entire body to sync if rm_aio is set
+ if self.rm_aio:
+ converted = transformers_globals["AsyncToSync"]().visit(converted)
+ return converted
+
+
+class PytestFixture(AstDecorator):
+ """
+ Used in place of pytest.fixture or pytest.mark.asyncio to mark fixtures
+
+ Args:
+ *args: all arguments to pass to pytest.fixture
+ **kwargs: all keyword arguments to pass to pytest.fixture
+ """
+
+ def __init__(self, *args, **kwargs):
+ self._args = args
+ self._kwargs = kwargs
+
+ def async_decorator(self):
+ import pytest_asyncio # type: ignore
+
+ return lambda f: pytest_asyncio.fixture(*self._args, **self._kwargs)(f)
+
+ def sync_ast_transform(self, wrapped_node, transformers_globals):
+ import ast
+ import copy
+
+ arg_nodes = [
+ a if isinstance(a, ast.expr) else ast.Constant(value=a) for a in self._args
+ ]
+ kwarg_nodes = []
+ for k, v in self._kwargs.items():
+ if not isinstance(v, ast.expr):
+ v = ast.Constant(value=v)
+ kwarg_nodes.append(ast.keyword(arg=k, value=v))
+
+ new_node = copy.deepcopy(wrapped_node)
+ if not hasattr(new_node, "decorator_list"):
+ new_node.decorator_list = []
+ new_node.decorator_list.append(
+ ast.Call(
+ func=ast.Attribute(
+ value=ast.Name(id="pytest", ctx=ast.Load()),
+ attr="fixture",
+ ctx=ast.Load(),
+ ),
+ args=arg_nodes,
+ keywords=kwarg_nodes,
+ )
+ )
+ return new_node
diff --git a/google/cloud/bigtable/data/_cross_sync/_mapping_meta.py b/google/cloud/bigtable/data/_cross_sync/_mapping_meta.py
new file mode 100644
index 000000000..5312708cc
--- /dev/null
+++ b/google/cloud/bigtable/data/_cross_sync/_mapping_meta.py
@@ -0,0 +1,64 @@
+# Copyright 2024 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+from __future__ import annotations
+from typing import Any
+
+
+class MappingMeta(type):
+ """
+ Metaclass to provide add_mapping functionality, allowing users to add
+ custom attributes to derived classes at runtime.
+
+ Using a metaclass allows us to share functionality between CrossSync
+ and CrossSync._Sync_Impl, and it works better with mypy checks than
+ monkypatching
+ """
+
+ # list of attributes that can be added to the derived class at runtime
+ _runtime_replacements: dict[tuple[MappingMeta, str], Any] = {}
+
+ def add_mapping(cls: MappingMeta, name: str, value: Any):
+ """
+ Add a new attribute to the class, for replacing library-level symbols
+
+ Raises:
+ - AttributeError if the attribute already exists with a different value
+ """
+ key = (cls, name)
+ old_value = cls._runtime_replacements.get(key)
+ if old_value is None:
+ cls._runtime_replacements[key] = value
+ elif old_value != value:
+ raise AttributeError(f"Conflicting assignments for CrossSync.{name}")
+
+ def add_mapping_decorator(cls: MappingMeta, name: str):
+ """
+ Exposes add_mapping as a class decorator
+ """
+
+ def decorator(wrapped_cls):
+ cls.add_mapping(name, wrapped_cls)
+ return wrapped_cls
+
+ return decorator
+
+ def __getattr__(cls: MappingMeta, name: str):
+ """
+ Retrieve custom attributes
+ """
+ key = (cls, name)
+ found = cls._runtime_replacements.get(key)
+ if found is not None:
+ return found
+ raise AttributeError(f"CrossSync has no attribute {name}")
diff --git a/google/cloud/bigtable/data/_cross_sync/cross_sync.py b/google/cloud/bigtable/data/_cross_sync/cross_sync.py
new file mode 100644
index 000000000..1f1ee111a
--- /dev/null
+++ b/google/cloud/bigtable/data/_cross_sync/cross_sync.py
@@ -0,0 +1,334 @@
+# Copyright 2024 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+"""
+CrossSync provides a toolset for sharing logic between async and sync codebases, including:
+- A set of decorators for annotating async classes and functions
+ (@CrossSync.export_sync, @CrossSync.convert, @CrossSync.drop_method, ...)
+- A set of wrappers to wrap common objects and types that have corresponding async and sync implementations
+ (CrossSync.Queue, CrossSync.Condition, CrossSync.Future, ...)
+- A set of function implementations for common async operations that can be used in both async and sync codebases
+ (CrossSync.gather_partials, CrossSync.wait, CrossSync.condition_wait, ...)
+- CrossSync.rm_aio(), which is used to annotate regions of the code containing async keywords to strip
+
+A separate module will use CrossSync annotations to generate a corresponding sync
+class based on a decorated async class.
+
+Usage Example:
+```python
+@CrossSync.export_sync(path="path/to/sync_module.py")
+
+ @CrossSync.convert
+ async def async_func(self, arg: int) -> int:
+ await CrossSync.sleep(1)
+ return arg
+```
+"""
+
+from __future__ import annotations
+
+from typing import (
+ TypeVar,
+ Any,
+ Callable,
+ Coroutine,
+ Sequence,
+ Union,
+ AsyncIterable,
+ AsyncIterator,
+ AsyncGenerator,
+ TYPE_CHECKING,
+)
+import typing
+
+import asyncio
+import sys
+import concurrent.futures
+import google.api_core.retry as retries
+import queue
+import threading
+import time
+from ._decorators import (
+ ConvertClass,
+ Convert,
+ Drop,
+ Pytest,
+ PytestFixture,
+)
+from ._mapping_meta import MappingMeta
+
+if TYPE_CHECKING:
+ from typing_extensions import TypeAlias
+
+T = TypeVar("T")
+
+
+class CrossSync(metaclass=MappingMeta):
+ # support CrossSync.is_async to check if the current environment is async
+ is_async = True
+
+ # provide aliases for common async functions and types
+ sleep = asyncio.sleep
+ retry_target = retries.retry_target_async
+ retry_target_stream = retries.retry_target_stream_async
+ Retry = retries.AsyncRetry
+ Queue: TypeAlias = asyncio.Queue
+ Condition: TypeAlias = asyncio.Condition
+ Future: TypeAlias = asyncio.Future
+ Task: TypeAlias = asyncio.Task
+ Event: TypeAlias = asyncio.Event
+ Semaphore: TypeAlias = asyncio.Semaphore
+ StopIteration: TypeAlias = StopAsyncIteration
+ # provide aliases for common async type annotations
+ Awaitable: TypeAlias = typing.Awaitable
+ Iterable: TypeAlias = AsyncIterable
+ Iterator: TypeAlias = AsyncIterator
+ Generator: TypeAlias = AsyncGenerator
+
+ # decorators
+ convert_class = ConvertClass.decorator # decorate classes to convert
+ convert = Convert.decorator # decorate methods to convert from async to sync
+ drop = Drop.decorator # decorate methods to remove from sync version
+ pytest = Pytest.decorator # decorate test methods to run with pytest-asyncio
+ pytest_fixture = (
+ PytestFixture.decorator
+ ) # decorate test methods to run with pytest fixture
+
+ @classmethod
+ def next(cls, iterable):
+ return iterable.__anext__()
+
+ @classmethod
+ def Mock(cls, *args, **kwargs):
+ """
+ Alias for AsyncMock, importing at runtime to avoid hard dependency on mock
+ """
+ try:
+ from unittest.mock import AsyncMock # type: ignore
+ except ImportError: # pragma: NO COVER
+ from mock import AsyncMock # type: ignore
+ return AsyncMock(*args, **kwargs)
+
+ @staticmethod
+ async def gather_partials(
+ partial_list: Sequence[Callable[[], Awaitable[T]]],
+ return_exceptions: bool = False,
+ sync_executor: concurrent.futures.ThreadPoolExecutor | None = None,
+ ) -> list[T | BaseException]:
+ """
+ abstraction over asyncio.gather, but with a set of partial functions instead
+ of coroutines, to work with sync functions.
+ To use gather with a set of futures instead of partials, use CrpssSync.wait
+
+ In the async version, the partials are expected to return an awaitable object. Patials
+ are unpacked and awaited in the gather call.
+
+ Sync version implemented with threadpool executor
+
+ Returns:
+ - a list of results (or exceptions, if return_exceptions=True) in the same order as partial_list
+ """
+ if not partial_list:
+ return []
+ awaitable_list = [partial() for partial in partial_list]
+ return await asyncio.gather(
+ *awaitable_list, return_exceptions=return_exceptions
+ )
+
+ @staticmethod
+ async def wait(
+ futures: Sequence[CrossSync.Future[T]], timeout: float | None = None
+ ) -> tuple[set[CrossSync.Future[T]], set[CrossSync.Future[T]]]:
+ """
+ abstraction over asyncio.wait
+
+ Return:
+ - a tuple of (done, pending) sets of futures
+ """
+ if not futures:
+ return set(), set()
+ return await asyncio.wait(futures, timeout=timeout)
+
+ @staticmethod
+ async def event_wait(
+ event: CrossSync.Event,
+ timeout: float | None = None,
+ async_break_early: bool = True,
+ ) -> None:
+ """
+ abstraction over asyncio.Event.wait
+
+ Args:
+ - event: event to wait for
+ - timeout: if set, will break out early after `timeout` seconds
+ - async_break_early: if False, the async version will wait for
+ the full timeout even if the event is set before the timeout.
+ This avoids creating a new background task
+ """
+ if timeout is None:
+ await event.wait()
+ elif not async_break_early:
+ if not event.is_set():
+ await asyncio.sleep(timeout)
+ else:
+ try:
+ await asyncio.wait_for(event.wait(), timeout=timeout)
+ except asyncio.TimeoutError:
+ pass
+
+ @staticmethod
+ def create_task(
+ fn: Callable[..., Coroutine[Any, Any, T]],
+ *fn_args,
+ sync_executor: concurrent.futures.ThreadPoolExecutor | None = None,
+ task_name: str | None = None,
+ **fn_kwargs,
+ ) -> CrossSync.Task[T]:
+ """
+ abstraction over asyncio.create_task. Sync version implemented with threadpool executor
+
+ sync_executor: ThreadPoolExecutor to use for sync operations. Ignored in async version
+ """
+ task: CrossSync.Task[T] = asyncio.create_task(fn(*fn_args, **fn_kwargs))
+ if task_name and sys.version_info >= (3, 8):
+ task.set_name(task_name)
+ return task
+
+ @staticmethod
+ async def yield_to_event_loop() -> None:
+ """
+ Call asyncio.sleep(0) to yield to allow other tasks to run
+ """
+ await asyncio.sleep(0)
+
+ @staticmethod
+ def verify_async_event_loop() -> None:
+ """
+ Raises RuntimeError if the event loop is not running
+ """
+ asyncio.get_running_loop()
+
+ @staticmethod
+ def rm_aio(statement: T) -> T:
+ """
+ Used to annotate regions of the code containing async keywords to strip
+
+ All async keywords inside an rm_aio call are removed, along with
+ `async with` and `async for` statements containing CrossSync.rm_aio() in the body
+ """
+ return statement
+
+ class _Sync_Impl(metaclass=MappingMeta):
+ """
+ Provide sync versions of the async functions and types in CrossSync
+ """
+
+ is_async = False
+
+ sleep = time.sleep
+ next = next
+ retry_target = retries.retry_target
+ retry_target_stream = retries.retry_target_stream
+ Retry = retries.Retry
+ Queue: TypeAlias = queue.Queue
+ Condition: TypeAlias = threading.Condition
+ Future: TypeAlias = concurrent.futures.Future
+ Task: TypeAlias = concurrent.futures.Future
+ Event: TypeAlias = threading.Event
+ Semaphore: TypeAlias = threading.Semaphore
+ StopIteration: TypeAlias = StopIteration
+ # type annotations
+ Awaitable: TypeAlias = Union[T]
+ Iterable: TypeAlias = typing.Iterable
+ Iterator: TypeAlias = typing.Iterator
+ Generator: TypeAlias = typing.Generator
+
+ @classmethod
+ def Mock(cls, *args, **kwargs):
+ from unittest.mock import Mock
+
+ return Mock(*args, **kwargs)
+
+ @staticmethod
+ def event_wait(
+ event: CrossSync._Sync_Impl.Event,
+ timeout: float | None = None,
+ async_break_early: bool = True,
+ ) -> None:
+ event.wait(timeout=timeout)
+
+ @staticmethod
+ def gather_partials(
+ partial_list: Sequence[Callable[[], T]],
+ return_exceptions: bool = False,
+ sync_executor: concurrent.futures.ThreadPoolExecutor | None = None,
+ ) -> list[T | BaseException]:
+ if not partial_list:
+ return []
+ if not sync_executor:
+ raise ValueError("sync_executor is required for sync version")
+ futures_list = [sync_executor.submit(partial) for partial in partial_list]
+ results_list: list[T | BaseException] = []
+ for future in futures_list:
+ found_exc = future.exception()
+ if found_exc is not None:
+ if return_exceptions:
+ results_list.append(found_exc)
+ else:
+ raise found_exc
+ else:
+ results_list.append(future.result())
+ return results_list
+
+ @staticmethod
+ def wait(
+ futures: Sequence[CrossSync._Sync_Impl.Future[T]],
+ timeout: float | None = None,
+ ) -> tuple[
+ set[CrossSync._Sync_Impl.Future[T]], set[CrossSync._Sync_Impl.Future[T]]
+ ]:
+ if not futures:
+ return set(), set()
+ return concurrent.futures.wait(futures, timeout=timeout)
+
+ @staticmethod
+ def create_task(
+ fn: Callable[..., T],
+ *fn_args,
+ sync_executor: concurrent.futures.ThreadPoolExecutor | None = None,
+ task_name: str | None = None,
+ **fn_kwargs,
+ ) -> CrossSync._Sync_Impl.Task[T]:
+ """
+ abstraction over asyncio.create_task. Sync version implemented with threadpool executor
+
+ sync_executor: ThreadPoolExecutor to use for sync operations. Ignored in async version
+ """
+ if not sync_executor:
+ raise ValueError("sync_executor is required for sync version")
+ return sync_executor.submit(fn, *fn_args, **fn_kwargs)
+
+ @staticmethod
+ def yield_to_event_loop() -> None:
+ """
+ No-op for sync version
+ """
+ pass
+
+ @staticmethod
+ def verify_async_event_loop() -> None:
+ """
+ No-op for sync version
+ """
+ pass
diff --git a/google/cloud/bigtable/data/_helpers.py b/google/cloud/bigtable/data/_helpers.py
new file mode 100644
index 000000000..e848ebc6f
--- /dev/null
+++ b/google/cloud/bigtable/data/_helpers.py
@@ -0,0 +1,309 @@
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+"""
+Helper functions used in various places in the library.
+"""
+from __future__ import annotations
+
+from typing import Sequence, List, Tuple, TYPE_CHECKING, Union
+import time
+import enum
+from collections import namedtuple
+from google.cloud.bigtable.data.read_rows_query import ReadRowsQuery
+
+from google.api_core import exceptions as core_exceptions
+from google.api_core.retry import exponential_sleep_generator
+from google.api_core.retry import RetryFailureReason
+from google.cloud.bigtable.data.exceptions import RetryExceptionGroup
+
+if TYPE_CHECKING:
+ import grpc
+ from google.cloud.bigtable.data._async.client import _DataApiTargetAsync
+ from google.cloud.bigtable.data._sync_autogen.client import _DataApiTarget
+
+"""
+Helper functions used in various places in the library.
+"""
+
+# Type alias for the output of sample_keys
+RowKeySamples = List[Tuple[bytes, int]]
+
+# type alias for the output of query.shard()
+ShardedQuery = List[ReadRowsQuery]
+
+# used by read_rows_sharded to limit how many requests are attempted in parallel
+_CONCURRENCY_LIMIT = 10
+
+# used to identify an active bigtable resource that needs to be warmed through PingAndWarm
+# each instance/app_profile_id pair needs to be individually tracked
+_WarmedInstanceKey = namedtuple(
+ "_WarmedInstanceKey", ["instance_name", "app_profile_id"]
+)
+
+
+# enum used on method calls when table defaults should be used
+class TABLE_DEFAULT(enum.Enum):
+ # default for mutate_row, sample_row_keys, check_and_mutate_row, and read_modify_write_row
+ DEFAULT = "DEFAULT"
+ # default for read_rows, read_rows_stream, read_rows_sharded, row_exists, and read_row
+ READ_ROWS = "READ_ROWS_DEFAULT"
+ # default for bulk_mutate_rows and mutations_batcher
+ MUTATE_ROWS = "MUTATE_ROWS_DEFAULT"
+
+
+def _attempt_timeout_generator(
+ per_request_timeout: float | None, operation_timeout: float
+):
+ """
+ Generator that yields the timeout value for each attempt of a retry loop.
+
+ Will return per_request_timeout until the operation_timeout is approached,
+ at which point it will return the remaining time in the operation_timeout.
+
+ Args:
+ per_request_timeout: The timeout value to use for each request, in seconds.
+ If None, the operation_timeout will be used for each request.
+ operation_timeout: The timeout value to use for the entire operationm in seconds.
+ Yields:
+ float: The timeout value to use for the next request, in seonds
+ """
+ per_request_timeout = (
+ per_request_timeout if per_request_timeout is not None else operation_timeout
+ )
+ deadline = operation_timeout + time.monotonic()
+ while True:
+ yield max(0, min(per_request_timeout, deadline - time.monotonic()))
+
+
+def _retry_exception_factory(
+ exc_list: list[Exception],
+ reason: RetryFailureReason,
+ timeout_val: float | None,
+) -> tuple[Exception, Exception | None]:
+ """
+ Build retry error based on exceptions encountered during operation
+
+ Args:
+ exc_list: list of exceptions encountered during operation
+ is_timeout: whether the operation failed due to timeout
+ timeout_val: the operation timeout value in seconds, for constructing
+ the error message
+ Returns:
+ tuple[Exception, Exception|None]:
+ tuple of the exception to raise, and a cause exception if applicable
+ """
+ if reason == RetryFailureReason.TIMEOUT:
+ timeout_val_str = f"of {timeout_val:0.1f}s " if timeout_val is not None else ""
+ # if failed due to timeout, raise deadline exceeded as primary exception
+ source_exc: Exception = core_exceptions.DeadlineExceeded(
+ f"operation_timeout{timeout_val_str} exceeded"
+ )
+ elif exc_list:
+ # otherwise, raise non-retryable error as primary exception
+ source_exc = exc_list.pop()
+ else:
+ source_exc = RuntimeError("failed with unspecified exception")
+ # use the retry exception group as the cause of the exception
+ cause_exc: Exception | None = RetryExceptionGroup(exc_list) if exc_list else None
+ source_exc.__cause__ = cause_exc
+ return source_exc, cause_exc
+
+
+def _get_timeouts(
+ operation: float | TABLE_DEFAULT,
+ attempt: float | None | TABLE_DEFAULT,
+ table: "_DataApiTargetAsync" | "_DataApiTarget",
+) -> tuple[float, float]:
+ """
+ Convert passed in timeout values to floats, using table defaults if necessary.
+
+ attempt will use operation value if None, or if larger than operation.
+
+ Will call _validate_timeouts on the outputs, and raise ValueError if the
+ resulting timeouts are invalid.
+
+ Args:
+ operation: The timeout value to use for the entire operation, in seconds.
+ attempt: The timeout value to use for each attempt, in seconds.
+ table: The table to use for default values.
+ Returns:
+ tuple[float, float]: A tuple of (operation_timeout, attempt_timeout)
+ """
+ # load table defaults if necessary
+ if operation == TABLE_DEFAULT.DEFAULT:
+ final_operation = table.default_operation_timeout
+ elif operation == TABLE_DEFAULT.READ_ROWS:
+ final_operation = table.default_read_rows_operation_timeout
+ elif operation == TABLE_DEFAULT.MUTATE_ROWS:
+ final_operation = table.default_mutate_rows_operation_timeout
+ else:
+ final_operation = operation
+ if attempt == TABLE_DEFAULT.DEFAULT:
+ attempt = table.default_attempt_timeout
+ elif attempt == TABLE_DEFAULT.READ_ROWS:
+ attempt = table.default_read_rows_attempt_timeout
+ elif attempt == TABLE_DEFAULT.MUTATE_ROWS:
+ attempt = table.default_mutate_rows_attempt_timeout
+
+ return _align_timeouts(final_operation, attempt)
+
+
+def _align_timeouts(operation: float, attempt: float | None) -> tuple[float, float]:
+ """
+ Convert passed in timeout values to floats.
+
+ attempt will use operation value if None, or if larger than operation.
+
+ Will call _validate_timeouts on the outputs, and raise ValueError if the
+ resulting timeouts are invalid.
+
+ Args:
+ operation: The timeout value to use for the entire operation, in seconds.
+ attempt: The timeout value to use for each attempt, in seconds.
+ Returns:
+ tuple[float, float]: A tuple of (operation_timeout, attempt_timeout)
+ """
+ if attempt is None:
+ # no timeout specified, use operation timeout for both
+ final_attempt = operation
+ else:
+ # cap attempt timeout at operation timeout
+ final_attempt = min(attempt, operation) if operation else attempt
+
+ _validate_timeouts(operation, final_attempt, allow_none=False)
+ return operation, final_attempt
+
+
+def _validate_timeouts(
+ operation_timeout: float, attempt_timeout: float | None, allow_none: bool = False
+):
+ """
+ Helper function that will verify that timeout values are valid, and raise
+ an exception if they are not.
+
+ Args:
+ operation_timeout: The timeout value to use for the entire operation, in seconds.
+ attempt_timeout: The timeout value to use for each attempt, in seconds.
+ allow_none: If True, attempt_timeout can be None. If False, None values will raise an exception.
+ Raises:
+ ValueError: if operation_timeout or attempt_timeout are invalid.
+ """
+ if operation_timeout is None:
+ raise ValueError("operation_timeout cannot be None")
+ if operation_timeout <= 0:
+ raise ValueError("operation_timeout must be greater than 0")
+ if not allow_none and attempt_timeout is None:
+ raise ValueError("attempt_timeout must not be None")
+ elif attempt_timeout is not None:
+ if attempt_timeout <= 0:
+ raise ValueError("attempt_timeout must be greater than 0")
+
+
+def _get_error_type(
+ call_code: Union["grpc.StatusCode", int, type[Exception]]
+) -> type[Exception]:
+ """Helper function for ensuring the object is an exception type.
+ If it is not, the proper GoogleAPICallError type is infered from the status
+ code.
+
+ Args:
+ - call_code: Exception type or gRPC status code.
+ """
+ if isinstance(call_code, type):
+ return call_code
+ else:
+ return type(core_exceptions.from_grpc_status(call_code, ""))
+
+
+def _get_retryable_errors(
+ call_codes: Sequence["grpc.StatusCode" | int | type[Exception]] | TABLE_DEFAULT,
+ table: "_DataApiTargetAsync" | "_DataApiTarget",
+) -> list[type[Exception]]:
+ """
+ Convert passed in retryable error codes to a list of exception types.
+
+ Args:
+ call_codes: The error codes to convert. Can be a list of grpc.StatusCode values,
+ int values, or Exception types, or a TABLE_DEFAULT value.
+ table: The table to use for default values.
+ Returns:
+ list[type[Exception]]: A list of exception types to retry on.
+ """
+ # load table defaults if necessary
+ if call_codes == TABLE_DEFAULT.DEFAULT:
+ call_codes = table.default_retryable_errors
+ elif call_codes == TABLE_DEFAULT.READ_ROWS:
+ call_codes = table.default_read_rows_retryable_errors
+ elif call_codes == TABLE_DEFAULT.MUTATE_ROWS:
+ call_codes = table.default_mutate_rows_retryable_errors
+
+ return [_get_error_type(e) for e in call_codes]
+
+
+class TrackedBackoffGenerator:
+ """
+ Generator class for exponential backoff sleep times.
+ This implementation builds on top of api_core.retries.exponential_sleep_generator,
+ adding the ability to retrieve previous values using get_attempt_backoff(idx).
+ This is used by the Metrics class to track the sleep times used for each attempt.
+ """
+
+ def __init__(self, initial=0.01, maximum=60, multiplier=2):
+ self.history = []
+ self.subgenerator = exponential_sleep_generator(
+ initial=initial, maximum=maximum, multiplier=multiplier
+ )
+ self._next_override: float | None = None
+
+ def __iter__(self):
+ return self
+
+ def set_next(self, next_value: float):
+ """
+ Set the next backoff value, instead of generating one from subgenerator.
+ After the value is yielded, it will go back to using self.subgenerator.
+
+ If set_next is called twice before the next() is called, only the latest
+ value will be used and others discarded
+
+ Args:
+ next_value: the upcomming value to yield when next() is called
+ Raises:
+ ValueError: if next_value is negative
+ """
+ if next_value < 0:
+ raise ValueError("backoff value cannot be less than 0")
+ self._next_override = next_value
+
+ def __next__(self) -> float:
+ if self._next_override is not None:
+ next_backoff = self._next_override
+ self._next_override = None
+ else:
+ next_backoff = next(self.subgenerator)
+ self.history.append(next_backoff)
+ return next_backoff
+
+ def get_attempt_backoff(self, attempt_idx) -> float:
+ """
+ returns the backoff time for a specific attempt index, starting at 0.
+
+ Args:
+ attempt_idx: the index of the attempt to return backoff for
+ Raises:
+ IndexError: if attempt_idx is negative, or not in history
+ """
+ if attempt_idx < 0:
+ raise IndexError("received negative attempt number")
+ return self.history[attempt_idx]
diff --git a/google/cloud/bigtable/data/_metrics/__init__.py b/google/cloud/bigtable/data/_metrics/__init__.py
new file mode 100644
index 000000000..26cfc1326
--- /dev/null
+++ b/google/cloud/bigtable/data/_metrics/__init__.py
@@ -0,0 +1,35 @@
+# Copyright 2023 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 google.cloud.bigtable.data._metrics.metrics_controller import (
+ BigtableClientSideMetricsController,
+)
+
+from google.cloud.bigtable.data._metrics.data_model import ActiveOperationMetric
+from google.cloud.bigtable.data._metrics.data_model import ActiveAttemptMetric
+from google.cloud.bigtable.data._metrics.data_model import CompletedOperationMetric
+from google.cloud.bigtable.data._metrics.data_model import CompletedAttemptMetric
+from google.cloud.bigtable.data._metrics.data_model import OperationState
+from google.cloud.bigtable.data._metrics.data_model import OperationType
+from google.cloud.bigtable.data._metrics.tracked_retry import tracked_retry
+
+__all__ = (
+ "BigtableClientSideMetricsController",
+ "OperationType",
+ "OperationState",
+ "ActiveOperationMetric",
+ "ActiveAttemptMetric",
+ "CompletedOperationMetric",
+ "CompletedAttemptMetric",
+ "tracked_retry",
+)
diff --git a/google/cloud/bigtable/data/_metrics/data_model.py b/google/cloud/bigtable/data/_metrics/data_model.py
new file mode 100644
index 000000000..64dd63bfa
--- /dev/null
+++ b/google/cloud/bigtable/data/_metrics/data_model.py
@@ -0,0 +1,469 @@
+# Copyright 2023 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 annotations
+
+from typing import ClassVar, Tuple, cast, TYPE_CHECKING
+
+import time
+import re
+import logging
+import contextvars
+
+from enum import Enum
+from functools import lru_cache
+from dataclasses import dataclass
+from dataclasses import field
+from grpc import StatusCode
+from grpc import RpcError
+from grpc.aio import AioRpcError
+
+import google.cloud.bigtable.data.exceptions as bt_exceptions
+from google.cloud.bigtable_v2.types.response_params import ResponseParams
+from google.cloud.bigtable.data._helpers import TrackedBackoffGenerator
+from google.protobuf.message import DecodeError
+
+if TYPE_CHECKING:
+ from google.cloud.bigtable.data._metrics.handlers._base import MetricsHandler
+
+
+LOGGER = logging.getLogger(__name__)
+
+# default values for zone and cluster data, if not captured
+DEFAULT_ZONE = "global"
+DEFAULT_CLUSTER_ID = ""
+
+# keys for parsing metadata blobs
+BIGTABLE_LOCATION_METADATA_KEY = "x-goog-ext-425905942-bin"
+SERVER_TIMING_METADATA_KEY = "server-timing"
+SERVER_TIMING_REGEX = re.compile(r".*gfet4t7;\s*dur=(\d+\.?\d*).*")
+
+INVALID_STATE_ERROR = "Invalid state for {}: {}"
+
+
+class OperationType(Enum):
+ """Enum for the type of operation being performed."""
+
+ READ_ROWS = "ReadRows"
+ SAMPLE_ROW_KEYS = "SampleRowKeys"
+ BULK_MUTATE_ROWS = "MutateRows"
+ MUTATE_ROW = "MutateRow"
+ CHECK_AND_MUTATE = "CheckAndMutateRow"
+ READ_MODIFY_WRITE = "ReadModifyWriteRow"
+
+
+class OperationState(Enum):
+ """Enum for the state of the active operation.
+
+ ┌───────────┐
+ │ CREATED │────────┐
+ └─────┬─────┘ │
+ │ │
+ ▼ │
+ ┌▶ ACTIVE_ATTEMPT ───┐│
+ │ │ ││
+ │ ▼ ││
+ └─ BETWEEN_ATTEMPTS ││
+ │ ││
+ ▼ ││
+ ┌───────────┐ ││
+ │ COMPLETED │ ◀─────┘│
+ └───────────┘ ◀──────┘
+ """
+
+ CREATED = 0
+ ACTIVE_ATTEMPT = 1
+ BETWEEN_ATTEMPTS = 2
+ COMPLETED = 3
+
+
+@dataclass(frozen=True)
+class CompletedAttemptMetric:
+ """
+ An immutable dataclass representing the data associated with a
+ completed rpc attempt.
+
+ Operation-level fields (eg. type, cluster, zone) are stored on the
+ corresponding CompletedOperationMetric or ActiveOperationMetric object.
+ """
+
+ duration_ns: int
+ end_status: StatusCode
+ gfe_latency_ns: int | None = None
+ application_blocking_time_ns: int = 0
+ backoff_before_attempt_ns: int = 0
+
+
+@dataclass(frozen=True)
+class CompletedOperationMetric:
+ """
+ An immutable dataclass representing the data associated with a
+ completed rpc operation.
+
+ Attempt-level fields (eg. duration, latencies, etc) are stored on the
+ corresponding CompletedAttemptMetric object.
+ """
+
+ op_type: OperationType
+ duration_ns: int
+ completed_attempts: list[CompletedAttemptMetric]
+ final_status: StatusCode
+ cluster_id: str
+ zone: str
+ is_streaming: bool
+ first_response_latency_ns: int | None = None
+ flow_throttling_time_ns: int = 0
+
+
+@dataclass
+class ActiveAttemptMetric:
+ """
+ A dataclass representing the data associated with an rpc attempt that is
+ currently in progress. Fields are mutable and may be optional.
+ """
+
+ # keep monotonic timestamps for active attempts
+ start_time_ns: int = field(default_factory=lambda: time.monotonic_ns())
+ # the time taken by the backend, in nanoseconds. Taken from response header
+ gfe_latency_ns: int | None = None
+ # time waiting on user to process the response, in nanoseconds
+ # currently only relevant for ReadRows
+ application_blocking_time_ns: int = 0
+ # backoff time is added to application_blocking_time_ns
+ backoff_before_attempt_ns: int = 0
+
+
+@dataclass
+class ActiveOperationMetric:
+ """
+ A dataclass representing the data associated with an rpc operation that is
+ currently in progress. Fields are mutable and may be optional.
+ """
+
+ op_type: OperationType
+ state: OperationState = OperationState.CREATED
+ # create a default backoff generator, initialized with standard default backoff values
+ backoff_generator: TrackedBackoffGenerator = field(
+ default_factory=lambda: TrackedBackoffGenerator(
+ initial=0.01, maximum=60, multiplier=2
+ )
+ )
+ # keep monotonic timestamps for active operations
+ start_time_ns: int = field(default_factory=lambda: time.monotonic_ns())
+ active_attempt: ActiveAttemptMetric | None = None
+ cluster_id: str | None = None
+ zone: str | None = None
+ completed_attempts: list[CompletedAttemptMetric] = field(default_factory=list)
+ is_streaming: bool = False # only True for read_rows operations
+ handlers: list[MetricsHandler] = field(default_factory=list)
+ # the time it takes to recieve the first response from the server, in nanoseconds
+ # attached by interceptor
+ # currently only tracked for ReadRows
+ first_response_latency_ns: int | None = None
+ # time waiting on flow control, in nanoseconds
+ flow_throttling_time_ns: int = 0
+
+ _active_operation_context: ClassVar[
+ contextvars.ContextVar[ActiveOperationMetric]
+ ] = contextvars.ContextVar("active_operation_context")
+
+ @classmethod
+ def from_context(cls) -> ActiveOperationMetric | None:
+ """Retrieves the active operation from the current execution context.
+
+ Because execution within a context is sequential, this guarantees
+ retrieval of the single, unique operation, isolated from other
+ concurrent RPCs.
+
+ Note:
+ This is intended to be called by gRPC interceptors at the start
+ of an RPC.
+
+ Returns:
+ ActiveOperationMetric: The current active operation.
+ None: If no operation is set, or if the current operation is
+ already in the `COMPLETED` state.
+ """
+ op = cls._active_operation_context.get(None)
+ if op and op.state == OperationState.COMPLETED:
+ return None
+ return op
+
+ def __post_init__(self):
+ """
+ Save new instances to contextvars on init
+ """
+ self._active_operation_context.set(self)
+
+ def start(self) -> None:
+ """
+ Optionally called to mark the start of the operation. If not called,
+ the operation will be started at initialization.
+
+ StartState: CREATED
+ EndState: CREATED
+ """
+ if self.state != OperationState.CREATED:
+ return self._handle_error(INVALID_STATE_ERROR.format("start", self.state))
+ self.start_time_ns = time.monotonic_ns()
+ # set as active operation in contextvars
+ self._active_operation_context.set(self)
+
+ def start_attempt(self) -> ActiveAttemptMetric | None:
+ """
+ Called to initiate a new attempt for the operation.
+
+ StartState: CREATED | BETWEEN_ATTEMPTS
+ EndState: ACTIVE_ATTEMPT
+ """
+ if (
+ self.state != OperationState.BETWEEN_ATTEMPTS
+ and self.state != OperationState.CREATED
+ ):
+ return self._handle_error(
+ INVALID_STATE_ERROR.format("start_attempt", self.state)
+ )
+ # set as active operation in contextvars
+ self._active_operation_context.set(self)
+
+ try:
+ # find backoff value before this attempt
+ prev_attempt_idx = len(self.completed_attempts) - 1
+ backoff = self.backoff_generator.get_attempt_backoff(prev_attempt_idx)
+ # generator will return the backoff time in seconds, so convert to nanoseconds
+ backoff_ns = int(backoff * 1e9)
+ except IndexError:
+ # backoff value not found
+ backoff_ns = 0
+
+ self.active_attempt = ActiveAttemptMetric(backoff_before_attempt_ns=backoff_ns)
+ self.state = OperationState.ACTIVE_ATTEMPT
+ return self.active_attempt
+
+ def add_response_metadata(self, metadata: dict[str, bytes | str]) -> None:
+ """
+ Attach trailing metadata to the active attempt.
+
+ If not called, default values for the metadata will be used.
+
+ StartState: ACTIVE_ATTEMPT
+ EndState: ACTIVE_ATTEMPT
+
+ Args:
+ - metadata: the metadata as extracted from the grpc call
+ """
+ if self.state != OperationState.ACTIVE_ATTEMPT:
+ return self._handle_error(
+ INVALID_STATE_ERROR.format("add_response_metadata", self.state)
+ )
+ if self.cluster_id is None or self.zone is None:
+ # BIGTABLE_LOCATION_METADATA_KEY should give a binary-encoded ResponseParams proto
+ blob = cast(bytes, metadata.get(BIGTABLE_LOCATION_METADATA_KEY))
+ if blob:
+ parse_result = self._parse_response_metadata_blob(blob)
+ if parse_result is not None:
+ cluster, zone = parse_result
+ if cluster:
+ self.cluster_id = cluster
+ if zone:
+ self.zone = zone
+ else:
+ self._handle_error(
+ f"Failed to decode {BIGTABLE_LOCATION_METADATA_KEY} metadata: {blob!r}"
+ )
+ # SERVER_TIMING_METADATA_KEY should give a string with the server-latency headers
+ timing_header = cast(str, metadata.get(SERVER_TIMING_METADATA_KEY))
+ if timing_header:
+ timing_data = SERVER_TIMING_REGEX.match(timing_header)
+ if timing_data and self.active_attempt:
+ gfe_latency_ms = float(timing_data.group(1))
+ self.active_attempt.gfe_latency_ns = int(gfe_latency_ms * 1e6)
+
+ @staticmethod
+ @lru_cache(maxsize=32)
+ def _parse_response_metadata_blob(blob: bytes) -> Tuple[str, str] | None:
+ """
+ Parse the response metadata blob and return a tuple of cluster and zone.
+
+ Function is cached to avoid parsing the same blob multiple times.
+
+ Args:
+ - blob: the metadata blob as extracted from the grpc call
+ Returns:
+ - a tuple of cluster_id and zone, or None if parsing failed
+ """
+ try:
+ proto = ResponseParams.pb().FromString(blob)
+ return proto.cluster_id, proto.zone_id
+ except (DecodeError, TypeError):
+ # failed to parse metadata
+ return None
+
+ def end_attempt_with_status(self, status: StatusCode | BaseException) -> None:
+ """
+ Called to mark the end of an attempt for the operation.
+
+ Typically, this is used to mark a retryable error. If a retry will not
+ be attempted, `end_with_status` or `end_with_success` should be used
+ to finalize the operation along with the attempt.
+
+ StartState: ACTIVE_ATTEMPT
+ EndState: BETWEEN_ATTEMPTS
+
+ Args:
+ - status: The status of the attempt.
+ """
+ if self.state != OperationState.ACTIVE_ATTEMPT or self.active_attempt is None:
+ return self._handle_error(
+ INVALID_STATE_ERROR.format("end_attempt_with_status", self.state)
+ )
+ if isinstance(status, BaseException):
+ status = self._exc_to_status(status)
+ duration_ns = self._ensure_positive(
+ time.monotonic_ns() - self.active_attempt.start_time_ns, "duration"
+ )
+ complete_attempt = CompletedAttemptMetric(
+ duration_ns=duration_ns,
+ end_status=status,
+ gfe_latency_ns=self.active_attempt.gfe_latency_ns,
+ application_blocking_time_ns=self.active_attempt.application_blocking_time_ns,
+ backoff_before_attempt_ns=self.active_attempt.backoff_before_attempt_ns,
+ )
+ self.completed_attempts.append(complete_attempt)
+ self.active_attempt = None
+ self.state = OperationState.BETWEEN_ATTEMPTS
+ for handler in self.handlers:
+ handler.on_attempt_complete(complete_attempt, self)
+
+ def end_with_status(self, status: StatusCode | BaseException) -> None:
+ """
+ Called to mark the end of the operation. If there is an active attempt,
+ end_attempt_with_status will be called with the same status.
+
+ StartState: CREATED | ACTIVE_ATTEMPT | BETWEEN_ATTEMPTS
+ EndState: COMPLETED
+
+ Causes on_operation_completed to be called for each registered handler.
+
+ Args:
+ - status: The status of the operation.
+ """
+ if self.state == OperationState.COMPLETED:
+ return self._handle_error(
+ INVALID_STATE_ERROR.format("end_with_status", self.state)
+ )
+ final_status = (
+ self._exc_to_status(status) if isinstance(status, BaseException) else status
+ )
+ if self.state == OperationState.ACTIVE_ATTEMPT:
+ self.end_attempt_with_status(final_status)
+ duration_ns = self._ensure_positive(
+ time.monotonic_ns() - self.start_time_ns, "duration"
+ )
+ finalized = CompletedOperationMetric(
+ op_type=self.op_type,
+ completed_attempts=self.completed_attempts,
+ duration_ns=duration_ns,
+ final_status=final_status,
+ cluster_id=self.cluster_id or DEFAULT_CLUSTER_ID,
+ zone=self.zone or DEFAULT_ZONE,
+ is_streaming=self.is_streaming,
+ first_response_latency_ns=self.first_response_latency_ns,
+ flow_throttling_time_ns=self.flow_throttling_time_ns,
+ )
+ self.state = OperationState.COMPLETED
+ for handler in self.handlers:
+ handler.on_operation_complete(finalized)
+
+ def end_with_success(self):
+ """
+ Called to mark the end of the operation with a successful status.
+
+ StartState: CREATED | ACTIVE_ATTEMPT | BETWEEN_ATTEMPTS
+ EndState: COMPLETED
+
+ Causes on_operation_completed to be called for each registered handler.
+ """
+ return self.end_with_status(StatusCode.OK)
+
+ @staticmethod
+ def _exc_to_status(exc: BaseException) -> StatusCode:
+ """
+ Extracts the grpc status code from an exception.
+
+ Exception groups and wrappers will be parsed to find the underlying
+ grpc Exception.
+
+ If the exception is not a grpc exception, will return StatusCode.UNKNOWN.
+
+ Args:
+ - exc: The exception to extract the status code from.
+ """
+ if isinstance(exc, bt_exceptions._BigtableExceptionGroup):
+ exc = exc.exceptions[-1]
+ if hasattr(exc, "grpc_status_code") and exc.grpc_status_code is not None:
+ return exc.grpc_status_code
+ if (
+ exc.__cause__
+ and hasattr(exc.__cause__, "grpc_status_code")
+ and exc.__cause__.grpc_status_code is not None
+ ):
+ return exc.__cause__.grpc_status_code
+ if isinstance(exc, AioRpcError) or isinstance(exc, RpcError):
+ return exc.code()
+ return StatusCode.UNKNOWN
+
+ @staticmethod
+ def _handle_error(message: str) -> None:
+ """
+ log error metric system error messages
+
+ Args:
+ - message: The message to include in the exception or warning.
+ """
+ full_message = f"Error in Bigtable Metrics: {message}"
+ LOGGER.warning(full_message)
+
+ def _ensure_positive(self, value: int, field_name: str) -> int:
+ """
+ Helper to replace negative value with 0, and record an error
+ """
+ if value < 0:
+ self._handle_error(f"received negative value for {field_name}: {value}")
+ return 0
+ return value
+
+ def __enter__(self):
+ """
+ Implements the async manager protocol
+
+ Using the operation's context manager provides assurances that the operation
+ is always closed when complete, with the proper status code automaticallty
+ detected when an exception is raised.
+ """
+ return self
+
+ def __exit__(self, exc_type, exc_val, exc_tb):
+ """
+ Implements the context manager protocol
+
+ The operation is automatically ended on exit, with the status determined
+ by the exception type and value.
+
+ If operation was already ended manually, do nothing.
+ """
+ if not self.state == OperationState.COMPLETED:
+ if exc_val is None:
+ self.end_with_success()
+ else:
+ self.end_with_status(exc_val)
diff --git a/google/cloud/bigtable/data/_metrics/handlers/_base.py b/google/cloud/bigtable/data/_metrics/handlers/_base.py
new file mode 100644
index 000000000..884091fdd
--- /dev/null
+++ b/google/cloud/bigtable/data/_metrics/handlers/_base.py
@@ -0,0 +1,38 @@
+# Copyright 2023 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 google.cloud.bigtable.data._metrics.data_model import ActiveOperationMetric
+from google.cloud.bigtable.data._metrics.data_model import CompletedAttemptMetric
+from google.cloud.bigtable.data._metrics.data_model import CompletedOperationMetric
+
+
+class MetricsHandler:
+ """
+ Base class for all metrics handlers. Metrics handlers will receive callbacks
+ when operations and attempts are completed, and can use this information to
+ update some external metrics system.
+ """
+
+ def __init__(self, **kwargs):
+ pass
+
+ def on_operation_complete(self, op: CompletedOperationMetric) -> None:
+ pass
+
+ def on_attempt_complete(
+ self, attempt: CompletedAttemptMetric, op: ActiveOperationMetric
+ ) -> None:
+ pass
+
+ def close(self):
+ pass
diff --git a/google/cloud/bigtable/data/_metrics/metrics_controller.py b/google/cloud/bigtable/data/_metrics/metrics_controller.py
new file mode 100644
index 000000000..e9815f201
--- /dev/null
+++ b/google/cloud/bigtable/data/_metrics/metrics_controller.py
@@ -0,0 +1,63 @@
+# Copyright 2023 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 annotations
+
+from google.cloud.bigtable.data._metrics.data_model import ActiveOperationMetric
+from google.cloud.bigtable.data._metrics.handlers._base import MetricsHandler
+from google.cloud.bigtable.data._metrics.data_model import OperationType
+
+
+class BigtableClientSideMetricsController:
+ """
+ BigtableClientSideMetricsController is responsible for managing the
+ lifecycle of the metrics system. The Bigtable client library will
+ use this class to create new operations. Each operation will be
+ registered with the handlers associated with this controller.
+ """
+
+ def __init__(
+ self,
+ handlers: list[MetricsHandler] | None = None,
+ ):
+ """
+ Initializes the metrics controller.
+
+ Args:
+ - handlers: A list of MetricsHandler objects to subscribe to metrics events.
+ """
+ self.handlers: list[MetricsHandler] = handlers or []
+
+ def add_handler(self, handler: MetricsHandler) -> None:
+ """
+ Add a new handler to the list of handlers.
+
+ Args:
+ - handler: A MetricsHandler object to add to the list of subscribed handlers.
+ """
+ self.handlers.append(handler)
+
+ def create_operation(
+ self, op_type: OperationType, **kwargs
+ ) -> ActiveOperationMetric:
+ """
+ Creates a new operation and registers it with the subscribed handlers.
+ """
+ return ActiveOperationMetric(op_type, **kwargs, handlers=self.handlers)
+
+ def close(self):
+ """
+ Close all handlers.
+ """
+ for handler in self.handlers:
+ handler.close()
diff --git a/google/cloud/bigtable/data/_metrics/tracked_retry.py b/google/cloud/bigtable/data/_metrics/tracked_retry.py
new file mode 100644
index 000000000..94d2e5dcb
--- /dev/null
+++ b/google/cloud/bigtable/data/_metrics/tracked_retry.py
@@ -0,0 +1,133 @@
+# Copyright 2025 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.
+"""
+Methods for instrumenting an google.api_core.retry.retry_target or
+google.api_core.retry.retry_target_stream method
+
+`tracked_retry` will intercept `on_error` and `exception_factory`
+methods to update the associated ActiveOperationMetric when exceptions
+are encountered through the retryable rpc.
+"""
+from __future__ import annotations
+
+from typing import Callable, List, Optional, Tuple, TypeVar
+
+from grpc import StatusCode
+from google.api_core.exceptions import GoogleAPICallError
+from google.api_core.retry import RetryFailureReason
+from google.cloud.bigtable.data.exceptions import _MutateRowsIncomplete
+from google.cloud.bigtable.data._helpers import _retry_exception_factory
+from google.cloud.bigtable.data._metrics import ActiveOperationMetric
+from google.cloud.bigtable.data._metrics import OperationState
+
+
+T = TypeVar("T")
+
+
+ExceptionFactoryType = Callable[
+ [List[Exception], RetryFailureReason, Optional[float]],
+ Tuple[Exception, Optional[Exception]],
+]
+
+
+def _track_retryable_error(
+ operation: ActiveOperationMetric,
+) -> Callable[[Exception], None]:
+ """
+ Used as input to api_core.Retry classes, to track when retryable errors are encountered
+
+ Should be passed as on_error callback
+ """
+
+ def wrapper(exc: Exception) -> None:
+ try:
+ # record metadata from failed rpc
+ if isinstance(exc, GoogleAPICallError) and exc.errors:
+ rpc_error = exc.errors[-1]
+ metadata = list(rpc_error.trailing_metadata()) + list(
+ rpc_error.initial_metadata()
+ )
+ operation.add_response_metadata({k: v for k, v in metadata})
+ except Exception:
+ # ignore errors in metadata collection
+ pass
+ if isinstance(exc, _MutateRowsIncomplete):
+ # _MutateRowsIncomplete represents a successful rpc with some failed mutations
+ # mark the attempt as successful
+ operation.end_attempt_with_status(StatusCode.OK)
+ else:
+ operation.end_attempt_with_status(exc)
+
+ return wrapper
+
+
+def _track_terminal_error(
+ operation: ActiveOperationMetric, exception_factory: ExceptionFactoryType
+) -> ExceptionFactoryType:
+ """
+ Used as input to api_core.Retry classes, to track when terminal errors are encountered
+
+ Should be used as a wrapper over an exception_factory callback
+ """
+
+ def wrapper(
+ exc_list: List[Exception],
+ reason: RetryFailureReason,
+ timeout_val: float | None,
+ ) -> tuple[Exception, Exception | None]:
+ source_exc, cause_exc = exception_factory(exc_list, reason, timeout_val)
+ try:
+ # record metadata from failed rpc
+ if isinstance(source_exc, GoogleAPICallError) and source_exc.errors:
+ rpc_error = source_exc.errors[-1]
+ metadata = list(rpc_error.trailing_metadata()) + list(
+ rpc_error.initial_metadata()
+ )
+ operation.add_response_metadata({k: v for k, v in metadata})
+ except Exception:
+ # ignore errors in metadata collection
+ pass
+ if (
+ reason == RetryFailureReason.TIMEOUT
+ and operation.state == OperationState.ACTIVE_ATTEMPT
+ and exc_list
+ ):
+ # record ending attempt for timeout failures
+ attempt_exc = exc_list[-1]
+ _track_retryable_error(operation)(attempt_exc)
+ operation.end_with_status(source_exc)
+ return source_exc, cause_exc
+
+ return wrapper
+
+
+def tracked_retry(
+ *,
+ retry_fn: Callable[..., T],
+ operation: ActiveOperationMetric,
+ **kwargs,
+) -> T:
+ """
+ Wrapper for retry_rarget or retry_target_stream, which injects methods to
+ track the lifecycle of the retry using the provided ActiveOperationMetric
+ """
+ in_exception_factory = kwargs.pop("exception_factory", _retry_exception_factory)
+ kwargs.pop("on_error", None)
+ kwargs.pop("sleep_generator", None)
+ return retry_fn(
+ sleep_generator=operation.backoff_generator,
+ on_error=_track_retryable_error(operation),
+ exception_factory=_track_terminal_error(operation, in_exception_factory),
+ **kwargs,
+ )
diff --git a/google/cloud/bigtable/data/_sync_autogen/_mutate_rows.py b/google/cloud/bigtable/data/_sync_autogen/_mutate_rows.py
new file mode 100644
index 000000000..3bf7b562f
--- /dev/null
+++ b/google/cloud/bigtable/data/_sync_autogen/_mutate_rows.py
@@ -0,0 +1,184 @@
+# Copyright 2024 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# This file is automatically generated by CrossSync. Do not edit manually.
+
+from __future__ import annotations
+from typing import Sequence, TYPE_CHECKING
+from google.api_core import exceptions as core_exceptions
+from google.api_core import retry as retries
+import google.cloud.bigtable_v2.types.bigtable as types_pb
+import google.cloud.bigtable.data.exceptions as bt_exceptions
+from google.cloud.bigtable.data._helpers import _attempt_timeout_generator
+from google.cloud.bigtable.data._helpers import _retry_exception_factory
+from google.cloud.bigtable.data.mutations import _MUTATE_ROWS_REQUEST_MUTATION_LIMIT
+from google.cloud.bigtable.data.mutations import _EntryWithProto
+from google.cloud.bigtable.data._cross_sync import CrossSync
+
+if TYPE_CHECKING:
+ from google.cloud.bigtable.data.mutations import RowMutationEntry
+ from google.cloud.bigtable_v2.services.bigtable.client import (
+ BigtableClient as GapicClientType,
+ )
+ from google.cloud.bigtable.data._sync_autogen.client import (
+ _DataApiTarget as TargetType,
+ )
+
+
+class _MutateRowsOperation:
+ """
+ MutateRowsOperation manages the logic of sending a set of row mutations,
+ and retrying on failed entries. It manages this using the _run_attempt
+ function, which attempts to mutate all outstanding entries, and raises
+ _MutateRowsIncomplete if any retryable errors are encountered.
+
+ Errors are exposed as a MutationsExceptionGroup, which contains a list of
+ exceptions organized by the related failed mutation entries.
+
+ Args:
+ gapic_client: the client to use for the mutate_rows call
+ target: the table or view associated with the request
+ mutation_entries: a list of RowMutationEntry objects to send to the server
+ operation_timeout: the timeout to use for the entire operation, in seconds.
+ attempt_timeout: the timeout to use for each mutate_rows attempt, in seconds.
+ If not specified, the request will run until operation_timeout is reached.
+ """
+
+ def __init__(
+ self,
+ gapic_client: GapicClientType,
+ target: TargetType,
+ mutation_entries: list["RowMutationEntry"],
+ operation_timeout: float,
+ attempt_timeout: float | None,
+ retryable_exceptions: Sequence[type[Exception]] = (),
+ ):
+ total_mutations = sum((len(entry.mutations) for entry in mutation_entries))
+ if total_mutations > _MUTATE_ROWS_REQUEST_MUTATION_LIMIT:
+ raise ValueError(
+ f"mutate_rows requests can contain at most {_MUTATE_ROWS_REQUEST_MUTATION_LIMIT} mutations across all entries. Found {total_mutations}."
+ )
+ self._target = target
+ self._gapic_fn = gapic_client.mutate_rows
+ self.is_retryable = retries.if_exception_type(
+ *retryable_exceptions, bt_exceptions._MutateRowsIncomplete
+ )
+ sleep_generator = retries.exponential_sleep_generator(0.01, 2, 60)
+ self._operation = lambda: CrossSync._Sync_Impl.retry_target(
+ self._run_attempt,
+ self.is_retryable,
+ sleep_generator,
+ operation_timeout,
+ exception_factory=_retry_exception_factory,
+ )
+ self.timeout_generator = _attempt_timeout_generator(
+ attempt_timeout, operation_timeout
+ )
+ self.mutations = [_EntryWithProto(m, m._to_pb()) for m in mutation_entries]
+ self.remaining_indices = list(range(len(self.mutations)))
+ self.errors: dict[int, list[Exception]] = {}
+
+ def start(self):
+ """Start the operation, and run until completion
+
+ Raises:
+ MutationsExceptionGroup: if any mutations failed"""
+ try:
+ self._operation()
+ except Exception as exc:
+ incomplete_indices = self.remaining_indices.copy()
+ for idx in incomplete_indices:
+ self._handle_entry_error(idx, exc)
+ finally:
+ all_errors: list[Exception] = []
+ for idx, exc_list in self.errors.items():
+ if len(exc_list) == 0:
+ raise core_exceptions.ClientError(
+ f"Mutation {idx} failed with no associated errors"
+ )
+ elif len(exc_list) == 1:
+ cause_exc = exc_list[0]
+ else:
+ cause_exc = bt_exceptions.RetryExceptionGroup(exc_list)
+ entry = self.mutations[idx].entry
+ all_errors.append(
+ bt_exceptions.FailedMutationEntryError(idx, entry, cause_exc)
+ )
+ if all_errors:
+ raise bt_exceptions.MutationsExceptionGroup(
+ all_errors, len(self.mutations)
+ )
+
+ def _run_attempt(self):
+ """Run a single attempt of the mutate_rows rpc.
+
+ Raises:
+ _MutateRowsIncomplete: if there are failed mutations eligible for
+ retry after the attempt is complete
+ GoogleAPICallError: if the gapic rpc fails"""
+ request_entries = [self.mutations[idx].proto for idx in self.remaining_indices]
+ active_request_indices = {
+ req_idx: orig_idx
+ for (req_idx, orig_idx) in enumerate(self.remaining_indices)
+ }
+ self.remaining_indices = []
+ if not request_entries:
+ return
+ try:
+ result_generator = self._gapic_fn(
+ request=types_pb.MutateRowsRequest(
+ entries=request_entries,
+ app_profile_id=self._target.app_profile_id,
+ **self._target._request_path,
+ ),
+ timeout=next(self.timeout_generator),
+ retry=None,
+ )
+ for result_list in result_generator:
+ for result in result_list.entries:
+ orig_idx = active_request_indices[result.index]
+ entry_error = core_exceptions.from_grpc_status(
+ result.status.code,
+ result.status.message,
+ details=result.status.details,
+ )
+ if result.status.code != 0:
+ self._handle_entry_error(orig_idx, entry_error)
+ elif orig_idx in self.errors:
+ del self.errors[orig_idx]
+ del active_request_indices[result.index]
+ except Exception as exc:
+ for idx in active_request_indices.values():
+ self._handle_entry_error(idx, exc)
+ raise
+ if self.remaining_indices:
+ raise bt_exceptions._MutateRowsIncomplete
+
+ def _handle_entry_error(self, idx: int, exc: Exception):
+ """Add an exception to the list of exceptions for a given mutation index,
+ and add the index to the list of remaining indices if the exception is
+ retryable.
+
+ Args:
+ idx: the index of the mutation that failed
+ exc: the exception to add to the list"""
+ entry = self.mutations[idx].entry
+ self.errors.setdefault(idx, []).append(exc)
+ if (
+ entry.is_idempotent()
+ and self.is_retryable(exc)
+ and (idx not in self.remaining_indices)
+ ):
+ self.remaining_indices.append(idx)
diff --git a/google/cloud/bigtable/data/_sync_autogen/_read_rows.py b/google/cloud/bigtable/data/_sync_autogen/_read_rows.py
new file mode 100644
index 000000000..3593475a9
--- /dev/null
+++ b/google/cloud/bigtable/data/_sync_autogen/_read_rows.py
@@ -0,0 +1,304 @@
+# Copyright 2024 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+
+# This file is automatically generated by CrossSync. Do not edit manually.
+
+from __future__ import annotations
+from typing import Sequence, TYPE_CHECKING
+from google.cloud.bigtable_v2.types import ReadRowsRequest as ReadRowsRequestPB
+from google.cloud.bigtable_v2.types import ReadRowsResponse as ReadRowsResponsePB
+from google.cloud.bigtable_v2.types import RowSet as RowSetPB
+from google.cloud.bigtable_v2.types import RowRange as RowRangePB
+from google.cloud.bigtable.data.row import Row, Cell
+from google.cloud.bigtable.data.read_rows_query import ReadRowsQuery
+from google.cloud.bigtable.data.exceptions import InvalidChunk
+from google.cloud.bigtable.data.exceptions import _RowSetComplete
+from google.cloud.bigtable.data.exceptions import _ResetRow
+from google.cloud.bigtable.data._helpers import _attempt_timeout_generator
+from google.cloud.bigtable.data._helpers import _retry_exception_factory
+from google.api_core import retry as retries
+from google.api_core.retry import exponential_sleep_generator
+from google.cloud.bigtable.data._cross_sync import CrossSync
+
+if TYPE_CHECKING:
+ from google.cloud.bigtable.data._sync_autogen.client import (
+ _DataApiTarget as TargetType,
+ )
+
+
+class _ReadRowsOperation:
+ """
+ ReadRowsOperation handles the logic of merging chunks from a ReadRowsResponse stream
+ into a stream of Row objects.
+
+ ReadRowsOperation.merge_row_response_stream takes in a stream of ReadRowsResponse
+ and turns them into a stream of Row objects using an internal
+ StateMachine.
+
+ ReadRowsOperation(request, client) handles row merging logic end-to-end, including
+ performing retries on stream errors.
+
+ Args:
+ query: The query to execute
+ target: The table or view to send the request to
+ operation_timeout: The total time to allow for the operation, in seconds
+ attempt_timeout: The time to allow for each individual attempt, in seconds
+ retryable_exceptions: A list of exceptions that should trigger a retry
+ """
+
+ __slots__ = (
+ "attempt_timeout_gen",
+ "operation_timeout",
+ "request",
+ "target",
+ "_predicate",
+ "_last_yielded_row_key",
+ "_remaining_count",
+ )
+
+ def __init__(
+ self,
+ query: ReadRowsQuery,
+ target: TargetType,
+ operation_timeout: float,
+ attempt_timeout: float,
+ retryable_exceptions: Sequence[type[Exception]] = (),
+ ):
+ self.attempt_timeout_gen = _attempt_timeout_generator(
+ attempt_timeout, operation_timeout
+ )
+ self.operation_timeout = operation_timeout
+ if isinstance(query, dict):
+ self.request = ReadRowsRequestPB(
+ **query, **target._request_path, app_profile_id=target.app_profile_id
+ )
+ else:
+ self.request = query._to_pb(target)
+ self.target = target
+ self._predicate = retries.if_exception_type(*retryable_exceptions)
+ self._last_yielded_row_key: bytes | None = None
+ self._remaining_count: int | None = self.request.rows_limit or None
+
+ def start_operation(self) -> CrossSync._Sync_Impl.Iterable[Row]:
+ """Start the read_rows operation, retrying on retryable errors.
+
+ Yields:
+ Row: The next row in the stream"""
+ return CrossSync._Sync_Impl.retry_target_stream(
+ self._read_rows_attempt,
+ self._predicate,
+ exponential_sleep_generator(0.01, 60, multiplier=2),
+ self.operation_timeout,
+ exception_factory=_retry_exception_factory,
+ )
+
+ def _read_rows_attempt(self) -> CrossSync._Sync_Impl.Iterable[Row]:
+ """Attempt a single read_rows rpc call.
+ This function is intended to be wrapped by retry logic,
+ which will call this function until it succeeds or
+ a non-retryable error is raised.
+
+ Yields:
+ Row: The next row in the stream"""
+ if self._last_yielded_row_key is not None:
+ try:
+ self.request.rows = self._revise_request_rowset(
+ row_set=self.request.rows,
+ last_seen_row_key=self._last_yielded_row_key,
+ )
+ except _RowSetComplete:
+ return self.merge_rows(None)
+ if self._remaining_count is not None:
+ self.request.rows_limit = self._remaining_count
+ if self._remaining_count == 0:
+ return self.merge_rows(None)
+ gapic_stream = self.target.client._gapic_client.read_rows(
+ self.request, timeout=next(self.attempt_timeout_gen), retry=None
+ )
+ chunked_stream = self.chunk_stream(gapic_stream)
+ return self.merge_rows(chunked_stream)
+
+ def chunk_stream(
+ self,
+ stream: CrossSync._Sync_Impl.Awaitable[
+ CrossSync._Sync_Impl.Iterable[ReadRowsResponsePB]
+ ],
+ ) -> CrossSync._Sync_Impl.Iterable[ReadRowsResponsePB.CellChunk]:
+ """process chunks out of raw read_rows stream
+
+ Args:
+ stream: the raw read_rows stream from the gapic client
+ Yields:
+ ReadRowsResponsePB.CellChunk: the next chunk in the stream"""
+ for resp in stream:
+ resp = resp._pb
+ if resp.last_scanned_row_key:
+ if (
+ self._last_yielded_row_key is not None
+ and resp.last_scanned_row_key <= self._last_yielded_row_key
+ ):
+ raise InvalidChunk("last scanned out of order")
+ self._last_yielded_row_key = resp.last_scanned_row_key
+ current_key = None
+ for c in resp.chunks:
+ if current_key is None:
+ current_key = c.row_key
+ if current_key is None:
+ raise InvalidChunk("first chunk is missing a row key")
+ elif (
+ self._last_yielded_row_key
+ and current_key <= self._last_yielded_row_key
+ ):
+ raise InvalidChunk("row keys should be strictly increasing")
+ yield c
+ if c.reset_row:
+ current_key = None
+ elif c.commit_row:
+ self._last_yielded_row_key = current_key
+ if self._remaining_count is not None:
+ self._remaining_count -= 1
+ if self._remaining_count < 0:
+ raise InvalidChunk("emit count exceeds row limit")
+ current_key = None
+
+ @staticmethod
+ def merge_rows(
+ chunks: CrossSync._Sync_Impl.Iterable[ReadRowsResponsePB.CellChunk] | None,
+ ) -> CrossSync._Sync_Impl.Iterable[Row]:
+ """Merge chunks into rows
+
+ Args:
+ chunks: the chunk stream to merge
+ Yields:
+ Row: the next row in the stream"""
+ if chunks is None:
+ return
+ it = chunks.__iter__()
+ while True:
+ try:
+ c = it.__next__()
+ except CrossSync._Sync_Impl.StopIteration:
+ return
+ row_key = c.row_key
+ if not row_key:
+ raise InvalidChunk("first row chunk is missing key")
+ cells = []
+ family: str | None = None
+ qualifier: bytes | None = None
+ try:
+ while True:
+ if c.reset_row:
+ raise _ResetRow(c)
+ k = c.row_key
+ f = c.family_name.value
+ q = c.qualifier.value if c.HasField("qualifier") else None
+ if k and k != row_key:
+ raise InvalidChunk("unexpected new row key")
+ if f:
+ family = f
+ if q is not None:
+ qualifier = q
+ else:
+ raise InvalidChunk("new family without qualifier")
+ elif family is None:
+ raise InvalidChunk("missing family")
+ elif q is not None:
+ if family is None:
+ raise InvalidChunk("new qualifier without family")
+ qualifier = q
+ elif qualifier is None:
+ raise InvalidChunk("missing qualifier")
+ ts = c.timestamp_micros
+ labels = c.labels if c.labels else []
+ value = c.value
+ if c.value_size > 0:
+ buffer = [value]
+ while c.value_size > 0:
+ c = it.__next__()
+ t = c.timestamp_micros
+ cl = c.labels
+ k = c.row_key
+ if (
+ c.HasField("family_name")
+ and c.family_name.value != family
+ ):
+ raise InvalidChunk("family changed mid cell")
+ if (
+ c.HasField("qualifier")
+ and c.qualifier.value != qualifier
+ ):
+ raise InvalidChunk("qualifier changed mid cell")
+ if t and t != ts:
+ raise InvalidChunk("timestamp changed mid cell")
+ if cl and cl != labels:
+ raise InvalidChunk("labels changed mid cell")
+ if k and k != row_key:
+ raise InvalidChunk("row key changed mid cell")
+ if c.reset_row:
+ raise _ResetRow(c)
+ buffer.append(c.value)
+ value = b"".join(buffer)
+ cells.append(
+ Cell(value, row_key, family, qualifier, ts, list(labels))
+ )
+ if c.commit_row:
+ yield Row(row_key, cells)
+ break
+ c = it.__next__()
+ except _ResetRow as e:
+ c = e.chunk
+ if (
+ c.row_key
+ or c.HasField("family_name")
+ or c.HasField("qualifier")
+ or c.timestamp_micros
+ or c.labels
+ or c.value
+ ):
+ raise InvalidChunk("reset row with data")
+ continue
+ except CrossSync._Sync_Impl.StopIteration:
+ raise InvalidChunk("premature end of stream")
+
+ @staticmethod
+ def _revise_request_rowset(row_set: RowSetPB, last_seen_row_key: bytes) -> RowSetPB:
+ """Revise the rows in the request to avoid ones we've already processed.
+
+ Args:
+ row_set: the row set from the request
+ last_seen_row_key: the last row key encountered
+ Returns:
+ RowSetPB: the new rowset after adusting for the last seen key
+ Raises:
+ _RowSetComplete: if there are no rows left to process after the revision"""
+ if row_set is None or (not row_set.row_ranges and (not row_set.row_keys)):
+ last_seen = last_seen_row_key
+ return RowSetPB(row_ranges=[RowRangePB(start_key_open=last_seen)])
+ adjusted_keys: list[bytes] = [
+ k for k in row_set.row_keys if k > last_seen_row_key
+ ]
+ adjusted_ranges: list[RowRangePB] = []
+ for row_range in row_set.row_ranges:
+ end_key = row_range.end_key_closed or row_range.end_key_open or None
+ if end_key is None or end_key > last_seen_row_key:
+ new_range = RowRangePB(row_range)
+ start_key = row_range.start_key_closed or row_range.start_key_open
+ if start_key is None or start_key <= last_seen_row_key:
+ new_range.start_key_open = last_seen_row_key
+ adjusted_ranges.append(new_range)
+ if len(adjusted_keys) == 0 and len(adjusted_ranges) == 0:
+ raise _RowSetComplete()
+ return RowSetPB(row_keys=adjusted_keys, row_ranges=adjusted_ranges)
diff --git a/google/cloud/bigtable/data/_sync_autogen/_swappable_channel.py b/google/cloud/bigtable/data/_sync_autogen/_swappable_channel.py
new file mode 100644
index 000000000..78ba129d9
--- /dev/null
+++ b/google/cloud/bigtable/data/_sync_autogen/_swappable_channel.py
@@ -0,0 +1,96 @@
+# Copyright 2023 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.
+#
+
+# This file is automatically generated by CrossSync. Do not edit manually.
+
+from __future__ import annotations
+from typing import Callable
+from grpc import ChannelConnectivity
+from grpc import Channel
+
+
+class _WrappedChannel(Channel):
+ """
+ A wrapper around a gRPC channel. All methods are passed
+ through to the underlying channel.
+ """
+
+ def __init__(self, channel: Channel):
+ self._channel = channel
+
+ def unary_unary(self, *args, **kwargs):
+ return self._channel.unary_unary(*args, **kwargs)
+
+ def unary_stream(self, *args, **kwargs):
+ return self._channel.unary_stream(*args, **kwargs)
+
+ def stream_unary(self, *args, **kwargs):
+ return self._channel.stream_unary(*args, **kwargs)
+
+ def stream_stream(self, *args, **kwargs):
+ return self._channel.stream_stream(*args, **kwargs)
+
+ def channel_ready(self):
+ return self._channel.channel_ready()
+
+ def __enter__(self):
+ self._channel.__enter__()
+ return self
+
+ def __exit__(self, exc_type, exc_val, exc_tb):
+ return self._channel.__exit__(exc_type, exc_val, exc_tb)
+
+ def get_state(self, try_to_connect: bool = False) -> ChannelConnectivity:
+ return self._channel.get_state(try_to_connect=try_to_connect)
+
+ def wait_for_state_change(self, last_observed_state):
+ return self._channel.wait_for_state_change(last_observed_state)
+
+ def __getattr__(self, name):
+ return getattr(self._channel, name)
+
+ def close(self, grace=None):
+ return self._channel.close()
+
+ def subscribe(self, callback, try_to_connect=False):
+ return self._channel.subscribe(callback, try_to_connect)
+
+ def unsubscribe(self, callback):
+ return self._channel.unsubscribe(callback)
+
+
+class SwappableChannel(_WrappedChannel):
+ """
+ Provides a grpc channel wrapper, that allows the internal channel to be swapped out
+
+ Args:
+ - channel_fn: a nullary function that returns a new channel instance.
+ It should be a partial with all channel configuration arguments built-in
+ """
+
+ def __init__(self, channel_fn: Callable[[], Channel]):
+ self._channel_fn = channel_fn
+ self._channel = channel_fn()
+
+ def create_channel(self) -> Channel:
+ """Create a fresh channel using the stored `channel_fn` partial"""
+ new_channel = self._channel_fn()
+ return new_channel
+
+ def swap_channel(self, new_channel: Channel) -> Channel:
+ """Replace the wrapped channel with a new instance. Typically created using `create_channel`"""
+ old_channel = self._channel
+ self._channel = new_channel
+ return old_channel
diff --git a/google/cloud/bigtable/data/_sync_autogen/client.py b/google/cloud/bigtable/data/_sync_autogen/client.py
new file mode 100644
index 000000000..622002763
--- /dev/null
+++ b/google/cloud/bigtable/data/_sync_autogen/client.py
@@ -0,0 +1,1589 @@
+# Copyright 2024 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+
+# This file is automatically generated by CrossSync. Do not edit manually.
+
+from __future__ import annotations
+from typing import cast, Any, Callable, Optional, Set, Sequence, TYPE_CHECKING
+import abc
+import time
+import warnings
+import random
+import os
+import concurrent.futures
+from functools import partial
+from grpc import Channel
+from google.cloud.bigtable.data.execute_query.values import ExecuteQueryValueType
+from google.cloud.bigtable.data.execute_query.metadata import (
+ SqlType,
+ _pb_metadata_to_metadata_types,
+)
+from google.cloud.bigtable.data.execute_query._parameters_formatting import (
+ _format_execute_query_params,
+ _to_param_types,
+)
+from google.cloud.bigtable_v2.services.bigtable.transports.base import (
+ DEFAULT_CLIENT_INFO,
+)
+from google.cloud.bigtable_v2.types.bigtable import PingAndWarmRequest
+from google.cloud.bigtable_v2.types.bigtable import SampleRowKeysRequest
+from google.cloud.bigtable_v2.types.bigtable import MutateRowRequest
+from google.cloud.bigtable_v2.types.bigtable import CheckAndMutateRowRequest
+from google.cloud.bigtable_v2.types.bigtable import ReadModifyWriteRowRequest
+from google.cloud.client import ClientWithProject
+from google.cloud.environment_vars import BIGTABLE_EMULATOR
+from google.api_core import retry as retries
+from google.api_core.exceptions import DeadlineExceeded
+from google.api_core.exceptions import ServiceUnavailable
+from google.api_core.exceptions import Aborted
+from google.api_core.exceptions import Cancelled
+from google.protobuf.message import Message
+from google.protobuf.internal.enum_type_wrapper import EnumTypeWrapper
+import google.auth.credentials
+import google.auth._default
+from google.api_core import client_options as client_options_lib
+from google.cloud.bigtable.client import _DEFAULT_BIGTABLE_EMULATOR_CLIENT
+from google.cloud.bigtable.data.row import Row
+from google.cloud.bigtable.data.read_rows_query import ReadRowsQuery
+from google.cloud.bigtable.data.exceptions import FailedQueryShardError
+from google.cloud.bigtable.data.exceptions import ShardedReadRowsExceptionGroup
+from google.cloud.bigtable.data._helpers import TABLE_DEFAULT, _align_timeouts
+from google.cloud.bigtable.data._helpers import _WarmedInstanceKey
+from google.cloud.bigtable.data._helpers import _CONCURRENCY_LIMIT
+from google.cloud.bigtable.data._helpers import _retry_exception_factory
+from google.cloud.bigtable.data._helpers import _validate_timeouts
+from google.cloud.bigtable.data._helpers import _get_error_type
+from google.cloud.bigtable.data._helpers import _get_retryable_errors
+from google.cloud.bigtable.data._helpers import _get_timeouts
+from google.cloud.bigtable.data._helpers import _attempt_timeout_generator
+from google.cloud.bigtable.data.mutations import Mutation, RowMutationEntry
+from google.cloud.bigtable.data.read_modify_write_rules import ReadModifyWriteRule
+from google.cloud.bigtable.data.row_filters import RowFilter
+from google.cloud.bigtable.data.row_filters import StripValueTransformerFilter
+from google.cloud.bigtable.data.row_filters import CellsRowLimitFilter
+from google.cloud.bigtable.data.row_filters import RowFilterChain
+from google.cloud.bigtable.data._metrics import BigtableClientSideMetricsController
+from google.cloud.bigtable.data._cross_sync import CrossSync
+from typing import Iterable
+from grpc import insecure_channel
+from grpc import intercept_channel
+from google.cloud.bigtable_v2.services.bigtable.transports import (
+ BigtableGrpcTransport as TransportType,
+)
+from google.cloud.bigtable_v2.services.bigtable import BigtableClient as GapicClient
+from google.cloud.bigtable.data._sync_autogen.mutations_batcher import _MB_SIZE
+from google.cloud.bigtable.data._sync_autogen._swappable_channel import (
+ SwappableChannel as SwappableChannelType,
+)
+from google.cloud.bigtable.data._sync_autogen.metrics_interceptor import (
+ BigtableMetricsInterceptor as MetricsInterceptorType,
+)
+
+if TYPE_CHECKING:
+ from google.cloud.bigtable.data._helpers import RowKeySamples
+ from google.cloud.bigtable.data._helpers import ShardedQuery
+ from google.cloud.bigtable.data._sync_autogen.mutations_batcher import (
+ MutationsBatcher,
+ )
+ from google.cloud.bigtable.data.execute_query._sync_autogen.execute_query_iterator import (
+ ExecuteQueryIterator,
+ )
+
+
+@CrossSync._Sync_Impl.add_mapping_decorator("DataClient")
+class BigtableDataClient(ClientWithProject):
+ def __init__(
+ self,
+ *,
+ project: str | None = None,
+ credentials: google.auth.credentials.Credentials | None = None,
+ client_options: dict[str, Any]
+ | "google.api_core.client_options.ClientOptions"
+ | None = None,
+ **kwargs,
+ ):
+ """Create a client instance for the Bigtable Data API
+
+
+
+ Args:
+ project: the project which the client acts on behalf of.
+ If not passed, falls back to the default inferred
+ from the environment.
+ credentials:
+ Thehe OAuth2 Credentials to use for this
+ client. If not passed (and if no ``_http`` object is
+ passed), falls back to the default inferred from the
+ environment.
+ client_options:
+ Client options used to set user options
+ on the client. API Endpoint should be set through client_options.
+ Raises:
+ """
+ if "pool_size" in kwargs:
+ warnings.warn("pool_size no longer supported")
+ self.client_info = DEFAULT_CLIENT_INFO
+ self.client_info.client_library_version = self._client_version()
+ if type(client_options) is dict:
+ client_options = client_options_lib.from_dict(client_options)
+ client_options = cast(
+ Optional[client_options_lib.ClientOptions], client_options
+ )
+ self._emulator_host = os.getenv(BIGTABLE_EMULATOR)
+ if self._emulator_host is not None:
+ warnings.warn(
+ "Connecting to Bigtable emulator at {}".format(self._emulator_host),
+ RuntimeWarning,
+ stacklevel=2,
+ )
+ if credentials is None:
+ credentials = google.auth.credentials.AnonymousCredentials()
+ if project is None:
+ project = _DEFAULT_BIGTABLE_EMULATOR_CLIENT
+ self._metrics_interceptor = MetricsInterceptorType()
+ ClientWithProject.__init__(
+ self,
+ credentials=credentials,
+ project=project,
+ client_options=client_options,
+ )
+ self._gapic_client = GapicClient(
+ credentials=credentials,
+ client_options=client_options,
+ client_info=self.client_info,
+ transport=lambda *args, **kwargs: TransportType(
+ *args, **kwargs, channel=self._build_grpc_channel
+ ),
+ )
+ if (
+ credentials
+ and credentials.universe_domain != self.universe_domain
+ and (self._emulator_host is None)
+ ):
+ raise ValueError(
+ f"The configured universe domain ({self.universe_domain}) does not match the universe domain found in the credentials ({self._credentials.universe_domain}). If you haven't configured the universe domain explicitly, `googleapis.com` is the default."
+ )
+ self._is_closed = CrossSync._Sync_Impl.Event()
+ self.transport = cast(TransportType, self._gapic_client.transport)
+ self._active_instances: Set[_WarmedInstanceKey] = set()
+ self._instance_owners: dict[_WarmedInstanceKey, Set[int]] = {}
+ self._channel_init_time = time.monotonic()
+ self._channel_refresh_task: CrossSync._Sync_Impl.Task[None] | None = None
+ self._executor: concurrent.futures.ThreadPoolExecutor | None = (
+ concurrent.futures.ThreadPoolExecutor()
+ if not CrossSync._Sync_Impl.is_async
+ else None
+ )
+ if self._emulator_host is None:
+ try:
+ self._start_background_channel_refresh()
+ except RuntimeError:
+ warnings.warn(
+ f"{self.__class__.__name__} should be started in an asyncio event loop. Channel refresh will not be started",
+ RuntimeWarning,
+ stacklevel=2,
+ )
+
+ def _build_grpc_channel(self, *args, **kwargs) -> SwappableChannelType:
+ """This method is called by the gapic transport to create a grpc channel.
+
+ The init arguments passed down are captured in a partial used by SwappableChannel
+ to create new channel instances in the future, as part of the channel refresh logic
+
+ Emulators always use an inseucre channel
+
+ Args:
+ - *args: positional arguments passed by the gapic layer to create a new channel with
+ - **kwargs: keyword arguments passed by the gapic layer to create a new channel with
+ Returns:
+ a custom wrapped swappable channel"""
+ create_channel_fn: Callable[[], Channel]
+ if self._emulator_host is not None:
+ create_channel_fn = partial(insecure_channel, self._emulator_host)
+ else:
+
+ def sync_create_channel_fn():
+ return intercept_channel(
+ TransportType.create_channel(*args, **kwargs),
+ self._metrics_interceptor,
+ )
+
+ create_channel_fn = sync_create_channel_fn
+ new_channel = SwappableChannelType(create_channel_fn)
+ return new_channel
+
+ @property
+ def universe_domain(self) -> str:
+ """Return the universe domain used by the client instance.
+
+ Returns:
+ str: The universe domain used by the client instance."""
+ return self._gapic_client.universe_domain
+
+ @property
+ def api_endpoint(self) -> str:
+ """Return the API endpoint used by the client instance.
+
+ Returns:
+ str: The API endpoint used by the client instance."""
+ return self._gapic_client.api_endpoint
+
+ @staticmethod
+ def _client_version() -> str:
+ """Helper function to return the client version string for this client"""
+ version_str = f"{google.cloud.bigtable.__version__}-data"
+ return version_str
+
+ def _start_background_channel_refresh(self) -> None:
+ """Starts a background task to ping and warm grpc channel
+
+ Raises:
+ None"""
+ if (
+ not self._channel_refresh_task
+ and (not self._emulator_host)
+ and (not self._is_closed.is_set())
+ ):
+ CrossSync._Sync_Impl.verify_async_event_loop()
+ self._channel_refresh_task = CrossSync._Sync_Impl.create_task(
+ self._manage_channel,
+ sync_executor=self._executor,
+ task_name=f"{self.__class__.__name__} channel refresh",
+ )
+
+ def close(self, timeout: float | None = 2.0):
+ """Cancel all background tasks"""
+ self._is_closed.set()
+ if self._channel_refresh_task is not None:
+ self._channel_refresh_task.cancel()
+ CrossSync._Sync_Impl.wait([self._channel_refresh_task], timeout=timeout)
+ self.transport.close()
+ if self._executor:
+ self._executor.shutdown(wait=False)
+ self._channel_refresh_task = None
+
+ def _ping_and_warm_instances(
+ self,
+ instance_key: _WarmedInstanceKey | None = None,
+ channel: Channel | None = None,
+ ) -> list[BaseException | None]:
+ """Prepares the backend for requests on a channel
+
+ Pings each Bigtable instance registered in `_active_instances` on the client
+
+ Args:
+ instance_key: if provided, only warm the instance associated with the key
+ channel: grpc channel to warm. If none, warms `self.transport.grpc_channel`
+ Returns:
+ list[BaseException | None]: sequence of results or exceptions from the ping requests
+ """
+ channel = channel or self.transport.grpc_channel
+ instance_list = (
+ [instance_key] if instance_key is not None else self._active_instances
+ )
+ ping_rpc = channel.unary_unary(
+ "/google.bigtable.v2.Bigtable/PingAndWarm",
+ request_serializer=PingAndWarmRequest.serialize,
+ )
+ partial_list = [
+ partial(
+ ping_rpc,
+ request={"name": instance_name, "app_profile_id": app_profile_id},
+ metadata=[
+ (
+ "x-goog-request-params",
+ f"name={instance_name}&app_profile_id={app_profile_id}",
+ )
+ ],
+ wait_for_ready=True,
+ )
+ for (instance_name, app_profile_id) in instance_list
+ ]
+ result_list = CrossSync._Sync_Impl.gather_partials(
+ partial_list, return_exceptions=True, sync_executor=self._executor
+ )
+ return [r or None for r in result_list]
+
+ def _invalidate_channel_stubs(self):
+ """Helper to reset the cached stubs. Needed when changing out the grpc channel"""
+ self.transport._stubs = {}
+ self.transport._prep_wrapped_messages(self.client_info)
+
+ def _manage_channel(
+ self,
+ refresh_interval_min: float = 60 * 35,
+ refresh_interval_max: float = 60 * 45,
+ grace_period: float = 60 * 10,
+ ) -> None:
+ """Background task that periodically refreshes and warms a grpc channel
+
+ The backend will automatically close channels after 60 minutes, so
+ `refresh_interval` + `grace_period` should be < 60 minutes
+
+ Runs continuously until the client is closed
+
+ Args:
+ refresh_interval_min: minimum interval before initiating refresh
+ process in seconds. Actual interval will be a random value
+ between `refresh_interval_min` and `refresh_interval_max`
+ refresh_interval_max: maximum interval before initiating refresh
+ process in seconds. Actual interval will be a random value
+ between `refresh_interval_min` and `refresh_interval_max`
+ grace_period: time to allow previous channel to serve existing
+ requests before closing, in seconds"""
+ if not isinstance(self.transport.grpc_channel, SwappableChannelType):
+ warnings.warn("Channel does not support auto-refresh.")
+ return
+ super_channel: SwappableChannelType = self.transport.grpc_channel
+ first_refresh = self._channel_init_time + random.uniform(
+ refresh_interval_min, refresh_interval_max
+ )
+ next_sleep = max(first_refresh - time.monotonic(), 0)
+ if next_sleep > 0:
+ self._ping_and_warm_instances(channel=super_channel)
+ while not self._is_closed.is_set():
+ CrossSync._Sync_Impl.event_wait(
+ self._is_closed, next_sleep, async_break_early=False
+ )
+ if self._is_closed.is_set():
+ break
+ start_timestamp = time.monotonic()
+ new_channel = super_channel.create_channel()
+ self._ping_and_warm_instances(channel=new_channel)
+ old_channel = super_channel.swap_channel(new_channel)
+ self._invalidate_channel_stubs()
+ if grace_period:
+ CrossSync._Sync_Impl.event_wait(
+ self._is_closed, grace_period, async_break_early=False
+ )
+ old_channel.close()
+ next_refresh = random.uniform(refresh_interval_min, refresh_interval_max)
+ next_sleep = max(next_refresh - (time.monotonic() - start_timestamp), 0)
+
+ def _register_instance(
+ self, instance_id: str, app_profile_id: Optional[str], owner_id: int
+ ) -> None:
+ """Registers an instance with the client, and warms the channel for the instance
+ The client will periodically refresh grpc channel used to make
+ requests, and new channels will be warmed for each registered instance
+ Channels will not be refreshed unless at least one instance is registered
+
+ Args:
+ instance_id: id of the instance to register.
+ app_profile_id: id of the app profile calling the instance.
+ owner_id: integer id of the object owning the instance. Owners will be tracked in
+ _instance_owners, and instances will only be unregistered when all
+ owners call _remove_instance_registration. Can be obtained by calling
+ `id` identity funcion, using `id(owner)`"""
+ instance_name = self._gapic_client.instance_path(self.project, instance_id)
+ instance_key = _WarmedInstanceKey(instance_name, app_profile_id)
+ self._instance_owners.setdefault(instance_key, set()).add(owner_id)
+ if instance_key not in self._active_instances:
+ self._active_instances.add(instance_key)
+ if self._channel_refresh_task:
+ self._ping_and_warm_instances(instance_key)
+ else:
+ self._start_background_channel_refresh()
+
+ def _remove_instance_registration(
+ self, instance_id: str, app_profile_id: Optional[str], owner_id: int
+ ) -> bool:
+ """Removes an instance from the client's registered instances, to prevent
+ warming new channels for the instance
+
+ If instance_id is not registered, or is still in use by other tables, returns False
+
+ Args:
+ instance_id: id of the instance to remove
+ app_profile_id: id of the app profile calling the instance.
+ owner_id: integer id of the object owning the instance. Can be
+ obtained by the `id` identity funcion, using `id(owner)`.
+ Returns:
+ bool: True if instance was removed, else False"""
+ instance_name = self._gapic_client.instance_path(self.project, instance_id)
+ instance_key = _WarmedInstanceKey(instance_name, app_profile_id)
+ owner_list = self._instance_owners.get(instance_key, set())
+ try:
+ owner_list.remove(owner_id)
+ if len(owner_list) == 0:
+ self._active_instances.remove(instance_key)
+ return True
+ except KeyError:
+ return False
+
+ def get_table(self, instance_id: str, table_id: str, *args, **kwargs) -> Table:
+ """Returns a table instance for making data API requests. All arguments are passed
+ directly to the Table constructor.
+
+
+
+ Args:
+ instance_id: The Bigtable instance ID to associate with this client.
+ instance_id is combined with the client's project to fully
+ specify the instance
+ table_id: The ID of the table. table_id is combined with the
+ instance_id and the client's project to fully specify the table
+ app_profile_id: The app profile to associate with requests.
+ https://cloud.google.com/bigtable/docs/app-profiles
+ default_read_rows_operation_timeout: The default timeout for read rows
+ operations, in seconds. If not set, defaults to 600 seconds (10 minutes)
+ default_read_rows_attempt_timeout: The default timeout for individual
+ read rows rpc requests, in seconds. If not set, defaults to 20 seconds
+ default_mutate_rows_operation_timeout: The default timeout for mutate rows
+ operations, in seconds. If not set, defaults to 600 seconds (10 minutes)
+ default_mutate_rows_attempt_timeout: The default timeout for individual
+ mutate rows rpc requests, in seconds. If not set, defaults to 60 seconds
+ default_operation_timeout: The default timeout for all other operations, in
+ seconds. If not set, defaults to 60 seconds
+ default_attempt_timeout: The default timeout for all other individual rpc
+ requests, in seconds. If not set, defaults to 20 seconds
+ default_read_rows_retryable_errors: a list of errors that will be retried
+ if encountered during read_rows and related operations.
+ Defaults to 4 (DeadlineExceeded), 14 (ServiceUnavailable), and 10 (Aborted)
+ default_mutate_rows_retryable_errors: a list of errors that will be retried
+ if encountered during mutate_rows and related operations.
+ Defaults to 4 (DeadlineExceeded) and 14 (ServiceUnavailable)
+ default_retryable_errors: a list of errors that will be retried if
+ encountered during all other operations.
+ Defaults to 4 (DeadlineExceeded) and 14 (ServiceUnavailable)
+ Returns:
+ Table: a table instance for making data API requests
+ Raises:
+ None"""
+ return Table(self, instance_id, table_id, *args, **kwargs)
+
+ def get_authorized_view(
+ self, instance_id: str, table_id: str, authorized_view_id: str, *args, **kwargs
+ ) -> AuthorizedView:
+ """Returns an authorized view instance for making data API requests. All arguments are passed
+ directly to the AuthorizedView constructor.
+
+
+
+ Args:
+ instance_id: The Bigtable instance ID to associate with this client.
+ instance_id is combined with the client's project to fully
+ specify the instance
+ table_id: The ID of the table. table_id is combined with the
+ instance_id and the client's project to fully specify the table
+ authorized_view_id: The id for the authorized view to use for requests
+ app_profile_id: The app profile to associate with requests.
+ https://cloud.google.com/bigtable/docs/app-profiles
+ default_read_rows_operation_timeout: The default timeout for read rows
+ operations, in seconds. If not set, defaults to Table's value
+ default_read_rows_attempt_timeout: The default timeout for individual
+ read rows rpc requests, in seconds. If not set, defaults Table's value
+ default_mutate_rows_operation_timeout: The default timeout for mutate rows
+ operations, in seconds. If not set, defaults to Table's value
+ default_mutate_rows_attempt_timeout: The default timeout for individual
+ mutate rows rpc requests, in seconds. If not set, defaults Table's value
+ default_operation_timeout: The default timeout for all other operations, in
+ seconds. If not set, defaults to Table's value
+ default_attempt_timeout: The default timeout for all other individual rpc
+ requests, in seconds. If not set, defaults to Table's value
+ default_read_rows_retryable_errors: a list of errors that will be retried
+ if encountered during read_rows and related operations. If not set,
+ defaults to Table's value
+ default_mutate_rows_retryable_errors: a list of errors that will be retried
+ if encountered during mutate_rows and related operations. If not set,
+ defaults to Table's value
+ default_retryable_errors: a list of errors that will be retried if
+ encountered during all other operations. If not set, defaults to
+ Table's value
+ Returns:
+ AuthorizedView: a table instance for making data API requests
+ Raises:
+ None"""
+ return CrossSync._Sync_Impl.AuthorizedView(
+ self, instance_id, table_id, authorized_view_id, *args, **kwargs
+ )
+
+ def execute_query(
+ self,
+ query: str,
+ instance_id: str,
+ *,
+ parameters: dict[str, ExecuteQueryValueType] | None = None,
+ parameter_types: dict[str, SqlType.Type] | None = None,
+ app_profile_id: str | None = None,
+ operation_timeout: float = 600,
+ attempt_timeout: float | None = 20,
+ retryable_errors: Sequence[type[Exception]] = (
+ DeadlineExceeded,
+ ServiceUnavailable,
+ Aborted,
+ ),
+ prepare_operation_timeout: float = 60,
+ prepare_attempt_timeout: float | None = 20,
+ prepare_retryable_errors: Sequence[type[Exception]] = (
+ DeadlineExceeded,
+ ServiceUnavailable,
+ ),
+ column_info: dict[str, Message | EnumTypeWrapper] | None = None,
+ ) -> "ExecuteQueryIterator":
+ """Executes an SQL query on an instance.
+ Returns an iterator to asynchronously stream back columns from selected rows.
+
+ Failed requests within operation_timeout will be retried based on the
+ retryable_errors list until operation_timeout is reached.
+
+ Note that this makes two requests, one to ``PrepareQuery`` and one to ``ExecuteQuery``.
+ These have separate retry configurations. ``ExecuteQuery`` is where the bulk of the
+ work happens.
+
+ Args:
+ query: Query to be run on Bigtable instance. The query can use ``@param``
+ placeholders to use parameter interpolation on the server. Values for all
+ parameters should be provided in ``parameters``. Types of parameters are
+ inferred but should be provided in ``parameter_types`` if the inference is
+ not possible (i.e. when value can be None, an empty list or an empty dict).
+ instance_id: The Bigtable instance ID to perform the query on.
+ instance_id is combined with the client's project to fully
+ specify the instance.
+ parameters: Dictionary with values for all parameters used in the ``query``.
+ parameter_types: Dictionary with types of parameters used in the ``query``.
+ Required to contain entries only for parameters whose type cannot be
+ detected automatically (i.e. the value can be None, an empty list or
+ an empty dict).
+ app_profile_id: The app profile to associate with requests.
+ https://cloud.google.com/bigtable/docs/app-profiles
+ operation_timeout: the time budget for the entire executeQuery operation, in seconds.
+ Failed requests will be retried within the budget.
+ Defaults to 600 seconds.
+ attempt_timeout: the time budget for an individual executeQuery network request, in seconds.
+ If it takes longer than this time to complete, the request will be cancelled with
+ a DeadlineExceeded exception, and a retry will be attempted.
+ Defaults to the 20 seconds.
+ If None, defaults to operation_timeout.
+ retryable_errors: a list of errors that will be retried if encountered during executeQuery.
+ Defaults to 4 (DeadlineExceeded), 14 (ServiceUnavailable), and 10 (Aborted)
+ prepare_operation_timeout: the time budget for the entire prepareQuery operation, in seconds.
+ Failed requests will be retried within the budget.
+ Defaults to 60 seconds.
+ prepare_attempt_timeout: the time budget for an individual prepareQuery network request, in seconds.
+ If it takes longer than this time to complete, the request will be cancelled with
+ a DeadlineExceeded exception, and a retry will be attempted.
+ Defaults to the 20 seconds.
+ If None, defaults to prepare_operation_timeout.
+ prepare_retryable_errors: a list of errors that will be retried if encountered during prepareQuery.
+ Defaults to 4 (DeadlineExceeded) and 14 (ServiceUnavailable)
+ column_info: (Optional) A dictionary mapping column names to Protobuf message classes or EnumTypeWrapper objects.
+ This dictionary provides the necessary type information for deserializing PROTO and
+ ENUM column values from the query results. When an entry is provided
+ for a PROTO or ENUM column, the client library will attempt to deserialize the raw data.
+
+ - For PROTO columns: The value in the dictionary should be the
+ Protobuf Message class (e.g., ``my_pb2.MyMessage``).
+ - For ENUM columns: The value should be the Protobuf EnumTypeWrapper
+ object (e.g., ``my_pb2.MyEnum``).
+
+ Example::
+
+ import my_pb2
+
+ column_info = {
+ "my_proto_column": my_pb2.MyMessage,
+ "my_enum_column": my_pb2.MyEnum
+ }
+
+ If ``column_info`` is not provided, or if a specific column name is not found
+ in the dictionary:
+
+ - PROTO columns will be returned as raw bytes.
+ - ENUM columns will be returned as integers.
+
+ Note for Nested PROTO or ENUM Fields:
+
+ To specify types for PROTO or ENUM fields within STRUCTs or MAPs, use a dot-separated
+ path from the top-level column name.
+
+ - For STRUCTs: ``struct_column_name.field_name``
+ - For MAPs: ``map_column_name.key`` or ``map_column_name.value`` to specify types
+ for the map keys or values, respectively.
+
+ Example::
+
+ import my_pb2
+
+ column_info = {
+ # Top-level column
+ "my_proto_column": my_pb2.MyMessage,
+ "my_enum_column": my_pb2.MyEnum,
+
+ # Nested field in a STRUCT column named 'my_struct'
+ "my_struct.nested_proto_field": my_pb2.OtherMessage,
+ "my_struct.nested_enum_field": my_pb2.AnotherEnum,
+
+ # Nested field in a MAP column named 'my_map'
+ "my_map.key": my_pb2.MapKeyEnum, # If map keys were enums
+ "my_map.value": my_pb2.MapValueMessage,
+
+ # PROTO field inside a STRUCT, where the STRUCT is the value in a MAP column
+ "struct_map.value.nested_proto_field": my_pb2.DeeplyNestedProto,
+ "struct_map.value.nested_enum_field": my_pb2.DeeplyNestedEnum
+ }
+
+ Returns:
+ ExecuteQueryIterator: an asynchronous iterator that yields rows returned by the query
+ Raises:
+ google.api_core.exceptions.DeadlineExceeded: raised after operation timeout
+ will be chained with a RetryExceptionGroup containing GoogleAPIError exceptions
+ from any retries that failed
+ google.api_core.exceptions.GoogleAPIError: raised if the request encounters an unrecoverable error
+ google.cloud.bigtable.data.exceptions.ParameterTypeInferenceFailed: Raised if
+ a parameter is passed without an explicit type, and the type cannot be infered
+ google.protobuf.message.DecodeError: raised if the deserialization of a PROTO/ENUM value fails.
+ """
+ instance_name = self._gapic_client.instance_path(self.project, instance_id)
+ converted_param_types = _to_param_types(parameters, parameter_types)
+ prepare_request = {
+ "instance_name": instance_name,
+ "query": query,
+ "app_profile_id": app_profile_id,
+ "param_types": converted_param_types,
+ "proto_format": {},
+ }
+ prepare_predicate = retries.if_exception_type(
+ *[_get_error_type(e) for e in prepare_retryable_errors]
+ )
+ (prepare_operation_timeout, prepare_attempt_timeout) = _align_timeouts(
+ prepare_operation_timeout, prepare_attempt_timeout
+ )
+ prepare_sleep_generator = retries.exponential_sleep_generator(0.01, 2, 60)
+ target = partial(
+ self._gapic_client.prepare_query,
+ request=prepare_request,
+ timeout=prepare_attempt_timeout,
+ retry=None,
+ )
+ prepare_result = CrossSync._Sync_Impl.retry_target(
+ target,
+ prepare_predicate,
+ prepare_sleep_generator,
+ prepare_operation_timeout,
+ exception_factory=_retry_exception_factory,
+ )
+ prepare_metadata = _pb_metadata_to_metadata_types(prepare_result.metadata)
+ retryable_excs = [_get_error_type(e) for e in retryable_errors]
+ pb_params = _format_execute_query_params(parameters, parameter_types)
+ request_body = {
+ "instance_name": instance_name,
+ "app_profile_id": app_profile_id,
+ "prepared_query": prepare_result.prepared_query,
+ "params": pb_params,
+ }
+ (operation_timeout, attempt_timeout) = _align_timeouts(
+ operation_timeout, attempt_timeout
+ )
+ return CrossSync._Sync_Impl.ExecuteQueryIterator(
+ self,
+ instance_id,
+ app_profile_id,
+ request_body,
+ prepare_metadata,
+ attempt_timeout,
+ operation_timeout,
+ retryable_excs=retryable_excs,
+ column_info=column_info,
+ )
+
+ def __enter__(self):
+ self._start_background_channel_refresh()
+ return self
+
+ def __exit__(self, exc_type, exc_val, exc_tb):
+ self.close()
+ self._gapic_client.__exit__(exc_type, exc_val, exc_tb)
+
+
+class _DataApiTarget(abc.ABC):
+ """
+ Abstract class containing API surface for BigtableDataClient. Should not be created directly
+
+ Can be instantiated as a Table or an AuthorizedView
+ """
+
+ def __init__(
+ self,
+ client: BigtableDataClient,
+ instance_id: str,
+ table_id: str,
+ app_profile_id: str | None = None,
+ *,
+ default_read_rows_operation_timeout: float = 600,
+ default_read_rows_attempt_timeout: float | None = 20,
+ default_mutate_rows_operation_timeout: float = 600,
+ default_mutate_rows_attempt_timeout: float | None = 60,
+ default_operation_timeout: float = 60,
+ default_attempt_timeout: float | None = 20,
+ default_read_rows_retryable_errors: Sequence[type[Exception]] = (
+ DeadlineExceeded,
+ ServiceUnavailable,
+ Aborted,
+ Cancelled,
+ ),
+ default_mutate_rows_retryable_errors: Sequence[type[Exception]] = (
+ DeadlineExceeded,
+ ServiceUnavailable,
+ ),
+ default_retryable_errors: Sequence[type[Exception]] = (
+ DeadlineExceeded,
+ ServiceUnavailable,
+ ),
+ ):
+ """Initialize a Table instance
+
+
+
+ Args:
+ instance_id: The Bigtable instance ID to associate with this client.
+ instance_id is combined with the client's project to fully
+ specify the instance
+ table_id: The ID of the table. table_id is combined with the
+ instance_id and the client's project to fully specify the table
+ app_profile_id: The app profile to associate with requests.
+ https://cloud.google.com/bigtable/docs/app-profiles
+ default_read_rows_operation_timeout: The default timeout for read rows
+ operations, in seconds. If not set, defaults to 600 seconds (10 minutes)
+ default_read_rows_attempt_timeout: The default timeout for individual
+ read rows rpc requests, in seconds. If not set, defaults to 20 seconds
+ default_mutate_rows_operation_timeout: The default timeout for mutate rows
+ operations, in seconds. If not set, defaults to 600 seconds (10 minutes)
+ default_mutate_rows_attempt_timeout: The default timeout for individual
+ mutate rows rpc requests, in seconds. If not set, defaults to 60 seconds
+ default_operation_timeout: The default timeout for all other operations, in
+ seconds. If not set, defaults to 60 seconds
+ default_attempt_timeout: The default timeout for all other individual rpc
+ requests, in seconds. If not set, defaults to 20 seconds
+ default_read_rows_retryable_errors: a list of errors that will be retried
+ if encountered during read_rows and related operations.
+ Defaults to 4 (DeadlineExceeded), 14 (ServiceUnavailable), and 10 (Aborted)
+ default_mutate_rows_retryable_errors: a list of errors that will be retried
+ if encountered during mutate_rows and related operations.
+ Defaults to 4 (DeadlineExceeded) and 14 (ServiceUnavailable)
+ default_retryable_errors: a list of errors that will be retried if
+ encountered during all other operations.
+ Defaults to 4 (DeadlineExceeded) and 14 (ServiceUnavailable)
+ Raises:
+ None"""
+ _validate_timeouts(
+ default_operation_timeout, default_attempt_timeout, allow_none=True
+ )
+ _validate_timeouts(
+ default_read_rows_operation_timeout,
+ default_read_rows_attempt_timeout,
+ allow_none=True,
+ )
+ _validate_timeouts(
+ default_mutate_rows_operation_timeout,
+ default_mutate_rows_attempt_timeout,
+ allow_none=True,
+ )
+ self.client = client
+ self.instance_id = instance_id
+ self.instance_name = self.client._gapic_client.instance_path(
+ self.client.project, instance_id
+ )
+ self.table_id = table_id
+ self.table_name = self.client._gapic_client.table_path(
+ self.client.project, instance_id, table_id
+ )
+ self.app_profile_id: str | None = app_profile_id
+ self.default_operation_timeout: float = default_operation_timeout
+ self.default_attempt_timeout: float | None = default_attempt_timeout
+ self.default_read_rows_operation_timeout: float = (
+ default_read_rows_operation_timeout
+ )
+ self.default_read_rows_attempt_timeout: float | None = (
+ default_read_rows_attempt_timeout
+ )
+ self.default_mutate_rows_operation_timeout: float = (
+ default_mutate_rows_operation_timeout
+ )
+ self.default_mutate_rows_attempt_timeout: float | None = (
+ default_mutate_rows_attempt_timeout
+ )
+ self.default_read_rows_retryable_errors: Sequence[type[Exception]] = (
+ default_read_rows_retryable_errors or ()
+ )
+ self.default_mutate_rows_retryable_errors: Sequence[type[Exception]] = (
+ default_mutate_rows_retryable_errors or ()
+ )
+ self.default_retryable_errors: Sequence[type[Exception]] = (
+ default_retryable_errors or ()
+ )
+ self._metrics = BigtableClientSideMetricsController()
+ try:
+ self._register_instance_future = CrossSync._Sync_Impl.create_task(
+ self.client._register_instance,
+ self.instance_id,
+ self.app_profile_id,
+ id(self),
+ sync_executor=self.client._executor,
+ )
+ except RuntimeError as e:
+ raise RuntimeError(
+ f"{self.__class__.__name__} must be created within an async event loop context."
+ ) from e
+
+ @property
+ @abc.abstractmethod
+ def _request_path(self) -> dict[str, str]:
+ """Used to populate table_name or authorized_view_name for rpc requests, depending on the subclass
+
+ Unimplemented in base class"""
+ raise NotImplementedError
+
+ def __str__(self):
+ path_str = list(self._request_path.values())[0] if self._request_path else ""
+ return f"{self.__class__.__name__}<{path_str!r}>"
+
+ def read_rows_stream(
+ self,
+ query: ReadRowsQuery,
+ *,
+ operation_timeout: float | TABLE_DEFAULT = TABLE_DEFAULT.READ_ROWS,
+ attempt_timeout: float | None | TABLE_DEFAULT = TABLE_DEFAULT.READ_ROWS,
+ retryable_errors: Sequence[type[Exception]]
+ | TABLE_DEFAULT = TABLE_DEFAULT.READ_ROWS,
+ ) -> Iterable[Row]:
+ """Read a set of rows from the table, based on the specified query.
+ Returns an iterator to asynchronously stream back row data.
+
+ Failed requests within operation_timeout will be retried based on the
+ retryable_errors list until operation_timeout is reached.
+
+ Args:
+ query: contains details about which rows to return
+ operation_timeout: the time budget for the entire operation, in seconds.
+ Failed requests will be retried within the budget.
+ Defaults to the Table's default_read_rows_operation_timeout
+ attempt_timeout: the time budget for an individual network request, in seconds.
+ If it takes longer than this time to complete, the request will be cancelled with
+ a DeadlineExceeded exception, and a retry will be attempted.
+ Defaults to the Table's default_read_rows_attempt_timeout.
+ If None, defaults to operation_timeout.
+ retryable_errors: a list of errors that will be retried if encountered.
+ Defaults to the Table's default_read_rows_retryable_errors
+ Returns:
+ Iterable[Row]: an asynchronous iterator that yields rows returned by the query
+ Raises:
+ google.api_core.exceptions.DeadlineExceeded: raised after operation timeout
+ will be chained with a RetryExceptionGroup containing GoogleAPIError exceptions
+ from any retries that failed
+ google.api_core.exceptions.GoogleAPIError: raised if the request encounters an unrecoverable error
+ """
+ (operation_timeout, attempt_timeout) = _get_timeouts(
+ operation_timeout, attempt_timeout, self
+ )
+ retryable_excs = _get_retryable_errors(retryable_errors, self)
+ row_merger = CrossSync._Sync_Impl._ReadRowsOperation(
+ query,
+ self,
+ operation_timeout=operation_timeout,
+ attempt_timeout=attempt_timeout,
+ retryable_exceptions=retryable_excs,
+ )
+ return row_merger.start_operation()
+
+ def read_rows(
+ self,
+ query: ReadRowsQuery,
+ *,
+ operation_timeout: float | TABLE_DEFAULT = TABLE_DEFAULT.READ_ROWS,
+ attempt_timeout: float | None | TABLE_DEFAULT = TABLE_DEFAULT.READ_ROWS,
+ retryable_errors: Sequence[type[Exception]]
+ | TABLE_DEFAULT = TABLE_DEFAULT.READ_ROWS,
+ ) -> list[Row]:
+ """Read a set of rows from the table, based on the specified query.
+ Retruns results as a list of Row objects when the request is complete.
+ For streamed results, use read_rows_stream.
+
+ Failed requests within operation_timeout will be retried based on the
+ retryable_errors list until operation_timeout is reached.
+
+ Args:
+ query: contains details about which rows to return
+ operation_timeout: the time budget for the entire operation, in seconds.
+ Failed requests will be retried within the budget.
+ Defaults to the Table's default_read_rows_operation_timeout
+ attempt_timeout: the time budget for an individual network request, in seconds.
+ If it takes longer than this time to complete, the request will be cancelled with
+ a DeadlineExceeded exception, and a retry will be attempted.
+ Defaults to the Table's default_read_rows_attempt_timeout.
+ If None, defaults to operation_timeout.
+ If None, defaults to the Table's default_read_rows_attempt_timeout,
+ or the operation_timeout if that is also None.
+ retryable_errors: a list of errors that will be retried if encountered.
+ Defaults to the Table's default_read_rows_retryable_errors.
+ Returns:
+ list[Row]: a list of Rows returned by the query
+ Raises:
+ google.api_core.exceptions.DeadlineExceeded: raised after operation timeout
+ will be chained with a RetryExceptionGroup containing GoogleAPIError exceptions
+ from any retries that failed
+ google.api_core.exceptions.GoogleAPIError: raised if the request encounters an unrecoverable error
+ """
+ row_generator = self.read_rows_stream(
+ query,
+ operation_timeout=operation_timeout,
+ attempt_timeout=attempt_timeout,
+ retryable_errors=retryable_errors,
+ )
+ return [row for row in row_generator]
+
+ def read_row(
+ self,
+ row_key: str | bytes,
+ *,
+ row_filter: RowFilter | None = None,
+ operation_timeout: float | TABLE_DEFAULT = TABLE_DEFAULT.READ_ROWS,
+ attempt_timeout: float | None | TABLE_DEFAULT = TABLE_DEFAULT.READ_ROWS,
+ retryable_errors: Sequence[type[Exception]]
+ | TABLE_DEFAULT = TABLE_DEFAULT.READ_ROWS,
+ ) -> Row | None:
+ """Read a single row from the table, based on the specified key.
+
+ Failed requests within operation_timeout will be retried based on the
+ retryable_errors list until operation_timeout is reached.
+
+ Args:
+ query: contains details about which rows to return
+ operation_timeout: the time budget for the entire operation, in seconds.
+ Failed requests will be retried within the budget.
+ Defaults to the Table's default_read_rows_operation_timeout
+ attempt_timeout: the time budget for an individual network request, in seconds.
+ If it takes longer than this time to complete, the request will be cancelled with
+ a DeadlineExceeded exception, and a retry will be attempted.
+ Defaults to the Table's default_read_rows_attempt_timeout.
+ If None, defaults to operation_timeout.
+ retryable_errors: a list of errors that will be retried if encountered.
+ Defaults to the Table's default_read_rows_retryable_errors.
+ Returns:
+ Row | None: a Row object if the row exists, otherwise None
+ Raises:
+ google.api_core.exceptions.DeadlineExceeded: raised after operation timeout
+ will be chained with a RetryExceptionGroup containing GoogleAPIError exceptions
+ from any retries that failed
+ google.api_core.exceptions.GoogleAPIError: raised if the request encounters an unrecoverable error
+ """
+ if row_key is None:
+ raise ValueError("row_key must be string or bytes")
+ query = ReadRowsQuery(row_keys=row_key, row_filter=row_filter, limit=1)
+ results = self.read_rows(
+ query,
+ operation_timeout=operation_timeout,
+ attempt_timeout=attempt_timeout,
+ retryable_errors=retryable_errors,
+ )
+ if len(results) == 0:
+ return None
+ return results[0]
+
+ def read_rows_sharded(
+ self,
+ sharded_query: ShardedQuery,
+ *,
+ operation_timeout: float | TABLE_DEFAULT = TABLE_DEFAULT.READ_ROWS,
+ attempt_timeout: float | None | TABLE_DEFAULT = TABLE_DEFAULT.READ_ROWS,
+ retryable_errors: Sequence[type[Exception]]
+ | TABLE_DEFAULT = TABLE_DEFAULT.READ_ROWS,
+ ) -> list[Row]:
+ """Runs a sharded query in parallel, then return the results in a single list.
+ Results will be returned in the order of the input queries.
+
+ This function is intended to be run on the results on a query.shard() call.
+ For example::
+
+ table_shard_keys = await table.sample_row_keys()
+ query = ReadRowsQuery(...)
+ shard_queries = query.shard(table_shard_keys)
+ results = await table.read_rows_sharded(shard_queries)
+
+ Args:
+ sharded_query: a sharded query to execute
+ operation_timeout: the time budget for the entire operation, in seconds.
+ Failed requests will be retried within the budget.
+ Defaults to the Table's default_read_rows_operation_timeout
+ attempt_timeout: the time budget for an individual network request, in seconds.
+ If it takes longer than this time to complete, the request will be cancelled with
+ a DeadlineExceeded exception, and a retry will be attempted.
+ Defaults to the Table's default_read_rows_attempt_timeout.
+ If None, defaults to operation_timeout.
+ retryable_errors: a list of errors that will be retried if encountered.
+ Defaults to the Table's default_read_rows_retryable_errors.
+ Returns:
+ list[Row]: a list of Rows returned by the query
+ Raises:
+ ShardedReadRowsExceptionGroup: if any of the queries failed
+ ValueError: if the query_list is empty"""
+ if not sharded_query:
+ raise ValueError("empty sharded_query")
+ (operation_timeout, attempt_timeout) = _get_timeouts(
+ operation_timeout, attempt_timeout, self
+ )
+ rpc_timeout_generator = _attempt_timeout_generator(
+ operation_timeout, operation_timeout
+ )
+ concurrency_sem = CrossSync._Sync_Impl.Semaphore(_CONCURRENCY_LIMIT)
+
+ def read_rows_with_semaphore(query):
+ with concurrency_sem:
+ shard_timeout = next(rpc_timeout_generator)
+ if shard_timeout <= 0:
+ raise DeadlineExceeded(
+ "Operation timeout exceeded before starting query"
+ )
+ return self.read_rows(
+ query,
+ operation_timeout=shard_timeout,
+ attempt_timeout=min(attempt_timeout, shard_timeout),
+ retryable_errors=retryable_errors,
+ )
+
+ routine_list = [
+ partial(read_rows_with_semaphore, query) for query in sharded_query
+ ]
+ batch_result = CrossSync._Sync_Impl.gather_partials(
+ routine_list, return_exceptions=True, sync_executor=self.client._executor
+ )
+ error_dict = {}
+ shard_idx = 0
+ results_list = []
+ for result in batch_result:
+ if isinstance(result, Exception):
+ error_dict[shard_idx] = result
+ elif isinstance(result, BaseException):
+ raise result
+ else:
+ results_list.extend(result)
+ shard_idx += 1
+ if error_dict:
+ raise ShardedReadRowsExceptionGroup(
+ [
+ FailedQueryShardError(idx, sharded_query[idx], e)
+ for (idx, e) in error_dict.items()
+ ],
+ results_list,
+ len(sharded_query),
+ )
+ return results_list
+
+ def row_exists(
+ self,
+ row_key: str | bytes,
+ *,
+ operation_timeout: float | TABLE_DEFAULT = TABLE_DEFAULT.READ_ROWS,
+ attempt_timeout: float | None | TABLE_DEFAULT = TABLE_DEFAULT.READ_ROWS,
+ retryable_errors: Sequence[type[Exception]]
+ | TABLE_DEFAULT = TABLE_DEFAULT.READ_ROWS,
+ ) -> bool:
+ """Return a boolean indicating whether the specified row exists in the table.
+ uses the filters: chain(limit cells per row = 1, strip value)
+
+ Args:
+ row_key: the key of the row to check
+ operation_timeout: the time budget for the entire operation, in seconds.
+ Failed requests will be retried within the budget.
+ Defaults to the Table's default_read_rows_operation_timeout
+ attempt_timeout: the time budget for an individual network request, in seconds.
+ If it takes longer than this time to complete, the request will be cancelled with
+ a DeadlineExceeded exception, and a retry will be attempted.
+ Defaults to the Table's default_read_rows_attempt_timeout.
+ If None, defaults to operation_timeout.
+ retryable_errors: a list of errors that will be retried if encountered.
+ Defaults to the Table's default_read_rows_retryable_errors.
+ Returns:
+ bool: a bool indicating whether the row exists
+ Raises:
+ google.api_core.exceptions.DeadlineExceeded: raised after operation timeout
+ will be chained with a RetryExceptionGroup containing GoogleAPIError exceptions
+ from any retries that failed
+ google.api_core.exceptions.GoogleAPIError: raised if the request encounters an unrecoverable error
+ """
+ if row_key is None:
+ raise ValueError("row_key must be string or bytes")
+ strip_filter = StripValueTransformerFilter(flag=True)
+ limit_filter = CellsRowLimitFilter(1)
+ chain_filter = RowFilterChain(filters=[limit_filter, strip_filter])
+ query = ReadRowsQuery(row_keys=row_key, limit=1, row_filter=chain_filter)
+ results = self.read_rows(
+ query,
+ operation_timeout=operation_timeout,
+ attempt_timeout=attempt_timeout,
+ retryable_errors=retryable_errors,
+ )
+ return len(results) > 0
+
+ def sample_row_keys(
+ self,
+ *,
+ operation_timeout: float | TABLE_DEFAULT = TABLE_DEFAULT.DEFAULT,
+ attempt_timeout: float | None | TABLE_DEFAULT = TABLE_DEFAULT.DEFAULT,
+ retryable_errors: Sequence[type[Exception]]
+ | TABLE_DEFAULT = TABLE_DEFAULT.DEFAULT,
+ ) -> RowKeySamples:
+ """Return a set of RowKeySamples that delimit contiguous sections of the table of
+ approximately equal size
+
+ RowKeySamples output can be used with ReadRowsQuery.shard() to create a sharded query that
+ can be parallelized across multiple backend nodes read_rows and read_rows_stream
+ requests will call sample_row_keys internally for this purpose when sharding is enabled
+
+ RowKeySamples is simply a type alias for list[tuple[bytes, int]]; a list of
+ row_keys, along with offset positions in the table
+
+ Args:
+ operation_timeout: the time budget for the entire operation, in seconds.
+ Failed requests will be retried within the budget.i
+ Defaults to the Table's default_operation_timeout
+ attempt_timeout: the time budget for an individual network request, in seconds.
+ If it takes longer than this time to complete, the request will be cancelled with
+ a DeadlineExceeded exception, and a retry will be attempted.
+ Defaults to the Table's default_attempt_timeout.
+ If None, defaults to operation_timeout.
+ retryable_errors: a list of errors that will be retried if encountered.
+ Defaults to the Table's default_retryable_errors.
+ Returns:
+ RowKeySamples: a set of RowKeySamples the delimit contiguous sections of the table
+ Raises:
+ google.api_core.exceptions.DeadlineExceeded: raised after operation timeout
+ will be chained with a RetryExceptionGroup containing GoogleAPIError exceptions
+ from any retries that failed
+ google.api_core.exceptions.GoogleAPIError: raised if the request encounters an unrecoverable error
+ """
+ (operation_timeout, attempt_timeout) = _get_timeouts(
+ operation_timeout, attempt_timeout, self
+ )
+ attempt_timeout_gen = _attempt_timeout_generator(
+ attempt_timeout, operation_timeout
+ )
+ retryable_excs = _get_retryable_errors(retryable_errors, self)
+ predicate = retries.if_exception_type(*retryable_excs)
+ sleep_generator = retries.exponential_sleep_generator(0.01, 2, 60)
+
+ def execute_rpc():
+ results = self.client._gapic_client.sample_row_keys(
+ request=SampleRowKeysRequest(
+ app_profile_id=self.app_profile_id, **self._request_path
+ ),
+ timeout=next(attempt_timeout_gen),
+ retry=None,
+ )
+ return [(s.row_key, s.offset_bytes) for s in results]
+
+ return CrossSync._Sync_Impl.retry_target(
+ execute_rpc,
+ predicate,
+ sleep_generator,
+ operation_timeout,
+ exception_factory=_retry_exception_factory,
+ )
+
+ def mutations_batcher(
+ self,
+ *,
+ flush_interval: float | None = 5,
+ flush_limit_mutation_count: int | None = 1000,
+ flush_limit_bytes: int = 20 * _MB_SIZE,
+ flow_control_max_mutation_count: int = 100000,
+ flow_control_max_bytes: int = 100 * _MB_SIZE,
+ batch_operation_timeout: float | TABLE_DEFAULT = TABLE_DEFAULT.MUTATE_ROWS,
+ batch_attempt_timeout: float | None | TABLE_DEFAULT = TABLE_DEFAULT.MUTATE_ROWS,
+ batch_retryable_errors: Sequence[type[Exception]]
+ | TABLE_DEFAULT = TABLE_DEFAULT.MUTATE_ROWS,
+ ) -> "MutationsBatcher":
+ """Returns a new mutations batcher instance.
+
+ Can be used to iteratively add mutations that are flushed as a group,
+ to avoid excess network calls
+
+ Args:
+ flush_interval: Automatically flush every flush_interval seconds. If None,
+ a table default will be used
+ flush_limit_mutation_count: Flush immediately after flush_limit_mutation_count
+ mutations are added across all entries. If None, this limit is ignored.
+ flush_limit_bytes: Flush immediately after flush_limit_bytes bytes are added.
+ flow_control_max_mutation_count: Maximum number of inflight mutations.
+ flow_control_max_bytes: Maximum number of inflight bytes.
+ batch_operation_timeout: timeout for each mutate_rows operation, in seconds.
+ Defaults to the Table's default_mutate_rows_operation_timeout
+ batch_attempt_timeout: timeout for each individual request, in seconds.
+ Defaults to the Table's default_mutate_rows_attempt_timeout.
+ If None, defaults to batch_operation_timeout.
+ batch_retryable_errors: a list of errors that will be retried if encountered.
+ Defaults to the Table's default_mutate_rows_retryable_errors.
+ Returns:
+ MutationsBatcher: a MutationsBatcher context manager that can batch requests
+ """
+ return CrossSync._Sync_Impl.MutationsBatcher(
+ self,
+ flush_interval=flush_interval,
+ flush_limit_mutation_count=flush_limit_mutation_count,
+ flush_limit_bytes=flush_limit_bytes,
+ flow_control_max_mutation_count=flow_control_max_mutation_count,
+ flow_control_max_bytes=flow_control_max_bytes,
+ batch_operation_timeout=batch_operation_timeout,
+ batch_attempt_timeout=batch_attempt_timeout,
+ batch_retryable_errors=batch_retryable_errors,
+ )
+
+ def mutate_row(
+ self,
+ row_key: str | bytes,
+ mutations: list[Mutation] | Mutation,
+ *,
+ operation_timeout: float | TABLE_DEFAULT = TABLE_DEFAULT.DEFAULT,
+ attempt_timeout: float | None | TABLE_DEFAULT = TABLE_DEFAULT.DEFAULT,
+ retryable_errors: Sequence[type[Exception]]
+ | TABLE_DEFAULT = TABLE_DEFAULT.DEFAULT,
+ ):
+ """Mutates a row atomically.
+
+ Cells already present in the row are left unchanged unless explicitly changed
+ by ``mutation``.
+
+ Idempotent operations (i.e, all mutations have an explicit timestamp) will be
+ retried on server failure. Non-idempotent operations will not.
+
+ Args:
+ row_key: the row to apply mutations to
+ mutations: the set of mutations to apply to the row
+ operation_timeout: the time budget for the entire operation, in seconds.
+ Failed requests will be retried within the budget.
+ Defaults to the Table's default_operation_timeout
+ attempt_timeout: the time budget for an individual network request, in seconds.
+ If it takes longer than this time to complete, the request will be cancelled with
+ a DeadlineExceeded exception, and a retry will be attempted.
+ Defaults to the Table's default_attempt_timeout.
+ If None, defaults to operation_timeout.
+ retryable_errors: a list of errors that will be retried if encountered.
+ Only idempotent mutations will be retried. Defaults to the Table's
+ default_retryable_errors.
+ Raises:
+ google.api_core.exceptions.DeadlineExceeded: raised after operation timeout
+ will be chained with a RetryExceptionGroup containing all
+ GoogleAPIError exceptions from any retries that failed
+ google.api_core.exceptions.GoogleAPIError: raised on non-idempotent operations that cannot be
+ safely retried.
+ ValueError: if invalid arguments are provided"""
+ (operation_timeout, attempt_timeout) = _get_timeouts(
+ operation_timeout, attempt_timeout, self
+ )
+ if not mutations:
+ raise ValueError("No mutations provided")
+ mutations_list = mutations if isinstance(mutations, list) else [mutations]
+ if all((mutation.is_idempotent() for mutation in mutations_list)):
+ predicate = retries.if_exception_type(
+ *_get_retryable_errors(retryable_errors, self)
+ )
+ else:
+ predicate = retries.if_exception_type()
+ sleep_generator = retries.exponential_sleep_generator(0.01, 2, 60)
+ target = partial(
+ self.client._gapic_client.mutate_row,
+ request=MutateRowRequest(
+ row_key=row_key.encode("utf-8")
+ if isinstance(row_key, str)
+ else row_key,
+ mutations=[mutation._to_pb() for mutation in mutations_list],
+ app_profile_id=self.app_profile_id,
+ **self._request_path,
+ ),
+ timeout=attempt_timeout,
+ retry=None,
+ )
+ return CrossSync._Sync_Impl.retry_target(
+ target,
+ predicate,
+ sleep_generator,
+ operation_timeout,
+ exception_factory=_retry_exception_factory,
+ )
+
+ def bulk_mutate_rows(
+ self,
+ mutation_entries: list[RowMutationEntry],
+ *,
+ operation_timeout: float | TABLE_DEFAULT = TABLE_DEFAULT.MUTATE_ROWS,
+ attempt_timeout: float | None | TABLE_DEFAULT = TABLE_DEFAULT.MUTATE_ROWS,
+ retryable_errors: Sequence[type[Exception]]
+ | TABLE_DEFAULT = TABLE_DEFAULT.MUTATE_ROWS,
+ ):
+ """Applies mutations for multiple rows in a single batched request.
+
+ Each individual RowMutationEntry is applied atomically, but separate entries
+ may be applied in arbitrary order (even for entries targetting the same row)
+ In total, the row_mutations can contain at most 100000 individual mutations
+ across all entries
+
+ Idempotent entries (i.e., entries with mutations with explicit timestamps)
+ will be retried on failure. Non-idempotent will not, and will reported in a
+ raised exception group
+
+ Args:
+ mutation_entries: the batches of mutations to apply
+ Each entry will be applied atomically, but entries will be applied
+ in arbitrary order
+ operation_timeout: the time budget for the entire operation, in seconds.
+ Failed requests will be retried within the budget.
+ Defaults to the Table's default_mutate_rows_operation_timeout
+ attempt_timeout: the time budget for an individual network request, in seconds.
+ If it takes longer than this time to complete, the request will be cancelled with
+ a DeadlineExceeded exception, and a retry will be attempted.
+ Defaults to the Table's default_mutate_rows_attempt_timeout.
+ If None, defaults to operation_timeout.
+ retryable_errors: a list of errors that will be retried if encountered.
+ Defaults to the Table's default_mutate_rows_retryable_errors
+ Raises:
+ MutationsExceptionGroup: if one or more mutations fails
+ Contains details about any failed entries in .exceptions
+ ValueError: if invalid arguments are provided"""
+ (operation_timeout, attempt_timeout) = _get_timeouts(
+ operation_timeout, attempt_timeout, self
+ )
+ retryable_excs = _get_retryable_errors(retryable_errors, self)
+ operation = CrossSync._Sync_Impl._MutateRowsOperation(
+ self.client._gapic_client,
+ self,
+ mutation_entries,
+ operation_timeout,
+ attempt_timeout,
+ retryable_exceptions=retryable_excs,
+ )
+ operation.start()
+
+ def check_and_mutate_row(
+ self,
+ row_key: str | bytes,
+ predicate: RowFilter | None,
+ *,
+ true_case_mutations: Mutation | list[Mutation] | None = None,
+ false_case_mutations: Mutation | list[Mutation] | None = None,
+ operation_timeout: float | TABLE_DEFAULT = TABLE_DEFAULT.DEFAULT,
+ ) -> bool:
+ """Mutates a row atomically based on the output of a predicate filter
+
+ Non-idempotent operation: will not be retried
+
+ Args:
+ row_key: the key of the row to mutate
+ predicate: the filter to be applied to the contents of the specified row.
+ Depending on whether or not any results are yielded,
+ either true_case_mutations or false_case_mutations will be executed.
+ If None, checks that the row contains any values at all.
+ true_case_mutations:
+ Changes to be atomically applied to the specified row if
+ predicate yields at least one cell when
+ applied to row_key. Entries are applied in order,
+ meaning that earlier mutations can be masked by later
+ ones. Must contain at least one entry if
+ false_case_mutations is empty, and at most 100000.
+ false_case_mutations:
+ Changes to be atomically applied to the specified row if
+ predicate_filter does not yield any cells when
+ applied to row_key. Entries are applied in order,
+ meaning that earlier mutations can be masked by later
+ ones. Must contain at least one entry if
+ `true_case_mutations` is empty, and at most 100000.
+ operation_timeout: the time budget for the entire operation, in seconds.
+ Failed requests will not be retried. Defaults to the Table's default_operation_timeout
+ Returns:
+ bool indicating whether the predicate was true or false
+ Raises:
+ google.api_core.exceptions.GoogleAPIError: exceptions from grpc call"""
+ (operation_timeout, _) = _get_timeouts(operation_timeout, None, self)
+ if true_case_mutations is not None and (
+ not isinstance(true_case_mutations, list)
+ ):
+ true_case_mutations = [true_case_mutations]
+ true_case_list = [m._to_pb() for m in true_case_mutations or []]
+ if false_case_mutations is not None and (
+ not isinstance(false_case_mutations, list)
+ ):
+ false_case_mutations = [false_case_mutations]
+ false_case_list = [m._to_pb() for m in false_case_mutations or []]
+ result = self.client._gapic_client.check_and_mutate_row(
+ request=CheckAndMutateRowRequest(
+ true_mutations=true_case_list,
+ false_mutations=false_case_list,
+ predicate_filter=predicate._to_pb() if predicate is not None else None,
+ row_key=row_key.encode("utf-8")
+ if isinstance(row_key, str)
+ else row_key,
+ app_profile_id=self.app_profile_id,
+ **self._request_path,
+ ),
+ timeout=operation_timeout,
+ retry=None,
+ )
+ return result.predicate_matched
+
+ def read_modify_write_row(
+ self,
+ row_key: str | bytes,
+ rules: ReadModifyWriteRule | list[ReadModifyWriteRule],
+ *,
+ operation_timeout: float | TABLE_DEFAULT = TABLE_DEFAULT.DEFAULT,
+ ) -> Row:
+ """Reads and modifies a row atomically according to input ReadModifyWriteRules,
+ and returns the contents of all modified cells
+
+ The new value for the timestamp is the greater of the existing timestamp or
+ the current server time.
+
+ Non-idempotent operation: will not be retried
+
+ Args:
+ row_key: the key of the row to apply read/modify/write rules to
+ rules: A rule or set of rules to apply to the row.
+ Rules are applied in order, meaning that earlier rules will affect the
+ results of later ones.
+ operation_timeout: the time budget for the entire operation, in seconds.
+ Failed requests will not be retried.
+ Defaults to the Table's default_operation_timeout.
+ Returns:
+ Row: a Row containing cell data that was modified as part of the operation
+ Raises:
+ google.api_core.exceptions.GoogleAPIError: exceptions from grpc call
+ ValueError: if invalid arguments are provided"""
+ (operation_timeout, _) = _get_timeouts(operation_timeout, None, self)
+ if operation_timeout <= 0:
+ raise ValueError("operation_timeout must be greater than 0")
+ if rules is not None and (not isinstance(rules, list)):
+ rules = [rules]
+ if not rules:
+ raise ValueError("rules must contain at least one item")
+ result = self.client._gapic_client.read_modify_write_row(
+ request=ReadModifyWriteRowRequest(
+ rules=[rule._to_pb() for rule in rules],
+ row_key=row_key.encode("utf-8")
+ if isinstance(row_key, str)
+ else row_key,
+ app_profile_id=self.app_profile_id,
+ **self._request_path,
+ ),
+ timeout=operation_timeout,
+ retry=None,
+ )
+ return Row._from_pb(result.row)
+
+ def close(self):
+ """Called to close the Table instance and release any resources held by it."""
+ self._metrics.close()
+ if self._register_instance_future:
+ self._register_instance_future.cancel()
+ self.client._remove_instance_registration(
+ self.instance_id, self.app_profile_id, id(self)
+ )
+
+ def __enter__(self):
+ """Implement async context manager protocol
+
+ Ensure registration task has time to run, so that
+ grpc channels will be warmed for the specified instance"""
+ if self._register_instance_future:
+ self._register_instance_future
+ return self
+
+ def __exit__(self, exc_type, exc_val, exc_tb):
+ """Implement async context manager protocol
+
+ Unregister this instance with the client, so that
+ grpc channels will no longer be warmed"""
+ self.close()
+
+
+@CrossSync._Sync_Impl.add_mapping_decorator("Table")
+class Table(_DataApiTarget):
+ """
+ Main Data API surface for interacting with a Bigtable table.
+
+ Table object maintains table_id, and app_profile_id context, and passes them with
+ each call
+ """
+
+ @property
+ def _request_path(self) -> dict[str, str]:
+ return {"table_name": self.table_name}
+
+
+@CrossSync._Sync_Impl.add_mapping_decorator("AuthorizedView")
+class AuthorizedView(_DataApiTarget):
+ """
+ Provides access to an authorized view of a table.
+
+ An authorized view is a subset of a table that you configure to include specific table data.
+ Then you grant access to the authorized view separately from access to the table.
+
+ AuthorizedView object maintains table_id, app_profile_id, and authorized_view_id context,
+ and passed them with each call
+ """
+
+ def __init__(
+ self,
+ client,
+ instance_id,
+ table_id,
+ authorized_view_id,
+ app_profile_id: str | None = None,
+ **kwargs,
+ ):
+ """Initialize an AuthorizedView instance
+
+
+
+ Args:
+ instance_id: The Bigtable instance ID to associate with this client.
+ instance_id is combined with the client's project to fully
+ specify the instance
+ table_id: The ID of the table. table_id is combined with the
+ instance_id and the client's project to fully specify the table
+ authorized_view_id: The id for the authorized view to use for requests
+ app_profile_id: The app profile to associate with requests.
+ https://cloud.google.com/bigtable/docs/app-profiles
+ default_read_rows_operation_timeout: The default timeout for read rows
+ operations, in seconds. If not set, defaults to 600 seconds (10 minutes)
+ default_read_rows_attempt_timeout: The default timeout for individual
+ read rows rpc requests, in seconds. If not set, defaults to 20 seconds
+ default_mutate_rows_operation_timeout: The default timeout for mutate rows
+ operations, in seconds. If not set, defaults to 600 seconds (10 minutes)
+ default_mutate_rows_attempt_timeout: The default timeout for individual
+ mutate rows rpc requests, in seconds. If not set, defaults to 60 seconds
+ default_operation_timeout: The default timeout for all other operations, in
+ seconds. If not set, defaults to 60 seconds
+ default_attempt_timeout: The default timeout for all other individual rpc
+ requests, in seconds. If not set, defaults to 20 seconds
+ default_read_rows_retryable_errors: a list of errors that will be retried
+ if encountered during read_rows and related operations.
+ Defaults to 4 (DeadlineExceeded), 14 (ServiceUnavailable), and 10 (Aborted)
+ default_mutate_rows_retryable_errors: a list of errors that will be retried
+ if encountered during mutate_rows and related operations.
+ Defaults to 4 (DeadlineExceeded) and 14 (ServiceUnavailable)
+ default_retryable_errors: a list of errors that will be retried if
+ encountered during all other operations.
+ Defaults to 4 (DeadlineExceeded) and 14 (ServiceUnavailable)
+ Raises:
+ None"""
+ super().__init__(client, instance_id, table_id, app_profile_id, **kwargs)
+ self.authorized_view_id = authorized_view_id
+ self.authorized_view_name: str = self.client._gapic_client.authorized_view_path(
+ self.client.project, instance_id, table_id, authorized_view_id
+ )
+
+ @property
+ def _request_path(self) -> dict[str, str]:
+ return {"authorized_view_name": self.authorized_view_name}
diff --git a/google/cloud/bigtable/data/_sync_autogen/metrics_interceptor.py b/google/cloud/bigtable/data/_sync_autogen/metrics_interceptor.py
new file mode 100644
index 000000000..c5a59787c
--- /dev/null
+++ b/google/cloud/bigtable/data/_sync_autogen/metrics_interceptor.py
@@ -0,0 +1,126 @@
+# Copyright 2025 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.
+
+# This file is automatically generated by CrossSync. Do not edit manually.
+
+from __future__ import annotations
+from typing import Sequence
+import time
+from functools import wraps
+from google.cloud.bigtable.data._metrics.data_model import ActiveOperationMetric
+from google.cloud.bigtable.data._metrics.data_model import OperationState
+from google.cloud.bigtable.data._metrics.data_model import OperationType
+from grpc import UnaryUnaryClientInterceptor
+from grpc import UnaryStreamClientInterceptor
+
+
+def _with_active_operation(func):
+ """Decorator for interceptor methods to extract the active operation associated with the
+ in-scope contextvars, and pass it to the decorated function."""
+
+ @wraps(func)
+ def wrapper(self, continuation, client_call_details, request):
+ operation: ActiveOperationMetric | None = ActiveOperationMetric.from_context()
+ if operation:
+ if (
+ operation.state == OperationState.CREATED
+ or operation.state == OperationState.BETWEEN_ATTEMPTS
+ ):
+ operation.start_attempt()
+ return func(self, operation, continuation, client_call_details, request)
+ else:
+ return continuation(client_call_details, request)
+
+ return wrapper
+
+
+def _get_metadata(source) -> dict[str, str | bytes] | None:
+ """Helper to extract metadata from a call or RpcError"""
+ try:
+ metadata: Sequence[tuple[str, str | bytes]]
+ metadata = source.trailing_metadata() + source.initial_metadata()
+ return {k: v for (k, v) in metadata}
+ except Exception:
+ return None
+
+
+class BigtableMetricsInterceptor(
+ UnaryUnaryClientInterceptor, UnaryStreamClientInterceptor
+):
+ """
+ An async gRPC interceptor to add client metadata and print server metadata.
+ """
+
+ @_with_active_operation
+ def intercept_unary_unary(
+ self, operation, continuation, client_call_details, request
+ ):
+ """Interceptor for unary rpcs:
+ - MutateRow
+ - CheckAndMutateRow
+ - ReadModifyWriteRow"""
+ metadata = None
+ try:
+ call = continuation(client_call_details, request)
+ metadata = _get_metadata(call)
+ return call
+ except Exception as rpc_error:
+ metadata = _get_metadata(rpc_error)
+ raise rpc_error
+ finally:
+ if metadata is not None:
+ operation.add_response_metadata(metadata)
+
+ @_with_active_operation
+ def intercept_unary_stream(
+ self, operation, continuation, client_call_details, request
+ ):
+ """Interceptor for streaming rpcs:
+ - ReadRows
+ - MutateRows
+ - SampleRowKeys"""
+ try:
+ return self._streaming_generator_wrapper(
+ operation, continuation(client_call_details, request)
+ )
+ except Exception as rpc_error:
+ metadata = _get_metadata(rpc_error)
+ if metadata is not None:
+ operation.add_response_metadata(metadata)
+ raise rpc_error
+
+ @staticmethod
+ def _streaming_generator_wrapper(operation, call):
+ """Wrapped generator to be returned by intercept_unary_stream."""
+ has_first_response = (
+ operation.first_response_latency_ns is not None
+ or operation.op_type != OperationType.READ_ROWS
+ )
+ encountered_exc = None
+ try:
+ for response in call:
+ if not has_first_response:
+ operation.first_response_latency_ns = (
+ time.monotonic_ns() - operation.start_time_ns
+ )
+ has_first_response = True
+ yield response
+ except Exception as e:
+ encountered_exc = e
+ raise
+ finally:
+ if call is not None:
+ metadata = _get_metadata(encountered_exc or call)
+ if metadata is not None:
+ operation.add_response_metadata(metadata)
diff --git a/google/cloud/bigtable/data/_sync_autogen/mutations_batcher.py b/google/cloud/bigtable/data/_sync_autogen/mutations_batcher.py
new file mode 100644
index 000000000..84f0ba8c0
--- /dev/null
+++ b/google/cloud/bigtable/data/_sync_autogen/mutations_batcher.py
@@ -0,0 +1,451 @@
+# Copyright 2024 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# This file is automatically generated by CrossSync. Do not edit manually.
+
+from __future__ import annotations
+from typing import Sequence, TYPE_CHECKING, cast
+import atexit
+import warnings
+from collections import deque
+import concurrent.futures
+from google.cloud.bigtable.data.exceptions import MutationsExceptionGroup
+from google.cloud.bigtable.data.exceptions import FailedMutationEntryError
+from google.cloud.bigtable.data._helpers import _get_retryable_errors
+from google.cloud.bigtable.data._helpers import _get_timeouts
+from google.cloud.bigtable.data._helpers import TABLE_DEFAULT
+from google.cloud.bigtable.data.mutations import _MUTATE_ROWS_REQUEST_MUTATION_LIMIT
+from google.cloud.bigtable.data.mutations import Mutation
+from google.cloud.bigtable.data._cross_sync import CrossSync
+
+if TYPE_CHECKING:
+ from google.cloud.bigtable.data.mutations import RowMutationEntry
+ from google.cloud.bigtable.data._sync_autogen.client import (
+ _DataApiTarget as TargetType,
+ )
+_MB_SIZE = 1024 * 1024
+
+
+@CrossSync._Sync_Impl.add_mapping_decorator("_FlowControl")
+class _FlowControl:
+ """
+ Manages flow control for batched mutations. Mutations are registered against
+ the FlowControl object before being sent, which will block if size or count
+ limits have reached capacity. As mutations completed, they are removed from
+ the FlowControl object, which will notify any blocked requests that there
+ is additional capacity.
+
+ Flow limits are not hard limits. If a single mutation exceeds the configured
+ limits, it will be allowed as a single batch when the capacity is available.
+
+ Args:
+ max_mutation_count: maximum number of mutations to send in a single rpc.
+ This corresponds to individual mutations in a single RowMutationEntry.
+ max_mutation_bytes: maximum number of bytes to send in a single rpc.
+ Raises:
+ ValueError: if max_mutation_count or max_mutation_bytes is less than 0
+ """
+
+ def __init__(self, max_mutation_count: int, max_mutation_bytes: int):
+ self._max_mutation_count = max_mutation_count
+ self._max_mutation_bytes = max_mutation_bytes
+ if self._max_mutation_count < 1:
+ raise ValueError("max_mutation_count must be greater than 0")
+ if self._max_mutation_bytes < 1:
+ raise ValueError("max_mutation_bytes must be greater than 0")
+ self._capacity_condition = CrossSync._Sync_Impl.Condition()
+ self._in_flight_mutation_count = 0
+ self._in_flight_mutation_bytes = 0
+
+ def _has_capacity(self, additional_count: int, additional_size: int) -> bool:
+ """Checks if there is capacity to send a new entry with the given size and count
+
+ FlowControl limits are not hard limits. If a single mutation exceeds
+ the configured flow limits, it will be sent in a single batch when
+ previous batches have completed.
+
+ Args:
+ additional_count: number of mutations in the pending entry
+ additional_size: size of the pending entry
+ Returns:
+ bool: True if there is capacity to send the pending entry, False otherwise
+ """
+ acceptable_size = max(self._max_mutation_bytes, additional_size)
+ acceptable_count = max(self._max_mutation_count, additional_count)
+ new_size = self._in_flight_mutation_bytes + additional_size
+ new_count = self._in_flight_mutation_count + additional_count
+ return new_size <= acceptable_size and new_count <= acceptable_count
+
+ def remove_from_flow(
+ self, mutations: RowMutationEntry | list[RowMutationEntry]
+ ) -> None:
+ """Removes mutations from flow control. This method should be called once
+ for each mutation that was sent to add_to_flow, after the corresponding
+ operation is complete.
+
+ Args:
+ mutations: mutation or list of mutations to remove from flow control"""
+ if not isinstance(mutations, list):
+ mutations = [mutations]
+ total_count = sum((len(entry.mutations) for entry in mutations))
+ total_size = sum((entry.size() for entry in mutations))
+ self._in_flight_mutation_count -= total_count
+ self._in_flight_mutation_bytes -= total_size
+ with self._capacity_condition:
+ self._capacity_condition.notify_all()
+
+ def add_to_flow(self, mutations: RowMutationEntry | list[RowMutationEntry]):
+ """Generator function that registers mutations with flow control. As mutations
+ are accepted into the flow control, they are yielded back to the caller,
+ to be sent in a batch. If the flow control is at capacity, the generator
+ will block until there is capacity available.
+
+ Args:
+ mutations: list mutations to break up into batches
+ Yields:
+ list[RowMutationEntry]:
+ list of mutations that have reserved space in the flow control.
+ Each batch contains at least one mutation."""
+ if not isinstance(mutations, list):
+ mutations = [mutations]
+ start_idx = 0
+ end_idx = 0
+ while end_idx < len(mutations):
+ start_idx = end_idx
+ batch_mutation_count = 0
+ with self._capacity_condition:
+ while end_idx < len(mutations):
+ next_entry = mutations[end_idx]
+ next_size = next_entry.size()
+ next_count = len(next_entry.mutations)
+ if (
+ self._has_capacity(next_count, next_size)
+ and batch_mutation_count + next_count
+ <= _MUTATE_ROWS_REQUEST_MUTATION_LIMIT
+ ):
+ end_idx += 1
+ batch_mutation_count += next_count
+ self._in_flight_mutation_bytes += next_size
+ self._in_flight_mutation_count += next_count
+ elif start_idx != end_idx:
+ break
+ else:
+ self._capacity_condition.wait_for(
+ lambda: self._has_capacity(next_count, next_size)
+ )
+ yield mutations[start_idx:end_idx]
+
+
+class MutationsBatcher:
+ """
+ Allows users to send batches using context manager API.
+
+ Runs mutate_row, mutate_rows, and check_and_mutate_row internally, combining
+ to use as few network requests as required
+
+ Will automatically flush the batcher:
+ - every flush_interval seconds
+ - after queue size reaches flush_limit_mutation_count
+ - after queue reaches flush_limit_bytes
+ - when batcher is closed or destroyed
+
+ Args:
+ table: table or autrhorized_view used to preform rpc calls
+ flush_interval: Automatically flush every flush_interval seconds.
+ If None, no time-based flushing is performed.
+ flush_limit_mutation_count: Flush immediately after flush_limit_mutation_count
+ mutations are added across all entries. If None, this limit is ignored.
+ flush_limit_bytes: Flush immediately after flush_limit_bytes bytes are added.
+ flow_control_max_mutation_count: Maximum number of inflight mutations.
+ flow_control_max_bytes: Maximum number of inflight bytes.
+ batch_operation_timeout: timeout for each mutate_rows operation, in seconds.
+ If TABLE_DEFAULT, defaults to the Table's default_mutate_rows_operation_timeout.
+ batch_attempt_timeout: timeout for each individual request, in seconds.
+ If TABLE_DEFAULT, defaults to the Table's default_mutate_rows_attempt_timeout.
+ If None, defaults to batch_operation_timeout.
+ batch_retryable_errors: a list of errors that will be retried if encountered.
+ Defaults to the Table's default_mutate_rows_retryable_errors.
+ """
+
+ def __init__(
+ self,
+ table: TargetType,
+ *,
+ flush_interval: float | None = 5,
+ flush_limit_mutation_count: int | None = 1000,
+ flush_limit_bytes: int = 20 * _MB_SIZE,
+ flow_control_max_mutation_count: int = 100000,
+ flow_control_max_bytes: int = 100 * _MB_SIZE,
+ batch_operation_timeout: float | TABLE_DEFAULT = TABLE_DEFAULT.MUTATE_ROWS,
+ batch_attempt_timeout: float | None | TABLE_DEFAULT = TABLE_DEFAULT.MUTATE_ROWS,
+ batch_retryable_errors: Sequence[type[Exception]]
+ | TABLE_DEFAULT = TABLE_DEFAULT.MUTATE_ROWS,
+ ):
+ (self._operation_timeout, self._attempt_timeout) = _get_timeouts(
+ batch_operation_timeout, batch_attempt_timeout, table
+ )
+ self._retryable_errors: list[type[Exception]] = _get_retryable_errors(
+ batch_retryable_errors, table
+ )
+ self._closed = CrossSync._Sync_Impl.Event()
+ self._target = table
+ self._staged_entries: list[RowMutationEntry] = []
+ (self._staged_count, self._staged_bytes) = (0, 0)
+ self._flow_control = CrossSync._Sync_Impl._FlowControl(
+ flow_control_max_mutation_count, flow_control_max_bytes
+ )
+ self._flush_limit_bytes = flush_limit_bytes
+ self._flush_limit_count = (
+ flush_limit_mutation_count
+ if flush_limit_mutation_count is not None
+ else float("inf")
+ )
+ self._sync_rpc_executor = (
+ concurrent.futures.ThreadPoolExecutor(max_workers=8)
+ if not CrossSync._Sync_Impl.is_async
+ else None
+ )
+ self._sync_flush_executor = (
+ concurrent.futures.ThreadPoolExecutor(max_workers=4)
+ if not CrossSync._Sync_Impl.is_async
+ else None
+ )
+ self._flush_timer = CrossSync._Sync_Impl.create_task(
+ self._timer_routine, flush_interval, sync_executor=self._sync_flush_executor
+ )
+ self._flush_jobs: set[CrossSync._Sync_Impl.Future[None]] = set()
+ self._entries_processed_since_last_raise: int = 0
+ self._exceptions_since_last_raise: int = 0
+ self._exception_list_limit: int = 10
+ self._oldest_exceptions: list[Exception] = []
+ self._newest_exceptions: deque[Exception] = deque(
+ maxlen=self._exception_list_limit
+ )
+ atexit.register(self._on_exit)
+
+ def _timer_routine(self, interval: float | None) -> None:
+ """Set up a background task to flush the batcher every interval seconds
+
+ If interval is None, an empty future is returned
+
+ Args:
+ flush_interval: Automatically flush every flush_interval seconds.
+ If None, no time-based flushing is performed."""
+ if not interval or interval <= 0:
+ return None
+ while not self._closed.is_set():
+ CrossSync._Sync_Impl.event_wait(
+ self._closed, timeout=interval, async_break_early=False
+ )
+ if not self._closed.is_set() and self._staged_entries:
+ self._schedule_flush()
+
+ def append(self, mutation_entry: RowMutationEntry):
+ """Add a new set of mutations to the internal queue
+
+ Args:
+ mutation_entry: new entry to add to flush queue
+ Raises:
+ RuntimeError: if batcher is closed
+ ValueError: if an invalid mutation type is added"""
+ if self._closed.is_set():
+ raise RuntimeError("Cannot append to closed MutationsBatcher")
+ if isinstance(cast(Mutation, mutation_entry), Mutation):
+ raise ValueError(
+ f"invalid mutation type: {type(mutation_entry).__name__}. Only RowMutationEntry objects are supported by batcher"
+ )
+ self._staged_entries.append(mutation_entry)
+ self._staged_count += len(mutation_entry.mutations)
+ self._staged_bytes += mutation_entry.size()
+ if (
+ self._staged_count >= self._flush_limit_count
+ or self._staged_bytes >= self._flush_limit_bytes
+ ):
+ self._schedule_flush()
+ CrossSync._Sync_Impl.yield_to_event_loop()
+
+ def _schedule_flush(self) -> CrossSync._Sync_Impl.Future[None] | None:
+ """Update the flush task to include the latest staged entries
+
+ Returns:
+ Future[None] | None:
+ future representing the background task, if started"""
+ if self._staged_entries:
+ (entries, self._staged_entries) = (self._staged_entries, [])
+ (self._staged_count, self._staged_bytes) = (0, 0)
+ new_task = CrossSync._Sync_Impl.create_task(
+ self._flush_internal, entries, sync_executor=self._sync_flush_executor
+ )
+ if not new_task.done():
+ self._flush_jobs.add(new_task)
+ new_task.add_done_callback(self._flush_jobs.remove)
+ return new_task
+ return None
+
+ def _flush_internal(self, new_entries: list[RowMutationEntry]):
+ """Flushes a set of mutations to the server, and updates internal state
+
+ Args:
+ new_entries list of RowMutationEntry objects to flush"""
+ in_process_requests: list[
+ CrossSync._Sync_Impl.Future[list[FailedMutationEntryError]]
+ ] = []
+ for batch in self._flow_control.add_to_flow(new_entries):
+ batch_task = CrossSync._Sync_Impl.create_task(
+ self._execute_mutate_rows, batch, sync_executor=self._sync_rpc_executor
+ )
+ in_process_requests.append(batch_task)
+ found_exceptions = self._wait_for_batch_results(*in_process_requests)
+ self._entries_processed_since_last_raise += len(new_entries)
+ self._add_exceptions(found_exceptions)
+
+ def _execute_mutate_rows(
+ self, batch: list[RowMutationEntry]
+ ) -> list[FailedMutationEntryError]:
+ """Helper to execute mutation operation on a batch
+
+ Args:
+ batch: list of RowMutationEntry objects to send to server
+ timeout: timeout in seconds. Used as operation_timeout and attempt_timeout.
+ If not given, will use table defaults
+ Returns:
+ list[FailedMutationEntryError]:
+ list of FailedMutationEntryError objects for mutations that failed.
+ FailedMutationEntryError objects will not contain index information"""
+ try:
+ operation = CrossSync._Sync_Impl._MutateRowsOperation(
+ self._target.client._gapic_client,
+ self._target,
+ batch,
+ operation_timeout=self._operation_timeout,
+ attempt_timeout=self._attempt_timeout,
+ retryable_exceptions=self._retryable_errors,
+ )
+ operation.start()
+ except MutationsExceptionGroup as e:
+ for subexc in e.exceptions:
+ subexc.index = None
+ return list(e.exceptions)
+ finally:
+ self._flow_control.remove_from_flow(batch)
+ return []
+
+ def _add_exceptions(self, excs: list[Exception]):
+ """Add new list of exceptions to internal store. To avoid unbounded memory,
+ the batcher will store the first and last _exception_list_limit exceptions,
+ and discard any in between.
+
+ Args:
+ excs: list of exceptions to add to the internal store"""
+ self._exceptions_since_last_raise += len(excs)
+ if excs and len(self._oldest_exceptions) < self._exception_list_limit:
+ addition_count = self._exception_list_limit - len(self._oldest_exceptions)
+ self._oldest_exceptions.extend(excs[:addition_count])
+ excs = excs[addition_count:]
+ if excs:
+ self._newest_exceptions.extend(excs[-self._exception_list_limit :])
+
+ def _raise_exceptions(self):
+ """Raise any unreported exceptions from background flush operations
+
+ Raises:
+ MutationsExceptionGroup: exception group with all unreported exceptions"""
+ if self._oldest_exceptions or self._newest_exceptions:
+ (oldest, self._oldest_exceptions) = (self._oldest_exceptions, [])
+ newest = list(self._newest_exceptions)
+ self._newest_exceptions.clear()
+ (entry_count, self._entries_processed_since_last_raise) = (
+ self._entries_processed_since_last_raise,
+ 0,
+ )
+ (exc_count, self._exceptions_since_last_raise) = (
+ self._exceptions_since_last_raise,
+ 0,
+ )
+ raise MutationsExceptionGroup.from_truncated_lists(
+ first_list=oldest,
+ last_list=newest,
+ total_excs=exc_count,
+ entry_count=entry_count,
+ )
+
+ def __enter__(self):
+ """Allow use of context manager API"""
+ return self
+
+ def __exit__(self, exc_type, exc, tb):
+ """Allow use of context manager API.
+
+ Flushes the batcher and cleans up resources."""
+ self.close()
+
+ @property
+ def closed(self) -> bool:
+ """Returns:
+ - True if the batcher is closed, False otherwise"""
+ return self._closed.is_set()
+
+ def close(self):
+ """Flush queue and clean up resources"""
+ self._closed.set()
+ self._flush_timer.cancel()
+ self._schedule_flush()
+ if self._sync_flush_executor:
+ with self._sync_flush_executor:
+ self._sync_flush_executor.shutdown(wait=True)
+ if self._sync_rpc_executor:
+ with self._sync_rpc_executor:
+ self._sync_rpc_executor.shutdown(wait=True)
+ CrossSync._Sync_Impl.wait([*self._flush_jobs, self._flush_timer])
+ atexit.unregister(self._on_exit)
+ self._raise_exceptions()
+
+ def _on_exit(self):
+ """Called when program is exited. Raises warning if unflushed mutations remain"""
+ if not self._closed.is_set() and self._staged_entries:
+ warnings.warn(
+ f"MutationsBatcher for target {self._target!r} was not closed. {len(self._staged_entries)} Unflushed mutations will not be sent to the server."
+ )
+
+ @staticmethod
+ def _wait_for_batch_results(
+ *tasks: CrossSync._Sync_Impl.Future[list[FailedMutationEntryError]]
+ | CrossSync._Sync_Impl.Future[None],
+ ) -> list[Exception]:
+ """Takes in a list of futures representing _execute_mutate_rows tasks,
+ waits for them to complete, and returns a list of errors encountered.
+
+ Args:
+ *tasks: futures representing _execute_mutate_rows or _flush_internal tasks
+ Returns:
+ list[Exception]:
+ list of Exceptions encountered by any of the tasks. Errors are expected
+ to be FailedMutationEntryError, representing a failed mutation operation.
+ If a task fails with a different exception, it will be included in the
+ output list. Successful tasks will not be represented in the output list.
+ """
+ if not tasks:
+ return []
+ exceptions: list[Exception] = []
+ for task in tasks:
+ try:
+ exc_list = task.result()
+ if exc_list:
+ for exc in exc_list:
+ exc.index = None
+ exceptions.extend(exc_list)
+ except Exception as e:
+ exceptions.append(e)
+ return exceptions
diff --git a/google/cloud/bigtable/data/exceptions.py b/google/cloud/bigtable/data/exceptions.py
new file mode 100644
index 000000000..b19e0e5ea
--- /dev/null
+++ b/google/cloud/bigtable/data/exceptions.py
@@ -0,0 +1,343 @@
+# Copyright 2023 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 annotations
+
+import sys
+
+from typing import Any, TYPE_CHECKING
+
+from google.api_core import exceptions as core_exceptions
+from google.cloud.bigtable.data.row import Row
+
+is_311_plus = sys.version_info >= (3, 11)
+
+if TYPE_CHECKING:
+ from google.cloud.bigtable.data.mutations import RowMutationEntry
+ from google.cloud.bigtable.data.read_rows_query import ReadRowsQuery
+
+
+class InvalidChunk(core_exceptions.GoogleAPICallError):
+ """Exception raised to invalid chunk data from back-end."""
+
+
+class _RowSetComplete(Exception):
+ """
+ Internal exception for _ReadRowsOperation
+ Raised in revise_request_rowset when there are no rows left to process when starting a retry attempt
+ """
+
+ pass
+
+
+class _ResetRow(Exception): # noqa: F811
+ """
+ Internal exception for _ReadRowsOperation
+
+ Denotes that the server sent a reset_row marker, telling the client to drop
+ all previous chunks for row_key and re-read from the beginning.
+
+ Args:
+ chunk: the reset_row chunk
+ """
+
+ def __init__(self, chunk):
+ self.chunk = chunk
+
+
+class _MutateRowsIncomplete(RuntimeError):
+ """
+ Exception raised when a mutate_rows call has unfinished work.
+ """
+
+ pass
+
+
+class _BigtableExceptionGroup(ExceptionGroup if is_311_plus else Exception): # type: ignore # noqa: F821
+ """
+ Represents one or more exceptions that occur during a bulk Bigtable operation
+
+ In Python 3.11+, this is an unmodified exception group. In < 3.10, it is a
+ custom exception with some exception group functionality backported, but does
+ Not implement the full API
+ """
+
+ def __init__(self, message, excs):
+ if is_311_plus:
+ super().__init__(message, excs)
+ else:
+ if len(excs) == 0:
+ raise ValueError("exceptions must be a non-empty sequence")
+ self.exceptions = tuple(excs)
+ # simulate an exception group in Python < 3.11 by adding exception info
+ # to the message
+ first_line = "--+---------------- 1 ----------------"
+ last_line = "+------------------------------------"
+ message_parts = [message + "\n" + first_line]
+ # print error info for each exception in the group
+ for idx, e in enumerate(excs[:15]):
+ # apply index header
+ if idx != 0:
+ message_parts.append(
+ f"+---------------- {str(idx + 1).rjust(2)} ----------------"
+ )
+ cause = e.__cause__
+ # if this exception was had a cause, print the cause first
+ # used to display root causes of FailedMutationEntryError and FailedQueryShardError
+ # format matches the error output of Python 3.11+
+ if cause is not None:
+ message_parts.extend(
+ f"| {type(cause).__name__}: {cause}".splitlines()
+ )
+ message_parts.append("| ")
+ message_parts.append(
+ "| The above exception was the direct cause of the following exception:"
+ )
+ message_parts.append("| ")
+ # attach error message for this sub-exception
+ # if the subexception is also a _BigtableExceptionGroup,
+ # error messages will be nested
+ message_parts.extend(f"| {type(e).__name__}: {e}".splitlines())
+ # truncate the message if there are more than 15 exceptions
+ if len(excs) > 15:
+ message_parts.append("+---------------- ... ---------------")
+ message_parts.append(f"| and {len(excs) - 15} more")
+ if last_line not in message_parts[-1]:
+ # in the case of nested _BigtableExceptionGroups, the last line
+ # does not need to be added, since one was added by the final sub-exception
+ message_parts.append(last_line)
+ super().__init__("\n ".join(message_parts))
+
+ def __new__(cls, message, excs):
+ if is_311_plus:
+ return super().__new__(cls, message, excs)
+ else:
+ return super().__new__(cls)
+
+ def __str__(self):
+ if is_311_plus:
+ # don't return built-in sub-exception message
+ return self.args[0]
+ return super().__str__()
+
+ def __repr__(self):
+ """
+ repr representation should strip out sub-exception details
+ """
+ if is_311_plus:
+ return super().__repr__()
+ message = self.args[0].split("\n")[0]
+ return f"{self.__class__.__name__}({message!r}, {self.exceptions!r})"
+
+
+class MutationsExceptionGroup(_BigtableExceptionGroup):
+ """
+ Represents one or more exceptions that occur during a bulk mutation operation
+
+ Exceptions will typically be of type FailedMutationEntryError, but other exceptions may
+ be included if they are raised during the mutation operation
+ """
+
+ @staticmethod
+ def _format_message(
+ excs: list[Exception], total_entries: int, exc_count: int | None = None
+ ) -> str:
+ """
+ Format a message for the exception group
+
+ Args:
+ excs: the exceptions in the group
+ total_entries: the total number of entries attempted, successful or not
+ exc_count: the number of exceptions associated with the request
+ if None, this will be len(excs)
+ Returns:
+ str: the formatted message
+ """
+ exc_count = exc_count if exc_count is not None else len(excs)
+ entry_str = "entry" if exc_count == 1 else "entries"
+ return f"{exc_count} failed {entry_str} from {total_entries} attempted."
+
+ def __init__(
+ self, excs: list[Exception], total_entries: int, message: str | None = None
+ ):
+ """
+ Args:
+ excs: the exceptions in the group
+ total_entries: the total number of entries attempted, successful or not
+ message: the message for the exception group. If None, a default message
+ will be generated
+ """
+ message = (
+ message
+ if message is not None
+ else self._format_message(excs, total_entries)
+ )
+ super().__init__(message, excs)
+ self.total_entries_attempted = total_entries
+
+ def __new__(
+ cls, excs: list[Exception], total_entries: int, message: str | None = None
+ ):
+ """
+ Args:
+ excs: the exceptions in the group
+ total_entries: the total number of entries attempted, successful or not
+ message: the message for the exception group. If None, a default message
+ Returns:
+ MutationsExceptionGroup: the new instance
+ """
+ message = (
+ message if message is not None else cls._format_message(excs, total_entries)
+ )
+ instance = super().__new__(cls, message, excs)
+ instance.total_entries_attempted = total_entries
+ return instance
+
+ @classmethod
+ def from_truncated_lists(
+ cls,
+ first_list: list[Exception],
+ last_list: list[Exception],
+ total_excs: int,
+ entry_count: int,
+ ) -> MutationsExceptionGroup:
+ """
+ Create a MutationsExceptionGroup from two lists of exceptions, representing
+ a larger set that has been truncated. The MutationsExceptionGroup will
+ contain the union of the two lists as sub-exceptions, and the error message
+ describe the number of exceptions that were truncated.
+
+ Args:
+ first_list: the set of oldest exceptions to add to the ExceptionGroup
+ last_list: the set of newest exceptions to add to the ExceptionGroup
+ total_excs: the total number of exceptions associated with the request
+ Should be len(first_list) + len(last_list) + number of dropped exceptions
+ in the middle
+ entry_count: the total number of entries attempted, successful or not
+ Returns:
+ MutationsExceptionGroup: the new instance
+ """
+ first_count, last_count = len(first_list), len(last_list)
+ if first_count + last_count >= total_excs:
+ # no exceptions were dropped
+ return cls(first_list + last_list, entry_count)
+ excs = first_list + last_list
+ truncation_count = total_excs - (first_count + last_count)
+ base_message = cls._format_message(excs, entry_count, total_excs)
+ first_message = f"first {first_count}" if first_count else ""
+ last_message = f"last {last_count}" if last_count else ""
+ conjunction = " and " if first_message and last_message else ""
+ message = f"{base_message} ({first_message}{conjunction}{last_message} attached as sub-exceptions; {truncation_count} truncated)"
+ return cls(excs, entry_count, message)
+
+
+class FailedMutationEntryError(Exception):
+ """
+ Represents a single failed RowMutationEntry in a bulk_mutate_rows request.
+ A collection of FailedMutationEntryErrors will be raised in a MutationsExceptionGroup
+ """
+
+ def __init__(
+ self,
+ failed_idx: int | None,
+ failed_mutation_entry: "RowMutationEntry",
+ cause: Exception,
+ ):
+ idempotent_msg = (
+ "idempotent" if failed_mutation_entry.is_idempotent() else "non-idempotent"
+ )
+ index_msg = f" at index {failed_idx}" if failed_idx is not None else ""
+ message = f"Failed {idempotent_msg} mutation entry{index_msg}"
+ super().__init__(message)
+ self.__cause__ = cause
+ self.index = failed_idx
+ self.entry = failed_mutation_entry
+
+
+class RetryExceptionGroup(_BigtableExceptionGroup):
+ """Represents one or more exceptions that occur during a retryable operation"""
+
+ @staticmethod
+ def _format_message(excs: list[Exception]):
+ if len(excs) == 0:
+ return "No exceptions"
+ plural = "s" if len(excs) > 1 else ""
+ return f"{len(excs)} failed attempt{plural}"
+
+ def __init__(self, excs: list[Exception]):
+ super().__init__(self._format_message(excs), excs)
+
+ def __new__(cls, excs: list[Exception]):
+ return super().__new__(cls, cls._format_message(excs), excs)
+
+
+class ShardedReadRowsExceptionGroup(_BigtableExceptionGroup):
+ """
+ Represents one or more exceptions that occur during a sharded read rows operation
+ """
+
+ @staticmethod
+ def _format_message(excs: list[FailedQueryShardError], total_queries: int):
+ query_str = "query" if total_queries == 1 else "queries"
+ plural_str = "" if len(excs) == 1 else "s"
+ return f"{len(excs)} sub-exception{plural_str} (from {total_queries} {query_str} attempted)"
+
+ def __init__(
+ self,
+ excs: list[FailedQueryShardError],
+ succeeded: list[Row],
+ total_queries: int,
+ ):
+ super().__init__(self._format_message(excs, total_queries), excs)
+ self.successful_rows = succeeded
+
+ def __new__(
+ cls, excs: list[FailedQueryShardError], succeeded: list[Row], total_queries: int
+ ):
+ instance = super().__new__(cls, cls._format_message(excs, total_queries), excs)
+ instance.successful_rows = succeeded
+ return instance
+
+
+class FailedQueryShardError(Exception):
+ """
+ Represents an individual failed query in a sharded read rows operation
+ """
+
+ def __init__(
+ self,
+ failed_index: int,
+ failed_query: "ReadRowsQuery" | dict[str, Any],
+ cause: Exception,
+ ):
+ message = f"Failed query at index {failed_index}"
+ super().__init__(message)
+ self.__cause__ = cause
+ self.index = failed_index
+ self.query = failed_query
+
+
+class InvalidExecuteQueryResponse(core_exceptions.GoogleAPICallError):
+ """Exception raised to invalid query response data from back-end."""
+
+ # Set to internal. This is representative of an internal error.
+ code = 13
+
+
+class ParameterTypeInferenceFailed(ValueError):
+ """Exception raised when query parameter types were not provided and cannot be inferred."""
+
+
+class EarlyMetadataCallError(RuntimeError):
+ """Execption raised when metadata is request from an ExecuteQueryIterator before the first row has been read, or the query has completed"""
diff --git a/google/cloud/bigtable/data/execute_query/__init__.py b/google/cloud/bigtable/data/execute_query/__init__.py
new file mode 100644
index 000000000..029e79b93
--- /dev/null
+++ b/google/cloud/bigtable/data/execute_query/__init__.py
@@ -0,0 +1,43 @@
+# Copyright 2024 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from google.cloud.bigtable.data.execute_query._async.execute_query_iterator import (
+ ExecuteQueryIteratorAsync,
+)
+from google.cloud.bigtable.data.execute_query._sync_autogen.execute_query_iterator import (
+ ExecuteQueryIterator,
+)
+from google.cloud.bigtable.data.execute_query.metadata import (
+ Metadata,
+ SqlType,
+)
+from google.cloud.bigtable.data.execute_query.values import (
+ ExecuteQueryValueType,
+ QueryResultRow,
+ Struct,
+)
+from google.cloud.bigtable.data._cross_sync import CrossSync
+
+CrossSync.add_mapping("ExecuteQueryIterator", ExecuteQueryIteratorAsync)
+CrossSync._Sync_Impl.add_mapping("ExecuteQueryIterator", ExecuteQueryIterator)
+
+__all__ = [
+ "ExecuteQueryValueType",
+ "SqlType",
+ "QueryResultRow",
+ "Struct",
+ "Metadata",
+ "ExecuteQueryIteratorAsync",
+ "ExecuteQueryIterator",
+]
diff --git a/google/cloud/bigtable/data/execute_query/_async/__init__.py b/google/cloud/bigtable/data/execute_query/_async/__init__.py
new file mode 100644
index 000000000..6d5e14bcf
--- /dev/null
+++ b/google/cloud/bigtable/data/execute_query/_async/__init__.py
@@ -0,0 +1,13 @@
+# Copyright 2024 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
diff --git a/google/cloud/bigtable/data/execute_query/_async/execute_query_iterator.py b/google/cloud/bigtable/data/execute_query/_async/execute_query_iterator.py
new file mode 100644
index 000000000..2beda4cd6
--- /dev/null
+++ b/google/cloud/bigtable/data/execute_query/_async/execute_query_iterator.py
@@ -0,0 +1,315 @@
+# Copyright 2024 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from __future__ import annotations
+
+from typing import (
+ Any,
+ Dict,
+ Optional,
+ Sequence,
+ Tuple,
+ TYPE_CHECKING,
+)
+from google.api_core import retry as retries
+from google.protobuf.message import Message
+from google.protobuf.internal.enum_type_wrapper import EnumTypeWrapper
+
+from google.cloud.bigtable.data.execute_query._byte_cursor import _ByteCursor
+from google.cloud.bigtable.data._helpers import (
+ _attempt_timeout_generator,
+ _retry_exception_factory,
+)
+from google.cloud.bigtable.data.exceptions import (
+ EarlyMetadataCallError,
+ InvalidExecuteQueryResponse,
+)
+from google.cloud.bigtable.data.execute_query.values import QueryResultRow
+from google.cloud.bigtable.data.execute_query.metadata import Metadata
+from google.cloud.bigtable.data.execute_query._reader import (
+ _QueryResultRowReader,
+ _Reader,
+)
+from google.cloud.bigtable_v2.types.bigtable import (
+ ExecuteQueryRequest as ExecuteQueryRequestPB,
+ ExecuteQueryResponse,
+)
+
+from google.cloud.bigtable.data._cross_sync import CrossSync
+
+if TYPE_CHECKING:
+ if CrossSync.is_async:
+ from google.cloud.bigtable.data import BigtableDataClientAsync as DataClientType
+ else:
+ from google.cloud.bigtable.data import BigtableDataClient as DataClientType
+
+__CROSS_SYNC_OUTPUT__ = (
+ "google.cloud.bigtable.data.execute_query._sync_autogen.execute_query_iterator"
+)
+
+
+def _has_resume_token(response: ExecuteQueryResponse) -> bool:
+ response_pb = response._pb # proto-plus attribute retrieval is slow.
+ if response_pb.HasField("results"):
+ results = response_pb.results
+ return len(results.resume_token) > 0
+ return False
+
+
+@CrossSync.convert_class(sync_name="ExecuteQueryIterator")
+class ExecuteQueryIteratorAsync:
+ @CrossSync.convert(
+ docstring_format_vars={
+ "NO_LOOP": (
+ "RuntimeError: if the instance is not created within an async event loop context.",
+ "None",
+ ),
+ "TASK_OR_THREAD": ("asyncio Tasks", "threads"),
+ }
+ )
+ def __init__(
+ self,
+ client: DataClientType,
+ instance_id: str,
+ app_profile_id: Optional[str],
+ request_body: Dict[str, Any],
+ prepare_metadata: Metadata,
+ attempt_timeout: float | None,
+ operation_timeout: float,
+ req_metadata: Sequence[Tuple[str, str]] = (),
+ retryable_excs: Sequence[type[Exception]] = (),
+ column_info: dict[str, Message | EnumTypeWrapper] | None = None,
+ ) -> None:
+ """
+ Collects responses from ExecuteQuery requests and parses them into QueryResultRows.
+
+ **Please Note** this is not meant to be constructed directly by applications. It should always
+ be created via the client. The constructor is subject to change.
+
+ It is **not thread-safe**. It should not be used by multiple {TASK_OR_THREAD}.
+
+ Args:
+ client: bigtable client
+ instance_id: id of the instance on which the query is executed
+ request_body: dict representing the body of the ExecuteQueryRequest
+ attempt_timeout: the time budget for an individual network request, in seconds.
+ If it takes longer than this time to complete, the request will be cancelled with
+ a DeadlineExceeded exception, and a retry will be attempted.
+ operation_timeout: the time budget for the entire operation, in seconds.
+ Failed requests will be retried within the budget
+ req_metadata: metadata used while sending the gRPC request
+ retryable_excs: a list of errors that will be retried if encountered.
+ column_info: dict with mappings between column names and additional column information
+ for protobuf deserialization.
+ Raises:
+ {NO_LOOP}
+ :class:`ValueError ` as a safeguard if data is processed in an unexpected state
+ """
+ self._table_name = None
+ self._app_profile_id = app_profile_id
+ self._client = client
+ self._instance_id = instance_id
+ self._prepare_metadata: Metadata = prepare_metadata
+ self._final_metadata: Metadata | None = None
+ self._byte_cursor = _ByteCursor()
+ self._reader: _Reader[QueryResultRow] = _QueryResultRowReader()
+ self.has_received_token = False
+ self._result_generator = self._next_impl()
+ self._register_instance_task = None
+ self._fully_consumed = False
+ self._is_closed = False
+ self._request_body = request_body
+ self._attempt_timeout_gen = _attempt_timeout_generator(
+ attempt_timeout, operation_timeout
+ )
+ self._stream = CrossSync.retry_target_stream(
+ self._make_request_with_resume_token,
+ retries.if_exception_type(*retryable_excs),
+ retries.exponential_sleep_generator(0.01, 60, multiplier=2),
+ operation_timeout,
+ exception_factory=_retry_exception_factory,
+ )
+ self._req_metadata = req_metadata
+ self._column_info = column_info
+ try:
+ self._register_instance_task = CrossSync.create_task(
+ self._client._register_instance,
+ self._instance_id,
+ self.app_profile_id,
+ id(self),
+ sync_executor=self._client._executor,
+ )
+ except RuntimeError as e:
+ raise RuntimeError(
+ f"{self.__class__.__name__} must be created within an async event loop context."
+ ) from e
+
+ @property
+ def is_closed(self) -> bool:
+ """Returns True if the iterator is closed, False otherwise."""
+ return self._is_closed
+
+ @property
+ def app_profile_id(self) -> Optional[str]:
+ """Returns the app_profile_id of the iterator."""
+ return self._app_profile_id
+
+ @property
+ def table_name(self) -> Optional[str]:
+ """Returns the table_name of the iterator."""
+ return self._table_name
+
+ @CrossSync.convert
+ async def _make_request_with_resume_token(self):
+ """
+ perfoms the rpc call using the correct resume token.
+ """
+ resume_token = self._byte_cursor.prepare_for_new_request()
+ request = ExecuteQueryRequestPB(
+ {
+ **self._request_body,
+ "resume_token": resume_token,
+ }
+ )
+ return await self._client._gapic_client.execute_query(
+ request,
+ timeout=next(self._attempt_timeout_gen),
+ metadata=self._req_metadata,
+ retry=None,
+ )
+
+ @CrossSync.convert
+ async def _next_impl(self) -> CrossSync.Iterator[QueryResultRow]:
+ """
+ Generator wrapping the response stream which parses the stream results
+ and returns full `QueryResultRow`s.
+ """
+ try:
+ async for response in self._stream:
+ try:
+ # we've received a resume token, so we can finalize the metadata
+ if self._final_metadata is None and _has_resume_token(response):
+ self._finalize_metadata()
+
+ batches_to_parse = self._byte_cursor.consume(response)
+ if not batches_to_parse:
+ continue
+ # metadata must be set at this point since there must be a resume_token
+ # for byte_cursor to yield data
+ if not self.metadata:
+ raise ValueError(
+ "Error parsing response before finalizing metadata"
+ )
+ results = self._reader.consume(
+ batches_to_parse, self.metadata, self._column_info
+ )
+ if results is None:
+ continue
+
+ except ValueError as e:
+ raise InvalidExecuteQueryResponse(
+ "Invalid ExecuteQuery response received"
+ ) from e
+
+ for result in results:
+ yield result
+ # this means the stream has finished with no responses. In that case we know the
+ # latest_prepare_reponses was used successfully so we can finalize the metadata
+ if self._final_metadata is None:
+ self._finalize_metadata()
+ self._fully_consumed = True
+ finally:
+ self._close_internal()
+
+ @CrossSync.convert(sync_name="__next__", replace_symbols={"__anext__": "__next__"})
+ async def __anext__(self) -> QueryResultRow:
+ """
+ Yields QueryResultRows representing the results of the query.
+
+ :raises: :class:`ValueError ` as a safeguard if data is processed in an unexpected state
+ """
+ if self._is_closed:
+ raise CrossSync.StopIteration
+ return await self._result_generator.__anext__()
+
+ @CrossSync.convert(sync_name="__iter__")
+ def __aiter__(self):
+ return self
+
+ @CrossSync.convert
+ def _finalize_metadata(self) -> None:
+ """
+ Sets _final_metadata to the metadata of the latest prepare_response.
+ The iterator should call this after either the first resume token is received or the
+ stream completes succesfully with no responses.
+
+ This can't be set on init because the metadata will be able to change due to plan refresh.
+ Plan refresh isn't implemented yet, but we want functionality to stay the same when it is.
+
+ For example the following scenario for query "SELECT * FROM table":
+ - Make a request, table has one column family 'cf'
+ - Return an incomplete batch
+ - request fails with transient error
+ - Meanwhile the table has had a second column family added 'cf2'
+ - Retry the request, get an error indicating the `prepared_query` has expired
+ - Refresh the prepared_query and retry the request, the new prepared_query
+ contains both 'cf' & 'cf2'
+ - It sends a new incomplete batch and resets the old outdated batch
+ - It send the next chunk with a checksum and resume_token, closing the batch.
+ In this we need to use the updated schema from the refreshed prepare request.
+ """
+ self._final_metadata = self._prepare_metadata
+
+ @property
+ def metadata(self) -> Metadata:
+ """
+ Returns query metadata from the server or None if the iterator has been closed
+ or if metadata has not been set yet.
+
+ Metadata will not be set until the first row has been yielded or response with no rows
+ completes.
+
+ raises: :class:`EarlyMetadataCallError` when called before the first row has been returned
+ or the iterator has completed with no rows in the response.
+ """
+ if not self._final_metadata:
+ raise EarlyMetadataCallError()
+ return self._final_metadata
+
+ @CrossSync.convert
+ async def close(self) -> None:
+ """
+ Cancel all background tasks. Should be called after all rows were processed.
+
+ Called automatically by iterator
+
+ :raises: :class:`ValueError ` if called in an invalid state
+ """
+ # this doesn't need to be async anymore but we wrap the sync api to avoid a breaking
+ # change
+ self._close_internal()
+
+ def _close_internal(self) -> None:
+ if self._is_closed:
+ return
+ # Throw an error if the iterator has been successfully consumed but there is
+ # still buffered data
+ if self._fully_consumed and not self._byte_cursor.empty():
+ raise ValueError("Unexpected buffered data at end of executeQuery reqest")
+ self._is_closed = True
+ if self._register_instance_task is not None:
+ self._register_instance_task.cancel()
+ self._client._remove_instance_registration(
+ self._instance_id, self.app_profile_id, id(self)
+ )
diff --git a/google/cloud/bigtable/data/execute_query/_byte_cursor.py b/google/cloud/bigtable/data/execute_query/_byte_cursor.py
new file mode 100644
index 000000000..16eacbe9b
--- /dev/null
+++ b/google/cloud/bigtable/data/execute_query/_byte_cursor.py
@@ -0,0 +1,123 @@
+# Copyright 2024 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from typing import List, Optional
+
+from google.cloud.bigtable.data.execute_query._checksum import _CRC32C
+from google.cloud.bigtable_v2 import ExecuteQueryResponse
+
+
+class _ByteCursor:
+ """
+ Buffers bytes from `ExecuteQuery` responses until resume_token is received or end-of-stream
+ is reached. :class:`google.cloud.bigtable_v2.types.bigtable.ExecuteQueryResponse` obtained from
+ the server should be passed to the ``consume`` method and its non-None results should be passed
+ to appropriate :class:`google.cloud.bigtable.execute_query_reader._Reader` for parsing gathered
+ bytes.
+
+ This class consumes data obtained externally to be usable in both sync and async clients.
+
+ See :class:`google.cloud.bigtable.execute_query_reader._Reader` for more context.
+ """
+
+ def __init__(self):
+ self._batch_buffer = bytearray()
+ self._batches: List[bytes] = []
+ self._resume_token = None
+
+ def reset(self):
+ self._batch_buffer = bytearray()
+ self._batches = []
+
+ def prepare_for_new_request(self):
+ """
+ Prepares this ``_ByteCursor`` for retrying an ``ExecuteQuery`` request.
+
+ Clears internal buffers of this ``_ByteCursor`` and returns last received
+ ``resume_token`` to be used in retried request.
+
+ This is the only method that returns ``resume_token`` to the user.
+ Returning the token to the user is tightly coupled with clearing internal
+ buffers to prevent accidental retry without clearing the state, what would
+ cause invalid results. ``resume_token`` are not needed in other cases,
+ thus they is no separate getter for it.
+
+ Returns:
+ bytes: Last received resume_token.
+ """
+ # The first response of any retried stream will always contain reset, so
+ # this isn't actually necessary, but we do it for safety
+ self.reset()
+ return self._resume_token
+
+ def empty(self) -> bool:
+ return not self._batch_buffer and not self._batches
+
+ def consume(self, response: ExecuteQueryResponse) -> Optional[List[bytes]]:
+ """
+ Reads results bytes from an ``ExecuteQuery`` response and adds them to a buffer.
+
+ If the response contains a ``resume_token``:
+ - the ``resume_token`` is saved in this ``_ByteCursor``, and
+ - internal buffers are flushed and returned to the caller.
+
+ ``resume_token`` is not available directly, but can be retrieved by calling
+ :meth:`._ByteCursor.prepare_for_new_request` when preparing to retry a request.
+
+ Args:
+ response (google.cloud.bigtable_v2.types.bigtable.ExecuteQueryResponse):
+ Response obtained from the stream.
+
+ Returns:
+ bytes or None: List of bytes if buffers were flushed or None otherwise.
+ Each element in the list represents the bytes of a `ProtoRows` message.
+
+ Raises:
+ ValueError: If provided ``ExecuteQueryResponse`` is not valid
+ or contains bytes representing response of a different kind than previously
+ processed responses.
+ """
+ response_pb = response._pb # proto-plus attribute retrieval is slow.
+
+ if response_pb.HasField("results"):
+ results = response_pb.results
+ if results.reset:
+ self.reset()
+ if results.HasField("proto_rows_batch"):
+ self._batch_buffer.extend(results.proto_rows_batch.batch_data)
+ # Note that 0 is a valid checksum so we must check for field presence
+ if results.HasField("batch_checksum"):
+ expected_checksum = results.batch_checksum
+ checksum = _CRC32C.checksum(self._batch_buffer)
+ if expected_checksum != checksum:
+ raise ValueError(
+ f"Unexpected checksum mismatch. Expected: {expected_checksum}, got: {checksum}"
+ )
+ # We have a complete batch so we move it to batches and reset the
+ # batch_buffer
+ self._batches.append(memoryview(self._batch_buffer))
+ self._batch_buffer = bytearray()
+
+ if results.resume_token:
+ self._resume_token = results.resume_token
+
+ if self._batches:
+ if self._batch_buffer:
+ raise ValueError("Unexpected resume_token without checksum")
+ return_value = self._batches
+ self._batches = []
+ return return_value
+ else:
+ raise ValueError(f"Unexpected ExecuteQueryResponse: {response}")
+ return None
diff --git a/google/cloud/bigtable/data/execute_query/_checksum.py b/google/cloud/bigtable/data/execute_query/_checksum.py
new file mode 100644
index 000000000..b45a164d5
--- /dev/null
+++ b/google/cloud/bigtable/data/execute_query/_checksum.py
@@ -0,0 +1,43 @@
+# -*- coding: utf-8 -*-
+# Copyright 2025 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.
+#
+import warnings
+
+with warnings.catch_warnings(record=True) as import_warning:
+ import google_crc32c # type: ignore
+
+
+class _CRC32C(object):
+ """
+ Wrapper around ``google_crc32c`` library
+ """
+
+ warn_emitted = False
+
+ @classmethod
+ def checksum(cls, val: bytearray) -> int:
+ """
+ Returns the crc32c checksum of the data.
+ """
+ if import_warning and not cls.warn_emitted:
+ cls.warn_emitted = True
+ warnings.warn(
+ "Using pure python implementation of `google-crc32` for ExecuteQuery response "
+ "validation. This is significantly slower than the c extension. If possible, "
+ "run in an environment that supports the c extension.",
+ RuntimeWarning,
+ )
+ memory_view = memoryview(val)
+ return google_crc32c.value(bytes(memory_view))
diff --git a/google/cloud/bigtable/data/execute_query/_parameters_formatting.py b/google/cloud/bigtable/data/execute_query/_parameters_formatting.py
new file mode 100644
index 000000000..ed7e946e8
--- /dev/null
+++ b/google/cloud/bigtable/data/execute_query/_parameters_formatting.py
@@ -0,0 +1,155 @@
+# Copyright 2024 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import datetime
+from typing import Any, Dict, Optional
+
+from google.api_core.datetime_helpers import DatetimeWithNanoseconds
+
+from google.cloud.bigtable.data.exceptions import ParameterTypeInferenceFailed
+from google.cloud.bigtable.data.execute_query.metadata import SqlType
+from google.cloud.bigtable.data.execute_query.values import ExecuteQueryValueType
+from google.cloud.bigtable_v2.types.data import Value
+
+
+def _format_execute_query_params(
+ params: Optional[Dict[str, ExecuteQueryValueType]],
+ parameter_types: Optional[Dict[str, SqlType.Type]],
+) -> Dict[str, Value]:
+ """
+ Takes a dictionary of param_name -> param_value and optionally parameter types.
+ If the parameters types are not provided, this function tries to infer them.
+
+ Args:
+ params (Optional[Dict[str, ExecuteQueryValueType]]): mapping from parameter names
+ like they appear in query (without @ at the beginning) to their values.
+ Only values of type ExecuteQueryValueType are permitted.
+ parameter_types (Optional[Dict[str, SqlType.Type]]): mapping of parameter names
+ to their types.
+
+ Raises:
+ ValueError: raised when parameter types cannot be inferred and were not
+ provided explicitly.
+
+ Returns:
+ dictionary prasable to a protobuf represenging parameters as defined
+ in ExecuteQueryRequest.params
+ """
+ if not params:
+ return {}
+ parameter_types = parameter_types or {}
+
+ result_values = {}
+ for key, value in params.items():
+ user_provided_type = parameter_types.get(key)
+ try:
+ if user_provided_type:
+ if not isinstance(user_provided_type, SqlType.Type):
+ raise ValueError(
+ f"Parameter type for {key} should be provided as an instance of SqlType.Type subclass."
+ )
+ param_type = user_provided_type
+ else:
+ param_type = _detect_type(value)
+
+ value_pb_dict = _convert_value_to_pb_value_dict(value, param_type)
+ except ValueError as err:
+ raise ValueError(f"Error when parsing parameter {key}") from err
+ result_values[key] = value_pb_dict
+
+ return result_values
+
+
+def _to_param_types(
+ params: Optional[Dict[str, ExecuteQueryValueType]],
+ param_types: Optional[Dict[str, SqlType.Type]],
+) -> Dict[str, Dict[str, Any]]:
+ """
+ Takes the params and user supplied types and creates a param_type dict for the PrepareQuery api
+
+ Args:
+ params: Dict of param name to param value
+ param_types: Dict of param name to param type for params with types that cannot be inferred
+
+ Returns:
+ Dict containing the param name and type for each parameter
+ """
+ if params is None:
+ return {}
+ formatted_types = {}
+ for param_key, param_value in params.items():
+ if param_types and param_key in param_types:
+ formatted_types[param_key] = param_types[param_key]._to_type_pb_dict()
+ else:
+ formatted_types[param_key] = _detect_type(param_value)._to_type_pb_dict()
+ return formatted_types
+
+
+def _convert_value_to_pb_value_dict(
+ value: ExecuteQueryValueType, param_type: SqlType.Type
+) -> Any:
+ """
+ Takes a value and converts it to a dictionary parsable to a protobuf.
+
+ Args:
+ value (ExecuteQueryValueType): value
+ param_type (SqlType.Type): object describing which ExecuteQuery type the value represents.
+
+ Returns:
+ dictionary parsable to a protobuf.
+ """
+ # type field will be set only in top-level Value.
+ value_dict = param_type._to_value_pb_dict(value)
+ value_dict["type_"] = param_type._to_type_pb_dict()
+ return value_dict
+
+
+_TYPES_TO_TYPE_DICTS = [
+ (bytes, SqlType.Bytes()),
+ (str, SqlType.String()),
+ (bool, SqlType.Bool()),
+ (int, SqlType.Int64()),
+ (DatetimeWithNanoseconds, SqlType.Timestamp()),
+ (datetime.datetime, SqlType.Timestamp()),
+ (datetime.date, SqlType.Date()),
+]
+
+
+def _detect_type(value: ExecuteQueryValueType) -> SqlType.Type:
+ """
+ Infers the ExecuteQuery type based on value. Raises error if type is amiguous.
+ raises ParameterTypeInferenceFailed if not possible.
+ """
+ if value is None:
+ raise ParameterTypeInferenceFailed(
+ "Cannot infer type of None, please provide the type manually."
+ )
+
+ if isinstance(value, list):
+ raise ParameterTypeInferenceFailed(
+ "Cannot infer type of ARRAY parameters, please provide the type manually."
+ )
+
+ if isinstance(value, float):
+ raise ParameterTypeInferenceFailed(
+ "Cannot infer type of float, must specify either FLOAT32 or FLOAT64 type manually."
+ )
+
+ for field_type, type_dict in _TYPES_TO_TYPE_DICTS:
+ if isinstance(value, field_type):
+ return type_dict
+
+ raise ParameterTypeInferenceFailed(
+ f"Cannot infer type of {type(value).__name__}, please provide the type manually."
+ )
diff --git a/google/cloud/bigtable/data/execute_query/_query_result_parsing_utils.py b/google/cloud/bigtable/data/execute_query/_query_result_parsing_utils.py
new file mode 100644
index 000000000..a43539e55
--- /dev/null
+++ b/google/cloud/bigtable/data/execute_query/_query_result_parsing_utils.py
@@ -0,0 +1,265 @@
+# Copyright 2024 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+from __future__ import annotations
+
+from typing import Any, Callable, Dict, Type, Optional, Union
+
+from google.protobuf.message import Message
+from google.protobuf.internal.enum_type_wrapper import EnumTypeWrapper
+from google.cloud.bigtable.data.execute_query.values import Struct
+from google.cloud.bigtable.data.execute_query.metadata import SqlType
+from google.cloud.bigtable_v2 import Value as PBValue
+from google.api_core.datetime_helpers import DatetimeWithNanoseconds
+
+_REQUIRED_PROTO_FIELDS = {
+ SqlType.Bytes: "bytes_value",
+ SqlType.String: "string_value",
+ SqlType.Int64: "int_value",
+ SqlType.Float32: "float_value",
+ SqlType.Float64: "float_value",
+ SqlType.Bool: "bool_value",
+ SqlType.Timestamp: "timestamp_value",
+ SqlType.Date: "date_value",
+ SqlType.Struct: "array_value",
+ SqlType.Array: "array_value",
+ SqlType.Map: "array_value",
+ SqlType.Proto: "bytes_value",
+ SqlType.Enum: "int_value",
+}
+
+
+def _parse_array_type(
+ value: PBValue,
+ metadata_type: SqlType.Array,
+ column_name: str | None,
+ column_info: dict[str, Message | EnumTypeWrapper] | None = None,
+) -> list[Any]:
+ """
+ used for parsing an array represented as a protobuf to a python list.
+ """
+ return list(
+ map(
+ lambda val: _parse_pb_value_to_python_value(
+ val, metadata_type.element_type, column_name, column_info
+ ),
+ value.array_value.values,
+ )
+ )
+
+
+def _parse_map_type(
+ value: PBValue,
+ metadata_type: SqlType.Map,
+ column_name: str | None,
+ column_info: dict[str, Message | EnumTypeWrapper] | None = None,
+) -> dict[Any, Any]:
+ """
+ used for parsing a map represented as a protobuf to a python dict.
+
+ Values of type `Map` are stored in a `Value.array_value` where each entry
+ is another `Value.array_value` with two elements (the key and the value,
+ in that order).
+ Normally encoded Map values won't have repeated keys, however, the client
+ must handle the case in which they do. If the same key appears
+ multiple times, the _last_ value takes precedence.
+ """
+
+ try:
+ return dict(
+ map(
+ lambda map_entry: (
+ _parse_pb_value_to_python_value(
+ map_entry.array_value.values[0],
+ metadata_type.key_type,
+ f"{column_name}.key" if column_name is not None else None,
+ column_info,
+ ),
+ _parse_pb_value_to_python_value(
+ map_entry.array_value.values[1],
+ metadata_type.value_type,
+ f"{column_name}.value" if column_name is not None else None,
+ column_info,
+ ),
+ ),
+ value.array_value.values,
+ )
+ )
+ except IndexError:
+ raise ValueError("Invalid map entry - less or more than two values.")
+
+
+def _parse_struct_type(
+ value: PBValue,
+ metadata_type: SqlType.Struct,
+ column_name: str | None,
+ column_info: dict[str, Message | EnumTypeWrapper] | None = None,
+) -> Struct:
+ """
+ used for parsing a struct represented as a protobuf to a
+ google.cloud.bigtable.data.execute_query.Struct
+ """
+ if len(value.array_value.values) != len(metadata_type.fields):
+ raise ValueError("Mismatched lengths of values and types.")
+
+ struct = Struct()
+ for value, field in zip(value.array_value.values, metadata_type.fields):
+ field_name, field_type = field
+ nested_column_name: str | None
+ if column_name and field_name:
+ # qualify the column name for nested lookups
+ nested_column_name = f"{column_name}.{field_name}"
+ else:
+ nested_column_name = None
+ struct.add_field(
+ field_name,
+ _parse_pb_value_to_python_value(
+ value, field_type, nested_column_name, column_info
+ ),
+ )
+
+ return struct
+
+
+def _parse_timestamp_type(
+ value: PBValue,
+ metadata_type: SqlType.Timestamp,
+ column_name: str | None,
+ column_info: dict[str, Message | EnumTypeWrapper] | None = None,
+) -> DatetimeWithNanoseconds:
+ """
+ used for parsing a timestamp represented as a protobuf to DatetimeWithNanoseconds
+ """
+ return DatetimeWithNanoseconds.from_timestamp_pb(value.timestamp_value)
+
+
+def _parse_proto_type(
+ value: PBValue,
+ metadata_type: SqlType.Proto,
+ column_name: str | None,
+ column_info: dict[str, Message | EnumTypeWrapper] | None = None,
+) -> Message | bytes:
+ """
+ Parses a serialized protobuf message into a Message object using type information
+ provided in column_info.
+
+ Args:
+ value: The value to parse, expected to have a bytes_value attribute.
+ metadata_type: The expected SQL type (Proto).
+ column_name: The name of the column.
+ column_info: (Optional) A dictionary mapping column names to their
+ corresponding Protobuf Message classes. This information is used
+ to deserialize the raw bytes.
+
+ Returns:
+ A deserialized Protobuf Message object if parsing is successful.
+ If the required type information is not found in column_info, the function
+ returns the original serialized data as bytes (value.bytes_value).
+ This fallback ensures that the raw data is still accessible.
+
+ Raises:
+ google.protobuf.message.DecodeError: If `value.bytes_value` cannot be
+ parsed as the Message type specified in `column_info`.
+ """
+ if (
+ column_name is not None
+ and column_info is not None
+ and column_info.get(column_name) is not None
+ ):
+ default_proto_message = column_info.get(column_name)
+ if isinstance(default_proto_message, Message):
+ proto_message = type(default_proto_message)()
+ proto_message.ParseFromString(value.bytes_value)
+ return proto_message
+ return value.bytes_value
+
+
+def _parse_enum_type(
+ value: PBValue,
+ metadata_type: SqlType.Enum,
+ column_name: str | None,
+ column_info: dict[str, Message | EnumTypeWrapper] | None = None,
+) -> int | str:
+ """
+ Parses an integer value into a Protobuf enum name string using type information
+ provided in column_info.
+
+ Args:
+ value: The value to parse, expected to have an int_value attribute.
+ metadata_type: The expected SQL type (Enum).
+ column_name: The name of the column.
+ column_info: (Optional) A dictionary mapping column names to their
+ corresponding Protobuf EnumTypeWrapper objects. This information
+ is used to convert the integer to an enum name.
+
+ Returns:
+ A string representing the name of the enum value if conversion is successful.
+ If conversion fails for any reason, such as the required EnumTypeWrapper
+ not being found in column_info, or if an error occurs during the name lookup
+ (e.g., the integer is not a valid enum value), the function returns the
+ original integer value (value.int_value). This fallback ensures the
+ raw integer representation is still accessible.
+ """
+ if (
+ column_name is not None
+ and column_info is not None
+ and column_info.get(column_name) is not None
+ ):
+ proto_enum = column_info.get(column_name)
+ if isinstance(proto_enum, EnumTypeWrapper):
+ return proto_enum.Name(value.int_value)
+ return value.int_value
+
+
+ParserCallable = Callable[
+ [PBValue, Any, Optional[str], Optional[Dict[str, Union[Message, EnumTypeWrapper]]]],
+ Any,
+]
+
+_TYPE_PARSERS: Dict[Type[SqlType.Type], ParserCallable] = {
+ SqlType.Timestamp: _parse_timestamp_type,
+ SqlType.Struct: _parse_struct_type,
+ SqlType.Array: _parse_array_type,
+ SqlType.Map: _parse_map_type,
+ SqlType.Proto: _parse_proto_type,
+ SqlType.Enum: _parse_enum_type,
+}
+
+
+def _parse_pb_value_to_python_value(
+ value: PBValue,
+ metadata_type: SqlType.Type,
+ column_name: str | None,
+ column_info: dict[str, Message | EnumTypeWrapper] | None = None,
+) -> Any:
+ """
+ used for converting the value represented as a protobufs to a python object.
+ """
+ value_kind = value.WhichOneof("kind")
+ if not value_kind:
+ return None
+
+ kind = type(metadata_type)
+ if not value.HasField(_REQUIRED_PROTO_FIELDS[kind]):
+ raise ValueError(
+ f"{_REQUIRED_PROTO_FIELDS[kind]} field for {kind.__name__} type not found in a Value."
+ )
+
+ if kind in _TYPE_PARSERS:
+ parser = _TYPE_PARSERS[kind]
+ return parser(value, metadata_type, column_name, column_info)
+ elif kind in _REQUIRED_PROTO_FIELDS:
+ field_name = _REQUIRED_PROTO_FIELDS[kind]
+ return getattr(value, field_name)
+ else:
+ raise ValueError(f"Unknown kind {kind}")
diff --git a/google/cloud/bigtable/data/execute_query/_reader.py b/google/cloud/bigtable/data/execute_query/_reader.py
new file mode 100644
index 000000000..467c2030f
--- /dev/null
+++ b/google/cloud/bigtable/data/execute_query/_reader.py
@@ -0,0 +1,142 @@
+# Copyright 2024 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+from __future__ import annotations
+
+from typing import (
+ List,
+ TypeVar,
+ Generic,
+ Iterable,
+ Optional,
+ Sequence,
+)
+from abc import ABC, abstractmethod
+from google.protobuf.message import Message
+from google.protobuf.internal.enum_type_wrapper import EnumTypeWrapper
+
+from google.cloud.bigtable_v2 import ProtoRows, Value as PBValue
+
+from google.cloud.bigtable.data.execute_query._query_result_parsing_utils import (
+ _parse_pb_value_to_python_value,
+)
+
+from google.cloud.bigtable.helpers import batched
+
+from google.cloud.bigtable.data.execute_query.values import QueryResultRow
+from google.cloud.bigtable.data.execute_query.metadata import Metadata
+
+
+T = TypeVar("T")
+
+
+class _Reader(ABC, Generic[T]):
+ """
+ An interface for classes that consume and parse bytes returned by ``_ByteCursor``.
+ Parsed bytes should be gathered into bundles (rows or columns) of expected size
+ and converted to an appropriate type ``T`` that will be returned as a semantically
+ meaningful result to the library user by
+ :meth:`google.cloud.bigtable.instance.Instance.execute_query` or
+ :meth:`google.cloud.bigtable.data._async.client.BigtableDataClientAsync.execute_query`
+ methods.
+
+ This class consumes data obtained externally to be usable in both sync and async clients.
+
+ See :class:`google.cloud.bigtable.byte_cursor._ByteCursor` for more context.
+ """
+
+ @abstractmethod
+ def consume(
+ self,
+ batches_to_consume: List[bytes],
+ metadata: Metadata,
+ column_info: dict[str, Message | EnumTypeWrapper] | None = None,
+ ) -> Optional[Iterable[T]]:
+ """This method receives a list of batches of bytes to be parsed as ProtoRows messages.
+ It then uses the metadata to group the values in the parsed messages into rows. Returns
+ None if batches_to_consume is empty
+ Args:
+ bytes_to_consume (bytes): chunk of parsable byte batches received from
+ :meth:`google.cloud.bigtable.byte_cursor._ByteCursor.consume`
+ method.
+ metadata: metadata used to transform values to rows
+ column_info: (Optional) dict with mappings between column names and additional column information
+ for protobuf deserialization.
+
+ Returns:
+ Iterable[T] or None: Iterable if gathered values can form one or more instances of T,
+ or None if there is not enough data to construct at least one instance of T with
+ appropriate number of entries.
+ """
+ raise NotImplementedError
+
+
+class _QueryResultRowReader(_Reader[QueryResultRow]):
+ """
+ A :class:`._Reader` consuming bytes representing
+ :class:`google.cloud.bigtable_v2.types.Type`
+ and producing :class:`google.cloud.bigtable.execute_query.QueryResultRow`.
+
+ Number of entries in each row is determined by number of columns in
+ :class:`google.cloud.bigtable.execute_query.Metadata` obtained from
+ :class:`google.cloud.bigtable.byte_cursor._ByteCursor` passed in the constructor.
+ """
+
+ def _parse_proto_rows(self, bytes_to_parse: bytes) -> Iterable[PBValue]:
+ proto_rows = ProtoRows.pb().FromString(bytes_to_parse)
+ return proto_rows.values
+
+ def _construct_query_result_row(
+ self,
+ values: Sequence[PBValue],
+ metadata: Metadata,
+ column_info: dict[str, Message | EnumTypeWrapper] | None = None,
+ ) -> QueryResultRow:
+ result = QueryResultRow()
+ columns = metadata.columns
+
+ assert len(values) == len(
+ columns
+ ), "This function should be called only when count of values matches count of columns."
+
+ for column, value in zip(columns, values):
+ parsed_value = _parse_pb_value_to_python_value(
+ value, column.column_type, column.column_name, column_info
+ )
+ result.add_field(column.column_name, parsed_value)
+ return result
+
+ def consume(
+ self,
+ batches_to_consume: List[bytes],
+ metadata: Metadata,
+ column_info: dict[str, Message | EnumTypeWrapper] | None = None,
+ ) -> Optional[Iterable[QueryResultRow]]:
+ num_columns = len(metadata.columns)
+ rows = []
+ for batch_bytes in batches_to_consume:
+ values = self._parse_proto_rows(batch_bytes)
+ for row_data in batched(values, n=num_columns):
+ if len(row_data) == num_columns:
+ rows.append(
+ self._construct_query_result_row(
+ row_data, metadata, column_info
+ )
+ )
+ else:
+ raise ValueError(
+ "Unexpected error, recieved bad number of values. "
+ f"Expected {num_columns} got {len(row_data)}."
+ )
+
+ return rows
diff --git a/google/cloud/bigtable/data/execute_query/_sync_autogen/execute_query_iterator.py b/google/cloud/bigtable/data/execute_query/_sync_autogen/execute_query_iterator.py
new file mode 100644
index 000000000..68594d0e8
--- /dev/null
+++ b/google/cloud/bigtable/data/execute_query/_sync_autogen/execute_query_iterator.py
@@ -0,0 +1,259 @@
+# Copyright 2024 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+# This file is automatically generated by CrossSync. Do not edit manually.
+
+from __future__ import annotations
+from typing import Any, Dict, Optional, Sequence, Tuple, TYPE_CHECKING
+from google.api_core import retry as retries
+from google.protobuf.message import Message
+from google.protobuf.internal.enum_type_wrapper import EnumTypeWrapper
+from google.cloud.bigtable.data.execute_query._byte_cursor import _ByteCursor
+from google.cloud.bigtable.data._helpers import (
+ _attempt_timeout_generator,
+ _retry_exception_factory,
+)
+from google.cloud.bigtable.data.exceptions import (
+ EarlyMetadataCallError,
+ InvalidExecuteQueryResponse,
+)
+from google.cloud.bigtable.data.execute_query.values import QueryResultRow
+from google.cloud.bigtable.data.execute_query.metadata import Metadata
+from google.cloud.bigtable.data.execute_query._reader import (
+ _QueryResultRowReader,
+ _Reader,
+)
+from google.cloud.bigtable_v2.types.bigtable import (
+ ExecuteQueryRequest as ExecuteQueryRequestPB,
+ ExecuteQueryResponse,
+)
+from google.cloud.bigtable.data._cross_sync import CrossSync
+
+if TYPE_CHECKING:
+ from google.cloud.bigtable.data import BigtableDataClient as DataClientType
+
+
+def _has_resume_token(response: ExecuteQueryResponse) -> bool:
+ response_pb = response._pb
+ if response_pb.HasField("results"):
+ results = response_pb.results
+ return len(results.resume_token) > 0
+ return False
+
+
+class ExecuteQueryIterator:
+ def __init__(
+ self,
+ client: DataClientType,
+ instance_id: str,
+ app_profile_id: Optional[str],
+ request_body: Dict[str, Any],
+ prepare_metadata: Metadata,
+ attempt_timeout: float | None,
+ operation_timeout: float,
+ req_metadata: Sequence[Tuple[str, str]] = (),
+ retryable_excs: Sequence[type[Exception]] = (),
+ column_info: dict[str, Message | EnumTypeWrapper] | None = None,
+ ) -> None:
+ """Collects responses from ExecuteQuery requests and parses them into QueryResultRows.
+
+ **Please Note** this is not meant to be constructed directly by applications. It should always
+ be created via the client. The constructor is subject to change.
+
+ It is **not thread-safe**. It should not be used by multiple threads.
+
+ Args:
+ client: bigtable client
+ instance_id: id of the instance on which the query is executed
+ request_body: dict representing the body of the ExecuteQueryRequest
+ attempt_timeout: the time budget for an individual network request, in seconds.
+ If it takes longer than this time to complete, the request will be cancelled with
+ a DeadlineExceeded exception, and a retry will be attempted.
+ operation_timeout: the time budget for the entire operation, in seconds.
+ Failed requests will be retried within the budget
+ req_metadata: metadata used while sending the gRPC request
+ retryable_excs: a list of errors that will be retried if encountered.
+ column_info: dict with mappings between column names and additional column information
+ for protobuf deserialization.
+ Raises:
+ None
+ :class:`ValueError ` as a safeguard if data is processed in an unexpected state
+ """
+ self._table_name = None
+ self._app_profile_id = app_profile_id
+ self._client = client
+ self._instance_id = instance_id
+ self._prepare_metadata: Metadata = prepare_metadata
+ self._final_metadata: Metadata | None = None
+ self._byte_cursor = _ByteCursor()
+ self._reader: _Reader[QueryResultRow] = _QueryResultRowReader()
+ self.has_received_token = False
+ self._result_generator = self._next_impl()
+ self._register_instance_task = None
+ self._fully_consumed = False
+ self._is_closed = False
+ self._request_body = request_body
+ self._attempt_timeout_gen = _attempt_timeout_generator(
+ attempt_timeout, operation_timeout
+ )
+ self._stream = CrossSync._Sync_Impl.retry_target_stream(
+ self._make_request_with_resume_token,
+ retries.if_exception_type(*retryable_excs),
+ retries.exponential_sleep_generator(0.01, 60, multiplier=2),
+ operation_timeout,
+ exception_factory=_retry_exception_factory,
+ )
+ self._req_metadata = req_metadata
+ self._column_info = column_info
+ try:
+ self._register_instance_task = CrossSync._Sync_Impl.create_task(
+ self._client._register_instance,
+ self._instance_id,
+ self.app_profile_id,
+ id(self),
+ sync_executor=self._client._executor,
+ )
+ except RuntimeError as e:
+ raise RuntimeError(
+ f"{self.__class__.__name__} must be created within an async event loop context."
+ ) from e
+
+ @property
+ def is_closed(self) -> bool:
+ """Returns True if the iterator is closed, False otherwise."""
+ return self._is_closed
+
+ @property
+ def app_profile_id(self) -> Optional[str]:
+ """Returns the app_profile_id of the iterator."""
+ return self._app_profile_id
+
+ @property
+ def table_name(self) -> Optional[str]:
+ """Returns the table_name of the iterator."""
+ return self._table_name
+
+ def _make_request_with_resume_token(self):
+ """perfoms the rpc call using the correct resume token."""
+ resume_token = self._byte_cursor.prepare_for_new_request()
+ request = ExecuteQueryRequestPB(
+ {**self._request_body, "resume_token": resume_token}
+ )
+ return self._client._gapic_client.execute_query(
+ request,
+ timeout=next(self._attempt_timeout_gen),
+ metadata=self._req_metadata,
+ retry=None,
+ )
+
+ def _next_impl(self) -> CrossSync._Sync_Impl.Iterator[QueryResultRow]:
+ """Generator wrapping the response stream which parses the stream results
+ and returns full `QueryResultRow`s."""
+ try:
+ for response in self._stream:
+ try:
+ if self._final_metadata is None and _has_resume_token(response):
+ self._finalize_metadata()
+ batches_to_parse = self._byte_cursor.consume(response)
+ if not batches_to_parse:
+ continue
+ if not self.metadata:
+ raise ValueError(
+ "Error parsing response before finalizing metadata"
+ )
+ results = self._reader.consume(
+ batches_to_parse, self.metadata, self._column_info
+ )
+ if results is None:
+ continue
+ except ValueError as e:
+ raise InvalidExecuteQueryResponse(
+ "Invalid ExecuteQuery response received"
+ ) from e
+ for result in results:
+ yield result
+ if self._final_metadata is None:
+ self._finalize_metadata()
+ self._fully_consumed = True
+ finally:
+ self._close_internal()
+
+ def __next__(self) -> QueryResultRow:
+ """Yields QueryResultRows representing the results of the query.
+
+ :raises: :class:`ValueError ` as a safeguard if data is processed in an unexpected state
+ """
+ if self._is_closed:
+ raise CrossSync._Sync_Impl.StopIteration
+ return self._result_generator.__next__()
+
+ def __iter__(self):
+ return self
+
+ def _finalize_metadata(self) -> None:
+ """Sets _final_metadata to the metadata of the latest prepare_response.
+ The iterator should call this after either the first resume token is received or the
+ stream completes succesfully with no responses.
+
+ This can't be set on init because the metadata will be able to change due to plan refresh.
+ Plan refresh isn't implemented yet, but we want functionality to stay the same when it is.
+
+ For example the following scenario for query "SELECT * FROM table":
+ - Make a request, table has one column family 'cf'
+ - Return an incomplete batch
+ - request fails with transient error
+ - Meanwhile the table has had a second column family added 'cf2'
+ - Retry the request, get an error indicating the `prepared_query` has expired
+ - Refresh the prepared_query and retry the request, the new prepared_query
+ contains both 'cf' & 'cf2'
+ - It sends a new incomplete batch and resets the old outdated batch
+ - It send the next chunk with a checksum and resume_token, closing the batch.
+ In this we need to use the updated schema from the refreshed prepare request."""
+ self._final_metadata = self._prepare_metadata
+
+ @property
+ def metadata(self) -> Metadata:
+ """Returns query metadata from the server or None if the iterator has been closed
+ or if metadata has not been set yet.
+
+ Metadata will not be set until the first row has been yielded or response with no rows
+ completes.
+
+ raises: :class:`EarlyMetadataCallError` when called before the first row has been returned
+ or the iterator has completed with no rows in the response."""
+ if not self._final_metadata:
+ raise EarlyMetadataCallError()
+ return self._final_metadata
+
+ def close(self) -> None:
+ """Cancel all background tasks. Should be called after all rows were processed.
+
+ Called automatically by iterator
+
+ :raises: :class:`ValueError ` if called in an invalid state
+ """
+ self._close_internal()
+
+ def _close_internal(self) -> None:
+ if self._is_closed:
+ return
+ if self._fully_consumed and (not self._byte_cursor.empty()):
+ raise ValueError("Unexpected buffered data at end of executeQuery reqest")
+ self._is_closed = True
+ if self._register_instance_task is not None:
+ self._register_instance_task.cancel()
+ self._client._remove_instance_registration(
+ self._instance_id, self.app_profile_id, id(self)
+ )
diff --git a/google/cloud/bigtable/data/execute_query/metadata.py b/google/cloud/bigtable/data/execute_query/metadata.py
new file mode 100644
index 000000000..74b6cb836
--- /dev/null
+++ b/google/cloud/bigtable/data/execute_query/metadata.py
@@ -0,0 +1,425 @@
+# Copyright 2024 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This module provides the SqlType class used for specifying types in
+ExecuteQuery and some utilities.
+
+The SqlTypes are used in Metadata returned by the ExecuteQuery operation as well
+as for specifying query parameter types explicitly.
+"""
+
+from collections import defaultdict
+import datetime
+from typing import Any, Dict, List, Optional, Set, Tuple, Type, Union
+
+from google.api_core.datetime_helpers import DatetimeWithNanoseconds
+from google.protobuf import timestamp_pb2 # type: ignore
+from google.type import date_pb2 # type: ignore
+
+from google.cloud.bigtable.data.execute_query.values import _NamedList
+from google.cloud.bigtable_v2 import ResultSetMetadata
+from google.cloud.bigtable_v2 import Type as PBType
+
+
+class SqlType:
+ """
+ Classes denoting types of values returned by Bigtable's ExecuteQuery operation.
+
+ Used in :class:`.Metadata`.
+ """
+
+ class Type:
+ expected_type: Optional[type] = None
+ value_pb_dict_field_name: Optional[str] = None
+ type_field_name: Optional[str] = None
+
+ @classmethod
+ def from_pb_type(cls, pb_type: Optional[PBType] = None):
+ return cls()
+
+ def _to_type_pb_dict(self) -> Dict[str, Any]:
+ if not self.type_field_name:
+ raise NotImplementedError(
+ "Fill in expected_type and value_pb_dict_field_name"
+ )
+
+ return {self.type_field_name: {}}
+
+ def _to_value_pb_dict(self, value: Any) -> Dict[str, Any]:
+ if self.expected_type is None or self.value_pb_dict_field_name is None:
+ raise NotImplementedError(
+ "Fill in expected_type and value_pb_dict_field_name"
+ )
+
+ if value is None:
+ return {}
+
+ if not isinstance(value, self.expected_type):
+ raise ValueError(
+ f"Expected query parameter of type {self.expected_type.__name__}, got {type(value).__name__}"
+ )
+
+ return {self.value_pb_dict_field_name: value}
+
+ def __eq__(self, other):
+ return isinstance(other, type(self))
+
+ def __str__(self) -> str:
+ return self.__class__.__name__
+
+ def __repr__(self) -> str:
+ return self.__str__()
+
+ class Struct(_NamedList[Type], Type):
+ """Struct SQL type."""
+
+ @classmethod
+ def from_pb_type(cls, type_pb: Optional[PBType] = None) -> "SqlType.Struct":
+ if type_pb is None:
+ raise ValueError("missing required argument type_pb")
+ fields: List[Tuple[Optional[str], SqlType.Type]] = []
+ for field in type_pb.struct_type.fields:
+ fields.append((field.field_name, _pb_type_to_metadata_type(field.type)))
+ return cls(fields)
+
+ def _to_value_pb_dict(self, value: Any):
+ raise NotImplementedError("Struct is not supported as a query parameter")
+
+ def _to_type_pb_dict(self) -> Dict[str, Any]:
+ raise NotImplementedError("Struct is not supported as a query parameter")
+
+ def __eq__(self, other: object):
+ # Cannot use super() here - we'd either have to:
+ # - call super() in these base classes, which would in turn call Object.__eq__
+ # to compare objects by identity and return a False, or
+ # - do not call super() in these base classes, which would result in calling only
+ # one of the __eq__ methods (a super() in the base class would be required to call the other one), or
+ # - call super() in only one of the base classes, but that would be error prone and changing
+ # the order of base classes would introduce unexpected behaviour.
+ # we also have to disable mypy because it doesn't see that SqlType.Struct == _NamedList[Type]
+ return SqlType.Type.__eq__(self, other) and _NamedList.__eq__(self, other) # type: ignore
+
+ def __str__(self):
+ return super(_NamedList, self).__str__()
+
+ class Array(Type):
+ """Array SQL type."""
+
+ def __init__(self, element_type: "SqlType.Type"):
+ if isinstance(element_type, SqlType.Array):
+ raise ValueError("Arrays of arrays are not supported.")
+ if isinstance(element_type, SqlType.Map):
+ raise ValueError("Arrays of Maps are not supported.")
+ self._element_type = element_type
+
+ @property
+ def element_type(self):
+ return self._element_type
+
+ @classmethod
+ def from_pb_type(cls, type_pb: Optional[PBType] = None) -> "SqlType.Array":
+ if type_pb is None:
+ raise ValueError("missing required argument type_pb")
+ return cls(_pb_type_to_metadata_type(type_pb.array_type.element_type))
+
+ def _to_value_pb_dict(self, value: Any):
+ if value is None:
+ return {}
+
+ return {
+ "array_value": {
+ "values": [
+ self.element_type._to_value_pb_dict(entry) for entry in value
+ ]
+ }
+ }
+
+ def _to_type_pb_dict(self) -> Dict[str, Any]:
+ return {
+ "array_type": {"element_type": self.element_type._to_type_pb_dict()}
+ }
+
+ def __eq__(self, other):
+ return super().__eq__(other) and self.element_type == other.element_type
+
+ def __str__(self) -> str:
+ return f"{self.__class__.__name__}<{str(self.element_type)}>"
+
+ class Map(Type):
+ """Map SQL type."""
+
+ def __init__(self, key_type: "SqlType.Type", value_type: "SqlType.Type"):
+ self._key_type = key_type
+ self._value_type = value_type
+
+ @property
+ def key_type(self):
+ return self._key_type
+
+ @property
+ def value_type(self):
+ return self._value_type
+
+ @classmethod
+ def from_pb_type(cls, type_pb: Optional[PBType] = None) -> "SqlType.Map":
+ if type_pb is None:
+ raise ValueError("missing required argument type_pb")
+ return cls(
+ _pb_type_to_metadata_type(type_pb.map_type.key_type),
+ _pb_type_to_metadata_type(type_pb.map_type.value_type),
+ )
+
+ def _to_type_pb_dict(self) -> Dict[str, Any]:
+ raise NotImplementedError("Map is not supported as a query parameter")
+
+ def _to_value_pb_dict(self, value: Any):
+ raise NotImplementedError("Map is not supported as a query parameter")
+
+ def __eq__(self, other):
+ return (
+ super().__eq__(other)
+ and self.key_type == other.key_type
+ and self.value_type == other.value_type
+ )
+
+ def __str__(self) -> str:
+ return (
+ f"{self.__class__.__name__}<"
+ f"{str(self._key_type)},{str(self._value_type)}>"
+ )
+
+ class Bytes(Type):
+ """Bytes SQL type."""
+
+ expected_type = bytes
+ value_pb_dict_field_name = "bytes_value"
+ type_field_name = "bytes_type"
+
+ class String(Type):
+ """String SQL type."""
+
+ expected_type = str
+ value_pb_dict_field_name = "string_value"
+ type_field_name = "string_type"
+
+ class Int64(Type):
+ """Int64 SQL type."""
+
+ expected_type = int
+ value_pb_dict_field_name = "int_value"
+ type_field_name = "int64_type"
+
+ class Float64(Type):
+ """Float64 SQL type."""
+
+ expected_type = float
+ value_pb_dict_field_name = "float_value"
+ type_field_name = "float64_type"
+
+ class Float32(Type):
+ """Float32 SQL type."""
+
+ expected_type = float
+ value_pb_dict_field_name = "float_value"
+ type_field_name = "float32_type"
+
+ class Bool(Type):
+ """Bool SQL type."""
+
+ expected_type = bool
+ value_pb_dict_field_name = "bool_value"
+ type_field_name = "bool_type"
+
+ class Timestamp(Type):
+ """
+ Timestamp SQL type.
+
+ Timestamp supports :class:`DatetimeWithNanoseconds` but Bigtable SQL does
+ not currently support nanoseconds precision. We support this for potential
+ compatibility in the future. Nanoseconds are currently ignored.
+ """
+
+ type_field_name = "timestamp_type"
+ expected_types = (
+ datetime.datetime,
+ DatetimeWithNanoseconds,
+ )
+
+ def _to_value_pb_dict(self, value: Any) -> Dict[str, Any]:
+ if value is None:
+ return {}
+
+ if not isinstance(value, self.expected_types):
+ raise ValueError(
+ f"Expected one of {', '.join((_type.__name__ for _type in self.expected_types))}"
+ )
+
+ if isinstance(value, DatetimeWithNanoseconds):
+ return {"timestamp_value": value.timestamp_pb()}
+ else: # value must be an instance of datetime.datetime
+ ts = timestamp_pb2.Timestamp()
+ ts.FromDatetime(value)
+ return {"timestamp_value": ts}
+
+ class Date(Type):
+ """Date SQL type."""
+
+ type_field_name = "date_type"
+ expected_type = datetime.date
+
+ def _to_value_pb_dict(self, value: Any) -> Dict[str, Any]:
+ if value is None:
+ return {}
+
+ if not isinstance(value, self.expected_type):
+ raise ValueError(
+ f"Expected query parameter of type {self.expected_type.__name__}, got {type(value).__name__}"
+ )
+
+ return {
+ "date_value": date_pb2.Date(
+ year=value.year,
+ month=value.month,
+ day=value.day,
+ )
+ }
+
+ class Proto(Type):
+ """Proto SQL type."""
+
+ type_field_name = "proto_type"
+
+ def _to_value_pb_dict(self, value: Any):
+ raise NotImplementedError("Proto is not supported as a query parameter")
+
+ def _to_type_pb_dict(self) -> Dict[str, Any]:
+ raise NotImplementedError("Proto is not supported as a query parameter")
+
+ class Enum(Type):
+ """Enum SQL type."""
+
+ type_field_name = "enum_type"
+
+ def _to_value_pb_dict(self, value: Any):
+ raise NotImplementedError("Enum is not supported as a query parameter")
+
+ def _to_type_pb_dict(self) -> Dict[str, Any]:
+ raise NotImplementedError("Enum is not supported as a query parameter")
+
+
+class Metadata:
+ """
+ Metadata class for the ExecuteQuery operation.
+
+ Args:
+ columns (List[Tuple[Optional[str], SqlType.Type]]): List of column
+ metadata tuples. Each tuple contains the column name and the column
+ type.
+ """
+
+ class Column:
+ def __init__(self, column_name: Optional[str], column_type: SqlType.Type):
+ self._column_name = column_name
+ self._column_type = column_type
+
+ @property
+ def column_name(self) -> Optional[str]:
+ return self._column_name
+
+ @property
+ def column_type(self) -> SqlType.Type:
+ return self._column_type
+
+ @property
+ def columns(self) -> List[Column]:
+ return self._columns
+
+ def __init__(
+ self, columns: Optional[List[Tuple[Optional[str], SqlType.Type]]] = None
+ ):
+ self._columns: List[Metadata.Column] = []
+ self._column_indexes: Dict[str, List[int]] = defaultdict(list)
+ self._duplicate_names: Set[str] = set()
+
+ if columns:
+ for column_name, column_type in columns:
+ if column_name is not None:
+ if column_name in self._column_indexes:
+ self._duplicate_names.add(column_name)
+ self._column_indexes[column_name].append(len(self._columns))
+ self._columns.append(Metadata.Column(column_name, column_type))
+
+ def __getitem__(self, index_or_name: Union[str, int]) -> Column:
+ if isinstance(index_or_name, str):
+ if index_or_name in self._duplicate_names:
+ raise KeyError(
+ f"Ambigious column name: '{index_or_name}', use index instead."
+ f" Field present on indexes {', '.join(map(str, self._column_indexes[index_or_name]))}."
+ )
+ if index_or_name not in self._column_indexes:
+ raise KeyError(f"No such column: {index_or_name}")
+ index = self._column_indexes[index_or_name][0]
+ else:
+ index = index_or_name
+ return self._columns[index]
+
+ def __len__(self):
+ return len(self._columns)
+
+ def __str__(self) -> str:
+ columns_str = ", ".join([str(column) for column in self._columns])
+ return f"{self.__class__.__name__}([{columns_str}])"
+
+ def __repr__(self) -> str:
+ return self.__str__()
+
+
+def _pb_metadata_to_metadata_types(
+ metadata_pb: ResultSetMetadata,
+) -> Metadata:
+ if "proto_schema" in metadata_pb:
+ fields: List[Tuple[Optional[str], SqlType.Type]] = []
+ if not metadata_pb.proto_schema.columns:
+ raise ValueError("Invalid empty ResultSetMetadata received.")
+ for column_metadata in metadata_pb.proto_schema.columns:
+ fields.append(
+ (column_metadata.name, _pb_type_to_metadata_type(column_metadata.type))
+ )
+ return Metadata(fields)
+ raise ValueError("Invalid ResultSetMetadata object received.")
+
+
+_PROTO_TYPE_TO_METADATA_TYPE_FACTORY: Dict[str, Type[SqlType.Type]] = {
+ "bytes_type": SqlType.Bytes,
+ "string_type": SqlType.String,
+ "int64_type": SqlType.Int64,
+ "float32_type": SqlType.Float32,
+ "float64_type": SqlType.Float64,
+ "bool_type": SqlType.Bool,
+ "timestamp_type": SqlType.Timestamp,
+ "date_type": SqlType.Date,
+ "proto_type": SqlType.Proto,
+ "enum_type": SqlType.Enum,
+ "struct_type": SqlType.Struct,
+ "array_type": SqlType.Array,
+ "map_type": SqlType.Map,
+}
+
+
+def _pb_type_to_metadata_type(type_pb: PBType) -> SqlType.Type:
+ kind = PBType.pb(type_pb).WhichOneof("kind")
+ if kind in _PROTO_TYPE_TO_METADATA_TYPE_FACTORY:
+ return _PROTO_TYPE_TO_METADATA_TYPE_FACTORY[kind].from_pb_type(type_pb)
+ raise ValueError(f"Unrecognized response data type: {type_pb}")
diff --git a/google/cloud/bigtable/data/execute_query/values.py b/google/cloud/bigtable/data/execute_query/values.py
new file mode 100644
index 000000000..80a0bff6f
--- /dev/null
+++ b/google/cloud/bigtable/data/execute_query/values.py
@@ -0,0 +1,123 @@
+# Copyright 2024 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from collections import defaultdict
+from typing import (
+ Optional,
+ List,
+ Dict,
+ Set,
+ Union,
+ TypeVar,
+ Generic,
+ Tuple,
+ Mapping,
+)
+from google.type import date_pb2 # type: ignore
+from google.api_core.datetime_helpers import DatetimeWithNanoseconds
+
+T = TypeVar("T")
+
+
+class _NamedList(Generic[T]):
+ """
+ A class designed to store a list of elements, which can be accessed by
+ name or index.
+ This class is different from namedtuple, because namedtuple has some
+ restrictions on names of fields and we do not want to have them.
+ """
+
+ _str_cls_name = "_NamedList"
+
+ def __init__(self, fields: Optional[List[Tuple[Optional[str], T]]] = None):
+ self._fields: List[Tuple[Optional[str], T]] = []
+ self._field_indexes: Dict[str, List[int]] = defaultdict(list)
+ self._duplicate_names: Set[str] = set()
+
+ if fields:
+ for field_name, field_type in fields:
+ self.add_field(field_name, field_type)
+
+ def add_field(self, name: Optional[str], value: T):
+ if name:
+ if name in self._field_indexes:
+ self._duplicate_names.add(name)
+ self._field_indexes[name].append(len(self._fields))
+ self._fields.append((name, value))
+
+ @property
+ def fields(self):
+ return self._fields
+
+ def __getitem__(self, index_or_name: Union[str, int]):
+ if isinstance(index_or_name, str):
+ if index_or_name in self._duplicate_names:
+ raise KeyError(
+ f"Ambigious field name: '{index_or_name}', use index instead."
+ f" Field present on indexes {', '.join(map(str, self._field_indexes[index_or_name]))}."
+ )
+ if index_or_name not in self._field_indexes:
+ raise KeyError(f"No such field: {index_or_name}")
+ index = self._field_indexes[index_or_name][0]
+ else:
+ index = index_or_name
+ return self._fields[index][1]
+
+ def __len__(self):
+ return len(self._fields)
+
+ def __eq__(self, other):
+ if not isinstance(other, _NamedList):
+ return False
+
+ return (
+ self._fields == other._fields
+ and self._field_indexes == other._field_indexes
+ )
+
+ def __str__(self) -> str:
+ fields_str = ", ".join([str(field) for field in self._fields])
+ return f"{self.__class__.__name__}([{fields_str}])"
+
+ def __repr__(self) -> str:
+ return self.__str__()
+
+
+ExecuteQueryValueType = Union[
+ int,
+ float,
+ bool,
+ bytes,
+ str,
+ # Note that Bigtable SQL does not currently support nanosecond precision,
+ # only microseconds. We use this for compatibility with potential future
+ # support
+ DatetimeWithNanoseconds,
+ date_pb2.Date,
+ "Struct",
+ List["ExecuteQueryValueType"],
+ Mapping[Union[str, int, bytes], "ExecuteQueryValueType"],
+]
+
+
+class QueryResultRow(_NamedList[ExecuteQueryValueType]):
+ """
+ Represents a single row of the result
+ """
+
+
+class Struct(_NamedList[ExecuteQueryValueType]):
+ """
+ Represents a struct value in the result
+ """
diff --git a/google/cloud/bigtable/data/mutations.py b/google/cloud/bigtable/data/mutations.py
new file mode 100644
index 000000000..f19b1e49e
--- /dev/null
+++ b/google/cloud/bigtable/data/mutations.py
@@ -0,0 +1,457 @@
+# Copyright 2023 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 annotations
+from typing import Any
+import time
+from dataclasses import dataclass
+from abc import ABC, abstractmethod
+from sys import getsizeof
+
+import google.cloud.bigtable_v2.types.bigtable as types_pb
+import google.cloud.bigtable_v2.types.data as data_pb
+
+from google.cloud.bigtable.data.read_modify_write_rules import _MAX_INCREMENT_VALUE
+
+
+# special value for SetCell mutation timestamps. If set, server will assign a timestamp
+_SERVER_SIDE_TIMESTAMP = -1
+
+# mutation entries above this should be rejected
+_MUTATE_ROWS_REQUEST_MUTATION_LIMIT = 100_000
+
+
+class Mutation(ABC):
+ """
+ Abstract base class for mutations.
+
+ This class defines the interface for different types of mutations that can be
+ applied to Bigtable rows.
+ """
+
+ @abstractmethod
+ def _to_dict(self) -> dict[str, Any]:
+ """
+ Convert the mutation to a dictionary representation.
+
+ Returns:
+ dict[str, Any]: A dictionary representation of the mutation.
+ """
+ raise NotImplementedError
+
+ def _to_pb(self) -> data_pb.Mutation:
+ """
+ Convert the mutation to a protobuf representation.
+
+ Returns:
+ Mutation: A protobuf representation of the mutation.
+ """
+ return data_pb.Mutation(**self._to_dict())
+
+ def is_idempotent(self) -> bool:
+ """
+ Check if the mutation is idempotent
+
+ Idempotent mutations can be safely retried on failure.
+
+ Returns:
+ bool: True if the mutation is idempotent, False otherwise.
+ """
+ return True
+
+ def __str__(self) -> str:
+ """
+ Return a string representation of the mutation.
+
+ Returns:
+ str: A string representation of the mutation.
+ """
+ return str(self._to_dict())
+
+ def size(self) -> int:
+ """
+ Get the size of the mutation in bytes
+
+ Returns:
+ int: The size of the mutation in bytes.
+ """
+ return getsizeof(self._to_dict())
+
+ @classmethod
+ def _from_dict(cls, input_dict: dict[str, Any]) -> Mutation:
+ """
+ Create a `Mutation` instance from a dictionary representation.
+
+ Args:
+ input_dict: A dictionary representation of the mutation.
+ Returns:
+ Mutation: A Mutation instance created from the dictionary.
+ Raises:
+ ValueError: If the input dictionary is invalid or does not represent a valid mutation type.
+ """
+ instance: Mutation | None = None
+ try:
+ if "set_cell" in input_dict:
+ details = input_dict["set_cell"]
+ instance = SetCell(
+ details["family_name"],
+ details["column_qualifier"],
+ details["value"],
+ details["timestamp_micros"],
+ )
+ elif "delete_from_column" in input_dict:
+ details = input_dict["delete_from_column"]
+ time_range = details.get("time_range", {})
+ start = time_range.get("start_timestamp_micros", None)
+ end = time_range.get("end_timestamp_micros", None)
+ instance = DeleteRangeFromColumn(
+ details["family_name"], details["column_qualifier"], start, end
+ )
+ elif "delete_from_family" in input_dict:
+ details = input_dict["delete_from_family"]
+ instance = DeleteAllFromFamily(details["family_name"])
+ elif "delete_from_row" in input_dict:
+ instance = DeleteAllFromRow()
+ elif "add_to_cell" in input_dict:
+ details = input_dict["add_to_cell"]
+ instance = AddToCell(
+ details["family_name"],
+ details["column_qualifier"]["raw_value"],
+ details["input"]["int_value"],
+ details["timestamp"]["raw_timestamp_micros"],
+ )
+ except KeyError as e:
+ raise ValueError("Invalid mutation dictionary") from e
+ if instance is None:
+ raise ValueError("No valid mutation found")
+ if not issubclass(instance.__class__, cls):
+ raise ValueError("Mutation type mismatch")
+ return instance
+
+
+class SetCell(Mutation):
+ """
+ Mutation to set the value of a cell.
+
+ Args:
+ family: The name of the column family to which the new cell belongs.
+ qualifier: The column qualifier of the new cell.
+ new_value: The value of the new cell.
+ timestamp_micros: The timestamp of the new cell. If `None`,
+ the current timestamp will be used. Timestamps will be sent with
+ millisecond precision. Extra precision will be truncated. If -1, the
+ server will assign a timestamp. Note that `SetCell` mutations with
+ server-side timestamps are non-idempotent operations and will not be retried.
+
+ Raises:
+ TypeError: If `qualifier` is not `bytes` or `str`.
+ TypeError: If `new_value` is not `bytes`, `str`, or `int`.
+ ValueError: If `timestamp_micros` is less than `_SERVER_SIDE_TIMESTAMP`.
+ """
+
+ def __init__(
+ self,
+ family: str,
+ qualifier: bytes | str,
+ new_value: bytes | str | int,
+ timestamp_micros: int | None = None,
+ ):
+ qualifier = qualifier.encode() if isinstance(qualifier, str) else qualifier
+ if not isinstance(qualifier, bytes):
+ raise TypeError("qualifier must be bytes or str")
+ if isinstance(new_value, str):
+ new_value = new_value.encode()
+ elif isinstance(new_value, int):
+ if abs(new_value) > _MAX_INCREMENT_VALUE:
+ raise ValueError(
+ "int values must be between -2**63 and 2**63 (64-bit signed int)"
+ )
+ new_value = new_value.to_bytes(8, "big", signed=True)
+ if not isinstance(new_value, bytes):
+ raise TypeError("new_value must be bytes, str, or int")
+ if timestamp_micros is None:
+ # use current timestamp, with milisecond precision
+ timestamp_micros = time.time_ns() // 1000
+ timestamp_micros = timestamp_micros - (timestamp_micros % 1000)
+ if timestamp_micros < _SERVER_SIDE_TIMESTAMP:
+ raise ValueError(
+ f"timestamp_micros must be positive (or {_SERVER_SIDE_TIMESTAMP} for server-side timestamp)"
+ )
+ self.family = family
+ self.qualifier = qualifier
+ self.new_value = new_value
+ self.timestamp_micros = timestamp_micros
+
+ def _to_dict(self) -> dict[str, Any]:
+ return {
+ "set_cell": {
+ "family_name": self.family,
+ "column_qualifier": self.qualifier,
+ "timestamp_micros": self.timestamp_micros,
+ "value": self.new_value,
+ }
+ }
+
+ def is_idempotent(self) -> bool:
+ return self.timestamp_micros != _SERVER_SIDE_TIMESTAMP
+
+
+@dataclass
+class DeleteRangeFromColumn(Mutation):
+ """
+ Mutation to delete a range of cells from a column.
+
+ Args:
+ family: The name of the column family.
+ qualifier: The column qualifier.
+ start_timestamp_micros: The start timestamp of the range to
+ delete. `None` represents 0. Defaults to `None`.
+ end_timestamp_micros: The end timestamp of the range to
+ delete. `None` represents infinity. Defaults to `None`.
+ Raises:
+ ValueError: If `start_timestamp_micros` is greater than `end_timestamp_micros`.
+ """
+
+ family: str
+ qualifier: bytes
+ # None represents 0
+ start_timestamp_micros: int | None = None
+ # None represents infinity
+ end_timestamp_micros: int | None = None
+
+ def __post_init__(self):
+ if (
+ self.start_timestamp_micros is not None
+ and self.end_timestamp_micros is not None
+ and self.start_timestamp_micros > self.end_timestamp_micros
+ ):
+ raise ValueError("start_timestamp_micros must be <= end_timestamp_micros")
+
+ def _to_dict(self) -> dict[str, Any]:
+ timestamp_range = {}
+ if self.start_timestamp_micros is not None:
+ timestamp_range["start_timestamp_micros"] = self.start_timestamp_micros
+ if self.end_timestamp_micros is not None:
+ timestamp_range["end_timestamp_micros"] = self.end_timestamp_micros
+ return {
+ "delete_from_column": {
+ "family_name": self.family,
+ "column_qualifier": self.qualifier,
+ "time_range": timestamp_range,
+ }
+ }
+
+
+@dataclass
+class DeleteAllFromFamily(Mutation):
+ """
+ Mutation to delete all cells from a column family.
+
+ Args:
+ family_to_delete: The name of the column family to delete.
+ """
+
+ family_to_delete: str
+
+ def _to_dict(self) -> dict[str, Any]:
+ return {
+ "delete_from_family": {
+ "family_name": self.family_to_delete,
+ }
+ }
+
+
+@dataclass
+class DeleteAllFromRow(Mutation):
+ """
+ Mutation to delete all cells from a row.
+ """
+
+ def _to_dict(self) -> dict[str, Any]:
+ return {
+ "delete_from_row": {},
+ }
+
+
+@dataclass
+class AddToCell(Mutation):
+ """
+ Adds an int64 value to an aggregate cell. The column family must be an
+ aggregate family and have an "int64" input type or this mutation will be
+ rejected.
+
+ Note: The timestamp values are in microseconds but must match the
+ granularity of the table (defaults to `MILLIS`). Therefore, the given value
+ must be a multiple of 1000 (millisecond granularity). For example:
+ `1571902339435000`.
+
+ Args:
+ family: The name of the column family to which the cell belongs.
+ qualifier: The column qualifier of the cell.
+ value: The value to be accumulated into the cell.
+ timestamp_micros: The timestamp of the cell. Must be provided for
+ cell aggregation to work correctly.
+
+
+ Raises:
+ TypeError: If `qualifier` is not `bytes` or `str`.
+ TypeError: If `value` is not `int`.
+ TypeError: If `timestamp_micros` is not `int`.
+ ValueError: If `value` is out of bounds for a 64-bit signed int.
+ ValueError: If `timestamp_micros` is less than 0.
+ """
+
+ def __init__(
+ self,
+ family: str,
+ qualifier: bytes | str,
+ value: int,
+ timestamp_micros: int,
+ ):
+ qualifier = qualifier.encode() if isinstance(qualifier, str) else qualifier
+ if not isinstance(qualifier, bytes):
+ raise TypeError("qualifier must be bytes or str")
+ if not isinstance(value, int):
+ raise TypeError("value must be int")
+ if not isinstance(timestamp_micros, int):
+ raise TypeError("timestamp_micros must be int")
+ if abs(value) > _MAX_INCREMENT_VALUE:
+ raise ValueError(
+ "int values must be between -2**63 and 2**63 (64-bit signed int)"
+ )
+
+ if timestamp_micros < 0:
+ raise ValueError("timestamp must be non-negative")
+
+ self.family = family
+ self.qualifier = qualifier
+ self.value = value
+ self.timestamp = timestamp_micros
+
+ def _to_dict(self) -> dict[str, Any]:
+ return {
+ "add_to_cell": {
+ "family_name": self.family,
+ "column_qualifier": {"raw_value": self.qualifier},
+ "timestamp": {"raw_timestamp_micros": self.timestamp},
+ "input": {"int_value": self.value},
+ }
+ }
+
+ def is_idempotent(self) -> bool:
+ return False
+
+
+class RowMutationEntry:
+ """
+ A single entry in a `MutateRows` request.
+
+ This class represents a set of mutations to apply to a specific row in a
+ Bigtable table.
+
+ Args:
+ row_key: The key of the row to mutate.
+ mutations: The mutation or list of mutations to apply
+ to the row.
+
+ Raises:
+ ValueError: If `mutations` is empty or contains more than
+ `_MUTATE_ROWS_REQUEST_MUTATION_LIMIT` mutations.
+ """
+
+ def __init__(self, row_key: bytes | str, mutations: Mutation | list[Mutation]):
+ if isinstance(row_key, str):
+ row_key = row_key.encode("utf-8")
+ if isinstance(mutations, Mutation):
+ mutations = [mutations]
+ if len(mutations) == 0:
+ raise ValueError("mutations must not be empty")
+ elif len(mutations) > _MUTATE_ROWS_REQUEST_MUTATION_LIMIT:
+ raise ValueError(
+ f"entries must have <= {_MUTATE_ROWS_REQUEST_MUTATION_LIMIT} mutations"
+ )
+ self.row_key = row_key
+ self.mutations = tuple(mutations)
+
+ def _to_dict(self) -> dict[str, Any]:
+ """
+ Convert the mutation entry to a dictionary representation.
+
+ Returns:
+ dict[str, Any]: A dictionary representation of the mutation entry
+ """
+ return {
+ "row_key": self.row_key,
+ "mutations": [mutation._to_dict() for mutation in self.mutations],
+ }
+
+ def _to_pb(self) -> types_pb.MutateRowsRequest.Entry:
+ """
+ Convert the mutation entry to a protobuf representation.
+
+ Returns:
+ MutateRowsRequest.Entry: A protobuf representation of the mutation entry.
+ """
+ return types_pb.MutateRowsRequest.Entry(
+ row_key=self.row_key,
+ mutations=[mutation._to_pb() for mutation in self.mutations],
+ )
+
+ def is_idempotent(self) -> bool:
+ """
+ Check if all mutations in the entry are idempotent.
+
+ Returns:
+ bool: True if all mutations in the entry are idempotent, False otherwise.
+ """
+ return all(mutation.is_idempotent() for mutation in self.mutations)
+
+ def size(self) -> int:
+ """
+ Get the size of the mutation entry in bytes.
+
+ Returns:
+ int: The size of the mutation entry in bytes.
+ """
+ return getsizeof(self._to_dict())
+
+ @classmethod
+ def _from_dict(cls, input_dict: dict[str, Any]) -> RowMutationEntry:
+ """
+ Create a `RowMutationEntry` instance from a dictionary representation.
+
+ Args:
+ input_dict: A dictionary representation of the mutation entry.
+
+ Returns:
+ RowMutationEntry: A RowMutationEntry instance created from the dictionary.
+ """
+ return RowMutationEntry(
+ row_key=input_dict["row_key"],
+ mutations=[
+ Mutation._from_dict(mutation) for mutation in input_dict["mutations"]
+ ],
+ )
+
+
+@dataclass
+class _EntryWithProto:
+ """
+ A dataclass to hold a RowMutationEntry and its corresponding proto representation.
+
+ Used in _MutateRowsOperation to avoid repeated conversion of RowMutationEntry to proto.
+ """
+
+ entry: RowMutationEntry
+ proto: types_pb.MutateRowsRequest.Entry
diff --git a/google/cloud/bigtable/data/read_modify_write_rules.py b/google/cloud/bigtable/data/read_modify_write_rules.py
new file mode 100644
index 000000000..e4446f755
--- /dev/null
+++ b/google/cloud/bigtable/data/read_modify_write_rules.py
@@ -0,0 +1,112 @@
+# Copyright 2023 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 annotations
+
+import abc
+
+import google.cloud.bigtable_v2.types.data as data_pb
+
+# value must fit in 64-bit signed integer
+_MAX_INCREMENT_VALUE = (1 << 63) - 1
+
+
+class ReadModifyWriteRule(abc.ABC):
+ """
+ Abstract base class for read-modify-write rules.
+ """
+
+ def __init__(self, family: str, qualifier: bytes | str):
+ qualifier = (
+ qualifier if isinstance(qualifier, bytes) else qualifier.encode("utf-8")
+ )
+ self.family = family
+ self.qualifier = qualifier
+
+ @abc.abstractmethod
+ def _to_dict(self) -> dict[str, str | bytes | int]:
+ raise NotImplementedError
+
+ def _to_pb(self) -> data_pb.ReadModifyWriteRule:
+ return data_pb.ReadModifyWriteRule(**self._to_dict())
+
+
+class IncrementRule(ReadModifyWriteRule):
+ """
+ Rule to increment a cell's value.
+
+ Args:
+ family:
+ The family name of the cell to increment.
+ qualifier:
+ The qualifier of the cell to increment.
+ increment_amount:
+ The amount to increment the cell's value. Must be between -2**63 and 2**63 (64-bit signed int).
+ Raises:
+ TypeError:
+ If increment_amount is not an integer.
+ ValueError:
+ If increment_amount is not between -2**63 and 2**63 (64-bit signed int).
+ """
+
+ def __init__(self, family: str, qualifier: bytes | str, increment_amount: int = 1):
+ if not isinstance(increment_amount, int):
+ raise TypeError("increment_amount must be an integer")
+ if abs(increment_amount) > _MAX_INCREMENT_VALUE:
+ raise ValueError(
+ "increment_amount must be between -2**63 and 2**63 (64-bit signed int)"
+ )
+ super().__init__(family, qualifier)
+ self.increment_amount = increment_amount
+
+ def _to_dict(self) -> dict[str, str | bytes | int]:
+ return {
+ "family_name": self.family,
+ "column_qualifier": self.qualifier,
+ "increment_amount": self.increment_amount,
+ }
+
+
+class AppendValueRule(ReadModifyWriteRule):
+ """
+ Rule to append a value to a cell's value.
+
+ Args:
+ family:
+ The family name of the cell to append to.
+ qualifier:
+ The qualifier of the cell to append to.
+ append_value:
+ The value to append to the cell's value.
+ Raises:
+ TypeError: If append_value is not bytes or str.
+ """
+
+ def __init__(self, family: str, qualifier: bytes | str, append_value: bytes | str):
+ append_value = (
+ append_value.encode("utf-8")
+ if isinstance(append_value, str)
+ else append_value
+ )
+ if not isinstance(append_value, bytes):
+ raise TypeError("append_value must be bytes or str")
+ super().__init__(family, qualifier)
+ self.append_value = append_value
+
+ def _to_dict(self) -> dict[str, str | bytes | int]:
+ return {
+ "family_name": self.family,
+ "column_qualifier": self.qualifier,
+ "append_value": self.append_value,
+ }
diff --git a/google/cloud/bigtable/data/read_rows_query.py b/google/cloud/bigtable/data/read_rows_query.py
new file mode 100644
index 000000000..7652bfbb9
--- /dev/null
+++ b/google/cloud/bigtable/data/read_rows_query.py
@@ -0,0 +1,536 @@
+# Copyright 2023 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 annotations
+from typing import TYPE_CHECKING, Any
+from bisect import bisect_left
+from bisect import bisect_right
+from collections import defaultdict
+from google.cloud.bigtable.data.row_filters import RowFilter
+
+from google.cloud.bigtable_v2.types import RowRange as RowRangePB
+from google.cloud.bigtable_v2.types import RowSet as RowSetPB
+from google.cloud.bigtable_v2.types import ReadRowsRequest as ReadRowsRequestPB
+
+if TYPE_CHECKING:
+ from google.cloud.bigtable.data import RowKeySamples
+ from google.cloud.bigtable.data import ShardedQuery
+
+
+class RowRange:
+ """
+ Represents a range of keys in a ReadRowsQuery
+
+ Args:
+ start_key: The start key of the range. If empty, the range is unbounded on the left.
+ end_key: The end key of the range. If empty, the range is unbounded on the right.
+ start_is_inclusive: Whether the start key is inclusive. If None, the start key is
+ inclusive.
+ end_is_inclusive: Whether the end key is inclusive. If None, the end key is not inclusive.
+ Raises:
+ ValueError: if start_key is greater than end_key, or start_is_inclusive
+ ValueError: if end_is_inclusive is set when the corresponding key is None
+ ValueError: if start_key or end_key is not a string or bytes.
+ """
+
+ __slots__ = ("_pb",)
+
+ def __init__(
+ self,
+ start_key: str | bytes | None = None,
+ end_key: str | bytes | None = None,
+ start_is_inclusive: bool | None = None,
+ end_is_inclusive: bool | None = None,
+ ):
+ # convert empty key inputs to None for consistency
+ start_key = None if not start_key else start_key
+ end_key = None if not end_key else end_key
+ # check for invalid combinations of arguments
+ if start_is_inclusive is None:
+ start_is_inclusive = True
+
+ if end_is_inclusive is None:
+ end_is_inclusive = False
+ # ensure that start_key and end_key are bytes
+ if isinstance(start_key, str):
+ start_key = start_key.encode()
+ elif start_key is not None and not isinstance(start_key, bytes):
+ raise ValueError("start_key must be a string or bytes")
+ if isinstance(end_key, str):
+ end_key = end_key.encode()
+ elif end_key is not None and not isinstance(end_key, bytes):
+ raise ValueError("end_key must be a string or bytes")
+ # ensure that start_key is less than or equal to end_key
+ if start_key is not None and end_key is not None and start_key > end_key:
+ raise ValueError("start_key must be less than or equal to end_key")
+
+ init_dict = {}
+ if start_key is not None:
+ if start_is_inclusive:
+ init_dict["start_key_closed"] = start_key
+ else:
+ init_dict["start_key_open"] = start_key
+ if end_key is not None:
+ if end_is_inclusive:
+ init_dict["end_key_closed"] = end_key
+ else:
+ init_dict["end_key_open"] = end_key
+ self._pb = RowRangePB(**init_dict)
+
+ @property
+ def start_key(self) -> bytes | None:
+ """
+ Returns the start key of the range. If None, the range is unbounded on the left.
+ """
+ return self._pb.start_key_closed or self._pb.start_key_open or None
+
+ @property
+ def end_key(self) -> bytes | None:
+ """
+ Returns the end key of the range. If None, the range is unbounded on the right.
+
+ Returns:
+ bytes | None: The end key of the range, or None if the range is unbounded on the right.
+ """
+ return self._pb.end_key_closed or self._pb.end_key_open or None
+
+ @property
+ def start_is_inclusive(self) -> bool:
+ """
+ Indicates if the range is inclusive of the start key.
+
+ If the range is unbounded on the left, this will return True.
+
+ Returns:
+ bool: Whether the range is inclusive of the start key.
+ """
+ return not bool(self._pb.start_key_open)
+
+ @property
+ def end_is_inclusive(self) -> bool:
+ """
+ Indicates if the range is inclusive of the end key.
+
+ If the range is unbounded on the right, this will return True.
+
+ Returns:
+ bool: Whether the range is inclusive of the end key.
+ """
+ return not bool(self._pb.end_key_open)
+
+ def _to_pb(self) -> RowRangePB:
+ """
+ Converts this object to a protobuf
+
+ Returns:
+ RowRangePB: The protobuf representation of this object
+ """
+ return self._pb
+
+ @classmethod
+ def _from_pb(cls, data: RowRangePB) -> RowRange:
+ """
+ Creates a RowRange from a protobuf
+
+ Args:
+ data (RowRangePB): The protobuf to convert
+ Returns:
+ RowRange: The converted RowRange
+ """
+ instance = cls()
+ instance._pb = data
+ return instance
+
+ @classmethod
+ def _from_dict(cls, data: dict[str, bytes | str]) -> RowRange:
+ """
+ Creates a RowRange from a protobuf
+
+ Args:
+ data (dict[str, bytes | str]): The dictionary to convert
+ Returns:
+ RowRange: The converted RowRange
+ """
+ formatted_data = {
+ k: v.encode() if isinstance(v, str) else v for k, v in data.items()
+ }
+ instance = cls()
+ instance._pb = RowRangePB(**formatted_data)
+ return instance
+
+ def __bool__(self) -> bool:
+ """
+ Empty RowRanges (representing a full table scan) are falsy, because
+ they can be substituted with None. Non-empty RowRanges are truthy.
+
+ Returns:
+ bool: True if the RowRange is not empty, False otherwise
+ """
+ return bool(
+ self._pb.start_key_closed
+ or self._pb.start_key_open
+ or self._pb.end_key_closed
+ or self._pb.end_key_open
+ )
+
+ def __eq__(self, other: Any) -> bool:
+ if not isinstance(other, RowRange):
+ return NotImplemented
+ return self._pb == other._pb
+
+ def __str__(self) -> str:
+ """
+ Represent range as a string, e.g. "[b'a', b'z)"
+
+ Unbounded start or end keys are represented as "-inf" or "+inf"
+
+ Returns:
+ str: The string representation of the range
+ """
+ left = "[" if self.start_is_inclusive else "("
+ right = "]" if self.end_is_inclusive else ")"
+ start = repr(self.start_key) if self.start_key is not None else "-inf"
+ end = repr(self.end_key) if self.end_key is not None else "+inf"
+ return f"{left}{start}, {end}{right}"
+
+ def __repr__(self) -> str:
+ args_list = []
+ args_list.append(f"start_key={self.start_key!r}")
+ args_list.append(f"end_key={self.end_key!r}")
+ if self.start_is_inclusive is False:
+ # only show start_is_inclusive if it is different from the default
+ args_list.append(f"start_is_inclusive={self.start_is_inclusive}")
+ if self.end_is_inclusive is True and self.end_key is not None:
+ # only show end_is_inclusive if it is different from the default
+ args_list.append(f"end_is_inclusive={self.end_is_inclusive}")
+ return f"RowRange({', '.join(args_list)})"
+
+
+class ReadRowsQuery:
+ """
+ Class to encapsulate details of a read row request
+
+ Args:
+ row_keys: row keys to include in the query
+ a query can contain multiple keys, but ranges should be preferred
+ row_ranges: ranges of rows to include in the query
+ limit: the maximum number of rows to return. None or 0 means no limit
+ default: None (no limit)
+ row_filter: a RowFilter to apply to the query
+ """
+
+ slots = ("_limit", "_filter", "_row_set")
+
+ def __init__(
+ self,
+ row_keys: list[str | bytes] | str | bytes | None = None,
+ row_ranges: list[RowRange] | RowRange | None = None,
+ limit: int | None = None,
+ row_filter: RowFilter | None = None,
+ ):
+ if row_keys is None:
+ row_keys = []
+ if row_ranges is None:
+ row_ranges = []
+ if not isinstance(row_ranges, list):
+ row_ranges = [row_ranges]
+ if not isinstance(row_keys, list):
+ row_keys = [row_keys]
+ row_keys = [key.encode() if isinstance(key, str) else key for key in row_keys]
+ self._row_set = RowSetPB(
+ row_keys=row_keys, row_ranges=[r._pb for r in row_ranges]
+ )
+ self.limit = limit or None
+ self.filter = row_filter
+
+ @property
+ def row_keys(self) -> list[bytes]:
+ """
+ Return the row keys in this query
+
+ Returns:
+ list[bytes]: the row keys in this query
+ """
+ return list(self._row_set.row_keys)
+
+ @property
+ def row_ranges(self) -> list[RowRange]:
+ """
+ Return the row ranges in this query
+
+ Returns:
+ list[RowRange]: the row ranges in this query
+ """
+ return [RowRange._from_pb(r) for r in self._row_set.row_ranges]
+
+ @property
+ def limit(self) -> int | None:
+ """
+ Return the maximum number of rows to return by this query
+
+ None or 0 means no limit
+
+ Returns:
+ int | None: the maximum number of rows to return by this query
+ """
+ return self._limit or None
+
+ @limit.setter
+ def limit(self, new_limit: int | None):
+ """
+ Set the maximum number of rows to return by this query.
+
+ None or 0 means no limit
+
+ Args:
+ new_limit: the new limit to apply to this query
+ Raises:
+ ValueError: if new_limit is < 0
+ """
+ if new_limit is not None and new_limit < 0:
+ raise ValueError("limit must be >= 0")
+ self._limit = new_limit
+
+ @property
+ def filter(self) -> RowFilter | None:
+ """
+ Return the RowFilter applied to this query
+
+ Returns:
+ RowFilter | None: the RowFilter applied to this query
+ """
+ return self._filter
+
+ @filter.setter
+ def filter(self, row_filter: RowFilter | None):
+ """
+ Set a RowFilter to apply to this query
+
+ Args:
+ row_filter: a RowFilter to apply to this query
+ """
+ self._filter = row_filter
+
+ def add_key(self, row_key: str | bytes):
+ """
+ Add a row key to this query
+
+ A query can contain multiple keys, but ranges should be preferred
+
+ Args:
+ row_key: a key to add to this query
+ Raises:
+ ValueError: if an input is not a string or bytes
+ """
+ if isinstance(row_key, str):
+ row_key = row_key.encode()
+ elif not isinstance(row_key, bytes):
+ raise ValueError("row_key must be string or bytes")
+ if row_key not in self._row_set.row_keys:
+ self._row_set.row_keys.append(row_key)
+
+ def add_range(
+ self,
+ row_range: RowRange,
+ ):
+ """
+ Add a range of row keys to this query.
+
+ Args:
+ row_range: a range of row keys to add to this query
+ """
+ if row_range not in self.row_ranges:
+ self._row_set.row_ranges.append(row_range._pb)
+
+ def shard(self, shard_keys: RowKeySamples) -> ShardedQuery:
+ """
+ Split this query into multiple queries that can be evenly distributed
+ across nodes and run in parallel
+
+ Args:
+ shard_keys: a list of row keys that define the boundaries of segments.
+ Returns:
+ ShardedQuery: a ShardedQuery that can be used in sharded_read_rows calls
+ Raises:
+ AttributeError: if the query contains a limit
+ """
+ if self.limit is not None:
+ raise AttributeError("Cannot shard query with a limit")
+ if len(self.row_keys) == 0 and len(self.row_ranges) == 0:
+ # empty query represents full scan
+ # ensure that we have at least one key or range
+ full_scan_query = ReadRowsQuery(
+ row_ranges=RowRange(), row_filter=self.filter
+ )
+ return full_scan_query.shard(shard_keys)
+
+ sharded_queries: dict[int, ReadRowsQuery] = defaultdict(
+ lambda: ReadRowsQuery(row_filter=self.filter)
+ )
+ # the split_points divde our key space into segments
+ # each split_point defines last key that belongs to a segment
+ # our goal is to break up the query into subqueries that each operate in a single segment
+ split_points = [sample[0] for sample in shard_keys if sample[0]]
+
+ # handle row_keys
+ # use binary search to find the segment that each key belongs to
+ for this_key in list(self.row_keys):
+ # bisect_left: in case of exact match, pick left side (keys are inclusive ends)
+ segment_index = bisect_left(split_points, this_key)
+ sharded_queries[segment_index].add_key(this_key)
+
+ # handle row_ranges
+ for this_range in self.row_ranges:
+ # defer to _shard_range helper
+ for segment_index, added_range in self._shard_range(
+ this_range, split_points
+ ):
+ sharded_queries[segment_index].add_range(added_range)
+ # return list of queries ordered by segment index
+ # pull populated segments out of sharded_queries dict
+ keys = sorted(list(sharded_queries.keys()))
+ # return list of queries
+ return [sharded_queries[k] for k in keys]
+
+ @staticmethod
+ def _shard_range(
+ orig_range: RowRange, split_points: list[bytes]
+ ) -> list[tuple[int, RowRange]]:
+ """
+ Helper function for sharding row_range into subranges that fit into
+ segments of the key-space, determined by split_points
+
+ Args:
+ orig_range: a row range to split
+ split_points: a list of row keys that define the boundaries of segments.
+ each point represents the inclusive end of a segment
+ Returns:
+ list[tuple[int, RowRange]]: a list of tuples, containing a segment index and a new sub-range.
+ """
+ # 1. find the index of the segment the start key belongs to
+ if orig_range.start_key is None:
+ # if range is open on the left, include first segment
+ start_segment = 0
+ else:
+ # use binary search to find the segment the start key belongs to
+ # bisect method determines how we break ties when the start key matches a split point
+ # if inclusive, bisect_left to the left segment, otherwise bisect_right
+ bisect = bisect_left if orig_range.start_is_inclusive else bisect_right
+ start_segment = bisect(split_points, orig_range.start_key)
+
+ # 2. find the index of the segment the end key belongs to
+ if orig_range.end_key is None:
+ # if range is open on the right, include final segment
+ end_segment = len(split_points)
+ else:
+ # use binary search to find the segment the end key belongs to.
+ end_segment = bisect_left(
+ split_points, orig_range.end_key, lo=start_segment
+ )
+ # note: end_segment will always bisect_left, because split points represent inclusive ends
+ # whether the end_key is includes the split point or not, the result is the same segment
+ # 3. create new range definitions for each segment this_range spans
+ if start_segment == end_segment:
+ # this_range is contained in a single segment.
+ # Add this_range to that segment's query only
+ return [(start_segment, orig_range)]
+ else:
+ results: list[tuple[int, RowRange]] = []
+ # this_range spans multiple segments. Create a new range for each segment's query
+ # 3a. add new range for first segment this_range spans
+ # first range spans from start_key to the split_point representing the last key in the segment
+ last_key_in_first_segment = split_points[start_segment]
+ start_range = RowRange(
+ start_key=orig_range.start_key,
+ start_is_inclusive=orig_range.start_is_inclusive,
+ end_key=last_key_in_first_segment,
+ end_is_inclusive=True,
+ )
+ results.append((start_segment, start_range))
+ # 3b. add new range for last segment this_range spans
+ # we start the final range using the end key from of the previous segment, with is_inclusive=False
+ previous_segment = end_segment - 1
+ last_key_before_segment = split_points[previous_segment]
+ end_range = RowRange(
+ start_key=last_key_before_segment,
+ start_is_inclusive=False,
+ end_key=orig_range.end_key,
+ end_is_inclusive=orig_range.end_is_inclusive,
+ )
+ results.append((end_segment, end_range))
+ # 3c. add new spanning range to all segments other than the first and last
+ for this_segment in range(start_segment + 1, end_segment):
+ prev_segment = this_segment - 1
+ prev_end_key = split_points[prev_segment]
+ this_end_key = split_points[prev_segment + 1]
+ new_range = RowRange(
+ start_key=prev_end_key,
+ start_is_inclusive=False,
+ end_key=this_end_key,
+ end_is_inclusive=True,
+ )
+ results.append((this_segment, new_range))
+ return results
+
+ def _to_pb(self, table) -> ReadRowsRequestPB:
+ """
+ Convert this query into a dictionary that can be used to construct a
+ ReadRowsRequest protobuf
+ """
+ return ReadRowsRequestPB(
+ app_profile_id=table.app_profile_id,
+ filter=self.filter._to_pb() if self.filter else None,
+ rows_limit=self.limit or 0,
+ rows=self._row_set,
+ **table._request_path,
+ )
+
+ def __eq__(self, other):
+ """
+ RowRanges are equal if they have the same row keys, row ranges,
+ filter and limit, or if they both represent a full scan with the
+ same filter and limit
+
+ Args:
+ other: the object to compare to
+ Returns:
+ bool: True if the objects are equal, False otherwise
+ """
+ if not isinstance(other, ReadRowsQuery):
+ return False
+ # empty queries are equal
+ if len(self.row_keys) == 0 and len(other.row_keys) == 0:
+ this_range_empty = len(self.row_ranges) == 0 or all(
+ [bool(r) is False for r in self.row_ranges]
+ )
+ other_range_empty = len(other.row_ranges) == 0 or all(
+ [bool(r) is False for r in other.row_ranges]
+ )
+ if this_range_empty and other_range_empty:
+ return self.filter == other.filter and self.limit == other.limit
+ # otherwise, sets should have same sizes
+ if len(self.row_keys) != len(other.row_keys):
+ return False
+ if len(self.row_ranges) != len(other.row_ranges):
+ return False
+ ranges_match = all([row in other.row_ranges for row in self.row_ranges])
+ return (
+ self.row_keys == other.row_keys
+ and ranges_match
+ and self.filter == other.filter
+ and self.limit == other.limit
+ )
+
+ def __repr__(self):
+ return f"ReadRowsQuery(row_keys={list(self.row_keys)}, row_ranges={list(self.row_ranges)}, row_filter={self.filter}, limit={self.limit})"
diff --git a/google/cloud/bigtable/data/row.py b/google/cloud/bigtable/data/row.py
new file mode 100644
index 000000000..50e65a958
--- /dev/null
+++ b/google/cloud/bigtable/data/row.py
@@ -0,0 +1,535 @@
+# Copyright 2023 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 annotations
+
+from collections import OrderedDict
+from typing import Generator, overload, Any
+from functools import total_ordering
+
+from google.cloud.bigtable_v2.types import Row as RowPB
+
+# Type aliases used internally for readability.
+_family_type = str
+_qualifier_type = bytes
+
+
+class Row:
+ """
+ Model class for row data returned from server
+
+ Does not represent all data contained in the row, only data returned by a
+ query.
+ Expected to be read-only to users, and written by backend
+
+ Can be indexed by family and qualifier to get cells in the row::
+
+ cells = row["family", "qualifier"]
+
+ Args:
+ key: Row key
+ cells: List of cells in the row
+ """
+
+ __slots__ = ("row_key", "cells", "_index_data")
+
+ def __init__(
+ self,
+ key: bytes,
+ cells: list[Cell],
+ ):
+ """
+ Row objects are not intended to be created by users.
+ They are returned by the Bigtable backend.
+ """
+ self.row_key = key
+ self.cells: list[Cell] = cells
+ # index is lazily created when needed
+ self._index_data: OrderedDict[
+ _family_type, OrderedDict[_qualifier_type, list[Cell]]
+ ] | None = None
+
+ @property
+ def _index(
+ self,
+ ) -> OrderedDict[_family_type, OrderedDict[_qualifier_type, list[Cell]]]:
+ """
+ Returns an index of cells associated with each family and qualifier.
+
+ The index is lazily created when needed
+
+ Returns:
+ OrderedDict: Index of cells
+ """
+ if self._index_data is None:
+ self._index_data = OrderedDict()
+ for cell in self.cells:
+ self._index_data.setdefault(cell.family, OrderedDict()).setdefault(
+ cell.qualifier, []
+ ).append(cell)
+ return self._index_data
+
+ @classmethod
+ def _from_pb(cls, row_pb: RowPB) -> Row:
+ """
+ Creates a row from a protobuf representation
+
+ Row objects are not intended to be created by users.
+ They are returned by the Bigtable backend.
+
+ Args:
+ row_pb (RowPB): Protobuf representation of the row
+ Returns:
+ Row: Row object created from the protobuf representation
+ """
+ row_key: bytes = row_pb.key
+ cell_list: list[Cell] = []
+ for family in row_pb.families:
+ for column in family.columns:
+ for cell in column.cells:
+ new_cell = Cell(
+ value=cell.value,
+ row_key=row_key,
+ family=family.name,
+ qualifier=column.qualifier,
+ timestamp_micros=cell.timestamp_micros,
+ labels=list(cell.labels) if cell.labels else None,
+ )
+ cell_list.append(new_cell)
+ return cls(row_key, cells=cell_list)
+
+ def get_cells(
+ self, family: str | None = None, qualifier: str | bytes | None = None
+ ) -> list[Cell]:
+ """
+ Returns cells sorted in Bigtable native order:
+ - Family lexicographically ascending
+ - Qualifier ascending
+ - Timestamp in reverse chronological order
+
+ If family or qualifier not passed, will include all
+
+ Can also be accessed through indexing::
+ cells = row["family", "qualifier"]
+ cells = row["family"]
+
+ Args:
+ family: family to filter cells by
+ qualifier: qualifier to filter cells by
+ Returns:
+ list[Cell]: List of cells in the row matching the filter
+ Raises:
+ ValueError: If family or qualifier is not found in the row
+ """
+ if family is None:
+ if qualifier is not None:
+ # get_cells(None, "qualifier") is not allowed
+ raise ValueError("Qualifier passed without family")
+ else:
+ # return all cells on get_cells()
+ return self.cells
+ if qualifier is None:
+ # return all cells in family on get_cells(family)
+ return list(self._get_all_from_family(family))
+ if isinstance(qualifier, str):
+ qualifier = qualifier.encode("utf-8")
+ # return cells in family and qualifier on get_cells(family, qualifier)
+ if family not in self._index:
+ raise ValueError(f"Family '{family}' not found in row '{self.row_key!r}'")
+ if qualifier not in self._index[family]:
+ raise ValueError(
+ f"Qualifier '{qualifier!r}' not found in family '{family}' in row '{self.row_key!r}'"
+ )
+ return self._index[family][qualifier]
+
+ def _get_all_from_family(self, family: str) -> Generator[Cell, None, None]:
+ """
+ Returns all cells in the row for the family_id
+
+ Args:
+ family: family to filter cells by
+ Yields:
+ Cell: cells in the row for the family_id
+ Raises:
+ ValueError: If family is not found in the row
+ """
+ if family not in self._index:
+ raise ValueError(f"Family '{family}' not found in row '{self.row_key!r}'")
+ for qualifier in self._index[family]:
+ yield from self._index[family][qualifier]
+
+ def __str__(self) -> str:
+ """
+ Human-readable string representation::
+
+ {
+ (family='fam', qualifier=b'col'): [b'value', (+1 more),],
+ (family='fam', qualifier=b'col2'): [b'other'],
+ }
+
+ Returns:
+ str: Human-readable string representation of the row
+ """
+ output = ["{"]
+ for family, qualifier in self._get_column_components():
+ cell_list = self[family, qualifier]
+ line = [f" (family={family!r}, qualifier={qualifier!r}): "]
+ if len(cell_list) == 0:
+ line.append("[],")
+ elif len(cell_list) == 1:
+ line.append(f"[{cell_list[0]}],")
+ else:
+ line.append(f"[{cell_list[0]}, (+{len(cell_list) - 1} more)],")
+ output.append("".join(line))
+ output.append("}")
+ return "\n".join(output)
+
+ def __repr__(self):
+ cell_str_buffer = ["{"]
+ for family, qualifier in self._get_column_components():
+ cell_list = self[family, qualifier]
+ repr_list = [cell._to_dict() for cell in cell_list]
+ cell_str_buffer.append(f" ('{family}', {qualifier!r}): {repr_list},")
+ cell_str_buffer.append("}")
+ cell_str = "\n".join(cell_str_buffer)
+ output = f"Row(key={self.row_key!r}, cells={cell_str})"
+ return output
+
+ def _to_dict(self) -> dict[str, Any]:
+ """
+ Returns a dictionary representation of the cell in the Bigtable Row
+ proto format
+
+ https://cloud.google.com/bigtable/docs/reference/data/rpc/google.bigtable.v2#row
+ """
+ family_list = []
+ for family_name, qualifier_dict in self._index.items():
+ qualifier_list = []
+ for qualifier_name, cell_list in qualifier_dict.items():
+ cell_dicts = [cell._to_dict() for cell in cell_list]
+ qualifier_list.append(
+ {"qualifier": qualifier_name, "cells": cell_dicts}
+ )
+ family_list.append({"name": family_name, "columns": qualifier_list})
+ return {"key": self.row_key, "families": family_list}
+
+ # Sequence and Mapping methods
+ def __iter__(self):
+ """
+ Allow iterating over all cells in the row
+
+ Returns:
+ Iterator: Iterator over the cells in the row
+ """
+ return iter(self.cells)
+
+ def __contains__(self, item):
+ """
+ Implements `in` operator
+
+ Works for both cells in the internal list, and `family` or
+ `(family, qualifier)` pairs associated with the cells
+
+ Args:
+ item: item to check for in the row
+ Returns:
+ bool: True if item is in the row, False otherwise
+ """
+ if isinstance(item, _family_type):
+ return item in self._index
+ elif (
+ isinstance(item, tuple)
+ and isinstance(item[0], _family_type)
+ and isinstance(item[1], (bytes, str))
+ ):
+ q = item[1] if isinstance(item[1], bytes) else item[1].encode("utf-8")
+ return item[0] in self._index and q in self._index[item[0]]
+ # check if Cell is in Row
+ return item in self.cells
+
+ @overload
+ def __getitem__(
+ self,
+ index: str | tuple[str, bytes | str],
+ ) -> list[Cell]:
+ # overload signature for type checking
+ pass
+
+ @overload
+ def __getitem__(self, index: int) -> Cell:
+ # overload signature for type checking
+ pass
+
+ @overload
+ def __getitem__(self, index: slice) -> list[Cell]:
+ # overload signature for type checking
+ pass
+
+ def __getitem__(self, index):
+ """
+ Implements [] indexing
+
+ Supports indexing by family, (family, qualifier) pair,
+ numerical index, and index slicing
+ """
+ if isinstance(index, _family_type):
+ return self.get_cells(family=index)
+ elif (
+ isinstance(index, tuple)
+ and isinstance(index[0], _family_type)
+ and isinstance(index[1], (bytes, str))
+ ):
+ return self.get_cells(family=index[0], qualifier=index[1])
+ elif isinstance(index, int) or isinstance(index, slice):
+ # index is int or slice
+ return self.cells[index]
+ else:
+ raise TypeError(
+ "Index must be family_id, (family_id, qualifier), int, or slice"
+ )
+
+ def __len__(self):
+ """
+ Returns the number of cells in the row
+
+ Returns:
+ int: Number of cells in the row
+ """
+ return len(self.cells)
+
+ def _get_column_components(self) -> list[tuple[str, bytes]]:
+ """
+ Returns a list of (family, qualifier) pairs associated with the cells
+
+ Pairs can be used for indexing
+
+ Returns:
+ list[tuple[str, bytes]]: List of (family, qualifier) pairs
+ """
+ return [(f, q) for f in self._index for q in self._index[f]]
+
+ def __eq__(self, other):
+ """
+ Implements `==` operator
+
+ Returns:
+ bool: True if rows are equal, False otherwise
+ """
+ # for performance reasons, check row metadata
+ # before checking individual cells
+ if not isinstance(other, Row):
+ return False
+ if self.row_key != other.row_key:
+ return False
+ if len(self.cells) != len(other.cells):
+ return False
+ components = self._get_column_components()
+ other_components = other._get_column_components()
+ if len(components) != len(other_components):
+ return False
+ if components != other_components:
+ return False
+ for family, qualifier in components:
+ if len(self[family, qualifier]) != len(other[family, qualifier]):
+ return False
+ # compare individual cell lists
+ if self.cells != other.cells:
+ return False
+ return True
+
+ def __ne__(self, other) -> bool:
+ """
+ Implements `!=` operator
+
+ Returns:
+ bool: True if rows are not equal, False otherwise
+ """
+ return not self == other
+
+
+@total_ordering
+class Cell:
+ """
+ Model class for cell data
+
+ Does not represent all data contained in the cell, only data returned by a
+ query.
+ Expected to be read-only to users, and written by backend
+
+ Args:
+ value: the byte string value of the cell
+ row_key: the row key of the cell
+ family: the family associated with the cell
+ qualifier: the column qualifier associated with the cell
+ timestamp_micros: the timestamp of the cell in microseconds
+ labels: the list of labels associated with the cell
+ """
+
+ __slots__ = (
+ "value",
+ "row_key",
+ "family",
+ "qualifier",
+ "timestamp_micros",
+ "labels",
+ )
+
+ def __init__(
+ self,
+ value: bytes,
+ row_key: bytes,
+ family: str,
+ qualifier: bytes | str,
+ timestamp_micros: int,
+ labels: list[str] | None = None,
+ ):
+ # Cell objects are not intended to be constructed by users.
+ # They are returned by the Bigtable backend.
+ self.value = value
+ self.row_key = row_key
+ self.family = family
+ if isinstance(qualifier, str):
+ qualifier = qualifier.encode()
+ self.qualifier = qualifier
+ self.timestamp_micros = timestamp_micros
+ self.labels = labels if labels is not None else []
+
+ def __int__(self) -> int:
+ """
+ Allows casting cell to int
+ Interprets value as a 64-bit big-endian signed integer, as expected by
+ ReadModifyWrite increment rule
+
+ Returns:
+ int: Value of the cell as a 64-bit big-endian signed integer
+ """
+ return int.from_bytes(self.value, byteorder="big", signed=True)
+
+ def _to_dict(self) -> dict[str, Any]:
+ """
+ Returns a dictionary representation of the cell in the Bigtable Cell
+ proto format
+
+ https://cloud.google.com/bigtable/docs/reference/data/rpc/google.bigtable.v2#cell
+
+ Returns:
+ dict: Dictionary representation of the cell
+ """
+ cell_dict: dict[str, Any] = {
+ "value": self.value,
+ }
+ cell_dict["timestamp_micros"] = self.timestamp_micros
+ if self.labels:
+ cell_dict["labels"] = self.labels
+ return cell_dict
+
+ def __str__(self) -> str:
+ """
+ Allows casting cell to str
+ Prints encoded byte string, same as printing value directly.
+
+ Returns:
+ str: Encoded byte string of the value
+ """
+ return str(self.value)
+
+ def __repr__(self):
+ """
+ Returns a string representation of the cell
+
+ Returns:
+ str: String representation of the cell
+ """
+ return f"Cell(value={self.value!r}, row_key={self.row_key!r}, family='{self.family}', qualifier={self.qualifier!r}, timestamp_micros={self.timestamp_micros}, labels={self.labels})"
+
+ """For Bigtable native ordering"""
+
+ def __lt__(self, other) -> bool:
+ """
+ Implements `<` operator
+
+ Args:
+ other: Cell to compare with
+ Returns:
+ bool: True if this cell is less than the other cell, False otherwise
+ Raises:
+ NotImplementedError: If other is not a Cell
+ """
+ if not isinstance(other, Cell):
+ raise NotImplementedError
+ this_ordering = (
+ self.family,
+ self.qualifier,
+ -self.timestamp_micros,
+ self.value,
+ self.labels,
+ )
+ other_ordering = (
+ other.family,
+ other.qualifier,
+ -other.timestamp_micros,
+ other.value,
+ other.labels,
+ )
+ return this_ordering < other_ordering
+
+ def __eq__(self, other) -> bool:
+ """
+ Implements `==` operator
+
+ Args:
+ other: Cell to compare with
+ Returns:
+ bool: True if cells are equal, False otherwise
+ """
+ if not isinstance(other, Cell):
+ return False
+ return (
+ self.row_key == other.row_key
+ and self.family == other.family
+ and self.qualifier == other.qualifier
+ and self.value == other.value
+ and self.timestamp_micros == other.timestamp_micros
+ and len(self.labels) == len(other.labels)
+ and all([label in other.labels for label in self.labels])
+ )
+
+ def __ne__(self, other) -> bool:
+ """
+ Implements `!=` operator
+
+ Args:
+ other: Cell to compare with
+ Returns:
+ bool: True if cells are not equal, False otherwise
+ """
+ return not self == other
+
+ def __hash__(self):
+ """
+ Implements `hash()` function to fingerprint cell
+
+ Returns:
+ int: hash value of the cell
+ """
+ return hash(
+ (
+ self.row_key,
+ self.family,
+ self.qualifier,
+ self.value,
+ self.timestamp_micros,
+ tuple(self.labels),
+ )
+ )
diff --git a/google/cloud/bigtable/data/row_filters.py b/google/cloud/bigtable/data/row_filters.py
new file mode 100644
index 000000000..9f09133d5
--- /dev/null
+++ b/google/cloud/bigtable/data/row_filters.py
@@ -0,0 +1,968 @@
+# Copyright 2016 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.
+
+"""Filters for Google Cloud Bigtable Row classes."""
+from __future__ import annotations
+
+import struct
+
+from typing import Any, Sequence, TYPE_CHECKING, overload
+from abc import ABC, abstractmethod
+
+from google.cloud._helpers import _microseconds_from_datetime # type: ignore
+from google.cloud._helpers import _to_bytes # type: ignore
+from google.cloud.bigtable_v2.types import data as data_v2_pb2
+
+if TYPE_CHECKING:
+ # import dependencies when type checking
+ from datetime import datetime
+
+_PACK_I64 = struct.Struct(">q").pack
+
+
+class RowFilter(ABC):
+ """Basic filter to apply to cells in a row.
+
+ These values can be combined via :class:`RowFilterChain`,
+ :class:`RowFilterUnion` and :class:`ConditionalRowFilter`.
+
+ .. note::
+
+ This class is a do-nothing base class for all row filters.
+ """
+
+ def _to_pb(self) -> data_v2_pb2.RowFilter:
+ """Converts the row filter to a protobuf.
+
+ Returns: The converted current object.
+ """
+ return data_v2_pb2.RowFilter(**self._to_dict())
+
+ @abstractmethod
+ def _to_dict(self) -> dict[str, Any]:
+ """Converts the row filter to a dict representation."""
+ pass
+
+ def __repr__(self) -> str:
+ return f"{self.__class__.__name__}()"
+
+
+class _BoolFilter(RowFilter, ABC):
+ """Row filter that uses a boolean flag.
+
+ :type flag: bool
+ :param flag: An indicator if a setting is turned on or off.
+ """
+
+ def __init__(self, flag: bool):
+ self.flag = flag
+
+ def __eq__(self, other):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return other.flag == self.flag
+
+ def __ne__(self, other):
+ return not self == other
+
+ def __repr__(self) -> str:
+ return f"{self.__class__.__name__}(flag={self.flag})"
+
+
+class SinkFilter(_BoolFilter):
+ """Advanced row filter to skip parent filters.
+
+ :type flag: bool
+ :param flag: ADVANCED USE ONLY. Hook for introspection into the row filter.
+ Outputs all cells directly to the output of the read rather
+ than to any parent filter. Cannot be used within the
+ ``predicate_filter``, ``true_filter``, or ``false_filter``
+ of a :class:`ConditionalRowFilter`.
+ """
+
+ def _to_dict(self) -> dict[str, Any]:
+ """Converts the row filter to a dict representation."""
+ return {"sink": self.flag}
+
+
+class PassAllFilter(_BoolFilter):
+ """Row filter equivalent to not filtering at all.
+
+ :type flag: bool
+ :param flag: Matches all cells, regardless of input. Functionally
+ equivalent to leaving ``filter`` unset, but included for
+ completeness.
+ """
+
+ def _to_dict(self) -> dict[str, Any]:
+ """Converts the row filter to a dict representation."""
+ return {"pass_all_filter": self.flag}
+
+
+class BlockAllFilter(_BoolFilter):
+ """Row filter that doesn't match any cells.
+
+ :type flag: bool
+ :param flag: Does not match any cells, regardless of input. Useful for
+ temporarily disabling just part of a filter.
+ """
+
+ def _to_dict(self) -> dict[str, Any]:
+ """Converts the row filter to a dict representation."""
+ return {"block_all_filter": self.flag}
+
+
+class _RegexFilter(RowFilter, ABC):
+ """Row filter that uses a regular expression.
+
+ The ``regex`` must be valid RE2 patterns. See Google's
+ `RE2 reference`_ for the accepted syntax.
+
+ .. _RE2 reference: https://github.com/google/re2/wiki/Syntax
+
+ :type regex: bytes or str
+ :param regex:
+ A regular expression (RE2) for some row filter. String values
+ will be encoded as ASCII.
+ """
+
+ def __init__(self, regex: str | bytes):
+ self.regex: bytes = _to_bytes(regex)
+
+ def __eq__(self, other):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return other.regex == self.regex
+
+ def __ne__(self, other):
+ return not self == other
+
+ def __repr__(self) -> str:
+ return f"{self.__class__.__name__}(regex={self.regex!r})"
+
+
+class RowKeyRegexFilter(_RegexFilter):
+ """Row filter for a row key regular expression.
+
+ The ``regex`` must be valid RE2 patterns. See Google's
+ `RE2 reference`_ for the accepted syntax.
+
+ .. _RE2 reference: https://github.com/google/re2/wiki/Syntax
+
+ .. note::
+
+ Special care need be used with the expression used. Since
+ each of these properties can contain arbitrary bytes, the ``\\C``
+ escape sequence must be used if a true wildcard is desired. The ``.``
+ character will not match the new line character ``\\n``, which may be
+ present in a binary value.
+
+ :type regex: bytes
+ :param regex: A regular expression (RE2) to match cells from rows with row
+ keys that satisfy this regex. For a
+ ``CheckAndMutateRowRequest``, this filter is unnecessary
+ since the row key is already specified.
+ """
+
+ def _to_dict(self) -> dict[str, Any]:
+ """Converts the row filter to a dict representation."""
+ return {"row_key_regex_filter": self.regex}
+
+
+class RowSampleFilter(RowFilter):
+ """Matches all cells from a row with probability p.
+
+ :type sample: float
+ :param sample: The probability of matching a cell (must be in the
+ interval ``(0, 1)`` The end points are excluded).
+ """
+
+ def __init__(self, sample: float):
+ self.sample: float = sample
+
+ def __eq__(self, other):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return other.sample == self.sample
+
+ def __ne__(self, other):
+ return not self == other
+
+ def _to_dict(self) -> dict[str, Any]:
+ """Converts the row filter to a dict representation."""
+ return {"row_sample_filter": self.sample}
+
+ def __repr__(self) -> str:
+ return f"{self.__class__.__name__}(sample={self.sample})"
+
+
+class FamilyNameRegexFilter(_RegexFilter):
+ """Row filter for a family name regular expression.
+
+ The ``regex`` must be valid RE2 patterns. See Google's
+ `RE2 reference`_ for the accepted syntax.
+
+ .. _RE2 reference: https://github.com/google/re2/wiki/Syntax
+
+ :type regex: str
+ :param regex: A regular expression (RE2) to match cells from columns in a
+ given column family. For technical reasons, the regex must
+ not contain the ``':'`` character, even if it is not being
+ used as a literal.
+ """
+
+ def _to_dict(self) -> dict[str, Any]:
+ """Converts the row filter to a dict representation."""
+ return {"family_name_regex_filter": self.regex}
+
+
+class ColumnQualifierRegexFilter(_RegexFilter):
+ """Row filter for a column qualifier regular expression.
+
+ The ``regex`` must be valid RE2 patterns. See Google's
+ `RE2 reference`_ for the accepted syntax.
+
+ .. _RE2 reference: https://github.com/google/re2/wiki/Syntax
+
+ .. note::
+
+ Special care need be used with the expression used. Since
+ each of these properties can contain arbitrary bytes, the ``\\C``
+ escape sequence must be used if a true wildcard is desired. The ``.``
+ character will not match the new line character ``\\n``, which may be
+ present in a binary value.
+
+ :type regex: bytes
+ :param regex: A regular expression (RE2) to match cells from column that
+ match this regex (irrespective of column family).
+ """
+
+ def _to_dict(self) -> dict[str, Any]:
+ """Converts the row filter to a dict representation."""
+ return {"column_qualifier_regex_filter": self.regex}
+
+
+class TimestampRange(object):
+ """Range of time with inclusive lower and exclusive upper bounds.
+
+ :type start: :class:`datetime.datetime`
+ :param start: (Optional) The (inclusive) lower bound of the timestamp
+ range. If omitted, defaults to Unix epoch.
+
+ :type end: :class:`datetime.datetime`
+ :param end: (Optional) The (exclusive) upper bound of the timestamp
+ range. If omitted, no upper bound is used.
+ """
+
+ def __init__(self, start: "datetime" | None = None, end: "datetime" | None = None):
+ self.start: "datetime" | None = start
+ self.end: "datetime" | None = end
+
+ def __eq__(self, other):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return other.start == self.start and other.end == self.end
+
+ def __ne__(self, other):
+ return not self == other
+
+ def _to_pb(self) -> data_v2_pb2.TimestampRange:
+ """Converts the :class:`TimestampRange` to a protobuf.
+
+ Returns: The converted current object.
+ """
+ return data_v2_pb2.TimestampRange(**self._to_dict())
+
+ def _to_dict(self) -> dict[str, int]:
+ """Converts the timestamp range to a dict representation."""
+ timestamp_range_kwargs = {}
+ if self.start is not None:
+ start_time = _microseconds_from_datetime(self.start) // 1000 * 1000
+ timestamp_range_kwargs["start_timestamp_micros"] = start_time
+ if self.end is not None:
+ end_time = _microseconds_from_datetime(self.end)
+ if end_time % 1000 != 0:
+ # if not a whole milisecond value, round up
+ end_time = end_time // 1000 * 1000 + 1000
+ timestamp_range_kwargs["end_timestamp_micros"] = end_time
+ return timestamp_range_kwargs
+
+ def __repr__(self) -> str:
+ return f"{self.__class__.__name__}(start={self.start}, end={self.end})"
+
+
+class TimestampRangeFilter(RowFilter):
+ """Row filter that limits cells to a range of time.
+
+ :type range_: :class:`TimestampRange`
+ :param range_: Range of time that cells should match against.
+ """
+
+ def __init__(self, start: "datetime" | None = None, end: "datetime" | None = None):
+ self.range_: TimestampRange = TimestampRange(start, end)
+
+ def __eq__(self, other):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return other.range_ == self.range_
+
+ def __ne__(self, other):
+ return not self == other
+
+ def _to_pb(self) -> data_v2_pb2.RowFilter:
+ """Converts the row filter to a protobuf.
+
+ First converts the ``range_`` on the current object to a protobuf and
+ then uses it in the ``timestamp_range_filter`` field.
+
+ Returns: The converted current object.
+ """
+ return data_v2_pb2.RowFilter(timestamp_range_filter=self.range_._to_pb())
+
+ def _to_dict(self) -> dict[str, Any]:
+ """Converts the row filter to a dict representation."""
+ return {"timestamp_range_filter": self.range_._to_dict()}
+
+ def __repr__(self) -> str:
+ return f"{self.__class__.__name__}(start={self.range_.start!r}, end={self.range_.end!r})"
+
+
+class ColumnRangeFilter(RowFilter):
+ """A row filter to restrict to a range of columns.
+
+ Both the start and end column can be included or excluded in the range.
+ By default, we include them both, but this can be changed with optional
+ flags.
+
+ :type family_id: str
+ :param family_id: The column family that contains the columns. Must
+ be of the form ``[_a-zA-Z0-9][-_.a-zA-Z0-9]*``.
+
+ :type start_qualifier: bytes
+ :param start_qualifier: The start of the range of columns. If no value is
+ used, the backend applies no upper bound to the
+ values.
+
+ :type end_qualifier: bytes
+ :param end_qualifier: The end of the range of columns. If no value is used,
+ the backend applies no upper bound to the values.
+
+ :type inclusive_start: bool
+ :param inclusive_start: Boolean indicating if the start column should be
+ included in the range (or excluded). Defaults
+ to :data:`True` if ``start_qualifier`` is passed and
+ no ``inclusive_start`` was given.
+
+ :type inclusive_end: bool
+ :param inclusive_end: Boolean indicating if the end column should be
+ included in the range (or excluded). Defaults
+ to :data:`True` if ``end_qualifier`` is passed and
+ no ``inclusive_end`` was given.
+
+ :raises: :class:`ValueError ` if ``inclusive_start``
+ is set but no ``start_qualifier`` is given or if ``inclusive_end``
+ is set but no ``end_qualifier`` is given
+ """
+
+ def __init__(
+ self,
+ family_id: str,
+ start_qualifier: bytes | None = None,
+ end_qualifier: bytes | None = None,
+ inclusive_start: bool | None = None,
+ inclusive_end: bool | None = None,
+ ):
+ if inclusive_start is None:
+ inclusive_start = True
+ elif start_qualifier is None:
+ raise ValueError(
+ "inclusive_start was specified but no start_qualifier was given."
+ )
+ if inclusive_end is None:
+ inclusive_end = True
+ elif end_qualifier is None:
+ raise ValueError(
+ "inclusive_end was specified but no end_qualifier was given."
+ )
+
+ self.family_id = family_id
+
+ self.start_qualifier = start_qualifier
+ self.inclusive_start = inclusive_start
+
+ self.end_qualifier = end_qualifier
+ self.inclusive_end = inclusive_end
+
+ def __eq__(self, other):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ other.family_id == self.family_id
+ and other.start_qualifier == self.start_qualifier
+ and other.end_qualifier == self.end_qualifier
+ and other.inclusive_start == self.inclusive_start
+ and other.inclusive_end == self.inclusive_end
+ )
+
+ def __ne__(self, other):
+ return not self == other
+
+ def _to_pb(self) -> data_v2_pb2.RowFilter:
+ """Converts the row filter to a protobuf.
+
+ First converts to a :class:`.data_v2_pb2.ColumnRange` and then uses it
+ in the ``column_range_filter`` field.
+
+ Returns: The converted current object.
+ """
+ column_range = data_v2_pb2.ColumnRange(**self._range_to_dict())
+ return data_v2_pb2.RowFilter(column_range_filter=column_range)
+
+ def _range_to_dict(self) -> dict[str, str | bytes]:
+ """Converts the column range range to a dict representation."""
+ column_range_kwargs: dict[str, str | bytes] = {}
+ column_range_kwargs["family_name"] = self.family_id
+ if self.start_qualifier is not None:
+ if self.inclusive_start:
+ key = "start_qualifier_closed"
+ else:
+ key = "start_qualifier_open"
+ column_range_kwargs[key] = _to_bytes(self.start_qualifier)
+ if self.end_qualifier is not None:
+ if self.inclusive_end:
+ key = "end_qualifier_closed"
+ else:
+ key = "end_qualifier_open"
+ column_range_kwargs[key] = _to_bytes(self.end_qualifier)
+ return column_range_kwargs
+
+ def _to_dict(self) -> dict[str, Any]:
+ """Converts the row filter to a dict representation."""
+ return {"column_range_filter": self._range_to_dict()}
+
+ def __repr__(self) -> str:
+ return f"{self.__class__.__name__}(family_id='{self.family_id}', start_qualifier={self.start_qualifier!r}, end_qualifier={self.end_qualifier!r}, inclusive_start={self.inclusive_start}, inclusive_end={self.inclusive_end})"
+
+
+class ValueRegexFilter(_RegexFilter):
+ """Row filter for a value regular expression.
+
+ The ``regex`` must be valid RE2 patterns. See Google's
+ `RE2 reference`_ for the accepted syntax.
+
+ .. _RE2 reference: https://github.com/google/re2/wiki/Syntax
+
+ .. note::
+
+ Special care need be used with the expression used. Since
+ each of these properties can contain arbitrary bytes, the ``\\C``
+ escape sequence must be used if a true wildcard is desired. The ``.``
+ character will not match the new line character ``\\n``, which may be
+ present in a binary value.
+
+ :type regex: bytes or str
+ :param regex: A regular expression (RE2) to match cells with values that
+ match this regex. String values will be encoded as ASCII.
+ """
+
+ def _to_dict(self) -> dict[str, bytes]:
+ """Converts the row filter to a dict representation."""
+ return {"value_regex_filter": self.regex}
+
+
+class LiteralValueFilter(ValueRegexFilter):
+ """Row filter for an exact value.
+
+
+ :type value: bytes or str or int
+ :param value:
+ a literal string, integer, or the equivalent bytes.
+ Integer values will be packed into signed 8-bytes.
+ """
+
+ def __init__(self, value: bytes | str | int):
+ if isinstance(value, int):
+ value = _PACK_I64(value)
+ elif isinstance(value, str):
+ value = value.encode("utf-8")
+ value = self._write_literal_regex(value)
+ super(LiteralValueFilter, self).__init__(value)
+
+ @staticmethod
+ def _write_literal_regex(input_bytes: bytes) -> bytes:
+ """
+ Escape re2 special characters from literal bytes.
+
+ Extracted from: re2 QuoteMeta:
+ https://github.com/google/re2/blob/70f66454c255080a54a8da806c52d1f618707f8a/re2/re2.cc#L456
+ """
+ result = bytearray()
+ for byte in input_bytes:
+ # If this is the part of a UTF8 or Latin1 character, we need \
+ # to copy this byte without escaping. Experimentally this is \
+ # what works correctly with the regexp library. \
+ utf8_latin1_check = (byte & 128) == 0
+ if (
+ (byte < ord("a") or byte > ord("z"))
+ and (byte < ord("A") or byte > ord("Z"))
+ and (byte < ord("0") or byte > ord("9"))
+ and byte != ord("_")
+ and utf8_latin1_check
+ ):
+ if byte == 0:
+ # Special handling for null chars.
+ # Note that this special handling is not strictly required for RE2,
+ # but this quoting is required for other regexp libraries such as
+ # PCRE.
+ # Can't use "\\0" since the next character might be a digit.
+ result.extend([ord("\\"), ord("x"), ord("0"), ord("0")])
+ continue
+ result.append(ord(b"\\"))
+ result.append(byte)
+ return bytes(result)
+
+ def __repr__(self) -> str:
+ return f"{self.__class__.__name__}(value={self.regex!r})"
+
+
+class ValueRangeFilter(RowFilter):
+ """A range of values to restrict to in a row filter.
+
+ Will only match cells that have values in this range.
+
+ Both the start and end value can be included or excluded in the range.
+ By default, we include them both, but this can be changed with optional
+ flags.
+
+ :type start_value: bytes
+ :param start_value: The start of the range of values. If no value is used,
+ the backend applies no lower bound to the values.
+
+ :type end_value: bytes
+ :param end_value: The end of the range of values. If no value is used,
+ the backend applies no upper bound to the values.
+
+ :type inclusive_start: bool
+ :param inclusive_start: Boolean indicating if the start value should be
+ included in the range (or excluded). Defaults
+ to :data:`True` if ``start_value`` is passed and
+ no ``inclusive_start`` was given.
+
+ :type inclusive_end: bool
+ :param inclusive_end: Boolean indicating if the end value should be
+ included in the range (or excluded). Defaults
+ to :data:`True` if ``end_value`` is passed and
+ no ``inclusive_end`` was given.
+
+ :raises: :class:`ValueError ` if ``inclusive_start``
+ is set but no ``start_value`` is given or if ``inclusive_end``
+ is set but no ``end_value`` is given
+ """
+
+ def __init__(
+ self,
+ start_value: bytes | int | None = None,
+ end_value: bytes | int | None = None,
+ inclusive_start: bool | None = None,
+ inclusive_end: bool | None = None,
+ ):
+ if inclusive_start is None:
+ inclusive_start = True
+ elif start_value is None:
+ raise ValueError(
+ "inclusive_start was specified but no start_value was given."
+ )
+ if inclusive_end is None:
+ inclusive_end = True
+ elif end_value is None:
+ raise ValueError(
+ "inclusive_end was specified but no end_qualifier was given."
+ )
+ if isinstance(start_value, int):
+ start_value = _PACK_I64(start_value)
+ self.start_value = start_value
+ self.inclusive_start = inclusive_start
+
+ if isinstance(end_value, int):
+ end_value = _PACK_I64(end_value)
+ self.end_value = end_value
+ self.inclusive_end = inclusive_end
+
+ def __eq__(self, other):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ other.start_value == self.start_value
+ and other.end_value == self.end_value
+ and other.inclusive_start == self.inclusive_start
+ and other.inclusive_end == self.inclusive_end
+ )
+
+ def __ne__(self, other):
+ return not self == other
+
+ def _to_pb(self) -> data_v2_pb2.RowFilter:
+ """Converts the row filter to a protobuf.
+
+ First converts to a :class:`.data_v2_pb2.ValueRange` and then uses
+ it to create a row filter protobuf.
+
+ Returns: The converted current object.
+ """
+ value_range = data_v2_pb2.ValueRange(**self._range_to_dict())
+ return data_v2_pb2.RowFilter(value_range_filter=value_range)
+
+ def _range_to_dict(self) -> dict[str, bytes]:
+ """Converts the value range range to a dict representation."""
+ value_range_kwargs = {}
+ if self.start_value is not None:
+ if self.inclusive_start:
+ key = "start_value_closed"
+ else:
+ key = "start_value_open"
+ value_range_kwargs[key] = _to_bytes(self.start_value)
+ if self.end_value is not None:
+ if self.inclusive_end:
+ key = "end_value_closed"
+ else:
+ key = "end_value_open"
+ value_range_kwargs[key] = _to_bytes(self.end_value)
+ return value_range_kwargs
+
+ def _to_dict(self) -> dict[str, Any]:
+ """Converts the row filter to a dict representation."""
+ return {"value_range_filter": self._range_to_dict()}
+
+ def __repr__(self) -> str:
+ return f"{self.__class__.__name__}(start_value={self.start_value!r}, end_value={self.end_value!r}, inclusive_start={self.inclusive_start}, inclusive_end={self.inclusive_end})"
+
+
+class _CellCountFilter(RowFilter, ABC):
+ """Row filter that uses an integer count of cells.
+
+ The cell count is used as an offset or a limit for the number
+ of results returned.
+
+ :type num_cells: int
+ :param num_cells: An integer count / offset / limit.
+ """
+
+ def __init__(self, num_cells: int):
+ self.num_cells = num_cells
+
+ def __eq__(self, other):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return other.num_cells == self.num_cells
+
+ def __ne__(self, other):
+ return not self == other
+
+ def __repr__(self) -> str:
+ return f"{self.__class__.__name__}(num_cells={self.num_cells})"
+
+
+class CellsRowOffsetFilter(_CellCountFilter):
+ """Row filter to skip cells in a row.
+
+ :type num_cells: int
+ :param num_cells: Skips the first N cells of the row.
+ """
+
+ def _to_dict(self) -> dict[str, int]:
+ """Converts the row filter to a dict representation."""
+ return {"cells_per_row_offset_filter": self.num_cells}
+
+
+class CellsRowLimitFilter(_CellCountFilter):
+ """Row filter to limit cells in a row.
+
+ :type num_cells: int
+ :param num_cells: Matches only the first N cells of the row.
+ """
+
+ def _to_dict(self) -> dict[str, int]:
+ """Converts the row filter to a dict representation."""
+ return {"cells_per_row_limit_filter": self.num_cells}
+
+
+class CellsColumnLimitFilter(_CellCountFilter):
+ """Row filter to limit cells in a column.
+
+ :type num_cells: int
+ :param num_cells: Matches only the most recent N cells within each column.
+ This filters a (family name, column) pair, based on
+ timestamps of each cell.
+ """
+
+ def _to_dict(self) -> dict[str, int]:
+ """Converts the row filter to a dict representation."""
+ return {"cells_per_column_limit_filter": self.num_cells}
+
+
+class StripValueTransformerFilter(_BoolFilter):
+ """Row filter that transforms cells into empty string (0 bytes).
+
+ :type flag: bool
+ :param flag: If :data:`True`, replaces each cell's value with the empty
+ string. As the name indicates, this is more useful as a
+ transformer than a generic query / filter.
+ """
+
+ def _to_dict(self) -> dict[str, Any]:
+ """Converts the row filter to a dict representation."""
+ return {"strip_value_transformer": self.flag}
+
+
+class ApplyLabelFilter(RowFilter):
+ """Filter to apply labels to cells.
+
+ Intended to be used as an intermediate filter on a pre-existing filtered
+ result set. This way if two sets are combined, the label can tell where
+ the cell(s) originated.This allows the client to determine which results
+ were produced from which part of the filter.
+
+ .. note::
+
+ Due to a technical limitation of the backend, it is not currently
+ possible to apply multiple labels to a cell.
+
+ :type label: str
+ :param label: Label to apply to cells in the output row. Values must be
+ at most 15 characters long, and match the pattern
+ ``[a-z0-9\\-]+``.
+ """
+
+ def __init__(self, label: str):
+ self.label = label
+
+ def __eq__(self, other):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return other.label == self.label
+
+ def __ne__(self, other):
+ return not self == other
+
+ def _to_dict(self) -> dict[str, str]:
+ """Converts the row filter to a dict representation."""
+ return {"apply_label_transformer": self.label}
+
+ def __repr__(self) -> str:
+ return f"{self.__class__.__name__}(label={self.label})"
+
+
+class _FilterCombination(RowFilter, Sequence[RowFilter], ABC):
+ """Chain of row filters.
+
+ Sends rows through several filters in sequence. The filters are "chained"
+ together to process a row. After the first filter is applied, the second
+ is applied to the filtered output and so on for subsequent filters.
+
+ :type filters: list
+ :param filters: List of :class:`RowFilter`
+ """
+
+ def __init__(self, filters: list[RowFilter] | None = None):
+ if filters is None:
+ filters = []
+ self.filters: list[RowFilter] = filters
+
+ def __eq__(self, other):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return other.filters == self.filters
+
+ def __ne__(self, other):
+ return not self == other
+
+ def __len__(self) -> int:
+ return len(self.filters)
+
+ @overload
+ def __getitem__(self, index: int) -> RowFilter:
+ # overload signature for type checking
+ pass
+
+ @overload
+ def __getitem__(self, index: slice) -> list[RowFilter]:
+ # overload signature for type checking
+ pass
+
+ def __getitem__(self, index):
+ return self.filters[index]
+
+ def __repr__(self) -> str:
+ return f"{self.__class__.__name__}(filters={self.filters})"
+
+ def __str__(self) -> str:
+ """
+ Returns a string representation of the filter chain.
+
+ Adds line breaks between each sub-filter for readability.
+ """
+ output = [f"{self.__class__.__name__}(["]
+ for filter_ in self.filters:
+ filter_lines = f"{filter_},".splitlines()
+ output.extend([f" {line}" for line in filter_lines])
+ output.append("])")
+ return "\n".join(output)
+
+
+class RowFilterChain(_FilterCombination):
+ """Chain of row filters.
+
+ Sends rows through several filters in sequence. The filters are "chained"
+ together to process a row. After the first filter is applied, the second
+ is applied to the filtered output and so on for subsequent filters.
+
+ :type filters: list
+ :param filters: List of :class:`RowFilter`
+ """
+
+ def _to_pb(self) -> data_v2_pb2.RowFilter:
+ """Converts the row filter to a protobuf.
+
+ Returns: The converted current object.
+ """
+ chain = data_v2_pb2.RowFilter.Chain(
+ filters=[row_filter._to_pb() for row_filter in self.filters]
+ )
+ return data_v2_pb2.RowFilter(chain=chain)
+
+ def _to_dict(self) -> dict[str, Any]:
+ """Converts the row filter to a dict representation."""
+ return {"chain": {"filters": [f._to_dict() for f in self.filters]}}
+
+
+class RowFilterUnion(_FilterCombination):
+ """Union of row filters.
+
+ Sends rows through several filters simultaneously, then
+ merges / interleaves all the filtered results together.
+
+ If multiple cells are produced with the same column and timestamp,
+ they will all appear in the output row in an unspecified mutual order.
+
+ :type filters: list
+ :param filters: List of :class:`RowFilter`
+ """
+
+ def _to_pb(self) -> data_v2_pb2.RowFilter:
+ """Converts the row filter to a protobuf.
+
+ Returns: The converted current object.
+ """
+ interleave = data_v2_pb2.RowFilter.Interleave(
+ filters=[row_filter._to_pb() for row_filter in self.filters]
+ )
+ return data_v2_pb2.RowFilter(interleave=interleave)
+
+ def _to_dict(self) -> dict[str, Any]:
+ """Converts the row filter to a dict representation."""
+ return {"interleave": {"filters": [f._to_dict() for f in self.filters]}}
+
+
+class ConditionalRowFilter(RowFilter):
+ """Conditional row filter which exhibits ternary behavior.
+
+ Executes one of two filters based on another filter. If the ``predicate_filter``
+ returns any cells in the row, then ``true_filter`` is executed. If not,
+ then ``false_filter`` is executed.
+
+ .. note::
+
+ The ``predicate_filter`` does not execute atomically with the true and false
+ filters, which may lead to inconsistent or unexpected results.
+
+ Additionally, executing a :class:`ConditionalRowFilter` has poor
+ performance on the server, especially when ``false_filter`` is set.
+
+ :type predicate_filter: :class:`RowFilter`
+ :param predicate_filter: The filter to condition on before executing the
+ true/false filters.
+
+ :type true_filter: :class:`RowFilter`
+ :param true_filter: (Optional) The filter to execute if there are any cells
+ matching ``predicate_filter``. If not provided, no results
+ will be returned in the true case.
+
+ :type false_filter: :class:`RowFilter`
+ :param false_filter: (Optional) The filter to execute if there are no cells
+ matching ``predicate_filter``. If not provided, no results
+ will be returned in the false case.
+ """
+
+ def __init__(
+ self,
+ predicate_filter: RowFilter,
+ true_filter: RowFilter | None = None,
+ false_filter: RowFilter | None = None,
+ ):
+ self.predicate_filter = predicate_filter
+ self.true_filter = true_filter
+ self.false_filter = false_filter
+
+ def __eq__(self, other):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ other.predicate_filter == self.predicate_filter
+ and other.true_filter == self.true_filter
+ and other.false_filter == self.false_filter
+ )
+
+ def __ne__(self, other):
+ return not self == other
+
+ def _to_pb(self) -> data_v2_pb2.RowFilter:
+ """Converts the row filter to a protobuf.
+
+ Returns: The converted current object.
+ """
+ condition_kwargs = {"predicate_filter": self.predicate_filter._to_pb()}
+ if self.true_filter is not None:
+ condition_kwargs["true_filter"] = self.true_filter._to_pb()
+ if self.false_filter is not None:
+ condition_kwargs["false_filter"] = self.false_filter._to_pb()
+ condition = data_v2_pb2.RowFilter.Condition(**condition_kwargs)
+ return data_v2_pb2.RowFilter(condition=condition)
+
+ def _condition_to_dict(self) -> dict[str, Any]:
+ """Converts the condition to a dict representation."""
+ condition_kwargs = {"predicate_filter": self.predicate_filter._to_dict()}
+ if self.true_filter is not None:
+ condition_kwargs["true_filter"] = self.true_filter._to_dict()
+ if self.false_filter is not None:
+ condition_kwargs["false_filter"] = self.false_filter._to_dict()
+ return condition_kwargs
+
+ def _to_dict(self) -> dict[str, Any]:
+ """Converts the row filter to a dict representation."""
+ return {"condition": self._condition_to_dict()}
+
+ def __repr__(self) -> str:
+ return f"{self.__class__.__name__}(predicate_filter={self.predicate_filter!r}, true_filter={self.true_filter!r}, false_filter={self.false_filter!r})"
+
+ def __str__(self) -> str:
+ output = [f"{self.__class__.__name__}("]
+ for filter_type in ("predicate_filter", "true_filter", "false_filter"):
+ filter_ = getattr(self, filter_type)
+ if filter_ is None:
+ continue
+ # add the new filter set, adding indentations for readability
+ filter_lines = f"{filter_type}={filter_},".splitlines()
+ output.extend(f" {line}" for line in filter_lines)
+ output.append(")")
+ return "\n".join(output)
diff --git a/google/cloud/bigtable/encryption_info.py b/google/cloud/bigtable/encryption_info.py
new file mode 100644
index 000000000..1757297bc
--- /dev/null
+++ b/google/cloud/bigtable/encryption_info.py
@@ -0,0 +1,64 @@
+# Copyright 2021 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.
+
+"""Class for encryption info for tables and backups."""
+
+from google.cloud.bigtable.error import Status
+
+
+class EncryptionInfo:
+ """Encryption information for a given resource.
+
+ If this resource is protected with customer managed encryption, the in-use Google
+ Cloud Key Management Service (KMS) key versions will be specified along with their
+ status.
+
+ :type encryption_type: int
+ :param encryption_type: See :class:`enums.EncryptionInfo.EncryptionType`
+
+ :type encryption_status: google.cloud.bigtable.encryption.Status
+ :param encryption_status: The encryption status.
+
+ :type kms_key_version: str
+ :param kms_key_version: The key version used for encryption.
+ """
+
+ @classmethod
+ def _from_pb(cls, info_pb):
+ return cls(
+ info_pb.encryption_type,
+ Status(info_pb.encryption_status),
+ info_pb.kms_key_version,
+ )
+
+ def __init__(self, encryption_type, encryption_status, kms_key_version):
+ self.encryption_type = encryption_type
+ self.encryption_status = encryption_status
+ self.kms_key_version = kms_key_version
+
+ def __eq__(self, other):
+ if self is other:
+ return True
+
+ if not isinstance(other, type(self)):
+ return NotImplemented
+
+ return (
+ self.encryption_type == other.encryption_type
+ and self.encryption_status == other.encryption_status
+ and self.kms_key_version == other.kms_key_version
+ )
+
+ def __ne__(self, other):
+ return not self == other
diff --git a/google/cloud/bigtable/enums.py b/google/cloud/bigtable/enums.py
index f0965779f..327b2f828 100644
--- a/google/cloud/bigtable/enums.py
+++ b/google/cloud/bigtable/enums.py
@@ -13,7 +13,9 @@
# limitations under the License.
"""Wrappers for gapic enum types."""
-from google.cloud.bigtable_admin_v2 import enums
+from google.cloud.bigtable_admin_v2.types import common
+from google.cloud.bigtable_admin_v2.types import instance
+from google.cloud.bigtable_admin_v2.types import table
class StorageType(object):
@@ -26,9 +28,9 @@ class StorageType(object):
HDD (int): Magnetic drive (HDD) storage should be used.
"""
- UNSPECIFIED = enums.StorageType.STORAGE_TYPE_UNSPECIFIED
- SSD = enums.StorageType.SSD
- HDD = enums.StorageType.HDD
+ UNSPECIFIED = common.StorageType.STORAGE_TYPE_UNSPECIFIED
+ SSD = common.StorageType.SSD
+ HDD = common.StorageType.HDD
class Instance(object):
@@ -45,9 +47,9 @@ class State(object):
destroyed if the creation process encounters an error.
"""
- NOT_KNOWN = enums.Instance.State.STATE_NOT_KNOWN
- READY = enums.Instance.State.READY
- CREATING = enums.Instance.State.CREATING
+ NOT_KNOWN = instance.Instance.State.STATE_NOT_KNOWN
+ READY = instance.Instance.State.READY
+ CREATING = instance.Instance.State.CREATING
class Type(object):
"""
@@ -70,9 +72,9 @@ class Type(object):
must not be set.
"""
- UNSPECIFIED = enums.Instance.Type.TYPE_UNSPECIFIED
- PRODUCTION = enums.Instance.Type.PRODUCTION
- DEVELOPMENT = enums.Instance.Type.DEVELOPMENT
+ UNSPECIFIED = instance.Instance.Type.TYPE_UNSPECIFIED
+ PRODUCTION = instance.Instance.Type.PRODUCTION
+ DEVELOPMENT = instance.Instance.Type.DEVELOPMENT
class Cluster(object):
@@ -96,11 +98,11 @@ class State(object):
still exist, but no operations can be performed on the cluster.
"""
- NOT_KNOWN = enums.Cluster.State.STATE_NOT_KNOWN
- READY = enums.Cluster.State.READY
- CREATING = enums.Cluster.State.CREATING
- RESIZING = enums.Cluster.State.RESIZING
- DISABLED = enums.Cluster.State.DISABLED
+ NOT_KNOWN = instance.Cluster.State.STATE_NOT_KNOWN
+ READY = instance.Cluster.State.READY
+ CREATING = instance.Cluster.State.CREATING
+ RESIZING = instance.Cluster.State.RESIZING
+ DISABLED = instance.Cluster.State.DISABLED
class RoutingPolicyType(object):
@@ -150,11 +152,12 @@ class View(object):
FULL (int): Populates all fields.
"""
- VIEW_UNSPECIFIED = enums.Table.View.VIEW_UNSPECIFIED
- NAME_ONLY = enums.Table.View.NAME_ONLY
- SCHEMA_VIEW = enums.Table.View.SCHEMA_VIEW
- REPLICATION_VIEW = enums.Table.View.REPLICATION_VIEW
- FULL = enums.Table.View.FULL
+ VIEW_UNSPECIFIED = table.Table.View.VIEW_UNSPECIFIED
+ NAME_ONLY = table.Table.View.NAME_ONLY
+ SCHEMA_VIEW = table.Table.View.SCHEMA_VIEW
+ REPLICATION_VIEW = table.Table.View.REPLICATION_VIEW
+ ENCRYPTION_VIEW = table.Table.View.ENCRYPTION_VIEW
+ FULL = table.Table.View.FULL
class ReplicationState(object):
"""
@@ -180,12 +183,41 @@ class ReplicationState(object):
reflect the state of the table in other clusters.
"""
- STATE_NOT_KNOWN = enums.Table.ClusterState.ReplicationState.STATE_NOT_KNOWN
- INITIALIZING = enums.Table.ClusterState.ReplicationState.INITIALIZING
+ STATE_NOT_KNOWN = table.Table.ClusterState.ReplicationState.STATE_NOT_KNOWN
+ INITIALIZING = table.Table.ClusterState.ReplicationState.INITIALIZING
PLANNED_MAINTENANCE = (
- enums.Table.ClusterState.ReplicationState.PLANNED_MAINTENANCE
+ table.Table.ClusterState.ReplicationState.PLANNED_MAINTENANCE
)
UNPLANNED_MAINTENANCE = (
- enums.Table.ClusterState.ReplicationState.UNPLANNED_MAINTENANCE
+ table.Table.ClusterState.ReplicationState.UNPLANNED_MAINTENANCE
+ )
+ READY = table.Table.ClusterState.ReplicationState.READY
+
+
+class EncryptionInfo:
+ class EncryptionType:
+ """Possible encryption types for a resource.
+
+ Attributes:
+ ENCRYPTION_TYPE_UNSPECIFIED (int): Encryption type was not specified, though
+ data at rest remains encrypted.
+ GOOGLE_DEFAULT_ENCRYPTION (int): The data backing this resource is encrypted
+ at rest with a key that is fully managed by Google. No key version or
+ status will be populated. This is the default state.
+ CUSTOMER_MANAGED_ENCRYPTION (int): The data backing this resource is
+ encrypted at rest with a key that is managed by the customer. The in-use
+ version of the key and its status are populated for CMEK-protected
+ tables. CMEK-protected backups are pinned to the key version that was in
+ use at the time the backup was taken. This key version is populated but
+ its status is not tracked and is reported as `UNKNOWN`.
+ """
+
+ ENCRYPTION_TYPE_UNSPECIFIED = (
+ table.EncryptionInfo.EncryptionType.ENCRYPTION_TYPE_UNSPECIFIED
+ )
+ GOOGLE_DEFAULT_ENCRYPTION = (
+ table.EncryptionInfo.EncryptionType.GOOGLE_DEFAULT_ENCRYPTION
+ )
+ CUSTOMER_MANAGED_ENCRYPTION = (
+ table.EncryptionInfo.EncryptionType.CUSTOMER_MANAGED_ENCRYPTION
)
- READY = enums.Table.ClusterState.ReplicationState.READY
diff --git a/google/cloud/bigtable/error.py b/google/cloud/bigtable/error.py
new file mode 100644
index 000000000..075bb01cc
--- /dev/null
+++ b/google/cloud/bigtable/error.py
@@ -0,0 +1,64 @@
+# Copyright 2021 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.
+
+"""Class for error status."""
+
+
+class Status:
+ """A status, comprising a code and a message.
+
+ See: `Cloud APIs Errors `_
+
+ This is a thin wrapper for ``google.rpc.status_pb2.Status``.
+
+ :type status_pb: google.rpc.status_pb2.Status
+ :param status_pb: The status protocol buffer.
+ """
+
+ def __init__(self, status_pb):
+ self.status_pb = status_pb
+
+ @property
+ def code(self):
+ """The status code.
+
+ Values are defined in ``google.rpc.code_pb2.Code``.
+
+ See: `google.rpc.Code
+ `_
+
+ :rtype: int
+ :returns: The status code.
+ """
+ return self.status_pb.code
+
+ @property
+ def message(self):
+ """A human readable status message.
+
+ :rypte: str
+ :returns: The status message.
+ """
+ return self.status_pb.message
+
+ def __repr__(self):
+ return repr(self.status_pb)
+
+ def __eq__(self, other):
+ if isinstance(other, type(self)):
+ return self.status_pb == other.status_pb
+ return NotImplemented
+
+ def __ne__(self, other):
+ return not self == other
diff --git a/google/cloud/bigtable/gapic_version.py b/google/cloud/bigtable/gapic_version.py
new file mode 100644
index 000000000..a105a8349
--- /dev/null
+++ b/google/cloud/bigtable/gapic_version.py
@@ -0,0 +1,16 @@
+# -*- coding: utf-8 -*-
+# Copyright 2022 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.
+#
+__version__ = "2.35.0" # {x-release-please-version}
diff --git a/google/cloud/bigtable/helpers.py b/google/cloud/bigtable/helpers.py
new file mode 100644
index 000000000..78af43089
--- /dev/null
+++ b/google/cloud/bigtable/helpers.py
@@ -0,0 +1,31 @@
+# Copyright 2024 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from typing import TypeVar, Iterable, Generator, Tuple
+
+from itertools import islice
+
+T = TypeVar("T")
+
+
+# batched landed in standard library in Python 3.11.
+def batched(iterable: Iterable[T], n) -> Generator[Tuple[T, ...], None, None]:
+ # batched('ABCDEFG', 3) → ABC DEF G
+ if n < 1:
+ raise ValueError("n must be at least one")
+ it = iter(iterable)
+ batch = tuple(islice(it, n))
+ while batch:
+ yield batch
+ batch = tuple(islice(it, n))
diff --git a/google/cloud/bigtable/instance.py b/google/cloud/bigtable/instance.py
index e0a30590b..23fb1c95d 100644
--- a/google/cloud/bigtable/instance.py
+++ b/google/cloud/bigtable/instance.py
@@ -14,16 +14,17 @@
"""User-friendly container for Google Cloud Bigtable Instance."""
-
import re
-from google.cloud.bigtable.table import Table
-from google.cloud.bigtable.cluster import Cluster
from google.cloud.bigtable.app_profile import AppProfile
+from google.cloud.bigtable.cluster import Cluster
+from google.cloud.bigtable.table import Table
from google.protobuf import field_mask_pb2
-from google.cloud.bigtable_admin_v2.types import instance_pb2, options_pb2
+from google.cloud.bigtable_admin_v2.types import instance
+
+from google.iam.v1 import options_pb2 # type: ignore
from google.api_core.exceptions import NotFound
@@ -31,6 +32,7 @@
import warnings
+
_INSTANCE_NAME_RE = re.compile(
r"^projects/(?P[^/]+)/" r"instances/(?P[a-z][-a-z0-9]*)$"
)
@@ -122,7 +124,7 @@ def _update_from_pb(self, instance_pb):
if not instance_pb.display_name: # Simple field (string)
raise ValueError("Instance protobuf does not contain display_name")
self.display_name = instance_pb.display_name
- self.type_ = instance_pb.type
+ self.type_ = instance_pb.type_
self.labels = dict(instance_pb.labels)
self._state = instance_pb.state
@@ -133,10 +135,11 @@ def from_pb(cls, instance_pb, client):
For example:
.. literalinclude:: snippets.py
- :start-after: [START bigtable_instance_from_pb]
- :end-before: [END bigtable_instance_from_pb]
+ :start-after: [START bigtable_api_instance_from_pb]
+ :end-before: [END bigtable_api_instance_from_pb]
+ :dedent: 4
- :type instance_pb: :class:`instance_pb2.Instance`
+ :type instance_pb: :class:`instance.Instance`
:param instance_pb: An instance protobuf object.
:type client: :class:`Client `
@@ -177,8 +180,9 @@ def name(self):
For example:
.. literalinclude:: snippets.py
- :start-after: [START bigtable_instance_name]
- :end-before: [END bigtable_instance_name]
+ :start-after: [START bigtable_api_instance_name]
+ :end-before: [END bigtable_api_instance_name]
+ :dedent: 4
The instance name is of the form
@@ -198,8 +202,9 @@ def state(self):
For example:
.. literalinclude:: snippets.py
- :start-after: [START bigtable_instance_state]
- :end-before: [END bigtable_instance_state]
+ :start-after: [START bigtable_api_instance_state]
+ :end-before: [END bigtable_api_instance_state]
+ :dedent: 4
"""
return self._state
@@ -224,14 +229,18 @@ def create(
serve_nodes=None,
default_storage_type=None,
clusters=None,
+ min_serve_nodes=None,
+ max_serve_nodes=None,
+ cpu_utilization_percent=None,
):
"""Create this instance.
For example:
.. literalinclude:: snippets.py
- :start-after: [START bigtable_create_prod_instance]
- :end-before: [END bigtable_create_prod_instance]
+ :start-after: [START bigtable_api_create_prod_instance]
+ :end-before: [END bigtable_api_create_prod_instance]
+ :dedent: 4
.. note::
@@ -265,7 +274,7 @@ def create(
Possible values are represented
by the following constants:
:data:`google.cloud.bigtable.enums.StorageType.SSD`.
- :data:`google.cloud.bigtable.enums.StorageType.SHD`,
+ :data:`google.cloud.bigtable.enums.StorageType.HDD`,
Defaults to
:data:`google.cloud.bigtable.enums.StorageType.UNSPECIFIED`.
@@ -298,12 +307,18 @@ def create(
location_id=location_id,
serve_nodes=serve_nodes,
default_storage_type=default_storage_type,
+ min_serve_nodes=None,
+ max_serve_nodes=None,
+ cpu_utilization_percent=None,
)
]
elif (
location_id is not None
or serve_nodes is not None
or default_storage_type is not None
+ or min_serve_nodes is not None
+ or max_serve_nodes is not None
+ or cpu_utilization_percent is not None
):
raise ValueError(
"clusters and one of location_id, serve_nodes, \
@@ -311,17 +326,19 @@ def create(
simultaneously."
)
- instance_pb = instance_pb2.Instance(
- display_name=self.display_name, type=self.type_, labels=self.labels
+ instance_pb = instance.Instance(
+ display_name=self.display_name, type_=self.type_, labels=self.labels
)
parent = self._client.project_path
return self._client.instance_admin_client.create_instance(
- parent=parent,
- instance_id=self.instance_id,
- instance=instance_pb,
- clusters={c.cluster_id: c._to_pb() for c in clusters},
+ request={
+ "parent": parent,
+ "instance_id": self.instance_id,
+ "instance": instance_pb,
+ "clusters": {c.cluster_id: c._to_pb() for c in clusters},
+ }
)
def exists(self):
@@ -330,14 +347,15 @@ def exists(self):
For example:
.. literalinclude:: snippets.py
- :start-after: [START bigtable_check_instance_exists]
- :end-before: [END bigtable_check_instance_exists]
+ :start-after: [START bigtable_api_check_instance_exists]
+ :end-before: [END bigtable_api_check_instance_exists]
+ :dedent: 4
:rtype: bool
:returns: True if the table exists, else False.
"""
try:
- self._client.instance_admin_client.get_instance(name=self.name)
+ self._client.instance_admin_client.get_instance(request={"name": self.name})
return True
# NOTE: There could be other exceptions that are returned to the user.
except NotFound:
@@ -349,10 +367,13 @@ def reload(self):
For example:
.. literalinclude:: snippets.py
- :start-after: [START bigtable_reload_instance]
- :end-before: [END bigtable_reload_instance]
+ :start-after: [START bigtable_api_reload_instance]
+ :end-before: [END bigtable_api_reload_instance]
+ :dedent: 4
"""
- instance_pb = self._client.instance_admin_client.get_instance(self.name)
+ instance_pb = self._client.instance_admin_client.get_instance(
+ request={"name": self.name}
+ )
# NOTE: _update_from_pb does not check that the project and
# instance ID on the response match the request.
@@ -364,8 +385,9 @@ def update(self):
For example:
.. literalinclude:: snippets.py
- :start-after: [START bigtable_update_instance]
- :end-before: [END bigtable_update_instance]
+ :start-after: [START bigtable_api_update_instance]
+ :end-before: [END bigtable_api_update_instance]
+ :dedent: 4
.. note::
@@ -393,15 +415,15 @@ def update(self):
update_mask_pb.paths.append("type")
if self.labels is not None:
update_mask_pb.paths.append("labels")
- instance_pb = instance_pb2.Instance(
+ instance_pb = instance.Instance(
name=self.name,
display_name=self.display_name,
- type=self.type_,
+ type_=self.type_,
labels=self.labels,
)
return self._client.instance_admin_client.partial_update_instance(
- instance=instance_pb, update_mask=update_mask_pb
+ request={"instance": instance_pb, "update_mask": update_mask_pb}
)
def delete(self):
@@ -410,8 +432,9 @@ def delete(self):
For example:
.. literalinclude:: snippets.py
- :start-after: [START bigtable_delete_instance]
- :end-before: [END bigtable_delete_instance]
+ :start-after: [START bigtable_api_delete_instance]
+ :end-before: [END bigtable_api_delete_instance]
+ :dedent: 4
Marks an instance and all of its tables for permanent deletion
in 7 days.
@@ -432,7 +455,7 @@ def delete(self):
irrevocably disappear from the API, and their data will be
permanently deleted.
"""
- self._client.instance_admin_client.delete_instance(name=self.name)
+ self._client.instance_admin_client.delete_instance(request={"name": self.name})
def get_iam_policy(self, requested_policy_version=None):
"""Gets the access control policy for an instance resource.
@@ -440,8 +463,9 @@ def get_iam_policy(self, requested_policy_version=None):
For example:
.. literalinclude:: snippets.py
- :start-after: [START bigtable_get_iam_policy]
- :end-before: [END bigtable_get_iam_policy]
+ :start-after: [START bigtable_api_get_iam_policy]
+ :end-before: [END bigtable_api_get_iam_policy]
+ :dedent: 4
:type requested_policy_version: int or ``NoneType``
:param requested_policy_version: Optional. The version of IAM policies to request.
@@ -466,7 +490,7 @@ def get_iam_policy(self, requested_policy_version=None):
instance_admin_client = self._client.instance_admin_client
- resp = instance_admin_client.get_iam_policy(**args)
+ resp = instance_admin_client.get_iam_policy(request=args)
return Policy.from_pb(resp)
def set_iam_policy(self, policy):
@@ -479,8 +503,9 @@ class `google.cloud.bigtable.policy.Policy`
For example:
.. literalinclude:: snippets.py
- :start-after: [START bigtable_set_iam_policy]
- :end-before: [END bigtable_set_iam_policy]
+ :start-after: [START bigtable_api_set_iam_policy]
+ :end-before: [END bigtable_api_set_iam_policy]
+ :dedent: 4
:type policy: :class:`google.cloud.bigtable.policy.Policy`
:param policy: A new IAM policy to replace the current IAM policy
@@ -491,7 +516,7 @@ class `google.cloud.bigtable.policy.Policy`
"""
instance_admin_client = self._client.instance_admin_client
resp = instance_admin_client.set_iam_policy(
- resource=self.name, policy=policy.to_pb()
+ request={"resource": self.name, "policy": policy.to_pb()}
)
return Policy.from_pb(resp)
@@ -502,8 +527,9 @@ def test_iam_permissions(self, permissions):
For example:
.. literalinclude:: snippets.py
- :start-after: [START bigtable_test_iam_permissions]
- :end-before: [END bigtable_test_iam_permissions]
+ :start-after: [START bigtable_api_test_iam_permissions]
+ :end-before: [END bigtable_api_test_iam_permissions]
+ :dedent: 4
:type permissions: list
:param permissions: The set of permissions to check for
@@ -519,20 +545,29 @@ def test_iam_permissions(self, permissions):
"""
instance_admin_client = self._client.instance_admin_client
resp = instance_admin_client.test_iam_permissions(
- resource=self.name, permissions=permissions
+ request={"resource": self.name, "permissions": permissions}
)
return list(resp.permissions)
def cluster(
- self, cluster_id, location_id=None, serve_nodes=None, default_storage_type=None
+ self,
+ cluster_id,
+ location_id=None,
+ serve_nodes=None,
+ default_storage_type=None,
+ kms_key_name=None,
+ min_serve_nodes=None,
+ max_serve_nodes=None,
+ cpu_utilization_percent=None,
):
"""Factory to create a cluster associated with this instance.
For example:
.. literalinclude:: snippets.py
- :start-after: [START bigtable_create_cluster]
- :end-before: [END bigtable_create_cluster]
+ :start-after: [START bigtable_api_create_cluster]
+ :end-before: [END bigtable_api_create_cluster]
+ :dedent: 4
:type cluster_id: str
:param cluster_id: The ID of the cluster.
@@ -553,12 +588,28 @@ def cluster(
Possible values are represented by the
following constants:
:data:`google.cloud.bigtable.enums.StorageType.SSD`.
- :data:`google.cloud.bigtable.enums.StorageType.SHD`,
+ :data:`google.cloud.bigtable.enums.StorageType.HDD`,
Defaults to
:data:`google.cloud.bigtable.enums.StorageType.UNSPECIFIED`.
:rtype: :class:`~google.cloud.bigtable.instance.Cluster`
:returns: a cluster owned by this instance.
+
+ :type kms_key_name: str
+ :param kms_key_name: (Optional, Creation Only) The name of the KMS customer
+ managed encryption key (CMEK) to use for at-rest encryption
+ of data in this cluster. If omitted, Google's default
+ encryption will be used. If specified, the requirements for
+ this key are:
+
+ 1) The Cloud Bigtable service account associated with the
+ project that contains the cluster must be granted the
+ ``cloudkms.cryptoKeyEncrypterDecrypter`` role on the
+ CMEK.
+ 2) Only regional keys can be used and the region of the
+ CMEK key must match the region of the cluster.
+ 3) All clusters within an instance must use the same CMEK
+ key.
"""
return Cluster(
cluster_id,
@@ -566,6 +617,10 @@ def cluster(
location_id=location_id,
serve_nodes=serve_nodes,
default_storage_type=default_storage_type,
+ kms_key_name=kms_key_name,
+ min_serve_nodes=min_serve_nodes,
+ max_serve_nodes=max_serve_nodes,
+ cpu_utilization_percent=cpu_utilization_percent,
)
def list_clusters(self):
@@ -574,8 +629,9 @@ def list_clusters(self):
For example:
.. literalinclude:: snippets.py
- :start-after: [START bigtable_list_clusters_on_instance]
- :end-before: [END bigtable_list_clusters_on_instance]
+ :start-after: [START bigtable_api_list_clusters_on_instance]
+ :end-before: [END bigtable_api_list_clusters_on_instance]
+ :dedent: 4
:rtype: tuple
:returns:
@@ -584,7 +640,9 @@ def list_clusters(self):
'failed_locations' is a list of locations which could not
be resolved.
"""
- resp = self._client.instance_admin_client.list_clusters(self.name)
+ resp = self._client.instance_admin_client.list_clusters(
+ request={"parent": self.name}
+ )
clusters = [Cluster.from_pb(cluster, self) for cluster in resp.clusters]
return clusters, resp.failed_locations
@@ -594,12 +652,16 @@ def table(self, table_id, mutation_timeout=None, app_profile_id=None):
For example:
.. literalinclude:: snippets.py
- :start-after: [START bigtable_create_table]
- :end-before: [END bigtable_create_table]
+ :start-after: [START bigtable_api_create_table]
+ :end-before: [END bigtable_api_create_table]
+ :dedent: 4
:type table_id: str
:param table_id: The ID of the table.
+ :type mutation_timeout: int
+ :param mutation_timeout: (Optional) The overriding mutation timeout.
+
:type app_profile_id: str
:param app_profile_id: (Optional) The unique name of the AppProfile.
@@ -619,18 +681,21 @@ def list_tables(self):
For example:
.. literalinclude:: snippets.py
- :start-after: [START bigtable_list_tables]
- :end-before: [END bigtable_list_tables]
+ :start-after: [START bigtable_api_list_tables]
+ :end-before: [END bigtable_api_list_tables]
+ :dedent: 4
:rtype: list of :class:`Table `
:returns: The list of tables owned by the instance.
:raises: :class:`ValueError ` if one of the
returned tables has a name that is not of the expected format.
"""
- table_list_pb = self._client.table_admin_client.list_tables(self.name)
+ table_list_pb = self._client.table_admin_client.list_tables(
+ request={"parent": self.name}
+ )
result = []
- for table_pb in table_list_pb:
+ for table_pb in table_list_pb.tables:
table_prefix = self.name + "/tables/"
if not table_pb.name.startswith(table_prefix):
raise ValueError(
@@ -647,6 +712,7 @@ def app_profile(
routing_policy_type=None,
description=None,
cluster_id=None,
+ multi_cluster_ids=None,
allow_transactional_writes=None,
):
"""Factory to create AppProfile associated with this instance.
@@ -654,8 +720,9 @@ def app_profile(
For example:
.. literalinclude:: snippets.py
- :start-after: [START bigtable_create_app_profile]
- :end-before: [END bigtable_create_app_profile]
+ :start-after: [START bigtable_api_create_app_profile]
+ :end-before: [END bigtable_api_create_app_profile]
+ :dedent: 4
:type app_profile_id: str
:param app_profile_id: The ID of the AppProfile. Must be of the form
@@ -677,6 +744,11 @@ def app_profile(
when routing_policy_type is
ROUTING_POLICY_TYPE_SINGLE.
+ :type: multi_cluster_ids: list
+ :param: multi_cluster_ids: (Optional) The set of clusters to route to.
+ The order is ignored; clusters will be tried in order of distance.
+ If left empty, all clusters are eligible.
+
:type: allow_transactional_writes: bool
:param: allow_transactional_writes: (Optional) If true, allow
transactional writes for
@@ -691,6 +763,7 @@ def app_profile(
routing_policy_type=routing_policy_type,
description=description,
cluster_id=cluster_id,
+ multi_cluster_ids=multi_cluster_ids,
allow_transactional_writes=allow_transactional_writes,
)
@@ -700,8 +773,9 @@ def list_app_profiles(self):
For example:
.. literalinclude:: snippets.py
- :start-after: [START bigtable_list_app_profiles]
- :end-before: [END bigtable_list_app_profiles]
+ :start-after: [START bigtable_api_list_app_profiles]
+ :end-before: [END bigtable_api_list_app_profiles]
+ :dedent: 4
:rtype: :list:[`~google.cloud.bigtable.app_profile.AppProfile`]
:returns: A :list:[`~google.cloud.bigtable.app_profile.AppProfile`].
@@ -709,5 +783,7 @@ def list_app_profiles(self):
:class:`~google.cloud.bigtable.app_profile.AppProfile`
instances.
"""
- resp = self._client.instance_admin_client.list_app_profiles(self.name)
+ resp = self._client.instance_admin_client.list_app_profiles(
+ request={"parent": self.name}
+ )
return [AppProfile.from_pb(app_profile, self) for app_profile in resp]
diff --git a/google/cloud/bigtable/policy.py b/google/cloud/bigtable/policy.py
index 65be0158a..8396642fb 100644
--- a/google/cloud/bigtable/policy.py
+++ b/google/cloud/bigtable/policy.py
@@ -15,8 +15,8 @@
import base64
from google.api_core.iam import Policy as BasePolicy
-from google.cloud._helpers import _to_bytes
-from google.iam.v1 import policy_pb2
+from google.cloud._helpers import _to_bytes # type: ignore
+from google.iam.v1 import policy_pb2 # type: ignore
"""IAM roles supported by Bigtable Instance resource"""
BIGTABLE_ADMIN_ROLE = "roles/bigtable.admin"
@@ -104,8 +104,9 @@ def bigtable_admins(self):
For example:
.. literalinclude:: snippets.py
- :start-after: [START bigtable_admins_policy]
- :end-before: [END bigtable_admins_policy]
+ :start-after: [START bigtable_api_admins_policy]
+ :end-before: [END bigtable_api_admins_policy]
+ :dedent: 4
"""
result = set()
for member in self.get(BIGTABLE_ADMIN_ROLE, ()):
@@ -121,8 +122,9 @@ def bigtable_readers(self):
For example:
.. literalinclude:: snippets.py
- :start-after: [START bigtable_readers_policy]
- :end-before: [END bigtable_readers_policy]
+ :start-after: [START bigtable_api_readers_policy]
+ :end-before: [END bigtable_api_readers_policy]
+ :dedent: 4
"""
result = set()
for member in self.get(BIGTABLE_READER_ROLE, ()):
@@ -138,8 +140,9 @@ def bigtable_users(self):
For example:
.. literalinclude:: snippets.py
- :start-after: [START bigtable_users_policy]
- :end-before: [END bigtable_users_policy]
+ :start-after: [START bigtable_api_users_policy]
+ :end-before: [END bigtable_api_users_policy]
+ :dedent: 4
"""
result = set()
for member in self.get(BIGTABLE_USER_ROLE, ()):
@@ -155,8 +158,9 @@ def bigtable_viewers(self):
For example:
.. literalinclude:: snippets.py
- :start-after: [START bigtable_viewers_policy]
- :end-before: [END bigtable_viewers_policy]
+ :start-after: [START bigtable_api_viewers_policy]
+ :end-before: [END bigtable_api_viewers_policy]
+ :dedent: 4
"""
result = set()
for member in self.get(BIGTABLE_VIEWER_ROLE, ()):
diff --git a/google/cloud/bigtable/py.typed b/google/cloud/bigtable/py.typed
new file mode 100644
index 000000000..889d34043
--- /dev/null
+++ b/google/cloud/bigtable/py.typed
@@ -0,0 +1,2 @@
+# Marker file for PEP 561.
+# The google-cloud-bigtable package uses inline types.
diff --git a/google/cloud/bigtable/row.py b/google/cloud/bigtable/row.py
index 079ba6c8f..752458a08 100644
--- a/google/cloud/bigtable/row.py
+++ b/google/cloud/bigtable/row.py
@@ -17,12 +17,10 @@
import struct
-import six
-
-from google.cloud._helpers import _datetime_from_microseconds
-from google.cloud._helpers import _microseconds_from_datetime
-from google.cloud._helpers import _to_bytes
-from google.cloud.bigtable_v2.proto import data_pb2 as data_v2_pb2
+from google.cloud._helpers import _datetime_from_microseconds # type: ignore
+from google.cloud._helpers import _microseconds_from_datetime # type: ignore
+from google.cloud._helpers import _to_bytes # type: ignore
+from google.cloud.bigtable_v2.types import data as data_v2_pb2
_PACK_I64 = struct.Struct(">q").pack
@@ -30,6 +28,15 @@
MAX_MUTATIONS = 100000
"""The maximum number of mutations that a row can accumulate."""
+_MISSING_COLUMN_FAMILY = "Column family {} is not among the cells stored in this row."
+_MISSING_COLUMN = (
+ "Column {} is not among the cells stored in this row in the column family {}."
+)
+_MISSING_INDEX = (
+ "Index {!r} is not valid for the cells stored in this row for column {} "
+ "in the column family {}. There are {} such cells."
+)
+
class Row(object):
"""Base representation of a Google Cloud Bigtable Row.
@@ -59,8 +66,9 @@ def row_key(self):
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_row_row_key]
- :end-before: [END bigtable_row_row_key]
+ :start-after: [START bigtable_api_row_row_key]
+ :end-before: [END bigtable_api_row_row_key]
+ :dedent: 4
:rtype: bytes
:returns: The key for the current row.
@@ -74,8 +82,9 @@ def table(self):
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_row_table]
- :end-before: [END bigtable_row_table]
+ :start-after: [START bigtable_api_row_table]
+ :end-before: [END bigtable_api_row_table]
+ :dedent: 4
:rtype: table: :class:`Table `
:returns: table: The table that owns the row.
@@ -149,7 +158,7 @@ def _set_cell(self, column_family_id, column, value, timestamp=None, state=None)
:meth:`_get_mutations`.
"""
column = _to_bytes(column)
- if isinstance(value, six.integer_types):
+ if isinstance(value, int):
value = _PACK_I64(value)
value = _to_bytes(value)
if timestamp is None:
@@ -293,19 +302,19 @@ def _get_mutations(self, state=None): # pylint: disable=unused-argument
return self._pb_mutations
def get_mutations_size(self):
- """ Gets the total mutations size for current row
+ """Gets the total mutations size for current row
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_row_get_mutations_size]
- :end-before: [END bigtable_row_get_mutations_size]
-
+ :start-after: [START bigtable_api_row_get_mutations_size]
+ :end-before: [END bigtable_api_row_get_mutations_size]
+ :dedent: 4
"""
mutation_size = 0
for mutation in self._get_mutations():
- mutation_size += mutation.ByteSize()
+ mutation_size += mutation._pb.ByteSize()
return mutation_size
@@ -326,8 +335,9 @@ def set_cell(self, column_family_id, column, value, timestamp=None):
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_row_set_cell]
- :end-before: [END bigtable_row_set_cell]
+ :start-after: [START bigtable_api_row_set_cell]
+ :end-before: [END bigtable_api_row_set_cell]
+ :dedent: 4
:type column_family_id: str
:param column_family_id: The column family that contains the column.
@@ -361,9 +371,9 @@ def delete(self):
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_row_delete]
- :end-before: [END bigtable_row_delete]
-
+ :start-after: [START bigtable_api_row_delete]
+ :end-before: [END bigtable_api_row_delete]
+ :dedent: 4
"""
self._delete(state=None)
@@ -380,8 +390,9 @@ def delete_cell(self, column_family_id, column, time_range=None):
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_row_delete_cell]
- :end-before: [END bigtable_row_delete_cell]
+ :start-after: [START bigtable_api_row_delete_cell]
+ :end-before: [END bigtable_api_row_delete_cell]
+ :dedent: 4
:type column_family_id: str
:param column_family_id: The column family that contains the column
@@ -413,8 +424,9 @@ def delete_cells(self, column_family_id, columns, time_range=None):
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_row_delete_cells]
- :end-before: [END bigtable_row_delete_cells]
+ :start-after: [START bigtable_api_row_delete_cells]
+ :end-before: [END bigtable_api_row_delete_cells]
+ :dedent: 4
:type column_family_id: str
:param column_family_id: The column family that contains the column
@@ -448,24 +460,31 @@ def commit(self):
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_row_commit]
- :end-before: [END bigtable_row_commit]
+ :start-after: [START bigtable_api_row_commit]
+ :end-before: [END bigtable_api_row_commit]
+ :dedent: 4
+ :rtype: :class:`~google.rpc.status_pb2.Status`
+ :returns: A response status (`google.rpc.status_pb2.Status`)
+ representing success or failure of the row committed.
:raises: :exc:`~.table.TooManyMutationsError` if the number of
mutations is greater than 100,000.
"""
- self._table.mutate_rows([self])
+ response = self._table.mutate_rows([self])
+
self.clear()
+ return response[0]
+
def clear(self):
"""Removes all currently accumulated mutations on the current row.
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_row_clear]
- :end-before: [END bigtable_row_clear]
-
+ :start-after: [START bigtable_api_row_clear]
+ :end-before: [END bigtable_api_row_clear]
+ :dedent: 4
"""
del self._pb_mutations[:]
@@ -555,8 +574,9 @@ def commit(self):
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_row_commit]
- :end-before: [END bigtable_row_commit]
+ :start-after: [START bigtable_api_row_commit]
+ :end-before: [END bigtable_api_row_commit]
+ :dedent: 4
:rtype: bool
:returns: Flag indicating if the filter was matched (which also
@@ -608,8 +628,9 @@ def set_cell(self, column_family_id, column, value, timestamp=None, state=True):
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_row_set_cell]
- :end-before: [END bigtable_row_set_cell]
+ :start-after: [START bigtable_api_row_set_cell]
+ :end-before: [END bigtable_api_row_set_cell]
+ :dedent: 4
:type column_family_id: str
:param column_family_id: The column family that contains the column.
@@ -649,8 +670,9 @@ def delete(self, state=True):
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_row_delete]
- :end-before: [END bigtable_row_delete]
+ :start-after: [START bigtable_api_row_delete]
+ :end-before: [END bigtable_api_row_delete]
+ :dedent: 4
:type state: bool
:param state: (Optional) The state that the mutation should be
@@ -671,8 +693,9 @@ def delete_cell(self, column_family_id, column, time_range=None, state=True):
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_row_delete_cell]
- :end-before: [END bigtable_row_delete_cell]
+ :start-after: [START bigtable_api_row_delete_cell]
+ :end-before: [END bigtable_api_row_delete_cell]
+ :dedent: 4
:type column_family_id: str
:param column_family_id: The column family that contains the column
@@ -708,8 +731,9 @@ def delete_cells(self, column_family_id, columns, time_range=None, state=True):
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_row_delete_cells]
- :end-before: [END bigtable_row_delete_cells]
+ :start-after: [START bigtable_api_row_delete_cells]
+ :end-before: [END bigtable_api_row_delete_cells]
+ :dedent: 4
:type column_family_id: str
:param column_family_id: The column family that contains the column
@@ -742,9 +766,9 @@ def clear(self):
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_row_clear]
- :end-before: [END bigtable_row_clear]
-
+ :start-after: [START bigtable_api_row_clear]
+ :end-before: [END bigtable_api_row_clear]
+ :dedent: 4
"""
del self._true_pb_mutations[:]
del self._false_pb_mutations[:]
@@ -781,9 +805,9 @@ def clear(self):
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_row_clear]
- :end-before: [END bigtable_row_clear]
-
+ :start-after: [START bigtable_api_row_clear]
+ :end-before: [END bigtable_api_row_clear]
+ :dedent: 4
"""
del self._rule_pb_list[:]
@@ -800,8 +824,9 @@ def append_cell_value(self, column_family_id, column, value):
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_row_append_cell_value]
- :end-before: [END bigtable_row_append_cell_value]
+ :start-after: [START bigtable_api_row_append_cell_value]
+ :end-before: [END bigtable_api_row_append_cell_value]
+ :dedent: 4
:type column_family_id: str
:param column_family_id: The column family that contains the column.
@@ -840,8 +865,9 @@ def increment_cell_value(self, column_family_id, column, int_value):
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_row_increment_cell_value]
- :end-before: [END bigtable_row_increment_cell_value]
+ :start-after: [START bigtable_api_row_increment_cell_value]
+ :end-before: [END bigtable_api_row_increment_cell_value]
+ :dedent: 4
:type column_family_id: str
:param column_family_id: The column family that contains the column.
@@ -886,8 +912,9 @@ def commit(self):
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_row_commit]
- :end-before: [END bigtable_row_commit]
+ :start-after: [START bigtable_api_row_commit]
+ :end-before: [END bigtable_api_row_commit]
+ :dedent: 4
:rtype: dict
:returns: The new contents of all modified cells. Returned as a
@@ -995,3 +1022,246 @@ def _parse_family_pb(family_pb):
cells.append(val_pair)
return family_pb.name, result
+
+
+class PartialRowData(object):
+ """Representation of partial row in a Google Cloud Bigtable Table.
+
+ These are expected to be updated directly from a
+ :class:`._generated.bigtable_service_messages_pb2.ReadRowsResponse`
+
+ :type row_key: bytes
+ :param row_key: The key for the row holding the (partial) data.
+ """
+
+ def __init__(self, row_key):
+ self._row_key = row_key
+ self._cells = {}
+
+ def __eq__(self, other):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return other._row_key == self._row_key and other._cells == self._cells
+
+ def __ne__(self, other):
+ return not self == other
+
+ def to_dict(self):
+ """Convert the cells to a dictionary.
+
+ This is intended to be used with HappyBase, so the column family and
+ column qualiers are combined (with ``:``).
+
+ :rtype: dict
+ :returns: Dictionary containing all the data in the cells of this row.
+ """
+ result = {}
+ for column_family_id, columns in self._cells.items():
+ for column_qual, cells in columns.items():
+ key = _to_bytes(column_family_id) + b":" + _to_bytes(column_qual)
+ result[key] = cells
+ return result
+
+ @property
+ def cells(self):
+ """Property returning all the cells accumulated on this partial row.
+
+ For example:
+
+ .. literalinclude:: snippets_table.py
+ :start-after: [START bigtable_api_row_data_cells]
+ :end-before: [END bigtable_api_row_data_cells]
+ :dedent: 4
+
+ :rtype: dict
+ :returns: Dictionary of the :class:`Cell` objects accumulated. This
+ dictionary has two-levels of keys (first for column families
+ and second for column names/qualifiers within a family). For
+ a given column, a list of :class:`Cell` objects is stored.
+ """
+ return self._cells
+
+ @property
+ def row_key(self):
+ """Getter for the current (partial) row's key.
+
+ :rtype: bytes
+ :returns: The current (partial) row's key.
+ """
+ return self._row_key
+
+ def find_cells(self, column_family_id, column):
+ """Get a time series of cells stored on this instance.
+
+ For example:
+
+ .. literalinclude:: snippets_table.py
+ :start-after: [START bigtable_api_row_find_cells]
+ :end-before: [END bigtable_api_row_find_cells]
+ :dedent: 4
+
+ Args:
+ column_family_id (str): The ID of the column family. Must be of the
+ form ``[_a-zA-Z0-9][-_.a-zA-Z0-9]*``.
+ column (bytes): The column within the column family where the cells
+ are located.
+
+ Returns:
+ List[~google.cloud.bigtable.row_data.Cell]: The cells stored in the
+ specified column.
+
+ Raises:
+ KeyError: If ``column_family_id`` is not among the cells stored
+ in this row.
+ KeyError: If ``column`` is not among the cells stored in this row
+ for the given ``column_family_id``.
+ """
+ try:
+ column_family = self._cells[column_family_id]
+ except KeyError:
+ raise KeyError(_MISSING_COLUMN_FAMILY.format(column_family_id))
+
+ try:
+ cells = column_family[column]
+ except KeyError:
+ raise KeyError(_MISSING_COLUMN.format(column, column_family_id))
+
+ return cells
+
+ def cell_value(self, column_family_id, column, index=0):
+ """Get a single cell value stored on this instance.
+
+ For example:
+
+ .. literalinclude:: snippets_table.py
+ :start-after: [START bigtable_api_row_cell_value]
+ :end-before: [END bigtable_api_row_cell_value]
+ :dedent: 4
+
+ Args:
+ column_family_id (str): The ID of the column family. Must be of the
+ form ``[_a-zA-Z0-9][-_.a-zA-Z0-9]*``.
+ column (bytes): The column within the column family where the cell
+ is located.
+ index (Optional[int]): The offset within the series of values. If
+ not specified, will return the first cell.
+
+ Returns:
+ ~google.cloud.bigtable.row_data.Cell value: The cell value stored
+ in the specified column and specified index.
+
+ Raises:
+ KeyError: If ``column_family_id`` is not among the cells stored
+ in this row.
+ KeyError: If ``column`` is not among the cells stored in this row
+ for the given ``column_family_id``.
+ IndexError: If ``index`` cannot be found within the cells stored
+ in this row for the given ``column_family_id``, ``column``
+ pair.
+ """
+ cells = self.find_cells(column_family_id, column)
+
+ try:
+ cell = cells[index]
+ except (TypeError, IndexError):
+ num_cells = len(cells)
+ msg = _MISSING_INDEX.format(index, column, column_family_id, num_cells)
+ raise IndexError(msg)
+
+ return cell.value
+
+ def cell_values(self, column_family_id, column, max_count=None):
+ """Get a time series of cells stored on this instance.
+
+ For example:
+
+ .. literalinclude:: snippets_table.py
+ :start-after: [START bigtable_api_row_cell_values]
+ :end-before: [END bigtable_api_row_cell_values]
+ :dedent: 4
+
+ Args:
+ column_family_id (str): The ID of the column family. Must be of the
+ form ``[_a-zA-Z0-9][-_.a-zA-Z0-9]*``.
+ column (bytes): The column within the column family where the cells
+ are located.
+ max_count (int): The maximum number of cells to use.
+
+ Returns:
+ A generator which provides: cell.value, cell.timestamp_micros
+ for each cell in the list of cells
+
+ Raises:
+ KeyError: If ``column_family_id`` is not among the cells stored
+ in this row.
+ KeyError: If ``column`` is not among the cells stored in this row
+ for the given ``column_family_id``.
+ """
+ cells = self.find_cells(column_family_id, column)
+ if max_count is None:
+ max_count = len(cells)
+
+ for index, cell in enumerate(cells):
+ if index == max_count:
+ break
+
+ yield cell.value, cell.timestamp_micros
+
+
+class Cell(object):
+ """Representation of a Google Cloud Bigtable Cell.
+
+ :type value: bytes
+ :param value: The value stored in the cell.
+
+ :type timestamp_micros: int
+ :param timestamp_micros: The timestamp_micros when the cell was stored.
+
+ :type labels: list
+ :param labels: (Optional) List of strings. Labels applied to the cell.
+ """
+
+ def __init__(self, value, timestamp_micros, labels=None):
+ self.value = value
+ self.timestamp_micros = timestamp_micros
+ self.labels = list(labels) if labels is not None else []
+
+ @classmethod
+ def from_pb(cls, cell_pb):
+ """Create a new cell from a Cell protobuf.
+
+ :type cell_pb: :class:`._generated.data_pb2.Cell`
+ :param cell_pb: The protobuf to convert.
+
+ :rtype: :class:`Cell`
+ :returns: The cell corresponding to the protobuf.
+ """
+ if cell_pb.labels:
+ return cls(cell_pb.value, cell_pb.timestamp_micros, labels=cell_pb.labels)
+ else:
+ return cls(cell_pb.value, cell_pb.timestamp_micros)
+
+ @property
+ def timestamp(self):
+ return _datetime_from_microseconds(self.timestamp_micros)
+
+ def __eq__(self, other):
+ if not isinstance(other, self.__class__):
+ return NotImplemented
+ return (
+ other.value == self.value
+ and other.timestamp_micros == self.timestamp_micros
+ and other.labels == self.labels
+ )
+
+ def __ne__(self, other):
+ return not self == other
+
+ def __repr__(self):
+ return "<{name} value={value!r} timestamp={timestamp}>".format(
+ name=self.__class__.__name__, value=self.value, timestamp=self.timestamp
+ )
+
+
+class InvalidChunk(RuntimeError):
+ """Exception raised to invalid chunk data from back-end."""
diff --git a/google/cloud/bigtable/row_data.py b/google/cloud/bigtable/row_data.py
index 24078b849..e11379108 100644
--- a/google/cloud/bigtable/row_data.py
+++ b/google/cloud/bigtable/row_data.py
@@ -16,107 +16,27 @@
import copy
-import six
-
-import grpc
+import grpc # type: ignore
+import warnings
from google.api_core import exceptions
from google.api_core import retry
-from google.cloud._helpers import _datetime_from_microseconds
-from google.cloud._helpers import _to_bytes
-from google.cloud.bigtable_v2.proto import bigtable_pb2 as data_messages_v2_pb2
-from google.cloud.bigtable_v2.proto import data_pb2 as data_v2_pb2
-
-_MISSING_COLUMN_FAMILY = "Column family {} is not among the cells stored in this row."
-_MISSING_COLUMN = (
- "Column {} is not among the cells stored in this row in the " "column family {}."
-)
-_MISSING_INDEX = (
- "Index {!r} is not valid for the cells stored in this row for column {} "
- "in the column family {}. There are {} such cells."
-)
-
-
-class Cell(object):
- """Representation of a Google Cloud Bigtable Cell.
-
- :type value: bytes
- :param value: The value stored in the cell.
-
- :type timestamp_micros: int
- :param timestamp_micros: The timestamp_micros when the cell was stored.
-
- :type labels: list
- :param labels: (Optional) List of strings. Labels applied to the cell.
- """
-
- def __init__(self, value, timestamp_micros, labels=None):
- self.value = value
- self.timestamp_micros = timestamp_micros
- self.labels = list(labels) if labels is not None else []
-
- @classmethod
- def from_pb(cls, cell_pb):
- """Create a new cell from a Cell protobuf.
-
- :type cell_pb: :class:`._generated.data_pb2.Cell`
- :param cell_pb: The protobuf to convert.
-
- :rtype: :class:`Cell`
- :returns: The cell corresponding to the protobuf.
- """
- if cell_pb.labels:
- return cls(cell_pb.value, cell_pb.timestamp_micros, labels=cell_pb.labels)
- else:
- return cls(cell_pb.value, cell_pb.timestamp_micros)
+from google.cloud._helpers import _to_bytes # type: ignore
- @property
- def timestamp(self):
- return _datetime_from_microseconds(self.timestamp_micros)
-
- def __eq__(self, other):
- if not isinstance(other, self.__class__):
- return NotImplemented
- return (
- other.value == self.value
- and other.timestamp_micros == self.timestamp_micros
- and other.labels == self.labels
- )
-
- def __ne__(self, other):
- return not self == other
-
- def __repr__(self):
- return "<{name} value={value!r} timestamp={timestamp}>".format(
- name=self.__class__.__name__, value=self.value, timestamp=self.timestamp
- )
+from google.cloud.bigtable.row_merger import _RowMerger, _State
+from google.cloud.bigtable_v2.types import bigtable as data_messages_v2_pb2
+from google.cloud.bigtable_v2.types import data as data_v2_pb2
+from google.cloud.bigtable.row import Cell, InvalidChunk, PartialRowData
-class PartialCellData(object):
- """Representation of partial cell in a Google Cloud Bigtable Table.
+# Some classes need to be re-exported here to keep backwards
+# compatibility. Those classes were moved to row_merger, but we dont want to
+# break enduser's imports. This hack, ensures they don't get marked as unused.
+_ = (Cell, InvalidChunk, PartialRowData)
- These are expected to be updated directly from a
- :class:`._generated.bigtable_service_messages_pb2.ReadRowsResponse`
- :type row_key: bytes
- :param row_key: The key for the row holding the (partial) cell.
-
- :type family_name: str
- :param family_name: The family name of the (partial) cell.
-
- :type qualifier: bytes
- :param qualifier: The column qualifier of the (partial) cell.
-
- :type timestamp_micros: int
- :param timestamp_micros: The timestamp (in microsecods) of the
- (partial) cell.
-
- :type labels: list of str
- :param labels: labels assigned to the (partial) cell
-
- :type value: bytes
- :param value: The (accumulated) value of the (partial) cell.
- """
+class PartialCellData(object): # pragma: NO COVER
+ """This class is no longer used and will be removed in the future"""
def __init__(
self, row_key, family_name, qualifier, timestamp_micros, labels=(), value=b""
@@ -129,206 +49,43 @@ def __init__(
self.value = value
def append_value(self, value):
- """Append bytes from a new chunk to value.
-
- :type value: bytes
- :param value: bytes to append
- """
self.value += value
-class PartialRowData(object):
- """Representation of partial row in a Google Cloud Bigtable Table.
-
- These are expected to be updated directly from a
- :class:`._generated.bigtable_service_messages_pb2.ReadRowsResponse`
-
- :type row_key: bytes
- :param row_key: The key for the row holding the (partial) data.
- """
-
- def __init__(self, row_key):
- self._row_key = row_key
- self._cells = {}
-
- def __eq__(self, other):
- if not isinstance(other, self.__class__):
- return NotImplemented
- return other._row_key == self._row_key and other._cells == self._cells
-
- def __ne__(self, other):
- return not self == other
-
- def to_dict(self):
- """Convert the cells to a dictionary.
-
- This is intended to be used with HappyBase, so the column family and
- column qualiers are combined (with ``:``).
-
- :rtype: dict
- :returns: Dictionary containing all the data in the cells of this row.
- """
- result = {}
- for column_family_id, columns in six.iteritems(self._cells):
- for column_qual, cells in six.iteritems(columns):
- key = _to_bytes(column_family_id) + b":" + _to_bytes(column_qual)
- result[key] = cells
- return result
-
- @property
- def cells(self):
- """Property returning all the cells accumulated on this partial row.
-
- For example:
-
- .. literalinclude:: snippets_table.py
- :start-after: [START bigtable_row_data_cells]
- :end-before: [END bigtable_row_data_cells]
-
- :rtype: dict
- :returns: Dictionary of the :class:`Cell` objects accumulated. This
- dictionary has two-levels of keys (first for column families
- and second for column names/qualifiers within a family). For
- a given column, a list of :class:`Cell` objects is stored.
- """
- return self._cells
-
- @property
- def row_key(self):
- """Getter for the current (partial) row's key.
-
- :rtype: bytes
- :returns: The current (partial) row's key.
- """
- return self._row_key
-
- def find_cells(self, column_family_id, column):
- """Get a time series of cells stored on this instance.
-
- For example:
-
- .. literalinclude:: snippets_table.py
- :start-after: [START bigtable_row_find_cells]
- :end-before: [END bigtable_row_find_cells]
-
- Args:
- column_family_id (str): The ID of the column family. Must be of the
- form ``[_a-zA-Z0-9][-_.a-zA-Z0-9]*``.
- column (bytes): The column within the column family where the cells
- are located.
-
- Returns:
- List[~google.cloud.bigtable.row_data.Cell]: The cells stored in the
- specified column.
+class InvalidReadRowsResponse(RuntimeError):
+ """Exception raised to invalid response data from back-end."""
- Raises:
- KeyError: If ``column_family_id`` is not among the cells stored
- in this row.
- KeyError: If ``column`` is not among the cells stored in this row
- for the given ``column_family_id``.
- """
- try:
- column_family = self._cells[column_family_id]
- except KeyError:
- raise KeyError(_MISSING_COLUMN_FAMILY.format(column_family_id))
-
- try:
- cells = column_family[column]
- except KeyError:
- raise KeyError(_MISSING_COLUMN.format(column, column_family_id))
-
- return cells
-
- def cell_value(self, column_family_id, column, index=0):
- """Get a single cell value stored on this instance.
-
- For example:
-
- .. literalinclude:: snippets_table.py
- :start-after: [START bigtable_row_cell_value]
- :end-before: [END bigtable_row_cell_value]
-
- Args:
- column_family_id (str): The ID of the column family. Must be of the
- form ``[_a-zA-Z0-9][-_.a-zA-Z0-9]*``.
- column (bytes): The column within the column family where the cell
- is located.
- index (Optional[int]): The offset within the series of values. If
- not specified, will return the first cell.
-
- Returns:
- ~google.cloud.bigtable.row_data.Cell value: The cell value stored
- in the specified column and specified index.
-
- Raises:
- KeyError: If ``column_family_id`` is not among the cells stored
- in this row.
- KeyError: If ``column`` is not among the cells stored in this row
- for the given ``column_family_id``.
- IndexError: If ``index`` cannot be found within the cells stored
- in this row for the given ``column_family_id``, ``column``
- pair.
- """
- cells = self.find_cells(column_family_id, column)
-
- try:
- cell = cells[index]
- except (TypeError, IndexError):
- num_cells = len(cells)
- msg = _MISSING_INDEX.format(index, column, column_family_id, num_cells)
- raise IndexError(msg)
-
- return cell.value
-
- def cell_values(self, column_family_id, column, max_count=None):
- """Get a time series of cells stored on this instance.
-
- For example:
-
- .. literalinclude:: snippets_table.py
- :start-after: [START bigtable_row_cell_values]
- :end-before: [END bigtable_row_cell_values]
-
- Args:
- column_family_id (str): The ID of the column family. Must be of the
- form ``[_a-zA-Z0-9][-_.a-zA-Z0-9]*``.
- column (bytes): The column within the column family where the cells
- are located.
- max_count (int): The maximum number of cells to use.
-
- Returns:
- A generator which provides: cell.value, cell.timestamp_micros
- for each cell in the list of cells
-
- Raises:
- KeyError: If ``column_family_id`` is not among the cells stored
- in this row.
- KeyError: If ``column`` is not among the cells stored in this row
- for the given ``column_family_id``.
- """
- cells = self.find_cells(column_family_id, column)
- if max_count is None:
- max_count = len(cells)
- for index, cell in enumerate(cells):
- if index == max_count:
- break
+class InvalidRetryRequest(RuntimeError):
+ """Exception raised when retry request is invalid."""
- yield cell.value, cell.timestamp_micros
-
-class InvalidReadRowsResponse(RuntimeError):
- """Exception raised to to invalid response data from back-end."""
+RETRYABLE_INTERNAL_ERROR_MESSAGES = (
+ "rst_stream",
+ "rst stream",
+ "received unexpected eos on data frame from server",
+)
+"""Internal error messages that can be retried during read row and mutation."""
-class InvalidChunk(RuntimeError):
- """Exception raised to to invalid chunk data from back-end."""
+def _retriable_internal_server_error(exc):
+ """
+ Return True if the internal server error is retriable.
+ """
+ return isinstance(exc, exceptions.InternalServerError) and any(
+ retryable_message in exc.message.lower()
+ for retryable_message in RETRYABLE_INTERNAL_ERROR_MESSAGES
+ )
def _retry_read_rows_exception(exc):
+ """Return True if the exception is retriable for read row requests."""
if isinstance(exc, grpc.RpcError):
exc = exceptions.from_grpc_error(exc)
- return isinstance(exc, (exceptions.ServiceUnavailable, exceptions.DeadlineExceeded))
+
+ return _retriable_internal_server_error(exc) or isinstance(
+ exc, (exceptions.ServiceUnavailable, exceptions.DeadlineExceeded)
+ )
DEFAULT_RETRY_READ_ROWS = retry.Retry(
@@ -386,37 +143,54 @@ class PartialRowsData(object):
def __init__(self, read_method, request, retry=DEFAULT_RETRY_READ_ROWS):
# Counter for rows returned to the user
self._counter = 0
- # In-progress row, unset until first response, after commit/reset
- self._row = None
- # Last complete row, unset until first commit
- self._previous_row = None
- # In-progress cell, unset until first response, after completion
- self._cell = None
- # Last complete cell, unset until first completion, after new row
- self._previous_cell = None
+ self._row_merger = _RowMerger()
# May be cached from previous response
self.last_scanned_row_key = None
self.read_method = read_method
self.request = request
self.retry = retry
- self.response_iterator = read_method(request)
+
+ # The `timeout` parameter must be somewhat greater than the value
+ # contained in `self.retry`, in order to avoid race-like condition and
+ # allow registering the first deadline error before invoking the retry.
+ # Otherwise there is a risk of entering an infinite loop that resets
+ # the timeout counter just before it being triggered. The increment
+ # by 1 second here is customary but should not be much less than that.
+ self.response_iterator = read_method(
+ request, timeout=self.retry._deadline + 1, retry=self.retry
+ )
self.rows = {}
- self._state = self.STATE_NEW_ROW
# Flag to stop iteration, for any reason not related to self.retry()
self._cancelled = False
@property
- def state(self):
- """State machine state.
-
- :rtype: str
- :returns: name of state corresponding to current row / chunk
- processing.
+ def state(self): # pragma: NO COVER
+ """
+ DEPRECATED: this property is deprecated and will be removed in the
+ future.
"""
- return self.read_states[self._state]
+ warnings.warn(
+ "`PartialRowsData#state()` is deprecated and will be removed in the future",
+ DeprecationWarning,
+ stacklevel=2,
+ )
+
+ # Best effort: try to map internal RowMerger states to old strings for
+ # backwards compatibility
+ internal_state = self._row_merger.state
+ if internal_state == _State.ROW_START:
+ return self.NEW_ROW
+ # note: _State.CELL_START, _State.CELL_COMPLETE are transient states
+ # and will not be visible in between chunks
+ elif internal_state == _State.CELL_IN_PROGRESS:
+ return self.CELL_IN_PROGRESS
+ elif internal_state == _State.ROW_COMPLETE:
+ return self.NEW_ROW
+ else:
+ raise RuntimeError("unexpected internal state: " + self._)
def cancel(self):
"""Cancels the iterator, closing the stream."""
@@ -452,15 +226,20 @@ def _on_error(self, exc):
if self.last_scanned_row_key:
retry_request = self._create_retry_request()
+ self._row_merger = _RowMerger(self._row_merger.last_seen_row_key)
self.response_iterator = self.read_method(retry_request)
def _read_next(self):
"""Helper for :meth:`__iter__`."""
- return six.next(self.response_iterator)
+ return next(self.response_iterator)
def _read_next_response(self):
"""Helper for :meth:`__iter__`."""
- return self.retry(self._read_next, on_error=self._on_error)()
+ resp_protoplus = self.retry(self._read_next, on_error=self._on_error)()
+ # unwrap the underlying protobuf, there is a significant amount of
+ # overhead that protoplus imposes for very little gain. The protos
+ # are not user visible, so we just use the raw protos for merging.
+ return data_messages_v2_pb2.ReadRowsResponse.pb(resp_protoplus)
def __iter__(self):
"""Consume the ``ReadRowsResponse`` s from the stream.
@@ -473,125 +252,27 @@ def __iter__(self):
try:
response = self._read_next_response()
except StopIteration:
- if self.state != self.NEW_ROW:
- raise ValueError("The row remains partial / is not committed.")
+ self._row_merger.finalize()
+ break
+ except InvalidRetryRequest:
+ self._cancelled = True
break
- for chunk in response.chunks:
+ for row in self._row_merger.process_chunks(response):
+ self.last_scanned_row_key = self._row_merger.last_seen_row_key
+ self._counter += 1
+
+ yield row
+
if self._cancelled:
break
- self._process_chunk(chunk)
- if chunk.commit_row:
- self.last_scanned_row_key = self._previous_row.row_key
- self._counter += 1
- yield self._previous_row
-
- resp_last_key = response.last_scanned_row_key
- if resp_last_key and resp_last_key > self.last_scanned_row_key:
- self.last_scanned_row_key = resp_last_key
-
- def _process_chunk(self, chunk):
- if chunk.reset_row:
- self._validate_chunk_reset_row(chunk)
- self._row = None
- self._cell = self._previous_cell = None
- self._state = self.STATE_NEW_ROW
- return
-
- self._update_cell(chunk)
-
- if self._row is None:
- if (
- self._previous_row is not None
- and self._cell.row_key <= self._previous_row.row_key
- ):
- raise InvalidChunk()
- self._row = PartialRowData(self._cell.row_key)
-
- if chunk.value_size == 0:
- self._state = self.STATE_ROW_IN_PROGRESS
- self._save_current_cell()
- else:
- self._state = self.STATE_CELL_IN_PROGRESS
-
- if chunk.commit_row:
- if chunk.value_size > 0:
- raise InvalidChunk()
-
- self._previous_row = self._row
- self._row = None
- self._previous_cell = None
- self._state = self.STATE_NEW_ROW
-
- def _update_cell(self, chunk):
- if self._cell is None:
- qualifier = None
- if chunk.HasField("qualifier"):
- qualifier = chunk.qualifier.value
- family = None
- if chunk.HasField("family_name"):
- family = chunk.family_name.value
-
- self._cell = PartialCellData(
- chunk.row_key,
- family,
- qualifier,
- chunk.timestamp_micros,
- chunk.labels,
- chunk.value,
- )
- self._copy_from_previous(self._cell)
- self._validate_cell_data_new_cell()
- else:
- self._cell.append_value(chunk.value)
-
- def _validate_cell_data_new_cell(self):
- cell = self._cell
- if not cell.row_key or not cell.family_name or cell.qualifier is None:
- raise InvalidChunk()
-
- prev = self._previous_cell
- if prev and prev.row_key != cell.row_key:
- raise InvalidChunk()
-
- def _validate_chunk_reset_row(self, chunk):
- # No reset for new row
- _raise_if(self._state == self.STATE_NEW_ROW)
-
- # No reset with other keys
- _raise_if(chunk.row_key)
- _raise_if(chunk.HasField("family_name"))
- _raise_if(chunk.HasField("qualifier"))
- _raise_if(chunk.timestamp_micros)
- _raise_if(chunk.labels)
- _raise_if(chunk.value_size)
- _raise_if(chunk.value)
- _raise_if(chunk.commit_row)
-
- def _save_current_cell(self):
- """Helper for :meth:`consume_next`."""
- row, cell = self._row, self._cell
- family = row._cells.setdefault(cell.family_name, {})
- qualified = family.setdefault(cell.qualifier, [])
- complete = Cell.from_pb(cell)
- qualified.append(complete)
- self._cell, self._previous_cell = None, cell
-
- def _copy_from_previous(self, cell):
- """Helper for :meth:`consume_next`."""
- previous = self._previous_cell
- if previous is not None:
- if not cell.row_key:
- cell.row_key = previous.row_key
- if not cell.family_name:
- cell.family_name = previous.family_name
- # NOTE: ``cell.qualifier`` **can** be empty string.
- if cell.qualifier is None:
- cell.qualifier = previous.qualifier
+ # The last response might not have generated any rows, but it
+ # could've updated last_scanned_row_key
+ self.last_scanned_row_key = self._row_merger.last_seen_row_key
class _ReadRowsRequestManager(object):
- """ Update the ReadRowsRequest message in case of failures by
+ """Update the ReadRowsRequest message in case of failures by
filtering the already read keys.
:type message: class:`data_messages_v2_pb2.ReadRowsRequest`
@@ -613,34 +294,40 @@ def __init__(self, message, last_scanned_key, rows_read_so_far):
self.rows_read_so_far = rows_read_so_far
def build_updated_request(self):
- """ Updates the given message request as per last scanned key
- """
- r_kwargs = {
- "table_name": self.message.table_name,
- "filter": self.message.filter,
- }
+ """Updates the given message request as per last scanned key"""
+
+ resume_request = data_messages_v2_pb2.ReadRowsRequest()
+ data_messages_v2_pb2.ReadRowsRequest.copy_from(resume_request, self.message)
if self.message.rows_limit != 0:
- r_kwargs["rows_limit"] = max(
- 1, self.message.rows_limit - self.rows_read_so_far
- )
+ row_limit_remaining = self.message.rows_limit - self.rows_read_so_far
+ if row_limit_remaining > 0:
+ resume_request.rows_limit = row_limit_remaining
+ else:
+ raise InvalidRetryRequest
# if neither RowSet.row_keys nor RowSet.row_ranges currently exist,
# add row_range that starts with last_scanned_key as start_key_open
# to request only rows that have not been returned yet
- if not self.message.HasField("rows"):
+ if "rows" not in self.message:
row_range = data_v2_pb2.RowRange(start_key_open=self.last_scanned_key)
- r_kwargs["rows"] = data_v2_pb2.RowSet(row_ranges=[row_range])
+ resume_request.rows = data_v2_pb2.RowSet(row_ranges=[row_range])
else:
row_keys = self._filter_rows_keys()
row_ranges = self._filter_row_ranges()
- r_kwargs["rows"] = data_v2_pb2.RowSet(
+
+ if len(row_keys) == 0 and len(row_ranges) == 0:
+ # Avoid sending empty row_keys and row_ranges
+ # if that was not the intention
+ raise InvalidRetryRequest
+
+ resume_request.rows = data_v2_pb2.RowSet(
row_keys=row_keys, row_ranges=row_ranges
)
- return data_messages_v2_pb2.ReadRowsRequest(**r_kwargs)
+ return resume_request
def _filter_rows_keys(self):
- """ Helper for :meth:`build_updated_request`"""
+ """Helper for :meth:`build_updated_request`"""
return [
row_key
for row_key in self.message.rows.row_keys
@@ -648,7 +335,7 @@ def _filter_rows_keys(self):
]
def _filter_row_ranges(self):
- """ Helper for :meth:`build_updated_request`"""
+ """Helper for :meth:`build_updated_request`"""
new_row_ranges = []
for row_range in self.message.rows.row_ranges:
@@ -679,21 +366,15 @@ def _filter_row_ranges(self):
return new_row_ranges
def _key_already_read(self, key):
- """ Helper for :meth:`_filter_row_ranges`"""
+ """Helper for :meth:`_filter_row_ranges`"""
return key <= self.last_scanned_key
@staticmethod
def _start_key_set(row_range):
- """ Helper for :meth:`_filter_row_ranges`"""
+ """Helper for :meth:`_filter_row_ranges`"""
return row_range.start_key_open or row_range.start_key_closed
@staticmethod
def _end_key_set(row_range):
- """ Helper for :meth:`_filter_row_ranges`"""
+ """Helper for :meth:`_filter_row_ranges`"""
return row_range.end_key_open or row_range.end_key_closed
-
-
-def _raise_if(predicate, *args):
- """Helper for validation methods."""
- if predicate:
- raise InvalidChunk(*args)
diff --git a/google/cloud/bigtable/row_filters.py b/google/cloud/bigtable/row_filters.py
index e8a70a9f4..53192acc8 100644
--- a/google/cloud/bigtable/row_filters.py
+++ b/google/cloud/bigtable/row_filters.py
@@ -14,10 +14,14 @@
"""Filters for Google Cloud Bigtable Row classes."""
+import struct
-from google.cloud._helpers import _microseconds_from_datetime
-from google.cloud._helpers import _to_bytes
-from google.cloud.bigtable_v2.proto import data_pb2 as data_v2_pb2
+
+from google.cloud._helpers import _microseconds_from_datetime # type: ignore
+from google.cloud._helpers import _to_bytes # type: ignore
+from google.cloud.bigtable_v2.types import data as data_v2_pb2
+
+_PACK_I64 = struct.Struct(">q").pack
class RowFilter(object):
@@ -115,7 +119,9 @@ class _RegexFilter(RowFilter):
.. _RE2 reference: https://github.com/google/re2/wiki/Syntax
:type regex: bytes or str
- :param regex: A regular expression (RE2) for some row filter.
+ :param regex:
+ A regular expression (RE2) for some row filter. String values
+ will be encoded as ASCII.
"""
def __init__(self, regex):
@@ -439,9 +445,9 @@ class ValueRegexFilter(_RegexFilter):
character will not match the new line character ``\\n``, which may be
present in a binary value.
- :type regex: bytes
+ :type regex: bytes or str
:param regex: A regular expression (RE2) to match cells with values that
- match this regex.
+ match this regex. String values will be encoded as ASCII.
"""
def to_pb(self):
@@ -453,6 +459,22 @@ def to_pb(self):
return data_v2_pb2.RowFilter(value_regex_filter=self.regex)
+class ExactValueFilter(ValueRegexFilter):
+ """Row filter for an exact value.
+
+
+ :type value: bytes or str or int
+ :param value:
+ a literal string encodable as ASCII, or the
+ equivalent bytes, or an integer (which will be packed into 8-bytes).
+ """
+
+ def __init__(self, value):
+ if isinstance(value, int):
+ value = _PACK_I64(value)
+ super(ExactValueFilter, self).__init__(value)
+
+
class ValueRangeFilter(RowFilter):
"""A range of values to restrict to in a row filter.
@@ -496,6 +518,8 @@ def __init__(
raise ValueError(
"Inclusive start was specified but no " "start value was given."
)
+ if isinstance(start_value, int):
+ start_value = _PACK_I64(start_value)
self.start_value = start_value
self.inclusive_start = inclusive_start
@@ -505,6 +529,8 @@ def __init__(
raise ValueError(
"Inclusive end was specified but no " "end value was given."
)
+ if isinstance(end_value, int):
+ end_value = _PACK_I64(end_value)
self.end_value = end_value
self.inclusive_end = inclusive_end
diff --git a/google/cloud/bigtable/row_merger.py b/google/cloud/bigtable/row_merger.py
new file mode 100644
index 000000000..515b91df7
--- /dev/null
+++ b/google/cloud/bigtable/row_merger.py
@@ -0,0 +1,250 @@
+from enum import Enum
+from collections import OrderedDict
+from google.cloud.bigtable.row import Cell, PartialRowData, InvalidChunk
+
+_MISSING_COLUMN_FAMILY = "Column family {} is not among the cells stored in this row."
+_MISSING_COLUMN = (
+ "Column {} is not among the cells stored in this row in the column family {}."
+)
+_MISSING_INDEX = (
+ "Index {!r} is not valid for the cells stored in this row for column {} "
+ "in the column family {}. There are {} such cells."
+)
+
+
+class _State(Enum):
+ ROW_START = "ROW_START"
+ CELL_START = "CELL_START"
+ CELL_IN_PROGRESS = "CELL_IN_PROGRESS"
+ CELL_COMPLETE = "CELL_COMPLETE"
+ ROW_COMPLETE = "ROW_COMPLETE"
+
+
+class _PartialRow(object):
+ __slots__ = [
+ "row_key",
+ "cells",
+ "last_family",
+ "last_family_cells",
+ "last_qualifier",
+ "last_qualifier_cells",
+ "cell",
+ ]
+
+ def __init__(self, row_key):
+ self.row_key = row_key
+ self.cells = OrderedDict()
+
+ self.last_family = None
+ self.last_family_cells = OrderedDict()
+ self.last_qualifier = None
+ self.last_qualifier_cells = []
+
+ self.cell = None
+
+
+class _PartialCell(object):
+ __slots__ = ["family", "qualifier", "timestamp", "labels", "value", "value_index"]
+
+ def __init__(self):
+ self.family = None
+ self.qualifier = None
+ self.timestamp = None
+ self.labels = None
+ self.value = None
+ self.value_index = 0
+
+
+class _RowMerger(object):
+ """
+ State machine to merge chunks from a response stream into logical rows.
+
+ The implementation is a fairly linear state machine that is implemented as
+ a method for every state in the _State enum. In general the states flow
+ from top to bottom with some repetition. Each state handler will do some
+ sanity checks, update in progress data and set the next state.
+
+ There can be multiple state transitions for each chunk, i.e. a single chunk
+ row will flow from ROW_START -> CELL_START -> CELL_COMPLETE -> ROW_COMPLETE
+ in a single iteration.
+ """
+
+ __slots__ = ["state", "last_seen_row_key", "row"]
+
+ def __init__(self, last_seen_row=b""):
+ self.last_seen_row_key = last_seen_row
+ self.state = _State.ROW_START
+ self.row = None
+
+ def process_chunks(self, response):
+ """
+ Process the chunks in the given response and yield logical rows.
+ This class will maintain state across multiple response protos.
+ """
+ if response.last_scanned_row_key:
+ if self.last_seen_row_key >= response.last_scanned_row_key:
+ raise InvalidChunk("Last scanned row key is out of order")
+ self.last_seen_row_key = response.last_scanned_row_key
+
+ for chunk in response.chunks:
+ if chunk.reset_row:
+ self._handle_reset(chunk)
+ continue
+
+ if self.state == _State.ROW_START:
+ self._handle_row_start(chunk)
+
+ if self.state == _State.CELL_START:
+ self._handle_cell_start(chunk)
+
+ if self.state == _State.CELL_IN_PROGRESS:
+ self._handle_cell_in_progress(chunk)
+
+ if self.state == _State.CELL_COMPLETE:
+ self._handle_cell_complete(chunk)
+
+ if self.state == _State.ROW_COMPLETE:
+ yield self._handle_row_complete(chunk)
+ elif chunk.commit_row:
+ raise InvalidChunk(
+ f"Chunk tried to commit row in wrong state (${self.state})"
+ )
+
+ def _handle_reset(self, chunk):
+ if self.state == _State.ROW_START:
+ raise InvalidChunk("Bare reset")
+ if chunk.row_key:
+ raise InvalidChunk("Reset chunk has a row key")
+ if chunk.HasField("family_name"):
+ raise InvalidChunk("Reset chunk has family_name")
+ if chunk.HasField("qualifier"):
+ raise InvalidChunk("Reset chunk has qualifier")
+ if chunk.timestamp_micros:
+ raise InvalidChunk("Reset chunk has a timestamp")
+ if chunk.labels:
+ raise InvalidChunk("Reset chunk has labels")
+ if chunk.value:
+ raise InvalidChunk("Reset chunk has a value")
+
+ self.state = _State.ROW_START
+ self.row = None
+
+ def _handle_row_start(self, chunk):
+ if not chunk.row_key:
+ raise InvalidChunk("New row is missing a row key")
+ if self.last_seen_row_key and self.last_seen_row_key >= chunk.row_key:
+ raise InvalidChunk("Out of order row keys")
+
+ self.row = _PartialRow(chunk.row_key)
+ self.state = _State.CELL_START
+
+ def _handle_cell_start(self, chunk):
+ # Ensure that all chunks after the first one either are missing a row
+ # key or the row is the same
+ if self.row.cells and chunk.row_key and chunk.row_key != self.row.row_key:
+ raise InvalidChunk("row key changed mid row")
+
+ if not self.row.cell:
+ self.row.cell = _PartialCell()
+
+ # Cells can inherit family/qualifier from previous cells
+ # However if the family changes, then qualifier must be specified as well
+ if chunk.HasField("family_name"):
+ self.row.cell.family = chunk.family_name.value
+ self.row.cell.qualifier = None
+ if not self.row.cell.family:
+ raise InvalidChunk("missing family for a new cell")
+
+ if chunk.HasField("qualifier"):
+ self.row.cell.qualifier = chunk.qualifier.value
+ if self.row.cell.qualifier is None:
+ raise InvalidChunk("missing qualifier for a new cell")
+
+ self.row.cell.timestamp = chunk.timestamp_micros
+ self.row.cell.labels = chunk.labels
+
+ if chunk.value_size > 0:
+ # explicitly avoid pre-allocation as it seems that bytearray
+ # concatenation performs better than slice copies.
+ self.row.cell.value = bytearray()
+ self.state = _State.CELL_IN_PROGRESS
+ else:
+ self.row.cell.value = chunk.value
+ self.state = _State.CELL_COMPLETE
+
+ def _handle_cell_in_progress(self, chunk):
+ # if this isn't the first cell chunk, make sure that everything except
+ # the value stayed constant.
+ if self.row.cell.value_index > 0:
+ if chunk.row_key:
+ raise InvalidChunk("found row key mid cell")
+ if chunk.HasField("family_name"):
+ raise InvalidChunk("In progress cell had a family name")
+ if chunk.HasField("qualifier"):
+ raise InvalidChunk("In progress cell had a qualifier")
+ if chunk.timestamp_micros:
+ raise InvalidChunk("In progress cell had a timestamp")
+ if chunk.labels:
+ raise InvalidChunk("In progress cell had labels")
+
+ self.row.cell.value += chunk.value
+ self.row.cell.value_index += len(chunk.value)
+
+ if chunk.value_size > 0:
+ self.state = _State.CELL_IN_PROGRESS
+ else:
+ self.row.cell.value = bytes(self.row.cell.value)
+ self.state = _State.CELL_COMPLETE
+
+ def _handle_cell_complete(self, chunk):
+ # since we are guaranteed that all family & qualifier cells are
+ # contiguous, we can optimize away the dict lookup by caching the last
+ # family/qualifier and simply comparing and appending
+ family_changed = False
+ if self.row.last_family != self.row.cell.family:
+ family_changed = True
+ self.row.last_family = self.row.cell.family
+ self.row.cells[
+ self.row.cell.family
+ ] = self.row.last_family_cells = OrderedDict()
+
+ if family_changed or self.row.last_qualifier != self.row.cell.qualifier:
+ self.row.last_qualifier = self.row.cell.qualifier
+ self.row.last_family_cells[
+ self.row.cell.qualifier
+ ] = self.row.last_qualifier_cells = []
+
+ self.row.last_qualifier_cells.append(
+ Cell(
+ self.row.cell.value,
+ self.row.cell.timestamp,
+ self.row.cell.labels,
+ )
+ )
+
+ self.row.cell.timestamp = 0
+ self.row.cell.value = None
+ self.row.cell.value_index = 0
+
+ if not chunk.commit_row:
+ self.state = _State.CELL_START
+ else:
+ self.state = _State.ROW_COMPLETE
+
+ def _handle_row_complete(self, chunk):
+ new_row = PartialRowData(self.row.row_key)
+ new_row._cells = self.row.cells
+
+ self.last_seen_row_key = new_row.row_key
+ self.row = None
+ self.state = _State.ROW_START
+
+ return new_row
+
+ def finalize(self):
+ """
+ Must be called at the end of the stream to ensure there are no unmerged
+ rows.
+ """
+ if self.row or self.state != _State.ROW_START:
+ raise ValueError("The row remains partial / is not committed.")
diff --git a/google/cloud/bigtable/row_set.py b/google/cloud/bigtable/row_set.py
index 0cb6443b0..2bc436d54 100644
--- a/google/cloud/bigtable/row_set.py
+++ b/google/cloud/bigtable/row_set.py
@@ -15,14 +15,14 @@
"""User-friendly container for Google Cloud Bigtable RowSet """
-from google.cloud._helpers import _to_bytes
+from google.cloud._helpers import _to_bytes # type: ignore
class RowSet(object):
- """ Convenience wrapper of google.bigtable.v2.RowSet
+ """Convenience wrapper of google.bigtable.v2.RowSet
- Useful for creating a set of row keys and row ranges, which can
- be passed to yield_rows method of class:`.Table.yield_rows`.
+ Useful for creating a set of row keys and row ranges, which can
+ be passed to read_rows method of class:`.Table.read_rows`.
"""
def __init__(self):
@@ -56,8 +56,9 @@ def add_row_key(self, row_key):
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_add_row_key]
- :end-before: [END bigtable_add_row_key]
+ :start-after: [START bigtable_api_add_row_key]
+ :end-before: [END bigtable_api_add_row_key]
+ :dedent: 4
:type row_key: bytes
:param row_key: The key of a row to read
@@ -70,8 +71,9 @@ def add_row_range(self, row_range):
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_add_row_range]
- :end-before: [END bigtable_add_row_range]
+ :start-after: [START bigtable_api_add_row_range]
+ :end-before: [END bigtable_api_add_row_range]
+ :dedent: 4
:type row_range: class:`RowRange`
:param row_range: The row range object having start and end key
@@ -86,8 +88,9 @@ def add_row_range_from_keys(
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_row_range_from_keys]
- :end-before: [END bigtable_row_range_from_keys]
+ :start-after: [START bigtable_api_row_range_from_keys]
+ :end-before: [END bigtable_api_row_range_from_keys]
+ :dedent: 4
:type start_key: bytes
:param start_key: (Optional) Start key of the row range. If left empty,
@@ -109,6 +112,24 @@ def add_row_range_from_keys(
row_range = RowRange(start_key, end_key, start_inclusive, end_inclusive)
self.row_ranges.append(row_range)
+ def add_row_range_with_prefix(self, row_key_prefix):
+ """Add row range to row_ranges list that start with the row_key_prefix from the row keys
+
+ For example:
+
+ .. literalinclude:: snippets_table.py
+ :start-after: [START bigtable_api_add_row_range_with_prefix]
+ :end-before: [END bigtable_api_add_row_range_with_prefix]
+
+ :type row_key_prefix: str
+ :param row_key_prefix: To retrieve all rows that start with this row key prefix.
+ Prefix cannot be zero length."""
+
+ end_key = row_key_prefix[:-1] + chr(ord(row_key_prefix[-1]) + 1)
+ self.add_row_range_from_keys(
+ row_key_prefix.encode("utf-8"), end_key.encode("utf-8")
+ )
+
def _update_message_request(self, message):
"""Add row keys and row range to given request message
@@ -116,15 +137,15 @@ def _update_message_request(self, message):
:param message: The ``ReadRowsRequest`` protobuf
"""
for each in self.row_keys:
- message.rows.row_keys.append(_to_bytes(each))
+ message.rows.row_keys._pb.append(_to_bytes(each))
for each in self.row_ranges:
r_kwrags = each.get_range_kwargs()
- message.rows.row_ranges.add(**r_kwrags)
+ message.rows.row_ranges.append(r_kwrags)
class RowRange(object):
- """ Convenience wrapper of google.bigtable.v2.RowRange
+ """Convenience wrapper of google.bigtable.v2.RowRange
:type start_key: bytes
:param start_key: (Optional) Start key of the row range. If left empty,
@@ -174,7 +195,7 @@ def __ne__(self, other):
return not self == other
def get_range_kwargs(self):
- """ Convert row range object to dict which can be passed to
+ """Convert row range object to dict which can be passed to
google.bigtable.v2.RowRange add method.
"""
range_kwargs = {}
diff --git a/google/cloud/bigtable/table.py b/google/cloud/bigtable/table.py
index 4852ff6e1..0009f287e 100644
--- a/google/cloud/bigtable/table.py
+++ b/google/cloud/bigtable/table.py
@@ -14,44 +14,66 @@
"""User-friendly container for Google Cloud Bigtable Table."""
-
-from grpc import StatusCode
+from typing import Set
+import warnings
from google.api_core import timeout
-from google.api_core.exceptions import RetryError
+from google.api_core.exceptions import Aborted
+from google.api_core.exceptions import DeadlineExceeded
from google.api_core.exceptions import NotFound
+from google.api_core.exceptions import RetryError
+from google.api_core.exceptions import ServiceUnavailable
+from google.api_core.exceptions import InternalServerError
+from google.api_core.gapic_v1.method import DEFAULT
from google.api_core.retry import if_exception_type
from google.api_core.retry import Retry
-from google.api_core.gapic_v1.method import wrap_method
-from google.cloud._helpers import _to_bytes
+from google.cloud._helpers import _to_bytes # type: ignore
+from google.cloud.bigtable.backup import Backup
from google.cloud.bigtable.column_family import _gc_rule_from_pb
from google.cloud.bigtable.column_family import ColumnFamily
from google.cloud.bigtable.batcher import MutationsBatcher
-from google.cloud.bigtable.batcher import FLUSH_COUNT, MAX_ROW_BYTES
+from google.cloud.bigtable.batcher import FLUSH_COUNT, MAX_MUTATION_SIZE
+from google.cloud.bigtable.encryption_info import EncryptionInfo
from google.cloud.bigtable.policy import Policy
from google.cloud.bigtable.row import AppendRow
from google.cloud.bigtable.row import ConditionalRow
from google.cloud.bigtable.row import DirectRow
-from google.cloud.bigtable.row_data import PartialRowsData
+from google.cloud.bigtable.row_data import (
+ PartialRowsData,
+ _retriable_internal_server_error,
+)
from google.cloud.bigtable.row_data import DEFAULT_RETRY_READ_ROWS
from google.cloud.bigtable.row_set import RowSet
from google.cloud.bigtable.row_set import RowRange
from google.cloud.bigtable import enums
-from google.cloud.bigtable_v2.proto import bigtable_pb2 as data_messages_v2_pb2
-from google.cloud.bigtable_admin_v2.proto import table_pb2 as admin_messages_v2_pb2
-from google.cloud.bigtable_admin_v2.proto import (
- bigtable_table_admin_pb2 as table_admin_messages_v2_pb2,
+from google.cloud.bigtable_v2.types import bigtable as data_messages_v2_pb2
+from google.cloud.bigtable_admin_v2 import BaseBigtableTableAdminClient
+from google.cloud.bigtable_admin_v2.types import table as admin_messages_v2_pb2
+from google.cloud.bigtable_admin_v2.types import (
+ bigtable_table_admin as table_admin_messages_v2_pb2,
)
-import warnings
-
-
# Maximum number of mutations in bulk (MutateRowsRequest message):
# (https://cloud.google.com/bigtable/docs/reference/data/rpc/
# google.bigtable.v2#google.bigtable.v2.MutateRowRequest)
_MAX_BULK_MUTATIONS = 100000
VIEW_NAME_ONLY = enums.Table.View.NAME_ONLY
+RETRYABLE_MUTATION_ERRORS = (
+ Aborted,
+ DeadlineExceeded,
+ ServiceUnavailable,
+ InternalServerError,
+)
+"""Errors which can be retried during row mutation."""
+
+
+RETRYABLE_CODES: Set[int] = set()
+
+for retryable in RETRYABLE_MUTATION_ERRORS:
+ if retryable.grpc_status_code is not None: # pragma: NO COVER
+ RETRYABLE_CODES.add(retryable.grpc_status_code.value[0])
+
class _BigtableRetryableError(Exception):
"""Retry-able error expected by the default retry strategy."""
@@ -117,8 +139,9 @@ def name(self):
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_table_name]
- :end-before: [END bigtable_table_name]
+ :start-after: [START bigtable_api_table_name]
+ :end-before: [END bigtable_api_table_name]
+ :dedent: 4
.. note::
@@ -145,14 +168,15 @@ def get_iam_policy(self):
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_table_get_iam_policy]
- :end-before: [END bigtable_table_get_iam_policy]
+ :start-after: [START bigtable_api_table_get_iam_policy]
+ :end-before: [END bigtable_api_table_get_iam_policy]
+ :dedent: 4
:rtype: :class:`google.cloud.bigtable.policy.Policy`
:returns: The current IAM policy of this table.
"""
table_client = self._instance._client.table_admin_client
- resp = table_client.get_iam_policy(resource=self.name)
+ resp = table_client.get_iam_policy(request={"resource": self.name})
return Policy.from_pb(resp)
def set_iam_policy(self, policy):
@@ -165,8 +189,9 @@ class `google.cloud.bigtable.policy.Policy`
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_table_set_iam_policy]
- :end-before: [END bigtable_table_set_iam_policy]
+ :start-after: [START bigtable_api_table_set_iam_policy]
+ :end-before: [END bigtable_api_table_set_iam_policy]
+ :dedent: 4
:type policy: :class:`google.cloud.bigtable.policy.Policy`
:param policy: A new IAM policy to replace the current IAM policy
@@ -176,7 +201,9 @@ class `google.cloud.bigtable.policy.Policy`
:returns: The current IAM policy of this table.
"""
table_client = self._instance._client.table_admin_client
- resp = table_client.set_iam_policy(resource=self.name, policy=policy.to_pb())
+ resp = table_client.set_iam_policy(
+ request={"resource": self.name, "policy": policy.to_pb()}
+ )
return Policy.from_pb(resp)
def test_iam_permissions(self, permissions):
@@ -186,8 +213,9 @@ def test_iam_permissions(self, permissions):
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_table_test_iam_permissions]
- :end-before: [END bigtable_table_test_iam_permissions]
+ :start-after: [START bigtable_api_table_test_iam_permissions]
+ :end-before: [END bigtable_api_table_test_iam_permissions]
+ :dedent: 4
:type permissions: list
:param permissions: The set of permissions to check for
@@ -203,7 +231,7 @@ def test_iam_permissions(self, permissions):
"""
table_client = self._instance._client.table_admin_client
resp = table_client.test_iam_permissions(
- resource=self.name, permissions=permissions
+ request={"resource": self.name, "permissions": permissions}
)
return list(resp.permissions)
@@ -213,8 +241,9 @@ def column_family(self, column_family_id, gc_rule=None):
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_table_column_family]
- :end-before: [END bigtable_table_column_family]
+ :start-after: [START bigtable_api_table_column_family]
+ :end-before: [END bigtable_api_table_column_family]
+ :dedent: 4
:type column_family_id: str
:param column_family_id: The ID of the column family. Must be of the
@@ -235,8 +264,9 @@ def row(self, row_key, filter_=None, append=False):
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_table_row]
- :end-before: [END bigtable_table_row]
+ :start-after: [START bigtable_api_table_row]
+ :end-before: [END bigtable_api_table_row]
+ :dedent: 4
.. warning::
@@ -282,8 +312,9 @@ def append_row(self, row_key):
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_table_append_row]
- :end-before: [END bigtable_table_append_row]
+ :start-after: [START bigtable_api_table_append_row]
+ :end-before: [END bigtable_api_table_append_row]
+ :dedent: 4
Args:
row_key (bytes): The key for the row being created.
@@ -299,8 +330,9 @@ def direct_row(self, row_key):
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_table_direct_row]
- :end-before: [END bigtable_table_direct_row]
+ :start-after: [START bigtable_api_table_direct_row]
+ :end-before: [END bigtable_api_table_direct_row]
+ :dedent: 4
Args:
row_key (bytes): The key for the row being created.
@@ -316,8 +348,9 @@ def conditional_row(self, row_key, filter_):
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_table_conditional_row]
- :end-before: [END bigtable_table_conditional_row]
+ :start-after: [START bigtable_api_table_conditional_row]
+ :end-before: [END bigtable_api_table_conditional_row]
+ :dedent: 4
Args:
row_key (bytes): The key for the row being created.
@@ -344,13 +377,14 @@ def create(self, initial_split_keys=[], column_families={}):
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_create_table]
- :end-before: [END bigtable_create_table]
+ :start-after: [START bigtable_api_create_table]
+ :end-before: [END bigtable_api_create_table]
+ :dedent: 4
.. note::
A create request returns a
- :class:`._generated.table_pb2.Table` but we don't use
+ :class:`._generated.table.Table` but we don't use
this response.
:type initial_split_keys: list
@@ -376,10 +410,12 @@ def create(self, initial_split_keys=[], column_families={}):
splits = [split(key=_to_bytes(key)) for key in initial_split_keys]
table_client.create_table(
- parent=instance_name,
- table_id=self.table_id,
- table=table,
- initial_splits=splits,
+ request={
+ "parent": instance_name,
+ "table_id": self.table_id,
+ "table": table,
+ "initial_splits": splits,
+ }
)
def exists(self):
@@ -388,15 +424,16 @@ def exists(self):
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_check_table_exists]
- :end-before: [END bigtable_check_table_exists]
+ :start-after: [START bigtable_api_check_table_exists]
+ :end-before: [END bigtable_api_check_table_exists]
+ :dedent: 4
:rtype: bool
:returns: True if the table exists, else False.
"""
table_client = self._instance._client.table_admin_client
try:
- table_client.get_table(name=self.name, view=VIEW_NAME_ONLY)
+ table_client.get_table(request={"name": self.name, "view": VIEW_NAME_ONLY})
return True
except NotFound:
return False
@@ -407,12 +444,12 @@ def delete(self):
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_delete_table]
- :end-before: [END bigtable_delete_table]
-
+ :start-after: [START bigtable_api_delete_table]
+ :end-before: [END bigtable_api_delete_table]
+ :dedent: 4
"""
table_client = self._instance._client.table_admin_client
- table_client.delete_table(name=self.name)
+ table_client.delete_table(request={"name": self.name})
def list_column_families(self):
"""List the column families owned by this table.
@@ -420,8 +457,9 @@ def list_column_families(self):
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_list_column_families]
- :end-before: [END bigtable_list_column_families]
+ :start-after: [START bigtable_api_list_column_families]
+ :end-before: [END bigtable_api_list_column_families]
+ :dedent: 4
:rtype: dict
:returns: Dictionary of column families attached to this table. Keys
@@ -432,7 +470,7 @@ def list_column_families(self):
name from the column family ID.
"""
table_client = self._instance._client.table_admin_client
- table_pb = table_client.get_table(self.name)
+ table_pb = table_client.get_table(request={"name": self.name})
result = {}
for column_family_id, value_pb in table_pb.column_families.items():
@@ -447,8 +485,9 @@ def get_cluster_states(self):
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_get_cluster_states]
- :end-before: [END bigtable_get_cluster_states]
+ :start-after: [START bigtable_api_get_cluster_states]
+ :end-before: [END bigtable_api_get_cluster_states]
+ :dedent: 4
:rtype: dict
:returns: Dictionary of cluster states for this table.
@@ -458,21 +497,51 @@ def get_cluster_states(self):
REPLICATION_VIEW = enums.Table.View.REPLICATION_VIEW
table_client = self._instance._client.table_admin_client
- table_pb = table_client.get_table(self.name, view=REPLICATION_VIEW)
+ table_pb = table_client.get_table(
+ request={"name": self.name, "view": REPLICATION_VIEW}
+ )
return {
cluster_id: ClusterState(value_pb.replication_state)
for cluster_id, value_pb in table_pb.cluster_states.items()
}
- def read_row(self, row_key, filter_=None):
+ def get_encryption_info(self):
+ """List the encryption info for each cluster owned by this table.
+
+ Gets the current encryption info for the table across all of the clusters. The
+ returned dict will be keyed by cluster id and contain a status for all of the
+ keys in use.
+
+ :rtype: dict
+ :returns: Dictionary of encryption info for this table. Keys are cluster ids and
+ values are tuples of :class:`google.cloud.bigtable.encryption.EncryptionInfo` instances.
+ """
+ ENCRYPTION_VIEW = enums.Table.View.ENCRYPTION_VIEW
+ table_client = self._instance._client.table_admin_client
+ table_pb = table_client.get_table(
+ request={"name": self.name, "view": ENCRYPTION_VIEW}
+ )
+
+ return {
+ cluster_id: tuple(
+ (
+ EncryptionInfo._from_pb(info_pb)
+ for info_pb in value_pb.encryption_info
+ )
+ )
+ for cluster_id, value_pb in table_pb.cluster_states.items()
+ }
+
+ def read_row(self, row_key, filter_=None, retry=DEFAULT_RETRY_READ_ROWS):
"""Read a single row from this table.
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_read_row]
- :end-before: [END bigtable_read_row]
+ :start-after: [START bigtable_api_read_row]
+ :end-before: [END bigtable_api_read_row]
+ :dedent: 4
:type row_key: bytes
:param row_key: The key of the row to read from.
@@ -481,6 +550,14 @@ def read_row(self, row_key, filter_=None):
:param filter_: (Optional) The filter to apply to the contents of the
row. If unset, returns the entire row.
+ :type retry: :class:`~google.api_core.retry.Retry`
+ :param retry:
+ (Optional) Retry delay and deadline arguments. To override, the
+ default value :attr:`DEFAULT_RETRY_READ_ROWS` can be used and
+ modified with the :meth:`~google.api_core.retry.Retry.with_delay`
+ method or the :meth:`~google.api_core.retry.Retry.with_deadline`
+ method.
+
:rtype: :class:`.PartialRowData`, :data:`NoneType `
:returns: The contents of the row if any chunks were returned in
the response, otherwise :data:`None`.
@@ -489,7 +566,9 @@ def read_row(self, row_key, filter_=None):
"""
row_set = RowSet()
row_set.add_row_key(row_key)
- result_iter = iter(self.read_rows(filter_=filter_, row_set=row_set))
+ result_iter = iter(
+ self.read_rows(filter_=filter_, row_set=row_set, retry=retry)
+ )
row = next(result_iter, None)
if next(result_iter, None) is not None:
raise ValueError("More than one row was returned.")
@@ -510,8 +589,9 @@ def read_rows(
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_read_rows]
- :end-before: [END bigtable_read_rows]
+ :start-after: [START bigtable_api_read_rows]
+ :end-before: [END bigtable_api_read_rows]
+ :dedent: 4
:type start_key: bytes
:param start_key: (Optional) The beginning of a range of row keys to
@@ -537,7 +617,7 @@ def read_rows(
:param end_inclusive: (Optional) Whether the ``end_key`` should be
considered inclusive. The default is False (exclusive).
- :type row_set: :class:`row_set.RowSet`
+ :type row_set: :class:`.RowSet`
:param row_set: (Optional) The row set containing multiple row keys and
row_ranges.
@@ -564,7 +644,7 @@ def read_rows(
row_set=row_set,
)
data_client = self._instance._client.table_data_client
- return PartialRowsData(data_client.transport.read_rows, request_pb, retry)
+ return PartialRowsData(data_client.read_rows, request_pb, retry)
def yield_rows(self, **kwargs):
"""Read rows from this table.
@@ -593,7 +673,7 @@ def yield_rows(self, **kwargs):
specified row(s). If unset, reads every column in
each row.
- :type row_set: :class:`row_set.RowSet`
+ :type row_set: :class:`.RowSet`
:param row_set: (Optional) The row set containing multiple row keys and
row_ranges.
@@ -607,14 +687,15 @@ def yield_rows(self, **kwargs):
)
return self.read_rows(**kwargs)
- def mutate_rows(self, rows, retry=DEFAULT_RETRY):
+ def mutate_rows(self, rows, retry=DEFAULT_RETRY, timeout=DEFAULT):
"""Mutates multiple rows in bulk.
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_mutate_rows]
- :end-before: [END bigtable_mutate_rows]
+ :start-after: [START bigtable_api_mutate_rows]
+ :end-before: [END bigtable_api_mutate_rows]
+ :dedent: 4
The method tries to update all specified rows.
If some of the rows weren't updated, it would not remove mutations.
@@ -637,17 +718,23 @@ def mutate_rows(self, rows, retry=DEFAULT_RETRY):
the :meth:`~google.api_core.retry.Retry.with_delay` method or the
:meth:`~google.api_core.retry.Retry.with_deadline` method.
+ :type timeout: float
+ :param timeout: number of seconds bounding retries for the call
+
:rtype: list
:returns: A list of response statuses (`google.rpc.status_pb2.Status`)
corresponding to success or failure of each row mutation
sent. These will be in the same order as the `rows`.
"""
+ if timeout is DEFAULT:
+ timeout = self.mutation_timeout
+
retryable_mutate_rows = _RetryableMutateRowsWorker(
self._instance._client,
self.name,
rows,
app_profile_id=self._app_profile_id,
- timeout=self.mutation_timeout,
+ timeout=timeout,
)
return retryable_mutate_rows(retry=retry)
@@ -657,8 +744,9 @@ def sample_row_keys(self):
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_sample_row_keys]
- :end-before: [END bigtable_sample_row_keys]
+ :start-after: [START bigtable_api_sample_row_keys]
+ :end-before: [END bigtable_api_sample_row_keys]
+ :dedent: 4
The returned row keys will delimit contiguous sections of the table of
approximately equal size, which can be used to break up the data for
@@ -690,7 +778,7 @@ def sample_row_keys(self):
"""
data_client = self._instance._client.table_data_client
response_iterator = data_client.sample_row_keys(
- self.name, app_profile_id=self._app_profile_id
+ request={"table_name": self.name, "app_profile_id": self._app_profile_id}
)
return response_iterator
@@ -701,8 +789,9 @@ def truncate(self, timeout=None):
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_truncate_table]
- :end-before: [END bigtable_truncate_table]
+ :start-after: [START bigtable_api_truncate_table]
+ :end-before: [END bigtable_api_truncate_table]
+ :dedent: 4
:type timeout: float
:param timeout: (Optional) The amount of time, in seconds, to wait
@@ -718,11 +807,12 @@ def truncate(self, timeout=None):
table_admin_client = client.table_admin_client
if timeout:
table_admin_client.drop_row_range(
- self.name, delete_all_data_from_table=True, timeout=timeout
+ request={"name": self.name, "delete_all_data_from_table": True},
+ timeout=timeout,
)
else:
table_admin_client.drop_row_range(
- self.name, delete_all_data_from_table=True
+ request={"name": self.name, "delete_all_data_from_table": True}
)
def drop_by_prefix(self, row_key_prefix, timeout=None):
@@ -731,8 +821,9 @@ def drop_by_prefix(self, row_key_prefix, timeout=None):
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_drop_by_prefix]
- :end-before: [END bigtable_drop_by_prefix]
+ :start-after: [START bigtable_api_drop_by_prefix]
+ :end-before: [END bigtable_api_drop_by_prefix]
+ :dedent: 4
:type row_key_prefix: bytes
:param row_key_prefix: Delete all rows that start with this row key
@@ -752,21 +843,28 @@ def drop_by_prefix(self, row_key_prefix, timeout=None):
table_admin_client = client.table_admin_client
if timeout:
table_admin_client.drop_row_range(
- self.name, row_key_prefix=_to_bytes(row_key_prefix), timeout=timeout
+ request={
+ "name": self.name,
+ "row_key_prefix": _to_bytes(row_key_prefix),
+ },
+ timeout=timeout,
)
else:
table_admin_client.drop_row_range(
- self.name, row_key_prefix=_to_bytes(row_key_prefix)
+ request={"name": self.name, "row_key_prefix": _to_bytes(row_key_prefix)}
)
- def mutations_batcher(self, flush_count=FLUSH_COUNT, max_row_bytes=MAX_ROW_BYTES):
+ def mutations_batcher(
+ self, flush_count=FLUSH_COUNT, max_row_bytes=MAX_MUTATION_SIZE
+ ):
"""Factory to create a mutation batcher associated with this instance.
For example:
.. literalinclude:: snippets_table.py
- :start-after: [START bigtable_mutations_batcher]
- :end-before: [END bigtable_mutations_batcher]
+ :start-after: [START bigtable_api_mutations_batcher]
+ :end-before: [END bigtable_api_mutations_batcher]
+ :dedent: 4
:type flush_count: int
:param flush_count: (Optional) Maximum number of rows per batch. If it
@@ -782,6 +880,189 @@ def mutations_batcher(self, flush_count=FLUSH_COUNT, max_row_bytes=MAX_ROW_BYTES
"""
return MutationsBatcher(self, flush_count, max_row_bytes)
+ def backup(self, backup_id, cluster_id=None, expire_time=None):
+ """Factory to create a Backup linked to this Table.
+
+ :type backup_id: str
+ :param backup_id: The ID of the Backup to be created.
+
+ :type cluster_id: str
+ :param cluster_id: (Optional) The ID of the Cluster. Required for
+ calling 'delete', 'exists' etc. methods.
+
+ :type expire_time: :class:`datetime.datetime`
+ :param expire_time: (Optional) The expiration time of this new Backup.
+ Required, if the `create` method needs to be called.
+ :rtype: :class:`.Backup`
+ :returns: A backup linked to this table.
+ """
+ return Backup(
+ backup_id,
+ self._instance,
+ cluster_id=cluster_id,
+ table_id=self.table_id,
+ expire_time=expire_time,
+ )
+
+ def list_backups(self, cluster_id=None, filter_=None, order_by=None, page_size=0):
+ """List Backups for this Table.
+
+ :type cluster_id: str
+ :param cluster_id: (Optional) Specifies a single cluster to list
+ Backups from. If none is specified, the returned list
+ contains all the Backups in this Instance.
+
+ :type filter_: str
+ :param filter_: (Optional) A filter expression that filters backups
+ listed in the response. The expression must specify
+ the field name, a comparison operator, and the value
+ that you want to use for filtering. The value must be
+ a string, a number, or a boolean. The comparison
+ operator must be <, >, <=, >=, !=, =, or :. Colon ':'
+ represents a HAS operator which is roughly synonymous
+ with equality. Filter rules are case insensitive.
+
+ The fields eligible for filtering are:
+
+ - ``name``
+ - ``source_table``
+ - ``state``
+ - ``start_time`` (values of the format YYYY-MM-DDTHH:MM:SSZ)
+ - ``end_time`` (values of the format YYYY-MM-DDTHH:MM:SSZ)
+ - ``expire_time`` (values of the format YYYY-MM-DDTHH:MM:SSZ)
+ - ``size_bytes``
+
+ To filter on multiple expressions, provide each
+ separate expression within parentheses. By default,
+ each expression is an AND expression. However, you can
+ include AND, OR, and NOT expressions explicitly.
+
+ Some examples of using filters are:
+
+ - ``name:"exact"`` --> The Backup name is the string "exact".
+ - ``name:howl`` --> The Backup name contains the string "howl"
+ - ``source_table:prod`` --> The source table's name contains
+ the string "prod".
+ - ``state:CREATING`` --> The Backup is pending creation.
+ - ``state:READY`` --> The Backup is created and ready for use.
+ - ``(name:howl) AND (start_time < \"2020-05-28T14:50:00Z\")``
+ --> The Backup name contains the string "howl" and
+ the Backup start time is before 2020-05-28T14:50:00Z.
+ - ``size_bytes > 10000000000`` --> The Backup size is greater
+ than 10GB
+
+ :type order_by: str
+ :param order_by: (Optional) An expression for specifying the sort order
+ of the results of the request. The string value should
+ specify one or more fields in ``Backup``. The full
+ syntax is described at https://aip.dev/132#ordering.
+
+ Fields supported are: \\* name \\* source_table \\*
+ expire_time \\* start_time \\* end_time \\*
+ size_bytes \\* state
+
+ For example, "start_time". The default sorting order
+ is ascending. To specify descending order for the
+ field, a suffix " desc" should be appended to the
+ field name. For example, "start_time desc". Redundant
+ space characters in the syntax are insigificant. If
+ order_by is empty, results will be sorted by
+ ``start_time`` in descending order starting from
+ the most recently created backup.
+
+ :type page_size: int
+ :param page_size: (Optional) The maximum number of resources contained
+ in the underlying API response. If page streaming is
+ performed per-resource, this parameter does not
+ affect the return value. If page streaming is
+ performed per-page, this determines the maximum
+ number of resources in a page.
+
+ :rtype: :class:`~google.api_core.page_iterator.Iterator`
+ :returns: Iterator of :class:`~google.cloud.bigtable.backup.Backup`
+ resources within the current Instance.
+ :raises: :class:`ValueError ` if one of the
+ returned Backups' name is not of the expected format.
+ """
+ cluster_id = cluster_id or "-"
+
+ backups_filter = "source_table:{}".format(self.name)
+ if filter_:
+ backups_filter = "({}) AND ({})".format(backups_filter, filter_)
+
+ parent = BaseBigtableTableAdminClient.cluster_path(
+ project=self._instance._client.project,
+ instance=self._instance.instance_id,
+ cluster=cluster_id,
+ )
+ client = self._instance._client.table_admin_client
+ backup_list_pb = client.list_backups(
+ request={
+ "parent": parent,
+ "filter": backups_filter,
+ "order_by": order_by,
+ "page_size": page_size,
+ }
+ )
+
+ result = []
+ for backup_pb in backup_list_pb.backups:
+ result.append(Backup.from_pb(backup_pb, self._instance))
+
+ return result
+
+ def restore(self, new_table_id, cluster_id=None, backup_id=None, backup_name=None):
+ """Creates a new Table by restoring from the Backup specified by either
+ `backup_id` or `backup_name`. The returned ``long-running operation``
+ can be used to track the progress of the operation and to cancel it.
+ The ``response`` type is ``Table``, if successful.
+
+ :type new_table_id: str
+ :param new_table_id: The ID of the Table to create and restore to.
+ This Table must not already exist.
+
+ :type cluster_id: str
+ :param cluster_id: The ID of the Cluster containing the Backup.
+ This parameter gets overriden by `backup_name`, if
+ the latter is provided.
+
+ :type backup_id: str
+ :param backup_id: The ID of the Backup to restore the Table from.
+ This parameter gets overriden by `backup_name`, if
+ the latter is provided.
+
+ :type backup_name: str
+ :param backup_name: (Optional) The full name of the Backup to restore
+ from. If specified, it overrides the `cluster_id`
+ and `backup_id` parameters even of such specified.
+
+ :return: An instance of
+ :class:`~google.api_core.operation.Operation`.
+
+ :raises: google.api_core.exceptions.AlreadyExists: If the table
+ already exists.
+ :raises: google.api_core.exceptions.GoogleAPICallError: If the request
+ failed for any reason.
+ :raises: google.api_core.exceptions.RetryError: If the request failed
+ due to a retryable error and retry attempts failed.
+ :raises: ValueError: If the parameters are invalid.
+ """
+ api = self._instance._client.table_admin_client
+ if not backup_name:
+ backup_name = BaseBigtableTableAdminClient.backup_path(
+ project=self._instance._client.project,
+ instance=self._instance.instance_id,
+ cluster=cluster_id,
+ backup=backup_id,
+ )
+ return api._restore_table(
+ request={
+ "parent": self._instance.name,
+ "table_id": new_table_id,
+ "backup": backup_name,
+ }
+ )
+
class _RetryableMutateRowsWorker(object):
"""A callable worker that can retry to mutate rows with transient errors.
@@ -791,14 +1072,6 @@ class _RetryableMutateRowsWorker(object):
are retryable, any subsequent call on this callable will be a no-op.
"""
- # pylint: disable=unsubscriptable-object
- RETRY_CODES = (
- StatusCode.DEADLINE_EXCEEDED.value[0],
- StatusCode.ABORTED.value[0],
- StatusCode.UNAVAILABLE.value[0],
- )
- # pylint: enable=unsubscriptable-object
-
def __init__(self, client, table_name, rows, app_profile_id=None, timeout=None):
self.client = client
self.table_name = table_name
@@ -835,7 +1108,7 @@ def __call__(self, retry=DEFAULT_RETRY):
@staticmethod
def _is_retryable(status):
- return status is None or status.code in _RetryableMutateRowsWorker.RETRY_CODES
+ return status is None or status.code in RETRYABLE_CODES
def _do_mutate_retryable_rows(self):
"""Mutate all the rows that are eligible for retry.
@@ -864,27 +1137,33 @@ def _do_mutate_retryable_rows(self):
# All mutations are either successful or non-retryable now.
return self.responses_statuses
- mutate_rows_request = _mutate_rows_request(
- self.table_name, retryable_rows, app_profile_id=self.app_profile_id
- )
+ entries = _compile_mutation_entries(self.table_name, retryable_rows)
data_client = self.client.table_data_client
- inner_api_calls = data_client._inner_api_calls
- if "mutate_rows" not in inner_api_calls:
- default_retry = (data_client._method_configs["MutateRows"].retry,)
- if self.timeout is None:
- default_timeout = data_client._method_configs["MutateRows"].timeout
- else:
- default_timeout = timeout.ExponentialTimeout(deadline=self.timeout)
- data_client._inner_api_calls["mutate_rows"] = wrap_method(
- data_client.transport.mutate_rows,
- default_retry=default_retry,
- default_timeout=default_timeout,
- client_info=data_client._client_info,
- )
- responses = data_client._inner_api_calls["mutate_rows"](
- mutate_rows_request, retry=None
- )
+ kwargs = {}
+ if self.timeout is not None:
+ kwargs["timeout"] = timeout.ExponentialTimeout(deadline=self.timeout)
+
+ try:
+ responses = data_client.mutate_rows(
+ table_name=self.table_name,
+ entries=entries,
+ app_profile_id=self.app_profile_id,
+ retry=None,
+ **kwargs
+ )
+ except RETRYABLE_MUTATION_ERRORS as exc:
+ # If an exception, considered retryable by `RETRYABLE_MUTATION_ERRORS`, is
+ # returned from the initial call, consider
+ # it to be retryable. Wrap as a Bigtable Retryable Error.
+ # For InternalServerError, it is only retriable if the message is related to RST Stream messages
+ if _retriable_internal_server_error(exc) or not isinstance(
+ exc, InternalServerError
+ ):
+ raise _BigtableRetryableError
+ else:
+ # re-raise the original exception
+ raise
num_responses = 0
num_retryable_responses = 0
@@ -1028,7 +1307,7 @@ def _create_row_request(
:type: app_profile_id: str
:param app_profile_id: (Optional) The unique name of the AppProfile.
- :type row_set: :class:`row_set.RowSet`
+ :type row_set: :class:`.RowSet`
:param row_set: (Optional) The row set containing multiple row keys and
row_ranges.
@@ -1060,8 +1339,8 @@ def _create_row_request(
return message
-def _mutate_rows_request(table_name, rows, app_profile_id=None):
- """Creates a request to mutate rows in a table.
+def _compile_mutation_entries(table_name, rows):
+ """Create list of mutation entries
:type table_name: str
:param table_name: The name of the table to write to.
@@ -1069,29 +1348,29 @@ def _mutate_rows_request(table_name, rows, app_profile_id=None):
:type rows: list
:param rows: List or other iterable of :class:`.DirectRow` instances.
- :type: app_profile_id: str
- :param app_profile_id: (Optional) The unique name of the AppProfile.
-
- :rtype: :class:`data_messages_v2_pb2.MutateRowsRequest`
- :returns: The ``MutateRowsRequest`` protobuf corresponding to the inputs.
+ :rtype: List[:class:`data_messages_v2_pb2.MutateRowsRequest.Entry`]
+ :returns: entries corresponding to the inputs.
:raises: :exc:`~.table.TooManyMutationsError` if the number of mutations is
- greater than 100,000
- """
- request_pb = data_messages_v2_pb2.MutateRowsRequest(
- table_name=table_name, app_profile_id=app_profile_id
+ greater than the max ({})
+ """.format(
+ _MAX_BULK_MUTATIONS
)
+ entries = []
mutations_count = 0
+ entry_klass = data_messages_v2_pb2.MutateRowsRequest.Entry
+
for row in rows:
_check_row_table_name(table_name, row)
_check_row_type(row)
mutations = row._get_mutations()
- request_pb.entries.add(row_key=row.row_key, mutations=mutations)
+ entries.append(entry_klass(row_key=row.row_key, mutations=mutations))
mutations_count += len(mutations)
+
if mutations_count > _MAX_BULK_MUTATIONS:
raise TooManyMutationsError(
"Maximum number of mutations is %s" % (_MAX_BULK_MUTATIONS,)
)
- return request_pb
+ return entries
def _check_row_table_name(table_name, row):
diff --git a/google/cloud/bigtable_admin/__init__.py b/google/cloud/bigtable_admin/__init__.py
new file mode 100644
index 000000000..2d95b06c8
--- /dev/null
+++ b/google/cloud/bigtable_admin/__init__.py
@@ -0,0 +1,455 @@
+# -*- coding: utf-8 -*-
+# Copyright 2025 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 google.cloud.bigtable_admin import gapic_version as package_version
+
+__version__ = package_version.__version__
+
+
+from google.cloud.bigtable_admin_v2.services.bigtable_instance_admin.client import (
+ BigtableInstanceAdminClient,
+)
+from google.cloud.bigtable_admin_v2.services.bigtable_instance_admin.async_client import (
+ BigtableInstanceAdminAsyncClient,
+)
+from google.cloud.bigtable_admin_v2.services.bigtable_table_admin.client import (
+ BaseBigtableTableAdminClient,
+)
+from google.cloud.bigtable_admin_v2.services.bigtable_table_admin.async_client import (
+ BaseBigtableTableAdminAsyncClient,
+)
+
+from google.cloud.bigtable_admin_v2.types.bigtable_instance_admin import (
+ CreateAppProfileRequest,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_instance_admin import (
+ CreateClusterMetadata,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_instance_admin import (
+ CreateClusterRequest,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_instance_admin import (
+ CreateInstanceMetadata,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_instance_admin import (
+ CreateInstanceRequest,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_instance_admin import (
+ CreateLogicalViewMetadata,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_instance_admin import (
+ CreateLogicalViewRequest,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_instance_admin import (
+ CreateMaterializedViewMetadata,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_instance_admin import (
+ CreateMaterializedViewRequest,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_instance_admin import (
+ DeleteAppProfileRequest,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_instance_admin import (
+ DeleteClusterRequest,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_instance_admin import (
+ DeleteInstanceRequest,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_instance_admin import (
+ DeleteLogicalViewRequest,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_instance_admin import (
+ DeleteMaterializedViewRequest,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_instance_admin import (
+ GetAppProfileRequest,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_instance_admin import (
+ GetClusterRequest,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_instance_admin import (
+ GetInstanceRequest,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_instance_admin import (
+ GetLogicalViewRequest,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_instance_admin import (
+ GetMaterializedViewRequest,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_instance_admin import (
+ ListAppProfilesRequest,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_instance_admin import (
+ ListAppProfilesResponse,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_instance_admin import (
+ ListClustersRequest,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_instance_admin import (
+ ListClustersResponse,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_instance_admin import (
+ ListHotTabletsRequest,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_instance_admin import (
+ ListHotTabletsResponse,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_instance_admin import (
+ ListInstancesRequest,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_instance_admin import (
+ ListInstancesResponse,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_instance_admin import (
+ ListLogicalViewsRequest,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_instance_admin import (
+ ListLogicalViewsResponse,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_instance_admin import (
+ ListMaterializedViewsRequest,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_instance_admin import (
+ ListMaterializedViewsResponse,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_instance_admin import (
+ PartialUpdateClusterMetadata,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_instance_admin import (
+ PartialUpdateClusterRequest,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_instance_admin import (
+ PartialUpdateInstanceRequest,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_instance_admin import (
+ UpdateAppProfileMetadata,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_instance_admin import (
+ UpdateAppProfileRequest,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_instance_admin import (
+ UpdateClusterMetadata,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_instance_admin import (
+ UpdateInstanceMetadata,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_instance_admin import (
+ UpdateLogicalViewMetadata,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_instance_admin import (
+ UpdateLogicalViewRequest,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_instance_admin import (
+ UpdateMaterializedViewMetadata,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_instance_admin import (
+ UpdateMaterializedViewRequest,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import (
+ CheckConsistencyRequest,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import (
+ CheckConsistencyResponse,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import CopyBackupMetadata
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import CopyBackupRequest
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import (
+ CreateAuthorizedViewMetadata,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import (
+ CreateAuthorizedViewRequest,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import (
+ CreateBackupMetadata,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import (
+ CreateBackupRequest,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import (
+ CreateSchemaBundleMetadata,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import (
+ CreateSchemaBundleRequest,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import (
+ CreateTableFromSnapshotMetadata,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import (
+ CreateTableFromSnapshotRequest,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import CreateTableRequest
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import (
+ DataBoostReadLocalWrites,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import (
+ DeleteAuthorizedViewRequest,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import (
+ DeleteBackupRequest,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import (
+ DeleteSchemaBundleRequest,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import (
+ DeleteSnapshotRequest,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import DeleteTableRequest
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import (
+ DropRowRangeRequest,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import (
+ GenerateConsistencyTokenRequest,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import (
+ GenerateConsistencyTokenResponse,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import (
+ GetAuthorizedViewRequest,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import GetBackupRequest
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import (
+ GetSchemaBundleRequest,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import GetSnapshotRequest
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import GetTableRequest
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import (
+ ListAuthorizedViewsRequest,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import (
+ ListAuthorizedViewsResponse,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import ListBackupsRequest
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import (
+ ListBackupsResponse,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import (
+ ListSchemaBundlesRequest,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import (
+ ListSchemaBundlesResponse,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import (
+ ListSnapshotsRequest,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import (
+ ListSnapshotsResponse,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import ListTablesRequest
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import ListTablesResponse
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import (
+ ModifyColumnFamiliesRequest,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import (
+ OptimizeRestoredTableMetadata,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import (
+ RestoreTableMetadata,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import (
+ RestoreTableRequest,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import (
+ SnapshotTableMetadata,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import (
+ SnapshotTableRequest,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import (
+ StandardReadRemoteWrites,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import (
+ UndeleteTableMetadata,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import (
+ UndeleteTableRequest,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import (
+ UpdateAuthorizedViewMetadata,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import (
+ UpdateAuthorizedViewRequest,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import (
+ UpdateBackupRequest,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import (
+ UpdateSchemaBundleMetadata,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import (
+ UpdateSchemaBundleRequest,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import (
+ UpdateTableMetadata,
+)
+from google.cloud.bigtable_admin_v2.types.bigtable_table_admin import UpdateTableRequest
+from google.cloud.bigtable_admin_v2.types.common import OperationProgress
+from google.cloud.bigtable_admin_v2.types.common import StorageType
+from google.cloud.bigtable_admin_v2.types.instance import AppProfile
+from google.cloud.bigtable_admin_v2.types.instance import AutoscalingLimits
+from google.cloud.bigtable_admin_v2.types.instance import AutoscalingTargets
+from google.cloud.bigtable_admin_v2.types.instance import Cluster
+from google.cloud.bigtable_admin_v2.types.instance import HotTablet
+from google.cloud.bigtable_admin_v2.types.instance import Instance
+from google.cloud.bigtable_admin_v2.types.instance import LogicalView
+from google.cloud.bigtable_admin_v2.types.instance import MaterializedView
+from google.cloud.bigtable_admin_v2.types.table import AuthorizedView
+from google.cloud.bigtable_admin_v2.types.table import Backup
+from google.cloud.bigtable_admin_v2.types.table import BackupInfo
+from google.cloud.bigtable_admin_v2.types.table import ChangeStreamConfig
+from google.cloud.bigtable_admin_v2.types.table import ColumnFamily
+from google.cloud.bigtable_admin_v2.types.table import EncryptionInfo
+from google.cloud.bigtable_admin_v2.types.table import GcRule
+from google.cloud.bigtable_admin_v2.types.table import ProtoSchema
+from google.cloud.bigtable_admin_v2.types.table import RestoreInfo
+from google.cloud.bigtable_admin_v2.types.table import SchemaBundle
+from google.cloud.bigtable_admin_v2.types.table import Snapshot
+from google.cloud.bigtable_admin_v2.types.table import Table
+from google.cloud.bigtable_admin_v2.types.table import TieredStorageConfig
+from google.cloud.bigtable_admin_v2.types.table import TieredStorageRule
+from google.cloud.bigtable_admin_v2.types.table import RestoreSourceType
+from google.cloud.bigtable_admin_v2.types.types import Type
+
+__all__ = (
+ "BigtableInstanceAdminClient",
+ "BigtableInstanceAdminAsyncClient",
+ "BaseBigtableTableAdminClient",
+ "BaseBigtableTableAdminAsyncClient",
+ "CreateAppProfileRequest",
+ "CreateClusterMetadata",
+ "CreateClusterRequest",
+ "CreateInstanceMetadata",
+ "CreateInstanceRequest",
+ "CreateLogicalViewMetadata",
+ "CreateLogicalViewRequest",
+ "CreateMaterializedViewMetadata",
+ "CreateMaterializedViewRequest",
+ "DeleteAppProfileRequest",
+ "DeleteClusterRequest",
+ "DeleteInstanceRequest",
+ "DeleteLogicalViewRequest",
+ "DeleteMaterializedViewRequest",
+ "GetAppProfileRequest",
+ "GetClusterRequest",
+ "GetInstanceRequest",
+ "GetLogicalViewRequest",
+ "GetMaterializedViewRequest",
+ "ListAppProfilesRequest",
+ "ListAppProfilesResponse",
+ "ListClustersRequest",
+ "ListClustersResponse",
+ "ListHotTabletsRequest",
+ "ListHotTabletsResponse",
+ "ListInstancesRequest",
+ "ListInstancesResponse",
+ "ListLogicalViewsRequest",
+ "ListLogicalViewsResponse",
+ "ListMaterializedViewsRequest",
+ "ListMaterializedViewsResponse",
+ "PartialUpdateClusterMetadata",
+ "PartialUpdateClusterRequest",
+ "PartialUpdateInstanceRequest",
+ "UpdateAppProfileMetadata",
+ "UpdateAppProfileRequest",
+ "UpdateClusterMetadata",
+ "UpdateInstanceMetadata",
+ "UpdateLogicalViewMetadata",
+ "UpdateLogicalViewRequest",
+ "UpdateMaterializedViewMetadata",
+ "UpdateMaterializedViewRequest",
+ "CheckConsistencyRequest",
+ "CheckConsistencyResponse",
+ "CopyBackupMetadata",
+ "CopyBackupRequest",
+ "CreateAuthorizedViewMetadata",
+ "CreateAuthorizedViewRequest",
+ "CreateBackupMetadata",
+ "CreateBackupRequest",
+ "CreateSchemaBundleMetadata",
+ "CreateSchemaBundleRequest",
+ "CreateTableFromSnapshotMetadata",
+ "CreateTableFromSnapshotRequest",
+ "CreateTableRequest",
+ "DataBoostReadLocalWrites",
+ "DeleteAuthorizedViewRequest",
+ "DeleteBackupRequest",
+ "DeleteSchemaBundleRequest",
+ "DeleteSnapshotRequest",
+ "DeleteTableRequest",
+ "DropRowRangeRequest",
+ "GenerateConsistencyTokenRequest",
+ "GenerateConsistencyTokenResponse",
+ "GetAuthorizedViewRequest",
+ "GetBackupRequest",
+ "GetSchemaBundleRequest",
+ "GetSnapshotRequest",
+ "GetTableRequest",
+ "ListAuthorizedViewsRequest",
+ "ListAuthorizedViewsResponse",
+ "ListBackupsRequest",
+ "ListBackupsResponse",
+ "ListSchemaBundlesRequest",
+ "ListSchemaBundlesResponse",
+ "ListSnapshotsRequest",
+ "ListSnapshotsResponse",
+ "ListTablesRequest",
+ "ListTablesResponse",
+ "ModifyColumnFamiliesRequest",
+ "OptimizeRestoredTableMetadata",
+ "RestoreTableMetadata",
+ "RestoreTableRequest",
+ "SnapshotTableMetadata",
+ "SnapshotTableRequest",
+ "StandardReadRemoteWrites",
+ "UndeleteTableMetadata",
+ "UndeleteTableRequest",
+ "UpdateAuthorizedViewMetadata",
+ "UpdateAuthorizedViewRequest",
+ "UpdateBackupRequest",
+ "UpdateSchemaBundleMetadata",
+ "UpdateSchemaBundleRequest",
+ "UpdateTableMetadata",
+ "UpdateTableRequest",
+ "OperationProgress",
+ "StorageType",
+ "AppProfile",
+ "AutoscalingLimits",
+ "AutoscalingTargets",
+ "Cluster",
+ "HotTablet",
+ "Instance",
+ "LogicalView",
+ "MaterializedView",
+ "AuthorizedView",
+ "Backup",
+ "BackupInfo",
+ "ChangeStreamConfig",
+ "ColumnFamily",
+ "EncryptionInfo",
+ "GcRule",
+ "ProtoSchema",
+ "RestoreInfo",
+ "SchemaBundle",
+ "Snapshot",
+ "Table",
+ "TieredStorageConfig",
+ "TieredStorageRule",
+ "RestoreSourceType",
+ "Type",
+)
+
+import google.cloud.bigtable_admin_v2.overlay # noqa: F401
+from google.cloud.bigtable_admin_v2.overlay import * # noqa: F401, F403
+
+__all__ += google.cloud.bigtable_admin_v2.overlay.__all__
diff --git a/google/cloud/bigtable_admin/gapic_version.py b/google/cloud/bigtable_admin/gapic_version.py
new file mode 100644
index 000000000..6d72a226d
--- /dev/null
+++ b/google/cloud/bigtable_admin/gapic_version.py
@@ -0,0 +1,16 @@
+# -*- coding: utf-8 -*-
+# Copyright 2025 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.
+#
+__version__ = "2.35.0" # {x-release-please-version}
diff --git a/google/cloud/bigtable_admin/py.typed b/google/cloud/bigtable_admin/py.typed
new file mode 100644
index 000000000..bc26f2069
--- /dev/null
+++ b/google/cloud/bigtable_admin/py.typed
@@ -0,0 +1,2 @@
+# Marker file for PEP 561.
+# The google-cloud-bigtable-admin package uses inline types.
diff --git a/google/cloud/bigtable_admin_v2/__init__.py b/google/cloud/bigtable_admin_v2/__init__.py
index 9f72d4f53..6a47979fd 100644
--- a/google/cloud/bigtable_admin_v2/__init__.py
+++ b/google/cloud/bigtable_admin_v2/__init__.py
@@ -1,54 +1,382 @@
# -*- coding: utf-8 -*-
-#
-# Copyright 2020 Google LLC
+# Copyright 2025 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
#
-# https://www.apache.org/licenses/LICENSE-2.0
+# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT 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 google.cloud.bigtable_admin_v2 import gapic_version as package_version
-
-from __future__ import absolute_import
+import google.api_core as api_core
import sys
-import warnings
-from google.cloud.bigtable_admin_v2 import types
-from google.cloud.bigtable_admin_v2.gapic import bigtable_instance_admin_client
-from google.cloud.bigtable_admin_v2.gapic import bigtable_table_admin_client
-from google.cloud.bigtable_admin_v2.gapic import enums
+__version__ = package_version.__version__
+
+if sys.version_info >= (3, 8): # pragma: NO COVER
+ from importlib import metadata
+else: # pragma: NO COVER
+ # TODO(https://github.com/googleapis/python-api-core/issues/835): Remove
+ # this code path once we drop support for Python 3.7
+ import importlib_metadata as metadata
-if sys.version_info[:2] == (2, 7):
- message = (
- "A future version of this library will drop support for Python 2.7. "
- "More details about Python 2 support for Google Cloud Client Libraries "
- "can be found at https://cloud.google.com/python/docs/python2-sunset/"
- )
- warnings.warn(message, DeprecationWarning)
+from .services.bigtable_instance_admin import BigtableInstanceAdminClient
+from .services.bigtable_instance_admin import BigtableInstanceAdminAsyncClient
+from .services.bigtable_table_admin import BaseBigtableTableAdminClient
+from .services.bigtable_table_admin import BaseBigtableTableAdminAsyncClient
+from .types.bigtable_instance_admin import CreateAppProfileRequest
+from .types.bigtable_instance_admin import CreateClusterMetadata
+from .types.bigtable_instance_admin import CreateClusterRequest
+from .types.bigtable_instance_admin import CreateInstanceMetadata
+from .types.bigtable_instance_admin import CreateInstanceRequest
+from .types.bigtable_instance_admin import CreateLogicalViewMetadata
+from .types.bigtable_instance_admin import CreateLogicalViewRequest
+from .types.bigtable_instance_admin import CreateMaterializedViewMetadata
+from .types.bigtable_instance_admin import CreateMaterializedViewRequest
+from .types.bigtable_instance_admin import DeleteAppProfileRequest
+from .types.bigtable_instance_admin import DeleteClusterRequest
+from .types.bigtable_instance_admin import DeleteInstanceRequest
+from .types.bigtable_instance_admin import DeleteLogicalViewRequest
+from .types.bigtable_instance_admin import DeleteMaterializedViewRequest
+from .types.bigtable_instance_admin import GetAppProfileRequest
+from .types.bigtable_instance_admin import GetClusterRequest
+from .types.bigtable_instance_admin import GetInstanceRequest
+from .types.bigtable_instance_admin import GetLogicalViewRequest
+from .types.bigtable_instance_admin import GetMaterializedViewRequest
+from .types.bigtable_instance_admin import ListAppProfilesRequest
+from .types.bigtable_instance_admin import ListAppProfilesResponse
+from .types.bigtable_instance_admin import ListClustersRequest
+from .types.bigtable_instance_admin import ListClustersResponse
+from .types.bigtable_instance_admin import ListHotTabletsRequest
+from .types.bigtable_instance_admin import ListHotTabletsResponse
+from .types.bigtable_instance_admin import ListInstancesRequest
+from .types.bigtable_instance_admin import ListInstancesResponse
+from .types.bigtable_instance_admin import ListLogicalViewsRequest
+from .types.bigtable_instance_admin import ListLogicalViewsResponse
+from .types.bigtable_instance_admin import ListMaterializedViewsRequest
+from .types.bigtable_instance_admin import ListMaterializedViewsResponse
+from .types.bigtable_instance_admin import PartialUpdateClusterMetadata
+from .types.bigtable_instance_admin import PartialUpdateClusterRequest
+from .types.bigtable_instance_admin import PartialUpdateInstanceRequest
+from .types.bigtable_instance_admin import UpdateAppProfileMetadata
+from .types.bigtable_instance_admin import UpdateAppProfileRequest
+from .types.bigtable_instance_admin import UpdateClusterMetadata
+from .types.bigtable_instance_admin import UpdateInstanceMetadata
+from .types.bigtable_instance_admin import UpdateLogicalViewMetadata
+from .types.bigtable_instance_admin import UpdateLogicalViewRequest
+from .types.bigtable_instance_admin import UpdateMaterializedViewMetadata
+from .types.bigtable_instance_admin import UpdateMaterializedViewRequest
+from .types.bigtable_table_admin import CheckConsistencyRequest
+from .types.bigtable_table_admin import CheckConsistencyResponse
+from .types.bigtable_table_admin import CopyBackupMetadata
+from .types.bigtable_table_admin import CopyBackupRequest
+from .types.bigtable_table_admin import CreateAuthorizedViewMetadata
+from .types.bigtable_table_admin import CreateAuthorizedViewRequest
+from .types.bigtable_table_admin import CreateBackupMetadata
+from .types.bigtable_table_admin import CreateBackupRequest
+from .types.bigtable_table_admin import CreateSchemaBundleMetadata
+from .types.bigtable_table_admin import CreateSchemaBundleRequest
+from .types.bigtable_table_admin import CreateTableFromSnapshotMetadata
+from .types.bigtable_table_admin import CreateTableFromSnapshotRequest
+from .types.bigtable_table_admin import CreateTableRequest
+from .types.bigtable_table_admin import DataBoostReadLocalWrites
+from .types.bigtable_table_admin import DeleteAuthorizedViewRequest
+from .types.bigtable_table_admin import DeleteBackupRequest
+from .types.bigtable_table_admin import DeleteSchemaBundleRequest
+from .types.bigtable_table_admin import DeleteSnapshotRequest
+from .types.bigtable_table_admin import DeleteTableRequest
+from .types.bigtable_table_admin import DropRowRangeRequest
+from .types.bigtable_table_admin import GenerateConsistencyTokenRequest
+from .types.bigtable_table_admin import GenerateConsistencyTokenResponse
+from .types.bigtable_table_admin import GetAuthorizedViewRequest
+from .types.bigtable_table_admin import GetBackupRequest
+from .types.bigtable_table_admin import GetSchemaBundleRequest
+from .types.bigtable_table_admin import GetSnapshotRequest
+from .types.bigtable_table_admin import GetTableRequest
+from .types.bigtable_table_admin import ListAuthorizedViewsRequest
+from .types.bigtable_table_admin import ListAuthorizedViewsResponse
+from .types.bigtable_table_admin import ListBackupsRequest
+from .types.bigtable_table_admin import ListBackupsResponse
+from .types.bigtable_table_admin import ListSchemaBundlesRequest
+from .types.bigtable_table_admin import ListSchemaBundlesResponse
+from .types.bigtable_table_admin import ListSnapshotsRequest
+from .types.bigtable_table_admin import ListSnapshotsResponse
+from .types.bigtable_table_admin import ListTablesRequest
+from .types.bigtable_table_admin import ListTablesResponse
+from .types.bigtable_table_admin import ModifyColumnFamiliesRequest
+from .types.bigtable_table_admin import OptimizeRestoredTableMetadata
+from .types.bigtable_table_admin import RestoreTableMetadata
+from .types.bigtable_table_admin import RestoreTableRequest
+from .types.bigtable_table_admin import SnapshotTableMetadata
+from .types.bigtable_table_admin import SnapshotTableRequest
+from .types.bigtable_table_admin import StandardReadRemoteWrites
+from .types.bigtable_table_admin import UndeleteTableMetadata
+from .types.bigtable_table_admin import UndeleteTableRequest
+from .types.bigtable_table_admin import UpdateAuthorizedViewMetadata
+from .types.bigtable_table_admin import UpdateAuthorizedViewRequest
+from .types.bigtable_table_admin import UpdateBackupRequest
+from .types.bigtable_table_admin import UpdateSchemaBundleMetadata
+from .types.bigtable_table_admin import UpdateSchemaBundleRequest
+from .types.bigtable_table_admin import UpdateTableMetadata
+from .types.bigtable_table_admin import UpdateTableRequest
+from .types.common import OperationProgress
+from .types.common import StorageType
+from .types.instance import AppProfile
+from .types.instance import AutoscalingLimits
+from .types.instance import AutoscalingTargets
+from .types.instance import Cluster
+from .types.instance import HotTablet
+from .types.instance import Instance
+from .types.instance import LogicalView
+from .types.instance import MaterializedView
+from .types.table import AuthorizedView
+from .types.table import Backup
+from .types.table import BackupInfo
+from .types.table import ChangeStreamConfig
+from .types.table import ColumnFamily
+from .types.table import EncryptionInfo
+from .types.table import GcRule
+from .types.table import ProtoSchema
+from .types.table import RestoreInfo
+from .types.table import SchemaBundle
+from .types.table import Snapshot
+from .types.table import Table
+from .types.table import TieredStorageConfig
+from .types.table import TieredStorageRule
+from .types.table import RestoreSourceType
+from .types.types import Type
-class BigtableInstanceAdminClient(
- bigtable_instance_admin_client.BigtableInstanceAdminClient
-):
- __doc__ = bigtable_instance_admin_client.BigtableInstanceAdminClient.__doc__
- enums = enums
+if hasattr(api_core, "check_python_version") and hasattr(
+ api_core, "check_dependency_versions"
+): # pragma: NO COVER
+ api_core.check_python_version("google.cloud.bigtable_admin_v2") # type: ignore
+ api_core.check_dependency_versions("google.cloud.bigtable_admin_v2") # type: ignore
+else: # pragma: NO COVER
+ # An older version of api_core is installed which does not define the
+ # functions above. We do equivalent checks manually.
+ try:
+ import warnings
+ import sys
+ _py_version_str = sys.version.split()[0]
+ _package_label = "google.cloud.bigtable_admin_v2"
+ if sys.version_info < (3, 9):
+ warnings.warn(
+ "You are using a non-supported Python version "
+ + f"({_py_version_str}). Google will not post any further "
+ + f"updates to {_package_label} supporting this Python version. "
+ + "Please upgrade to the latest Python version, or at "
+ + f"least to Python 3.9, and then update {_package_label}.",
+ FutureWarning,
+ )
+ if sys.version_info[:2] == (3, 9):
+ warnings.warn(
+ f"You are using a Python version ({_py_version_str}) "
+ + f"which Google will stop supporting in {_package_label} in "
+ + "January 2026. Please "
+ + "upgrade to the latest Python version, or at "
+ + "least to Python 3.10, before then, and "
+ + f"then update {_package_label}.",
+ FutureWarning,
+ )
-class BigtableTableAdminClient(bigtable_table_admin_client.BigtableTableAdminClient):
- __doc__ = bigtable_table_admin_client.BigtableTableAdminClient.__doc__
- enums = enums
+ def parse_version_to_tuple(version_string: str):
+ """Safely converts a semantic version string to a comparable tuple of integers.
+ Example: "4.25.8" -> (4, 25, 8)
+ Ignores non-numeric parts and handles common version formats.
+ Args:
+ version_string: Version string in the format "x.y.z" or "x.y.z"
+ Returns:
+ Tuple of integers for the parsed version string.
+ """
+ parts = []
+ for part in version_string.split("."):
+ try:
+ parts.append(int(part))
+ except ValueError:
+ # If it's a non-numeric part (e.g., '1.0.0b1' -> 'b1'), stop here.
+ # This is a simplification compared to 'packaging.parse_version', but sufficient
+ # for comparing strictly numeric semantic versions.
+ break
+ return tuple(parts)
+ def _get_version(dependency_name):
+ try:
+ version_string: str = metadata.version(dependency_name)
+ parsed_version = parse_version_to_tuple(version_string)
+ return (parsed_version, version_string)
+ except Exception:
+ # Catch exceptions from metadata.version() (e.g., PackageNotFoundError)
+ # or errors during parse_version_to_tuple
+ return (None, "--")
+
+ _dependency_package = "google.protobuf"
+ _next_supported_version = "4.25.8"
+ _next_supported_version_tuple = (4, 25, 8)
+ _recommendation = " (we recommend 6.x)"
+ (_version_used, _version_used_string) = _get_version(_dependency_package)
+ if _version_used and _version_used < _next_supported_version_tuple:
+ warnings.warn(
+ f"Package {_package_label} depends on "
+ + f"{_dependency_package}, currently installed at version "
+ + f"{_version_used_string}. Future updates to "
+ + f"{_package_label} will require {_dependency_package} at "
+ + f"version {_next_supported_version} or higher{_recommendation}."
+ + " Please ensure "
+ + "that either (a) your Python environment doesn't pin the "
+ + f"version of {_dependency_package}, so that updates to "
+ + f"{_package_label} can require the higher version, or "
+ + "(b) you manually update your Python environment to use at "
+ + f"least version {_next_supported_version} of "
+ + f"{_dependency_package}.",
+ FutureWarning,
+ )
+ except Exception:
+ warnings.warn(
+ "Could not determine the version of Python "
+ + "currently being used. To continue receiving "
+ + "updates for {_package_label}, ensure you are "
+ + "using a supported version of Python; see "
+ + "https://devguide.python.org/versions/"
+ )
__all__ = (
- "enums",
- "types",
+ "BaseBigtableTableAdminAsyncClient",
+ "BigtableInstanceAdminAsyncClient",
+ "AppProfile",
+ "AuthorizedView",
+ "AutoscalingLimits",
+ "AutoscalingTargets",
+ "Backup",
+ "BackupInfo",
+ "BaseBigtableTableAdminClient",
"BigtableInstanceAdminClient",
- "BigtableTableAdminClient",
+ "ChangeStreamConfig",
+ "CheckConsistencyRequest",
+ "CheckConsistencyResponse",
+ "Cluster",
+ "ColumnFamily",
+ "CopyBackupMetadata",
+ "CopyBackupRequest",
+ "CreateAppProfileRequest",
+ "CreateAuthorizedViewMetadata",
+ "CreateAuthorizedViewRequest",
+ "CreateBackupMetadata",
+ "CreateBackupRequest",
+ "CreateClusterMetadata",
+ "CreateClusterRequest",
+ "CreateInstanceMetadata",
+ "CreateInstanceRequest",
+ "CreateLogicalViewMetadata",
+ "CreateLogicalViewRequest",
+ "CreateMaterializedViewMetadata",
+ "CreateMaterializedViewRequest",
+ "CreateSchemaBundleMetadata",
+ "CreateSchemaBundleRequest",
+ "CreateTableFromSnapshotMetadata",
+ "CreateTableFromSnapshotRequest",
+ "CreateTableRequest",
+ "DataBoostReadLocalWrites",
+ "DeleteAppProfileRequest",
+ "DeleteAuthorizedViewRequest",
+ "DeleteBackupRequest",
+ "DeleteClusterRequest",
+ "DeleteInstanceRequest",
+ "DeleteLogicalViewRequest",
+ "DeleteMaterializedViewRequest",
+ "DeleteSchemaBundleRequest",
+ "DeleteSnapshotRequest",
+ "DeleteTableRequest",
+ "DropRowRangeRequest",
+ "EncryptionInfo",
+ "GcRule",
+ "GenerateConsistencyTokenRequest",
+ "GenerateConsistencyTokenResponse",
+ "GetAppProfileRequest",
+ "GetAuthorizedViewRequest",
+ "GetBackupRequest",
+ "GetClusterRequest",
+ "GetInstanceRequest",
+ "GetLogicalViewRequest",
+ "GetMaterializedViewRequest",
+ "GetSchemaBundleRequest",
+ "GetSnapshotRequest",
+ "GetTableRequest",
+ "HotTablet",
+ "Instance",
+ "ListAppProfilesRequest",
+ "ListAppProfilesResponse",
+ "ListAuthorizedViewsRequest",
+ "ListAuthorizedViewsResponse",
+ "ListBackupsRequest",
+ "ListBackupsResponse",
+ "ListClustersRequest",
+ "ListClustersResponse",
+ "ListHotTabletsRequest",
+ "ListHotTabletsResponse",
+ "ListInstancesRequest",
+ "ListInstancesResponse",
+ "ListLogicalViewsRequest",
+ "ListLogicalViewsResponse",
+ "ListMaterializedViewsRequest",
+ "ListMaterializedViewsResponse",
+ "ListSchemaBundlesRequest",
+ "ListSchemaBundlesResponse",
+ "ListSnapshotsRequest",
+ "ListSnapshotsResponse",
+ "ListTablesRequest",
+ "ListTablesResponse",
+ "LogicalView",
+ "MaterializedView",
+ "ModifyColumnFamiliesRequest",
+ "OperationProgress",
+ "OptimizeRestoredTableMetadata",
+ "PartialUpdateClusterMetadata",
+ "PartialUpdateClusterRequest",
+ "PartialUpdateInstanceRequest",
+ "ProtoSchema",
+ "RestoreInfo",
+ "RestoreSourceType",
+ "RestoreTableMetadata",
+ "RestoreTableRequest",
+ "SchemaBundle",
+ "Snapshot",
+ "SnapshotTableMetadata",
+ "SnapshotTableRequest",
+ "StandardReadRemoteWrites",
+ "StorageType",
+ "Table",
+ "TieredStorageConfig",
+ "TieredStorageRule",
+ "Type",
+ "UndeleteTableMetadata",
+ "UndeleteTableRequest",
+ "UpdateAppProfileMetadata",
+ "UpdateAppProfileRequest",
+ "UpdateAuthorizedViewMetadata",
+ "UpdateAuthorizedViewRequest",
+ "UpdateBackupRequest",
+ "UpdateClusterMetadata",
+ "UpdateInstanceMetadata",
+ "UpdateLogicalViewMetadata",
+ "UpdateLogicalViewRequest",
+ "UpdateMaterializedViewMetadata",
+ "UpdateMaterializedViewRequest",
+ "UpdateSchemaBundleMetadata",
+ "UpdateSchemaBundleRequest",
+ "UpdateTableMetadata",
+ "UpdateTableRequest",
)
+
+from .overlay import * # noqa: F403
+
+__all__ += overlay.__all__ # noqa: F405
diff --git a/google/cloud/bigtable_admin_v2/gapic/bigtable_instance_admin_client.py b/google/cloud/bigtable_admin_v2/gapic/bigtable_instance_admin_client.py
deleted file mode 100644
index 8edb3c168..000000000
--- a/google/cloud/bigtable_admin_v2/gapic/bigtable_instance_admin_client.py
+++ /dev/null
@@ -1,1891 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# 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
-#
-# https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""Accesses the google.bigtable.admin.v2 BigtableInstanceAdmin API."""
-
-import functools
-import pkg_resources
-import warnings
-
-from google.oauth2 import service_account
-import google.api_core.client_options
-import google.api_core.gapic_v1.client_info
-import google.api_core.gapic_v1.config
-import google.api_core.gapic_v1.method
-import google.api_core.gapic_v1.routing_header
-import google.api_core.grpc_helpers
-import google.api_core.operation
-import google.api_core.operations_v1
-import google.api_core.page_iterator
-import google.api_core.path_template
-import grpc
-
-from google.cloud.bigtable_admin_v2.gapic import bigtable_instance_admin_client_config
-from google.cloud.bigtable_admin_v2.gapic import enums
-from google.cloud.bigtable_admin_v2.gapic.transports import (
- bigtable_instance_admin_grpc_transport,
-)
-from google.cloud.bigtable_admin_v2.proto import bigtable_instance_admin_pb2
-from google.cloud.bigtable_admin_v2.proto import bigtable_instance_admin_pb2_grpc
-from google.cloud.bigtable_admin_v2.proto import instance_pb2
-from google.iam.v1 import iam_policy_pb2
-from google.iam.v1 import options_pb2
-from google.iam.v1 import policy_pb2
-from google.longrunning import operations_pb2
-from google.protobuf import empty_pb2
-from google.protobuf import field_mask_pb2
-
-
-_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution(
- "google-cloud-bigtable",
-).version
-
-
-class BigtableInstanceAdminClient(object):
- """
- Service for creating, configuring, and deleting Cloud Bigtable Instances and
- Clusters. Provides access to the Instance and Cluster schemas only, not the
- tables' metadata or data stored in those tables.
- """
-
- SERVICE_ADDRESS = "bigtableadmin.googleapis.com:443"
- """The default address of the service."""
-
- # The name of the interface for this client. This is the key used to
- # find the method configuration in the client_config dictionary.
- _INTERFACE_NAME = "google.bigtable.admin.v2.BigtableInstanceAdmin"
-
- @classmethod
- def from_service_account_file(cls, filename, *args, **kwargs):
- """Creates an instance of this client using the provided credentials
- file.
-
- Args:
- filename (str): The path to the service account private key json
- file.
- args: Additional arguments to pass to the constructor.
- kwargs: Additional arguments to pass to the constructor.
-
- Returns:
- BigtableInstanceAdminClient: The constructed client.
- """
- credentials = service_account.Credentials.from_service_account_file(filename)
- kwargs["credentials"] = credentials
- return cls(*args, **kwargs)
-
- from_service_account_json = from_service_account_file
-
- @classmethod
- def app_profile_path(cls, project, instance, app_profile):
- """Return a fully-qualified app_profile string."""
- return google.api_core.path_template.expand(
- "projects/{project}/instances/{instance}/appProfiles/{app_profile}",
- project=project,
- instance=instance,
- app_profile=app_profile,
- )
-
- @classmethod
- def cluster_path(cls, project, instance, cluster):
- """Return a fully-qualified cluster string."""
- return google.api_core.path_template.expand(
- "projects/{project}/instances/{instance}/clusters/{cluster}",
- project=project,
- instance=instance,
- cluster=cluster,
- )
-
- @classmethod
- def instance_path(cls, project, instance):
- """Return a fully-qualified instance string."""
- return google.api_core.path_template.expand(
- "projects/{project}/instances/{instance}",
- project=project,
- instance=instance,
- )
-
- @classmethod
- def location_path(cls, project, location):
- """Return a fully-qualified location string."""
- return google.api_core.path_template.expand(
- "projects/{project}/locations/{location}",
- project=project,
- location=location,
- )
-
- @classmethod
- def project_path(cls, project):
- """Return a fully-qualified project string."""
- return google.api_core.path_template.expand(
- "projects/{project}", project=project,
- )
-
- def __init__(
- self,
- transport=None,
- channel=None,
- credentials=None,
- client_config=None,
- client_info=None,
- client_options=None,
- ):
- """Constructor.
-
- Args:
- transport (Union[~.BigtableInstanceAdminGrpcTransport,
- Callable[[~.Credentials, type], ~.BigtableInstanceAdminGrpcTransport]): A transport
- instance, responsible for actually making the API calls.
- The default transport uses the gRPC protocol.
- This argument may also be a callable which returns a
- transport instance. Callables will be sent the credentials
- as the first argument and the default transport class as
- the second argument.
- channel (grpc.Channel): DEPRECATED. A ``Channel`` instance
- through which to make calls. This argument is mutually exclusive
- with ``credentials``; providing both will raise an exception.
- credentials (google.auth.credentials.Credentials): The
- authorization credentials to attach to requests. These
- credentials identify this application to the service. If none
- are specified, the client will attempt to ascertain the
- credentials from the environment.
- This argument is mutually exclusive with providing a
- transport instance to ``transport``; doing so will raise
- an exception.
- client_config (dict): DEPRECATED. A dictionary of call options for
- each method. If not specified, the default configuration is used.
- client_info (google.api_core.gapic_v1.client_info.ClientInfo):
- The client info used to send a user-agent string along with
- API requests. If ``None``, then default info will be used.
- Generally, you only need to set this if you're developing
- your own client library.
- client_options (Union[dict, google.api_core.client_options.ClientOptions]):
- Client options used to set user options on the client. API Endpoint
- should be set through client_options.
- """
- # Raise deprecation warnings for things we want to go away.
- if client_config is not None:
- warnings.warn(
- "The `client_config` argument is deprecated.",
- PendingDeprecationWarning,
- stacklevel=2,
- )
- else:
- client_config = bigtable_instance_admin_client_config.config
-
- if channel:
- warnings.warn(
- "The `channel` argument is deprecated; use " "`transport` instead.",
- PendingDeprecationWarning,
- stacklevel=2,
- )
-
- api_endpoint = self.SERVICE_ADDRESS
- if client_options:
- if type(client_options) == dict:
- client_options = google.api_core.client_options.from_dict(
- client_options
- )
- if client_options.api_endpoint:
- api_endpoint = client_options.api_endpoint
-
- # Instantiate the transport.
- # The transport is responsible for handling serialization and
- # deserialization and actually sending data to the service.
- if transport:
- if callable(transport):
- self.transport = transport(
- credentials=credentials,
- default_class=bigtable_instance_admin_grpc_transport.BigtableInstanceAdminGrpcTransport,
- address=api_endpoint,
- )
- else:
- if credentials:
- raise ValueError(
- "Received both a transport instance and "
- "credentials; these are mutually exclusive."
- )
- self.transport = transport
- else:
- self.transport = bigtable_instance_admin_grpc_transport.BigtableInstanceAdminGrpcTransport(
- address=api_endpoint, channel=channel, credentials=credentials,
- )
-
- if client_info is None:
- client_info = google.api_core.gapic_v1.client_info.ClientInfo(
- gapic_version=_GAPIC_LIBRARY_VERSION,
- )
- else:
- client_info.gapic_version = _GAPIC_LIBRARY_VERSION
- self._client_info = client_info
-
- # Parse out the default settings for retry and timeout for each RPC
- # from the client configuration.
- # (Ordinarily, these are the defaults specified in the `*_config.py`
- # file next to this one.)
- self._method_configs = google.api_core.gapic_v1.config.parse_method_configs(
- client_config["interfaces"][self._INTERFACE_NAME],
- )
-
- # Save a dictionary of cached API call functions.
- # These are the actual callables which invoke the proper
- # transport methods, wrapped with `wrap_method` to add retry,
- # timeout, and the like.
- self._inner_api_calls = {}
-
- # Service calls
- def create_instance(
- self,
- parent,
- instance_id,
- instance,
- clusters,
- retry=google.api_core.gapic_v1.method.DEFAULT,
- timeout=google.api_core.gapic_v1.method.DEFAULT,
- metadata=None,
- ):
- """
- Create an instance within a project.
-
- Example:
- >>> from google.cloud import bigtable_admin_v2
- >>>
- >>> client = bigtable_admin_v2.BigtableInstanceAdminClient()
- >>>
- >>> parent = client.project_path('[PROJECT]')
- >>>
- >>> # TODO: Initialize `instance_id`:
- >>> instance_id = ''
- >>>
- >>> # TODO: Initialize `instance`:
- >>> instance = {}
- >>>
- >>> # TODO: Initialize `clusters`:
- >>> clusters = {}
- >>>
- >>> response = client.create_instance(parent, instance_id, instance, clusters)
- >>>
- >>> def callback(operation_future):
- ... # Handle result.
- ... result = operation_future.result()
- >>>
- >>> response.add_done_callback(callback)
- >>>
- >>> # Handle metadata.
- >>> metadata = response.metadata()
-
- Args:
- parent (str): Required. The unique name of the project in which to create the new
- instance. Values are of the form ``projects/{project}``.
- instance_id (str): Required. The ID to be used when referring to the new instance
- within its project, e.g., just ``myinstance`` rather than
- ``projects/myproject/instances/myinstance``.
- instance (Union[dict, ~google.cloud.bigtable_admin_v2.types.Instance]): Required. The instance to create. Fields marked ``OutputOnly`` must
- be left blank.
-
- If a dict is provided, it must be of the same form as the protobuf
- message :class:`~google.cloud.bigtable_admin_v2.types.Instance`
- clusters (dict[str -> Union[dict, ~google.cloud.bigtable_admin_v2.types.Cluster]]): Required. The clusters to be created within the instance, mapped by
- desired cluster ID, e.g., just ``mycluster`` rather than
- ``projects/myproject/instances/myinstance/clusters/mycluster``. Fields
- marked ``OutputOnly`` must be left blank. Currently, at most four
- clusters can be specified.
-
- If a dict is provided, it must be of the same form as the protobuf
- message :class:`~google.cloud.bigtable_admin_v2.types.Cluster`
- retry (Optional[google.api_core.retry.Retry]): A retry object used
- to retry requests. If ``None`` is specified, requests will
- be retried using a default configuration.
- timeout (Optional[float]): The amount of time, in seconds, to wait
- for the request to complete. Note that if ``retry`` is
- specified, the timeout applies to each individual attempt.
- metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
- that is provided to the method.
-
- Returns:
- A :class:`~google.cloud.bigtable_admin_v2.types._OperationFuture` instance.
-
- Raises:
- google.api_core.exceptions.GoogleAPICallError: If the request
- failed for any reason.
- google.api_core.exceptions.RetryError: If the request failed due
- to a retryable error and retry attempts failed.
- ValueError: If the parameters are invalid.
- """
- # Wrap the transport method to add retry and timeout logic.
- if "create_instance" not in self._inner_api_calls:
- self._inner_api_calls[
- "create_instance"
- ] = google.api_core.gapic_v1.method.wrap_method(
- self.transport.create_instance,
- default_retry=self._method_configs["CreateInstance"].retry,
- default_timeout=self._method_configs["CreateInstance"].timeout,
- client_info=self._client_info,
- )
-
- request = bigtable_instance_admin_pb2.CreateInstanceRequest(
- parent=parent,
- instance_id=instance_id,
- instance=instance,
- clusters=clusters,
- )
- if metadata is None:
- metadata = []
- metadata = list(metadata)
- try:
- routing_header = [("parent", parent)]
- except AttributeError:
- pass
- else:
- routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
- routing_header
- )
- metadata.append(routing_metadata)
-
- operation = self._inner_api_calls["create_instance"](
- request, retry=retry, timeout=timeout, metadata=metadata
- )
- return google.api_core.operation.from_gapic(
- operation,
- self.transport._operations_client,
- instance_pb2.Instance,
- metadata_type=bigtable_instance_admin_pb2.CreateInstanceMetadata,
- )
-
- def get_instance(
- self,
- name,
- retry=google.api_core.gapic_v1.method.DEFAULT,
- timeout=google.api_core.gapic_v1.method.DEFAULT,
- metadata=None,
- ):
- """
- Gets information about an instance.
-
- Example:
- >>> from google.cloud import bigtable_admin_v2
- >>>
- >>> client = bigtable_admin_v2.BigtableInstanceAdminClient()
- >>>
- >>> name = client.instance_path('[PROJECT]', '[INSTANCE]')
- >>>
- >>> response = client.get_instance(name)
-
- Args:
- name (str): Required. The unique name of the requested instance. Values are of
- the form ``projects/{project}/instances/{instance}``.
- retry (Optional[google.api_core.retry.Retry]): A retry object used
- to retry requests. If ``None`` is specified, requests will
- be retried using a default configuration.
- timeout (Optional[float]): The amount of time, in seconds, to wait
- for the request to complete. Note that if ``retry`` is
- specified, the timeout applies to each individual attempt.
- metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
- that is provided to the method.
-
- Returns:
- A :class:`~google.cloud.bigtable_admin_v2.types.Instance` instance.
-
- Raises:
- google.api_core.exceptions.GoogleAPICallError: If the request
- failed for any reason.
- google.api_core.exceptions.RetryError: If the request failed due
- to a retryable error and retry attempts failed.
- ValueError: If the parameters are invalid.
- """
- # Wrap the transport method to add retry and timeout logic.
- if "get_instance" not in self._inner_api_calls:
- self._inner_api_calls[
- "get_instance"
- ] = google.api_core.gapic_v1.method.wrap_method(
- self.transport.get_instance,
- default_retry=self._method_configs["GetInstance"].retry,
- default_timeout=self._method_configs["GetInstance"].timeout,
- client_info=self._client_info,
- )
-
- request = bigtable_instance_admin_pb2.GetInstanceRequest(name=name,)
- if metadata is None:
- metadata = []
- metadata = list(metadata)
- try:
- routing_header = [("name", name)]
- except AttributeError:
- pass
- else:
- routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
- routing_header
- )
- metadata.append(routing_metadata)
-
- return self._inner_api_calls["get_instance"](
- request, retry=retry, timeout=timeout, metadata=metadata
- )
-
- def list_instances(
- self,
- parent,
- page_token=None,
- retry=google.api_core.gapic_v1.method.DEFAULT,
- timeout=google.api_core.gapic_v1.method.DEFAULT,
- metadata=None,
- ):
- """
- Lists information about instances in a project.
-
- Example:
- >>> from google.cloud import bigtable_admin_v2
- >>>
- >>> client = bigtable_admin_v2.BigtableInstanceAdminClient()
- >>>
- >>> parent = client.project_path('[PROJECT]')
- >>>
- >>> response = client.list_instances(parent)
-
- Args:
- parent (str): Required. The unique name of the project for which a list of
- instances is requested. Values are of the form ``projects/{project}``.
- page_token (str): DEPRECATED: This field is unused and ignored.
- retry (Optional[google.api_core.retry.Retry]): A retry object used
- to retry requests. If ``None`` is specified, requests will
- be retried using a default configuration.
- timeout (Optional[float]): The amount of time, in seconds, to wait
- for the request to complete. Note that if ``retry`` is
- specified, the timeout applies to each individual attempt.
- metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
- that is provided to the method.
-
- Returns:
- A :class:`~google.cloud.bigtable_admin_v2.types.ListInstancesResponse` instance.
-
- Raises:
- google.api_core.exceptions.GoogleAPICallError: If the request
- failed for any reason.
- google.api_core.exceptions.RetryError: If the request failed due
- to a retryable error and retry attempts failed.
- ValueError: If the parameters are invalid.
- """
- # Wrap the transport method to add retry and timeout logic.
- if "list_instances" not in self._inner_api_calls:
- self._inner_api_calls[
- "list_instances"
- ] = google.api_core.gapic_v1.method.wrap_method(
- self.transport.list_instances,
- default_retry=self._method_configs["ListInstances"].retry,
- default_timeout=self._method_configs["ListInstances"].timeout,
- client_info=self._client_info,
- )
-
- request = bigtable_instance_admin_pb2.ListInstancesRequest(
- parent=parent, page_token=page_token,
- )
- if metadata is None:
- metadata = []
- metadata = list(metadata)
- try:
- routing_header = [("parent", parent)]
- except AttributeError:
- pass
- else:
- routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
- routing_header
- )
- metadata.append(routing_metadata)
-
- return self._inner_api_calls["list_instances"](
- request, retry=retry, timeout=timeout, metadata=metadata
- )
-
- def update_instance(
- self,
- display_name,
- name=None,
- state=None,
- type_=None,
- labels=None,
- retry=google.api_core.gapic_v1.method.DEFAULT,
- timeout=google.api_core.gapic_v1.method.DEFAULT,
- metadata=None,
- ):
- """
- Updates an instance within a project. This method updates only the display
- name and type for an Instance. To update other Instance properties, such as
- labels, use PartialUpdateInstance.
-
- Example:
- >>> from google.cloud import bigtable_admin_v2
- >>>
- >>> client = bigtable_admin_v2.BigtableInstanceAdminClient()
- >>>
- >>> # TODO: Initialize `display_name`:
- >>> display_name = ''
- >>>
- >>> response = client.update_instance(display_name)
-
- Args:
- display_name (str): Required. The descriptive name for this instance as it appears in UIs.
- Can be changed at any time, but should be kept globally unique
- to avoid confusion.
- name (str): The unique name of the instance. Values are of the form
- ``projects/{project}/instances/[a-z][a-z0-9\\-]+[a-z0-9]``.
- state (~google.cloud.bigtable_admin_v2.types.State): (``OutputOnly``) The current state of the instance.
- type_ (~google.cloud.bigtable_admin_v2.types.Type): The type of the instance. Defaults to ``PRODUCTION``.
- labels (dict[str -> str]): Labels are a flexible and lightweight mechanism for organizing cloud
- resources into groups that reflect a customer's organizational needs and
- deployment strategies. They can be used to filter resources and
- aggregate metrics.
-
- - Label keys must be between 1 and 63 characters long and must conform
- to the regular expression:
- ``[\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}_-]{0,62}``.
- - Label values must be between 0 and 63 characters long and must
- conform to the regular expression: ``[\p{Ll}\p{Lo}\p{N}_-]{0,63}``.
- - No more than 64 labels can be associated with a given resource.
- - Keys and values must both be under 128 bytes.
- retry (Optional[google.api_core.retry.Retry]): A retry object used
- to retry requests. If ``None`` is specified, requests will
- be retried using a default configuration.
- timeout (Optional[float]): The amount of time, in seconds, to wait
- for the request to complete. Note that if ``retry`` is
- specified, the timeout applies to each individual attempt.
- metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
- that is provided to the method.
-
- Returns:
- A :class:`~google.cloud.bigtable_admin_v2.types.Instance` instance.
-
- Raises:
- google.api_core.exceptions.GoogleAPICallError: If the request
- failed for any reason.
- google.api_core.exceptions.RetryError: If the request failed due
- to a retryable error and retry attempts failed.
- ValueError: If the parameters are invalid.
- """
- # Wrap the transport method to add retry and timeout logic.
- if "update_instance" not in self._inner_api_calls:
- self._inner_api_calls[
- "update_instance"
- ] = google.api_core.gapic_v1.method.wrap_method(
- self.transport.update_instance,
- default_retry=self._method_configs["UpdateInstance"].retry,
- default_timeout=self._method_configs["UpdateInstance"].timeout,
- client_info=self._client_info,
- )
-
- request = instance_pb2.Instance(
- display_name=display_name,
- name=name,
- state=state,
- type=type_,
- labels=labels,
- )
- if metadata is None:
- metadata = []
- metadata = list(metadata)
- try:
- routing_header = [("name", name)]
- except AttributeError:
- pass
- else:
- routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
- routing_header
- )
- metadata.append(routing_metadata)
-
- return self._inner_api_calls["update_instance"](
- request, retry=retry, timeout=timeout, metadata=metadata
- )
-
- def partial_update_instance(
- self,
- instance,
- update_mask,
- retry=google.api_core.gapic_v1.method.DEFAULT,
- timeout=google.api_core.gapic_v1.method.DEFAULT,
- metadata=None,
- ):
- """
- Partially updates an instance within a project. This method can modify all
- fields of an Instance and is the preferred way to update an Instance.
-
- Example:
- >>> from google.cloud import bigtable_admin_v2
- >>>
- >>> client = bigtable_admin_v2.BigtableInstanceAdminClient()
- >>>
- >>> # TODO: Initialize `instance`:
- >>> instance = {}
- >>>
- >>> # TODO: Initialize `update_mask`:
- >>> update_mask = {}
- >>>
- >>> response = client.partial_update_instance(instance, update_mask)
- >>>
- >>> def callback(operation_future):
- ... # Handle result.
- ... result = operation_future.result()
- >>>
- >>> response.add_done_callback(callback)
- >>>
- >>> # Handle metadata.
- >>> metadata = response.metadata()
-
- Args:
- instance (Union[dict, ~google.cloud.bigtable_admin_v2.types.Instance]): Required. The Instance which will (partially) replace the current value.
-
- If a dict is provided, it must be of the same form as the protobuf
- message :class:`~google.cloud.bigtable_admin_v2.types.Instance`
- update_mask (Union[dict, ~google.cloud.bigtable_admin_v2.types.FieldMask]): Required. The subset of Instance fields which should be replaced.
- Must be explicitly set.
-
- If a dict is provided, it must be of the same form as the protobuf
- message :class:`~google.cloud.bigtable_admin_v2.types.FieldMask`
- retry (Optional[google.api_core.retry.Retry]): A retry object used
- to retry requests. If ``None`` is specified, requests will
- be retried using a default configuration.
- timeout (Optional[float]): The amount of time, in seconds, to wait
- for the request to complete. Note that if ``retry`` is
- specified, the timeout applies to each individual attempt.
- metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
- that is provided to the method.
-
- Returns:
- A :class:`~google.cloud.bigtable_admin_v2.types._OperationFuture` instance.
-
- Raises:
- google.api_core.exceptions.GoogleAPICallError: If the request
- failed for any reason.
- google.api_core.exceptions.RetryError: If the request failed due
- to a retryable error and retry attempts failed.
- ValueError: If the parameters are invalid.
- """
- # Wrap the transport method to add retry and timeout logic.
- if "partial_update_instance" not in self._inner_api_calls:
- self._inner_api_calls[
- "partial_update_instance"
- ] = google.api_core.gapic_v1.method.wrap_method(
- self.transport.partial_update_instance,
- default_retry=self._method_configs["PartialUpdateInstance"].retry,
- default_timeout=self._method_configs["PartialUpdateInstance"].timeout,
- client_info=self._client_info,
- )
-
- request = bigtable_instance_admin_pb2.PartialUpdateInstanceRequest(
- instance=instance, update_mask=update_mask,
- )
- if metadata is None:
- metadata = []
- metadata = list(metadata)
- try:
- routing_header = [("instance.name", instance.name)]
- except AttributeError:
- pass
- else:
- routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
- routing_header
- )
- metadata.append(routing_metadata)
-
- operation = self._inner_api_calls["partial_update_instance"](
- request, retry=retry, timeout=timeout, metadata=metadata
- )
- return google.api_core.operation.from_gapic(
- operation,
- self.transport._operations_client,
- instance_pb2.Instance,
- metadata_type=bigtable_instance_admin_pb2.UpdateInstanceMetadata,
- )
-
- def delete_instance(
- self,
- name,
- retry=google.api_core.gapic_v1.method.DEFAULT,
- timeout=google.api_core.gapic_v1.method.DEFAULT,
- metadata=None,
- ):
- """
- Delete an instance from a project.
-
- Example:
- >>> from google.cloud import bigtable_admin_v2
- >>>
- >>> client = bigtable_admin_v2.BigtableInstanceAdminClient()
- >>>
- >>> name = client.instance_path('[PROJECT]', '[INSTANCE]')
- >>>
- >>> client.delete_instance(name)
-
- Args:
- name (str): Required. The unique name of the instance to be deleted. Values are
- of the form ``projects/{project}/instances/{instance}``.
- retry (Optional[google.api_core.retry.Retry]): A retry object used
- to retry requests. If ``None`` is specified, requests will
- be retried using a default configuration.
- timeout (Optional[float]): The amount of time, in seconds, to wait
- for the request to complete. Note that if ``retry`` is
- specified, the timeout applies to each individual attempt.
- metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
- that is provided to the method.
-
- Raises:
- google.api_core.exceptions.GoogleAPICallError: If the request
- failed for any reason.
- google.api_core.exceptions.RetryError: If the request failed due
- to a retryable error and retry attempts failed.
- ValueError: If the parameters are invalid.
- """
- # Wrap the transport method to add retry and timeout logic.
- if "delete_instance" not in self._inner_api_calls:
- self._inner_api_calls[
- "delete_instance"
- ] = google.api_core.gapic_v1.method.wrap_method(
- self.transport.delete_instance,
- default_retry=self._method_configs["DeleteInstance"].retry,
- default_timeout=self._method_configs["DeleteInstance"].timeout,
- client_info=self._client_info,
- )
-
- request = bigtable_instance_admin_pb2.DeleteInstanceRequest(name=name,)
- if metadata is None:
- metadata = []
- metadata = list(metadata)
- try:
- routing_header = [("name", name)]
- except AttributeError:
- pass
- else:
- routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
- routing_header
- )
- metadata.append(routing_metadata)
-
- self._inner_api_calls["delete_instance"](
- request, retry=retry, timeout=timeout, metadata=metadata
- )
-
- def create_cluster(
- self,
- parent,
- cluster_id,
- cluster,
- retry=google.api_core.gapic_v1.method.DEFAULT,
- timeout=google.api_core.gapic_v1.method.DEFAULT,
- metadata=None,
- ):
- """
- Creates a cluster within an instance.
-
- Example:
- >>> from google.cloud import bigtable_admin_v2
- >>>
- >>> client = bigtable_admin_v2.BigtableInstanceAdminClient()
- >>>
- >>> parent = client.instance_path('[PROJECT]', '[INSTANCE]')
- >>>
- >>> # TODO: Initialize `cluster_id`:
- >>> cluster_id = ''
- >>>
- >>> # TODO: Initialize `cluster`:
- >>> cluster = {}
- >>>
- >>> response = client.create_cluster(parent, cluster_id, cluster)
- >>>
- >>> def callback(operation_future):
- ... # Handle result.
- ... result = operation_future.result()
- >>>
- >>> response.add_done_callback(callback)
- >>>
- >>> # Handle metadata.
- >>> metadata = response.metadata()
-
- Args:
- parent (str): Required. The unique name of the instance in which to create the new
- cluster. Values are of the form
- ``projects/{project}/instances/{instance}``.
- cluster_id (str): Required. The ID to be used when referring to the new cluster within
- its instance, e.g., just ``mycluster`` rather than
- ``projects/myproject/instances/myinstance/clusters/mycluster``.
- cluster (Union[dict, ~google.cloud.bigtable_admin_v2.types.Cluster]): Required. The cluster to be created. Fields marked ``OutputOnly``
- must be left blank.
-
- If a dict is provided, it must be of the same form as the protobuf
- message :class:`~google.cloud.bigtable_admin_v2.types.Cluster`
- retry (Optional[google.api_core.retry.Retry]): A retry object used
- to retry requests. If ``None`` is specified, requests will
- be retried using a default configuration.
- timeout (Optional[float]): The amount of time, in seconds, to wait
- for the request to complete. Note that if ``retry`` is
- specified, the timeout applies to each individual attempt.
- metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
- that is provided to the method.
-
- Returns:
- A :class:`~google.cloud.bigtable_admin_v2.types._OperationFuture` instance.
-
- Raises:
- google.api_core.exceptions.GoogleAPICallError: If the request
- failed for any reason.
- google.api_core.exceptions.RetryError: If the request failed due
- to a retryable error and retry attempts failed.
- ValueError: If the parameters are invalid.
- """
- # Wrap the transport method to add retry and timeout logic.
- if "create_cluster" not in self._inner_api_calls:
- self._inner_api_calls[
- "create_cluster"
- ] = google.api_core.gapic_v1.method.wrap_method(
- self.transport.create_cluster,
- default_retry=self._method_configs["CreateCluster"].retry,
- default_timeout=self._method_configs["CreateCluster"].timeout,
- client_info=self._client_info,
- )
-
- request = bigtable_instance_admin_pb2.CreateClusterRequest(
- parent=parent, cluster_id=cluster_id, cluster=cluster,
- )
- if metadata is None:
- metadata = []
- metadata = list(metadata)
- try:
- routing_header = [("parent", parent)]
- except AttributeError:
- pass
- else:
- routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
- routing_header
- )
- metadata.append(routing_metadata)
-
- operation = self._inner_api_calls["create_cluster"](
- request, retry=retry, timeout=timeout, metadata=metadata
- )
- return google.api_core.operation.from_gapic(
- operation,
- self.transport._operations_client,
- instance_pb2.Cluster,
- metadata_type=bigtable_instance_admin_pb2.CreateClusterMetadata,
- )
-
- def get_cluster(
- self,
- name,
- retry=google.api_core.gapic_v1.method.DEFAULT,
- timeout=google.api_core.gapic_v1.method.DEFAULT,
- metadata=None,
- ):
- """
- Gets information about a cluster.
-
- Example:
- >>> from google.cloud import bigtable_admin_v2
- >>>
- >>> client = bigtable_admin_v2.BigtableInstanceAdminClient()
- >>>
- >>> name = client.cluster_path('[PROJECT]', '[INSTANCE]', '[CLUSTER]')
- >>>
- >>> response = client.get_cluster(name)
-
- Args:
- name (str): Required. The unique name of the requested cluster. Values are of
- the form ``projects/{project}/instances/{instance}/clusters/{cluster}``.
- retry (Optional[google.api_core.retry.Retry]): A retry object used
- to retry requests. If ``None`` is specified, requests will
- be retried using a default configuration.
- timeout (Optional[float]): The amount of time, in seconds, to wait
- for the request to complete. Note that if ``retry`` is
- specified, the timeout applies to each individual attempt.
- metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
- that is provided to the method.
-
- Returns:
- A :class:`~google.cloud.bigtable_admin_v2.types.Cluster` instance.
-
- Raises:
- google.api_core.exceptions.GoogleAPICallError: If the request
- failed for any reason.
- google.api_core.exceptions.RetryError: If the request failed due
- to a retryable error and retry attempts failed.
- ValueError: If the parameters are invalid.
- """
- # Wrap the transport method to add retry and timeout logic.
- if "get_cluster" not in self._inner_api_calls:
- self._inner_api_calls[
- "get_cluster"
- ] = google.api_core.gapic_v1.method.wrap_method(
- self.transport.get_cluster,
- default_retry=self._method_configs["GetCluster"].retry,
- default_timeout=self._method_configs["GetCluster"].timeout,
- client_info=self._client_info,
- )
-
- request = bigtable_instance_admin_pb2.GetClusterRequest(name=name,)
- if metadata is None:
- metadata = []
- metadata = list(metadata)
- try:
- routing_header = [("name", name)]
- except AttributeError:
- pass
- else:
- routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
- routing_header
- )
- metadata.append(routing_metadata)
-
- return self._inner_api_calls["get_cluster"](
- request, retry=retry, timeout=timeout, metadata=metadata
- )
-
- def list_clusters(
- self,
- parent,
- page_token=None,
- retry=google.api_core.gapic_v1.method.DEFAULT,
- timeout=google.api_core.gapic_v1.method.DEFAULT,
- metadata=None,
- ):
- """
- Lists information about clusters in an instance.
-
- Example:
- >>> from google.cloud import bigtable_admin_v2
- >>>
- >>> client = bigtable_admin_v2.BigtableInstanceAdminClient()
- >>>
- >>> parent = client.instance_path('[PROJECT]', '[INSTANCE]')
- >>>
- >>> response = client.list_clusters(parent)
-
- Args:
- parent (str): Required. The unique name of the instance for which a list of
- clusters is requested. Values are of the form
- ``projects/{project}/instances/{instance}``. Use ``{instance} = '-'`` to
- list Clusters for all Instances in a project, e.g.,
- ``projects/myproject/instances/-``.
- page_token (str): DEPRECATED: This field is unused and ignored.
- retry (Optional[google.api_core.retry.Retry]): A retry object used
- to retry requests. If ``None`` is specified, requests will
- be retried using a default configuration.
- timeout (Optional[float]): The amount of time, in seconds, to wait
- for the request to complete. Note that if ``retry`` is
- specified, the timeout applies to each individual attempt.
- metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
- that is provided to the method.
-
- Returns:
- A :class:`~google.cloud.bigtable_admin_v2.types.ListClustersResponse` instance.
-
- Raises:
- google.api_core.exceptions.GoogleAPICallError: If the request
- failed for any reason.
- google.api_core.exceptions.RetryError: If the request failed due
- to a retryable error and retry attempts failed.
- ValueError: If the parameters are invalid.
- """
- # Wrap the transport method to add retry and timeout logic.
- if "list_clusters" not in self._inner_api_calls:
- self._inner_api_calls[
- "list_clusters"
- ] = google.api_core.gapic_v1.method.wrap_method(
- self.transport.list_clusters,
- default_retry=self._method_configs["ListClusters"].retry,
- default_timeout=self._method_configs["ListClusters"].timeout,
- client_info=self._client_info,
- )
-
- request = bigtable_instance_admin_pb2.ListClustersRequest(
- parent=parent, page_token=page_token,
- )
- if metadata is None:
- metadata = []
- metadata = list(metadata)
- try:
- routing_header = [("parent", parent)]
- except AttributeError:
- pass
- else:
- routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
- routing_header
- )
- metadata.append(routing_metadata)
-
- return self._inner_api_calls["list_clusters"](
- request, retry=retry, timeout=timeout, metadata=metadata
- )
-
- def update_cluster(
- self,
- serve_nodes,
- name=None,
- location=None,
- state=None,
- default_storage_type=None,
- retry=google.api_core.gapic_v1.method.DEFAULT,
- timeout=google.api_core.gapic_v1.method.DEFAULT,
- metadata=None,
- ):
- """
- Updates a cluster within an instance.
-
- Example:
- >>> from google.cloud import bigtable_admin_v2
- >>>
- >>> client = bigtable_admin_v2.BigtableInstanceAdminClient()
- >>>
- >>> # TODO: Initialize `serve_nodes`:
- >>> serve_nodes = 0
- >>>
- >>> response = client.update_cluster(serve_nodes)
- >>>
- >>> def callback(operation_future):
- ... # Handle result.
- ... result = operation_future.result()
- >>>
- >>> response.add_done_callback(callback)
- >>>
- >>> # Handle metadata.
- >>> metadata = response.metadata()
-
- Args:
- serve_nodes (int): Required. The number of nodes allocated to this cluster. More nodes enable
- higher throughput and more consistent performance.
- name (str): The unique name of the cluster. Values are of the form
- ``projects/{project}/instances/{instance}/clusters/[a-z][-a-z0-9]*``.
- location (str): (``CreationOnly``) The location where this cluster's nodes and
- storage reside. For best performance, clients should be located as close
- as possible to this cluster. Currently only zones are supported, so
- values should be of the form ``projects/{project}/locations/{zone}``.
- state (~google.cloud.bigtable_admin_v2.types.State): The current state of the cluster.
- default_storage_type (~google.cloud.bigtable_admin_v2.types.StorageType): (``CreationOnly``) The type of storage used by this cluster to serve
- its parent instance's tables, unless explicitly overridden.
- retry (Optional[google.api_core.retry.Retry]): A retry object used
- to retry requests. If ``None`` is specified, requests will
- be retried using a default configuration.
- timeout (Optional[float]): The amount of time, in seconds, to wait
- for the request to complete. Note that if ``retry`` is
- specified, the timeout applies to each individual attempt.
- metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
- that is provided to the method.
-
- Returns:
- A :class:`~google.cloud.bigtable_admin_v2.types._OperationFuture` instance.
-
- Raises:
- google.api_core.exceptions.GoogleAPICallError: If the request
- failed for any reason.
- google.api_core.exceptions.RetryError: If the request failed due
- to a retryable error and retry attempts failed.
- ValueError: If the parameters are invalid.
- """
- # Wrap the transport method to add retry and timeout logic.
- if "update_cluster" not in self._inner_api_calls:
- self._inner_api_calls[
- "update_cluster"
- ] = google.api_core.gapic_v1.method.wrap_method(
- self.transport.update_cluster,
- default_retry=self._method_configs["UpdateCluster"].retry,
- default_timeout=self._method_configs["UpdateCluster"].timeout,
- client_info=self._client_info,
- )
-
- request = instance_pb2.Cluster(
- serve_nodes=serve_nodes,
- name=name,
- location=location,
- state=state,
- default_storage_type=default_storage_type,
- )
- if metadata is None:
- metadata = []
- metadata = list(metadata)
- try:
- routing_header = [("name", name)]
- except AttributeError:
- pass
- else:
- routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
- routing_header
- )
- metadata.append(routing_metadata)
-
- operation = self._inner_api_calls["update_cluster"](
- request, retry=retry, timeout=timeout, metadata=metadata
- )
- return google.api_core.operation.from_gapic(
- operation,
- self.transport._operations_client,
- instance_pb2.Cluster,
- metadata_type=bigtable_instance_admin_pb2.UpdateClusterMetadata,
- )
-
- def delete_cluster(
- self,
- name,
- retry=google.api_core.gapic_v1.method.DEFAULT,
- timeout=google.api_core.gapic_v1.method.DEFAULT,
- metadata=None,
- ):
- """
- Deletes a cluster from an instance.
-
- Example:
- >>> from google.cloud import bigtable_admin_v2
- >>>
- >>> client = bigtable_admin_v2.BigtableInstanceAdminClient()
- >>>
- >>> name = client.cluster_path('[PROJECT]', '[INSTANCE]', '[CLUSTER]')
- >>>
- >>> client.delete_cluster(name)
-
- Args:
- name (str): Required. The unique name of the cluster to be deleted. Values are
- of the form
- ``projects/{project}/instances/{instance}/clusters/{cluster}``.
- retry (Optional[google.api_core.retry.Retry]): A retry object used
- to retry requests. If ``None`` is specified, requests will
- be retried using a default configuration.
- timeout (Optional[float]): The amount of time, in seconds, to wait
- for the request to complete. Note that if ``retry`` is
- specified, the timeout applies to each individual attempt.
- metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
- that is provided to the method.
-
- Raises:
- google.api_core.exceptions.GoogleAPICallError: If the request
- failed for any reason.
- google.api_core.exceptions.RetryError: If the request failed due
- to a retryable error and retry attempts failed.
- ValueError: If the parameters are invalid.
- """
- # Wrap the transport method to add retry and timeout logic.
- if "delete_cluster" not in self._inner_api_calls:
- self._inner_api_calls[
- "delete_cluster"
- ] = google.api_core.gapic_v1.method.wrap_method(
- self.transport.delete_cluster,
- default_retry=self._method_configs["DeleteCluster"].retry,
- default_timeout=self._method_configs["DeleteCluster"].timeout,
- client_info=self._client_info,
- )
-
- request = bigtable_instance_admin_pb2.DeleteClusterRequest(name=name,)
- if metadata is None:
- metadata = []
- metadata = list(metadata)
- try:
- routing_header = [("name", name)]
- except AttributeError:
- pass
- else:
- routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
- routing_header
- )
- metadata.append(routing_metadata)
-
- self._inner_api_calls["delete_cluster"](
- request, retry=retry, timeout=timeout, metadata=metadata
- )
-
- def create_app_profile(
- self,
- parent,
- app_profile_id,
- app_profile,
- ignore_warnings=None,
- retry=google.api_core.gapic_v1.method.DEFAULT,
- timeout=google.api_core.gapic_v1.method.DEFAULT,
- metadata=None,
- ):
- """
- Creates an app profile within an instance.
-
- Example:
- >>> from google.cloud import bigtable_admin_v2
- >>>
- >>> client = bigtable_admin_v2.BigtableInstanceAdminClient()
- >>>
- >>> parent = client.instance_path('[PROJECT]', '[INSTANCE]')
- >>>
- >>> # TODO: Initialize `app_profile_id`:
- >>> app_profile_id = ''
- >>>
- >>> # TODO: Initialize `app_profile`:
- >>> app_profile = {}
- >>>
- >>> response = client.create_app_profile(parent, app_profile_id, app_profile)
-
- Args:
- parent (str): Required. The unique name of the instance in which to create the new
- app profile. Values are of the form
- ``projects/{project}/instances/{instance}``.
- app_profile_id (str): Required. The ID to be used when referring to the new app profile
- within its instance, e.g., just ``myprofile`` rather than
- ``projects/myproject/instances/myinstance/appProfiles/myprofile``.
- app_profile (Union[dict, ~google.cloud.bigtable_admin_v2.types.AppProfile]): Required. The app profile to be created. Fields marked
- ``OutputOnly`` will be ignored.
-
- If a dict is provided, it must be of the same form as the protobuf
- message :class:`~google.cloud.bigtable_admin_v2.types.AppProfile`
- ignore_warnings (bool): If true, ignore safety checks when creating the app profile.
- retry (Optional[google.api_core.retry.Retry]): A retry object used
- to retry requests. If ``None`` is specified, requests will
- be retried using a default configuration.
- timeout (Optional[float]): The amount of time, in seconds, to wait
- for the request to complete. Note that if ``retry`` is
- specified, the timeout applies to each individual attempt.
- metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
- that is provided to the method.
-
- Returns:
- A :class:`~google.cloud.bigtable_admin_v2.types.AppProfile` instance.
-
- Raises:
- google.api_core.exceptions.GoogleAPICallError: If the request
- failed for any reason.
- google.api_core.exceptions.RetryError: If the request failed due
- to a retryable error and retry attempts failed.
- ValueError: If the parameters are invalid.
- """
- # Wrap the transport method to add retry and timeout logic.
- if "create_app_profile" not in self._inner_api_calls:
- self._inner_api_calls[
- "create_app_profile"
- ] = google.api_core.gapic_v1.method.wrap_method(
- self.transport.create_app_profile,
- default_retry=self._method_configs["CreateAppProfile"].retry,
- default_timeout=self._method_configs["CreateAppProfile"].timeout,
- client_info=self._client_info,
- )
-
- request = bigtable_instance_admin_pb2.CreateAppProfileRequest(
- parent=parent,
- app_profile_id=app_profile_id,
- app_profile=app_profile,
- ignore_warnings=ignore_warnings,
- )
- if metadata is None:
- metadata = []
- metadata = list(metadata)
- try:
- routing_header = [("parent", parent)]
- except AttributeError:
- pass
- else:
- routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
- routing_header
- )
- metadata.append(routing_metadata)
-
- return self._inner_api_calls["create_app_profile"](
- request, retry=retry, timeout=timeout, metadata=metadata
- )
-
- def get_app_profile(
- self,
- name,
- retry=google.api_core.gapic_v1.method.DEFAULT,
- timeout=google.api_core.gapic_v1.method.DEFAULT,
- metadata=None,
- ):
- """
- Gets information about an app profile.
-
- Example:
- >>> from google.cloud import bigtable_admin_v2
- >>>
- >>> client = bigtable_admin_v2.BigtableInstanceAdminClient()
- >>>
- >>> name = client.app_profile_path('[PROJECT]', '[INSTANCE]', '[APP_PROFILE]')
- >>>
- >>> response = client.get_app_profile(name)
-
- Args:
- name (str): Required. The unique name of the requested app profile. Values are
- of the form
- ``projects/{project}/instances/{instance}/appProfiles/{app_profile}``.
- retry (Optional[google.api_core.retry.Retry]): A retry object used
- to retry requests. If ``None`` is specified, requests will
- be retried using a default configuration.
- timeout (Optional[float]): The amount of time, in seconds, to wait
- for the request to complete. Note that if ``retry`` is
- specified, the timeout applies to each individual attempt.
- metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
- that is provided to the method.
-
- Returns:
- A :class:`~google.cloud.bigtable_admin_v2.types.AppProfile` instance.
-
- Raises:
- google.api_core.exceptions.GoogleAPICallError: If the request
- failed for any reason.
- google.api_core.exceptions.RetryError: If the request failed due
- to a retryable error and retry attempts failed.
- ValueError: If the parameters are invalid.
- """
- # Wrap the transport method to add retry and timeout logic.
- if "get_app_profile" not in self._inner_api_calls:
- self._inner_api_calls[
- "get_app_profile"
- ] = google.api_core.gapic_v1.method.wrap_method(
- self.transport.get_app_profile,
- default_retry=self._method_configs["GetAppProfile"].retry,
- default_timeout=self._method_configs["GetAppProfile"].timeout,
- client_info=self._client_info,
- )
-
- request = bigtable_instance_admin_pb2.GetAppProfileRequest(name=name,)
- if metadata is None:
- metadata = []
- metadata = list(metadata)
- try:
- routing_header = [("name", name)]
- except AttributeError:
- pass
- else:
- routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
- routing_header
- )
- metadata.append(routing_metadata)
-
- return self._inner_api_calls["get_app_profile"](
- request, retry=retry, timeout=timeout, metadata=metadata
- )
-
- def list_app_profiles(
- self,
- parent,
- page_size=None,
- retry=google.api_core.gapic_v1.method.DEFAULT,
- timeout=google.api_core.gapic_v1.method.DEFAULT,
- metadata=None,
- ):
- """
- Lists information about app profiles in an instance.
-
- Example:
- >>> from google.cloud import bigtable_admin_v2
- >>>
- >>> client = bigtable_admin_v2.BigtableInstanceAdminClient()
- >>>
- >>> parent = client.instance_path('[PROJECT]', '[INSTANCE]')
- >>>
- >>> # Iterate over all results
- >>> for element in client.list_app_profiles(parent):
- ... # process element
- ... pass
- >>>
- >>>
- >>> # Alternatively:
- >>>
- >>> # Iterate over results one page at a time
- >>> for page in client.list_app_profiles(parent).pages:
- ... for element in page:
- ... # process element
- ... pass
-
- Args:
- parent (str): Required. The unique name of the instance for which a list of app
- profiles is requested. Values are of the form
- ``projects/{project}/instances/{instance}``. Use ``{instance} = '-'`` to
- list AppProfiles for all Instances in a project, e.g.,
- ``projects/myproject/instances/-``.
- page_size (int): The maximum number of resources contained in the
- underlying API response. If page streaming is performed per-
- resource, this parameter does not affect the return value. If page
- streaming is performed per-page, this determines the maximum number
- of resources in a page.
- retry (Optional[google.api_core.retry.Retry]): A retry object used
- to retry requests. If ``None`` is specified, requests will
- be retried using a default configuration.
- timeout (Optional[float]): The amount of time, in seconds, to wait
- for the request to complete. Note that if ``retry`` is
- specified, the timeout applies to each individual attempt.
- metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
- that is provided to the method.
-
- Returns:
- A :class:`~google.api_core.page_iterator.PageIterator` instance.
- An iterable of :class:`~google.cloud.bigtable_admin_v2.types.AppProfile` instances.
- You can also iterate over the pages of the response
- using its `pages` property.
-
- Raises:
- google.api_core.exceptions.GoogleAPICallError: If the request
- failed for any reason.
- google.api_core.exceptions.RetryError: If the request failed due
- to a retryable error and retry attempts failed.
- ValueError: If the parameters are invalid.
- """
- # Wrap the transport method to add retry and timeout logic.
- if "list_app_profiles" not in self._inner_api_calls:
- self._inner_api_calls[
- "list_app_profiles"
- ] = google.api_core.gapic_v1.method.wrap_method(
- self.transport.list_app_profiles,
- default_retry=self._method_configs["ListAppProfiles"].retry,
- default_timeout=self._method_configs["ListAppProfiles"].timeout,
- client_info=self._client_info,
- )
-
- request = bigtable_instance_admin_pb2.ListAppProfilesRequest(
- parent=parent, page_size=page_size,
- )
- if metadata is None:
- metadata = []
- metadata = list(metadata)
- try:
- routing_header = [("parent", parent)]
- except AttributeError:
- pass
- else:
- routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
- routing_header
- )
- metadata.append(routing_metadata)
-
- iterator = google.api_core.page_iterator.GRPCIterator(
- client=None,
- method=functools.partial(
- self._inner_api_calls["list_app_profiles"],
- retry=retry,
- timeout=timeout,
- metadata=metadata,
- ),
- request=request,
- items_field="app_profiles",
- request_token_field="page_token",
- response_token_field="next_page_token",
- )
- return iterator
-
- def update_app_profile(
- self,
- app_profile,
- update_mask,
- ignore_warnings=None,
- retry=google.api_core.gapic_v1.method.DEFAULT,
- timeout=google.api_core.gapic_v1.method.DEFAULT,
- metadata=None,
- ):
- """
- Updates an app profile within an instance.
-
- Example:
- >>> from google.cloud import bigtable_admin_v2
- >>>
- >>> client = bigtable_admin_v2.BigtableInstanceAdminClient()
- >>>
- >>> # TODO: Initialize `app_profile`:
- >>> app_profile = {}
- >>>
- >>> # TODO: Initialize `update_mask`:
- >>> update_mask = {}
- >>>
- >>> response = client.update_app_profile(app_profile, update_mask)
- >>>
- >>> def callback(operation_future):
- ... # Handle result.
- ... result = operation_future.result()
- >>>
- >>> response.add_done_callback(callback)
- >>>
- >>> # Handle metadata.
- >>> metadata = response.metadata()
-
- Args:
- app_profile (Union[dict, ~google.cloud.bigtable_admin_v2.types.AppProfile]): Required. The app profile which will (partially) replace the current value.
-
- If a dict is provided, it must be of the same form as the protobuf
- message :class:`~google.cloud.bigtable_admin_v2.types.AppProfile`
- update_mask (Union[dict, ~google.cloud.bigtable_admin_v2.types.FieldMask]): Required. The subset of app profile fields which should be replaced.
- If unset, all fields will be replaced.
-
- If a dict is provided, it must be of the same form as the protobuf
- message :class:`~google.cloud.bigtable_admin_v2.types.FieldMask`
- ignore_warnings (bool): If true, ignore safety checks when updating the app profile.
- retry (Optional[google.api_core.retry.Retry]): A retry object used
- to retry requests. If ``None`` is specified, requests will
- be retried using a default configuration.
- timeout (Optional[float]): The amount of time, in seconds, to wait
- for the request to complete. Note that if ``retry`` is
- specified, the timeout applies to each individual attempt.
- metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
- that is provided to the method.
-
- Returns:
- A :class:`~google.cloud.bigtable_admin_v2.types._OperationFuture` instance.
-
- Raises:
- google.api_core.exceptions.GoogleAPICallError: If the request
- failed for any reason.
- google.api_core.exceptions.RetryError: If the request failed due
- to a retryable error and retry attempts failed.
- ValueError: If the parameters are invalid.
- """
- # Wrap the transport method to add retry and timeout logic.
- if "update_app_profile" not in self._inner_api_calls:
- self._inner_api_calls[
- "update_app_profile"
- ] = google.api_core.gapic_v1.method.wrap_method(
- self.transport.update_app_profile,
- default_retry=self._method_configs["UpdateAppProfile"].retry,
- default_timeout=self._method_configs["UpdateAppProfile"].timeout,
- client_info=self._client_info,
- )
-
- request = bigtable_instance_admin_pb2.UpdateAppProfileRequest(
- app_profile=app_profile,
- update_mask=update_mask,
- ignore_warnings=ignore_warnings,
- )
- if metadata is None:
- metadata = []
- metadata = list(metadata)
- try:
- routing_header = [("app_profile.name", app_profile.name)]
- except AttributeError:
- pass
- else:
- routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
- routing_header
- )
- metadata.append(routing_metadata)
-
- operation = self._inner_api_calls["update_app_profile"](
- request, retry=retry, timeout=timeout, metadata=metadata
- )
- return google.api_core.operation.from_gapic(
- operation,
- self.transport._operations_client,
- instance_pb2.AppProfile,
- metadata_type=bigtable_instance_admin_pb2.UpdateAppProfileMetadata,
- )
-
- def delete_app_profile(
- self,
- name,
- ignore_warnings=None,
- retry=google.api_core.gapic_v1.method.DEFAULT,
- timeout=google.api_core.gapic_v1.method.DEFAULT,
- metadata=None,
- ):
- """
- Deletes an app profile from an instance.
-
- Example:
- >>> from google.cloud import bigtable_admin_v2
- >>>
- >>> client = bigtable_admin_v2.BigtableInstanceAdminClient()
- >>>
- >>> name = client.app_profile_path('[PROJECT]', '[INSTANCE]', '[APP_PROFILE]')
- >>>
- >>> client.delete_app_profile(name)
-
- Args:
- name (str): Required. The unique name of the app profile to be deleted. Values
- are of the form
- ``projects/{project}/instances/{instance}/appProfiles/{app_profile}``.
- ignore_warnings (bool): If true, ignore safety checks when deleting the app profile.
- retry (Optional[google.api_core.retry.Retry]): A retry object used
- to retry requests. If ``None`` is specified, requests will
- be retried using a default configuration.
- timeout (Optional[float]): The amount of time, in seconds, to wait
- for the request to complete. Note that if ``retry`` is
- specified, the timeout applies to each individual attempt.
- metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
- that is provided to the method.
-
- Raises:
- google.api_core.exceptions.GoogleAPICallError: If the request
- failed for any reason.
- google.api_core.exceptions.RetryError: If the request failed due
- to a retryable error and retry attempts failed.
- ValueError: If the parameters are invalid.
- """
- # Wrap the transport method to add retry and timeout logic.
- if "delete_app_profile" not in self._inner_api_calls:
- self._inner_api_calls[
- "delete_app_profile"
- ] = google.api_core.gapic_v1.method.wrap_method(
- self.transport.delete_app_profile,
- default_retry=self._method_configs["DeleteAppProfile"].retry,
- default_timeout=self._method_configs["DeleteAppProfile"].timeout,
- client_info=self._client_info,
- )
-
- request = bigtable_instance_admin_pb2.DeleteAppProfileRequest(
- name=name, ignore_warnings=ignore_warnings,
- )
- if metadata is None:
- metadata = []
- metadata = list(metadata)
- try:
- routing_header = [("name", name)]
- except AttributeError:
- pass
- else:
- routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
- routing_header
- )
- metadata.append(routing_metadata)
-
- self._inner_api_calls["delete_app_profile"](
- request, retry=retry, timeout=timeout, metadata=metadata
- )
-
- def get_iam_policy(
- self,
- resource,
- options_=None,
- retry=google.api_core.gapic_v1.method.DEFAULT,
- timeout=google.api_core.gapic_v1.method.DEFAULT,
- metadata=None,
- ):
- """
- Gets the access control policy for an instance resource. Returns an empty
- policy if an instance exists but does not have a policy set.
-
- Example:
- >>> from google.cloud import bigtable_admin_v2
- >>>
- >>> client = bigtable_admin_v2.BigtableInstanceAdminClient()
- >>>
- >>> # TODO: Initialize `resource`:
- >>> resource = ''
- >>>
- >>> response = client.get_iam_policy(resource)
-
- Args:
- resource (str): REQUIRED: The resource for which the policy is being requested.
- See the operation documentation for the appropriate value for this field.
- options_ (Union[dict, ~google.cloud.bigtable_admin_v2.types.GetPolicyOptions]): OPTIONAL: A ``GetPolicyOptions`` object for specifying options to
- ``GetIamPolicy``. This field is only used by Cloud IAM.
-
- If a dict is provided, it must be of the same form as the protobuf
- message :class:`~google.cloud.bigtable_admin_v2.types.GetPolicyOptions`
- retry (Optional[google.api_core.retry.Retry]): A retry object used
- to retry requests. If ``None`` is specified, requests will
- be retried using a default configuration.
- timeout (Optional[float]): The amount of time, in seconds, to wait
- for the request to complete. Note that if ``retry`` is
- specified, the timeout applies to each individual attempt.
- metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
- that is provided to the method.
-
- Returns:
- A :class:`~google.cloud.bigtable_admin_v2.types.Policy` instance.
-
- Raises:
- google.api_core.exceptions.GoogleAPICallError: If the request
- failed for any reason.
- google.api_core.exceptions.RetryError: If the request failed due
- to a retryable error and retry attempts failed.
- ValueError: If the parameters are invalid.
- """
- # Wrap the transport method to add retry and timeout logic.
- if "get_iam_policy" not in self._inner_api_calls:
- self._inner_api_calls[
- "get_iam_policy"
- ] = google.api_core.gapic_v1.method.wrap_method(
- self.transport.get_iam_policy,
- default_retry=self._method_configs["GetIamPolicy"].retry,
- default_timeout=self._method_configs["GetIamPolicy"].timeout,
- client_info=self._client_info,
- )
-
- request = iam_policy_pb2.GetIamPolicyRequest(
- resource=resource, options=options_,
- )
- if metadata is None:
- metadata = []
- metadata = list(metadata)
- try:
- routing_header = [("resource", resource)]
- except AttributeError:
- pass
- else:
- routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
- routing_header
- )
- metadata.append(routing_metadata)
-
- return self._inner_api_calls["get_iam_policy"](
- request, retry=retry, timeout=timeout, metadata=metadata
- )
-
- def set_iam_policy(
- self,
- resource,
- policy,
- retry=google.api_core.gapic_v1.method.DEFAULT,
- timeout=google.api_core.gapic_v1.method.DEFAULT,
- metadata=None,
- ):
- """
- Sets the access control policy on an instance resource. Replaces any
- existing policy.
-
- Example:
- >>> from google.cloud import bigtable_admin_v2
- >>>
- >>> client = bigtable_admin_v2.BigtableInstanceAdminClient()
- >>>
- >>> # TODO: Initialize `resource`:
- >>> resource = ''
- >>>
- >>> # TODO: Initialize `policy`:
- >>> policy = {}
- >>>
- >>> response = client.set_iam_policy(resource, policy)
-
- Args:
- resource (str): REQUIRED: The resource for which the policy is being specified.
- See the operation documentation for the appropriate value for this field.
- policy (Union[dict, ~google.cloud.bigtable_admin_v2.types.Policy]): REQUIRED: The complete policy to be applied to the ``resource``. The
- size of the policy is limited to a few 10s of KB. An empty policy is a
- valid policy but certain Cloud Platform services (such as Projects)
- might reject them.
-
- If a dict is provided, it must be of the same form as the protobuf
- message :class:`~google.cloud.bigtable_admin_v2.types.Policy`
- retry (Optional[google.api_core.retry.Retry]): A retry object used
- to retry requests. If ``None`` is specified, requests will
- be retried using a default configuration.
- timeout (Optional[float]): The amount of time, in seconds, to wait
- for the request to complete. Note that if ``retry`` is
- specified, the timeout applies to each individual attempt.
- metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
- that is provided to the method.
-
- Returns:
- A :class:`~google.cloud.bigtable_admin_v2.types.Policy` instance.
-
- Raises:
- google.api_core.exceptions.GoogleAPICallError: If the request
- failed for any reason.
- google.api_core.exceptions.RetryError: If the request failed due
- to a retryable error and retry attempts failed.
- ValueError: If the parameters are invalid.
- """
- # Wrap the transport method to add retry and timeout logic.
- if "set_iam_policy" not in self._inner_api_calls:
- self._inner_api_calls[
- "set_iam_policy"
- ] = google.api_core.gapic_v1.method.wrap_method(
- self.transport.set_iam_policy,
- default_retry=self._method_configs["SetIamPolicy"].retry,
- default_timeout=self._method_configs["SetIamPolicy"].timeout,
- client_info=self._client_info,
- )
-
- request = iam_policy_pb2.SetIamPolicyRequest(resource=resource, policy=policy,)
- if metadata is None:
- metadata = []
- metadata = list(metadata)
- try:
- routing_header = [("resource", resource)]
- except AttributeError:
- pass
- else:
- routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
- routing_header
- )
- metadata.append(routing_metadata)
-
- return self._inner_api_calls["set_iam_policy"](
- request, retry=retry, timeout=timeout, metadata=metadata
- )
-
- def test_iam_permissions(
- self,
- resource,
- permissions,
- retry=google.api_core.gapic_v1.method.DEFAULT,
- timeout=google.api_core.gapic_v1.method.DEFAULT,
- metadata=None,
- ):
- """
- Returns permissions that the caller has on the specified instance resource.
-
- Example:
- >>> from google.cloud import bigtable_admin_v2
- >>>
- >>> client = bigtable_admin_v2.BigtableInstanceAdminClient()
- >>>
- >>> # TODO: Initialize `resource`:
- >>> resource = ''
- >>>
- >>> # TODO: Initialize `permissions`:
- >>> permissions = []
- >>>
- >>> response = client.test_iam_permissions(resource, permissions)
-
- Args:
- resource (str): REQUIRED: The resource for which the policy detail is being requested.
- See the operation documentation for the appropriate value for this field.
- permissions (list[str]): The set of permissions to check for the ``resource``. Permissions
- with wildcards (such as '*' or 'storage.*') are not allowed. For more
- information see `IAM
- Overview `__.
- retry (Optional[google.api_core.retry.Retry]): A retry object used
- to retry requests. If ``None`` is specified, requests will
- be retried using a default configuration.
- timeout (Optional[float]): The amount of time, in seconds, to wait
- for the request to complete. Note that if ``retry`` is
- specified, the timeout applies to each individual attempt.
- metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
- that is provided to the method.
-
- Returns:
- A :class:`~google.cloud.bigtable_admin_v2.types.TestIamPermissionsResponse` instance.
-
- Raises:
- google.api_core.exceptions.GoogleAPICallError: If the request
- failed for any reason.
- google.api_core.exceptions.RetryError: If the request failed due
- to a retryable error and retry attempts failed.
- ValueError: If the parameters are invalid.
- """
- # Wrap the transport method to add retry and timeout logic.
- if "test_iam_permissions" not in self._inner_api_calls:
- self._inner_api_calls[
- "test_iam_permissions"
- ] = google.api_core.gapic_v1.method.wrap_method(
- self.transport.test_iam_permissions,
- default_retry=self._method_configs["TestIamPermissions"].retry,
- default_timeout=self._method_configs["TestIamPermissions"].timeout,
- client_info=self._client_info,
- )
-
- request = iam_policy_pb2.TestIamPermissionsRequest(
- resource=resource, permissions=permissions,
- )
- if metadata is None:
- metadata = []
- metadata = list(metadata)
- try:
- routing_header = [("resource", resource)]
- except AttributeError:
- pass
- else:
- routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
- routing_header
- )
- metadata.append(routing_metadata)
-
- return self._inner_api_calls["test_iam_permissions"](
- request, retry=retry, timeout=timeout, metadata=metadata
- )
diff --git a/google/cloud/bigtable_admin_v2/gapic/bigtable_instance_admin_client_config.py b/google/cloud/bigtable_admin_v2/gapic/bigtable_instance_admin_client_config.py
deleted file mode 100644
index b2ec35e01..000000000
--- a/google/cloud/bigtable_admin_v2/gapic/bigtable_instance_admin_client_config.py
+++ /dev/null
@@ -1,136 +0,0 @@
-config = {
- "interfaces": {
- "google.bigtable.admin.v2.BigtableInstanceAdmin": {
- "retry_codes": {
- "idempotent": ["DEADLINE_EXCEEDED", "UNAVAILABLE"],
- "non_idempotent": [],
- },
- "retry_params": {
- "idempotent_params": {
- "initial_retry_delay_millis": 1000,
- "retry_delay_multiplier": 2.0,
- "max_retry_delay_millis": 60000,
- "initial_rpc_timeout_millis": 60000,
- "rpc_timeout_multiplier": 1.0,
- "max_rpc_timeout_millis": 60000,
- "total_timeout_millis": 600000,
- },
- "non_idempotent_params": {
- "initial_retry_delay_millis": 0,
- "retry_delay_multiplier": 1.0,
- "max_retry_delay_millis": 0,
- "initial_rpc_timeout_millis": 60000,
- "rpc_timeout_multiplier": 1.0,
- "max_rpc_timeout_millis": 60000,
- "total_timeout_millis": 60000,
- },
- "non_idempotent_heavy_params": {
- "initial_retry_delay_millis": 0,
- "retry_delay_multiplier": 1.0,
- "max_retry_delay_millis": 0,
- "initial_rpc_timeout_millis": 300000,
- "rpc_timeout_multiplier": 1.0,
- "max_rpc_timeout_millis": 300000,
- "total_timeout_millis": 300000,
- },
- },
- "methods": {
- "CreateInstance": {
- "timeout_millis": 60000,
- "retry_codes_name": "non_idempotent",
- "retry_params_name": "non_idempotent_heavy_params",
- },
- "GetInstance": {
- "timeout_millis": 60000,
- "retry_codes_name": "idempotent",
- "retry_params_name": "idempotent_params",
- },
- "ListInstances": {
- "timeout_millis": 60000,
- "retry_codes_name": "idempotent",
- "retry_params_name": "idempotent_params",
- },
- "UpdateInstance": {
- "timeout_millis": 60000,
- "retry_codes_name": "idempotent",
- "retry_params_name": "idempotent_params",
- },
- "PartialUpdateInstance": {
- "timeout_millis": 60000,
- "retry_codes_name": "idempotent",
- "retry_params_name": "idempotent_params",
- },
- "DeleteInstance": {
- "timeout_millis": 60000,
- "retry_codes_name": "non_idempotent",
- "retry_params_name": "non_idempotent_params",
- },
- "CreateCluster": {
- "timeout_millis": 60000,
- "retry_codes_name": "non_idempotent",
- "retry_params_name": "non_idempotent_params",
- },
- "GetCluster": {
- "timeout_millis": 60000,
- "retry_codes_name": "idempotent",
- "retry_params_name": "idempotent_params",
- },
- "ListClusters": {
- "timeout_millis": 60000,
- "retry_codes_name": "idempotent",
- "retry_params_name": "idempotent_params",
- },
- "UpdateCluster": {
- "timeout_millis": 60000,
- "retry_codes_name": "idempotent",
- "retry_params_name": "idempotent_params",
- },
- "DeleteCluster": {
- "timeout_millis": 60000,
- "retry_codes_name": "non_idempotent",
- "retry_params_name": "non_idempotent_params",
- },
- "CreateAppProfile": {
- "timeout_millis": 60000,
- "retry_codes_name": "non_idempotent",
- "retry_params_name": "non_idempotent_params",
- },
- "GetAppProfile": {
- "timeout_millis": 60000,
- "retry_codes_name": "idempotent",
- "retry_params_name": "idempotent_params",
- },
- "ListAppProfiles": {
- "timeout_millis": 60000,
- "retry_codes_name": "idempotent",
- "retry_params_name": "idempotent_params",
- },
- "UpdateAppProfile": {
- "timeout_millis": 60000,
- "retry_codes_name": "idempotent",
- "retry_params_name": "idempotent_params",
- },
- "DeleteAppProfile": {
- "timeout_millis": 60000,
- "retry_codes_name": "non_idempotent",
- "retry_params_name": "non_idempotent_params",
- },
- "GetIamPolicy": {
- "timeout_millis": 60000,
- "retry_codes_name": "idempotent",
- "retry_params_name": "idempotent_params",
- },
- "SetIamPolicy": {
- "timeout_millis": 60000,
- "retry_codes_name": "non_idempotent",
- "retry_params_name": "non_idempotent_params",
- },
- "TestIamPermissions": {
- "timeout_millis": 60000,
- "retry_codes_name": "idempotent",
- "retry_params_name": "idempotent_params",
- },
- },
- }
- }
-}
diff --git a/google/cloud/bigtable_admin_v2/gapic/bigtable_table_admin_client.py b/google/cloud/bigtable_admin_v2/gapic/bigtable_table_admin_client.py
deleted file mode 100644
index cac517314..000000000
--- a/google/cloud/bigtable_admin_v2/gapic/bigtable_table_admin_client.py
+++ /dev/null
@@ -1,2292 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# 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
-#
-# https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""Accesses the google.bigtable.admin.v2 BigtableTableAdmin API."""
-
-import functools
-import pkg_resources
-import warnings
-
-from google.oauth2 import service_account
-import google.api_core.client_options
-import google.api_core.gapic_v1.client_info
-import google.api_core.gapic_v1.config
-import google.api_core.gapic_v1.method
-import google.api_core.gapic_v1.routing_header
-import google.api_core.grpc_helpers
-import google.api_core.operation
-import google.api_core.operations_v1
-import google.api_core.page_iterator
-import google.api_core.path_template
-import google.api_core.protobuf_helpers
-import grpc
-
-from google.cloud.bigtable_admin_v2.gapic import bigtable_table_admin_client_config
-from google.cloud.bigtable_admin_v2.gapic import enums
-from google.cloud.bigtable_admin_v2.gapic.transports import (
- bigtable_table_admin_grpc_transport,
-)
-from google.cloud.bigtable_admin_v2.proto import bigtable_instance_admin_pb2
-from google.cloud.bigtable_admin_v2.proto import bigtable_instance_admin_pb2_grpc
-from google.cloud.bigtable_admin_v2.proto import bigtable_table_admin_pb2
-from google.cloud.bigtable_admin_v2.proto import bigtable_table_admin_pb2_grpc
-from google.cloud.bigtable_admin_v2.proto import instance_pb2
-from google.cloud.bigtable_admin_v2.proto import table_pb2
-from google.iam.v1 import iam_policy_pb2
-from google.iam.v1 import options_pb2
-from google.iam.v1 import policy_pb2
-from google.longrunning import operations_pb2
-from google.protobuf import duration_pb2
-from google.protobuf import empty_pb2
-from google.protobuf import field_mask_pb2
-
-
-_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution(
- "google-cloud-bigtable",
-).version
-
-
-class BigtableTableAdminClient(object):
- """
- Service for creating, configuring, and deleting Cloud Bigtable tables.
-
-
- Provides access to the table schemas only, not the data stored within
- the tables.
- """
-
- SERVICE_ADDRESS = "bigtableadmin.googleapis.com:443"
- """The default address of the service."""
-
- # The name of the interface for this client. This is the key used to
- # find the method configuration in the client_config dictionary.
- _INTERFACE_NAME = "google.bigtable.admin.v2.BigtableTableAdmin"
-
- @classmethod
- def from_service_account_file(cls, filename, *args, **kwargs):
- """Creates an instance of this client using the provided credentials
- file.
-
- Args:
- filename (str): The path to the service account private key json
- file.
- args: Additional arguments to pass to the constructor.
- kwargs: Additional arguments to pass to the constructor.
-
- Returns:
- BigtableTableAdminClient: The constructed client.
- """
- credentials = service_account.Credentials.from_service_account_file(filename)
- kwargs["credentials"] = credentials
- return cls(*args, **kwargs)
-
- from_service_account_json = from_service_account_file
-
- @classmethod
- def backup_path(cls, project, instance, cluster, backup):
- """Return a fully-qualified backup string."""
- return google.api_core.path_template.expand(
- "projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}",
- project=project,
- instance=instance,
- cluster=cluster,
- backup=backup,
- )
-
- @classmethod
- def cluster_path(cls, project, instance, cluster):
- """Return a fully-qualified cluster string."""
- return google.api_core.path_template.expand(
- "projects/{project}/instances/{instance}/clusters/{cluster}",
- project=project,
- instance=instance,
- cluster=cluster,
- )
-
- @classmethod
- def instance_path(cls, project, instance):
- """Return a fully-qualified instance string."""
- return google.api_core.path_template.expand(
- "projects/{project}/instances/{instance}",
- project=project,
- instance=instance,
- )
-
- @classmethod
- def snapshot_path(cls, project, instance, cluster, snapshot):
- """Return a fully-qualified snapshot string."""
- return google.api_core.path_template.expand(
- "projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}",
- project=project,
- instance=instance,
- cluster=cluster,
- snapshot=snapshot,
- )
-
- @classmethod
- def table_path(cls, project, instance, table):
- """Return a fully-qualified table string."""
- return google.api_core.path_template.expand(
- "projects/{project}/instances/{instance}/tables/{table}",
- project=project,
- instance=instance,
- table=table,
- )
-
- def __init__(
- self,
- transport=None,
- channel=None,
- credentials=None,
- client_config=None,
- client_info=None,
- client_options=None,
- ):
- """Constructor.
-
- Args:
- transport (Union[~.BigtableTableAdminGrpcTransport,
- Callable[[~.Credentials, type], ~.BigtableTableAdminGrpcTransport]): A transport
- instance, responsible for actually making the API calls.
- The default transport uses the gRPC protocol.
- This argument may also be a callable which returns a
- transport instance. Callables will be sent the credentials
- as the first argument and the default transport class as
- the second argument.
- channel (grpc.Channel): DEPRECATED. A ``Channel`` instance
- through which to make calls. This argument is mutually exclusive
- with ``credentials``; providing both will raise an exception.
- credentials (google.auth.credentials.Credentials): The
- authorization credentials to attach to requests. These
- credentials identify this application to the service. If none
- are specified, the client will attempt to ascertain the
- credentials from the environment.
- This argument is mutually exclusive with providing a
- transport instance to ``transport``; doing so will raise
- an exception.
- client_config (dict): DEPRECATED. A dictionary of call options for
- each method. If not specified, the default configuration is used.
- client_info (google.api_core.gapic_v1.client_info.ClientInfo):
- The client info used to send a user-agent string along with
- API requests. If ``None``, then default info will be used.
- Generally, you only need to set this if you're developing
- your own client library.
- client_options (Union[dict, google.api_core.client_options.ClientOptions]):
- Client options used to set user options on the client. API Endpoint
- should be set through client_options.
- """
- # Raise deprecation warnings for things we want to go away.
- if client_config is not None:
- warnings.warn(
- "The `client_config` argument is deprecated.",
- PendingDeprecationWarning,
- stacklevel=2,
- )
- else:
- client_config = bigtable_table_admin_client_config.config
-
- if channel:
- warnings.warn(
- "The `channel` argument is deprecated; use " "`transport` instead.",
- PendingDeprecationWarning,
- stacklevel=2,
- )
-
- api_endpoint = self.SERVICE_ADDRESS
- if client_options:
- if type(client_options) == dict:
- client_options = google.api_core.client_options.from_dict(
- client_options
- )
- if client_options.api_endpoint:
- api_endpoint = client_options.api_endpoint
-
- # Instantiate the transport.
- # The transport is responsible for handling serialization and
- # deserialization and actually sending data to the service.
- if transport:
- if callable(transport):
- self.transport = transport(
- credentials=credentials,
- default_class=bigtable_table_admin_grpc_transport.BigtableTableAdminGrpcTransport,
- address=api_endpoint,
- )
- else:
- if credentials:
- raise ValueError(
- "Received both a transport instance and "
- "credentials; these are mutually exclusive."
- )
- self.transport = transport
- else:
- self.transport = bigtable_table_admin_grpc_transport.BigtableTableAdminGrpcTransport(
- address=api_endpoint, channel=channel, credentials=credentials,
- )
-
- if client_info is None:
- client_info = google.api_core.gapic_v1.client_info.ClientInfo(
- gapic_version=_GAPIC_LIBRARY_VERSION,
- )
- else:
- client_info.gapic_version = _GAPIC_LIBRARY_VERSION
- self._client_info = client_info
-
- # Parse out the default settings for retry and timeout for each RPC
- # from the client configuration.
- # (Ordinarily, these are the defaults specified in the `*_config.py`
- # file next to this one.)
- self._method_configs = google.api_core.gapic_v1.config.parse_method_configs(
- client_config["interfaces"][self._INTERFACE_NAME],
- )
-
- # Save a dictionary of cached API call functions.
- # These are the actual callables which invoke the proper
- # transport methods, wrapped with `wrap_method` to add retry,
- # timeout, and the like.
- self._inner_api_calls = {}
-
- # Service calls
- def create_table(
- self,
- parent,
- table_id,
- table,
- initial_splits=None,
- retry=google.api_core.gapic_v1.method.DEFAULT,
- timeout=google.api_core.gapic_v1.method.DEFAULT,
- metadata=None,
- ):
- """
- Creates a new table in the specified instance.
- The table can be created with a full set of initial column families,
- specified in the request.
-
- Example:
- >>> from google.cloud import bigtable_admin_v2
- >>>
- >>> client = bigtable_admin_v2.BigtableTableAdminClient()
- >>>
- >>> parent = client.instance_path('[PROJECT]', '[INSTANCE]')
- >>>
- >>> # TODO: Initialize `table_id`:
- >>> table_id = ''
- >>>
- >>> # TODO: Initialize `table`:
- >>> table = {}
- >>>
- >>> response = client.create_table(parent, table_id, table)
-
- Args:
- parent (str): Required. The unique name of the instance in which to create the
- table. Values are of the form
- ``projects/{project}/instances/{instance}``.
- table_id (str): Required. The name by which the new table should be referred to
- within the parent instance, e.g., ``foobar`` rather than
- ``{parent}/tables/foobar``. Maximum 50 characters.
- table (Union[dict, ~google.cloud.bigtable_admin_v2.types.Table]): Required. The Table to create.
-
- If a dict is provided, it must be of the same form as the protobuf
- message :class:`~google.cloud.bigtable_admin_v2.types.Table`
- initial_splits (list[Union[dict, ~google.cloud.bigtable_admin_v2.types.Split]]): The optional list of row keys that will be used to initially split
- the table into several tablets (tablets are similar to HBase regions).
- Given two split keys, ``s1`` and ``s2``, three tablets will be created,
- spanning the key ranges: ``[, s1), [s1, s2), [s2, )``.
-
- Example:
-
- - Row keys := ``["a", "apple", "custom", "customer_1", "customer_2",``
- ``"other", "zz"]``
- - initial_split_keys :=
- ``["apple", "customer_1", "customer_2", "other"]``
- - Key assignment:
-
- - Tablet 1 ``[, apple) => {"a"}.``
- - Tablet 2 ``[apple, customer_1) => {"apple", "custom"}.``
- - Tablet 3 ``[customer_1, customer_2) => {"customer_1"}.``
- - Tablet 4 ``[customer_2, other) => {"customer_2"}.``
- - Tablet 5 ``[other, ) => {"other", "zz"}.``
-
- If a dict is provided, it must be of the same form as the protobuf
- message :class:`~google.cloud.bigtable_admin_v2.types.Split`
- retry (Optional[google.api_core.retry.Retry]): A retry object used
- to retry requests. If ``None`` is specified, requests will
- be retried using a default configuration.
- timeout (Optional[float]): The amount of time, in seconds, to wait
- for the request to complete. Note that if ``retry`` is
- specified, the timeout applies to each individual attempt.
- metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
- that is provided to the method.
-
- Returns:
- A :class:`~google.cloud.bigtable_admin_v2.types.Table` instance.
-
- Raises:
- google.api_core.exceptions.GoogleAPICallError: If the request
- failed for any reason.
- google.api_core.exceptions.RetryError: If the request failed due
- to a retryable error and retry attempts failed.
- ValueError: If the parameters are invalid.
- """
- # Wrap the transport method to add retry and timeout logic.
- if "create_table" not in self._inner_api_calls:
- self._inner_api_calls[
- "create_table"
- ] = google.api_core.gapic_v1.method.wrap_method(
- self.transport.create_table,
- default_retry=self._method_configs["CreateTable"].retry,
- default_timeout=self._method_configs["CreateTable"].timeout,
- client_info=self._client_info,
- )
-
- request = bigtable_table_admin_pb2.CreateTableRequest(
- parent=parent,
- table_id=table_id,
- table=table,
- initial_splits=initial_splits,
- )
- if metadata is None:
- metadata = []
- metadata = list(metadata)
- try:
- routing_header = [("parent", parent)]
- except AttributeError:
- pass
- else:
- routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
- routing_header
- )
- metadata.append(routing_metadata)
-
- return self._inner_api_calls["create_table"](
- request, retry=retry, timeout=timeout, metadata=metadata
- )
-
- def create_table_from_snapshot(
- self,
- parent,
- table_id,
- source_snapshot,
- retry=google.api_core.gapic_v1.method.DEFAULT,
- timeout=google.api_core.gapic_v1.method.DEFAULT,
- metadata=None,
- ):
- """
- Creates a new table from the specified snapshot. The target table must
- not exist. The snapshot and the table must be in the same instance.
-
- Note: This is a private alpha release of Cloud Bigtable snapshots. This
- feature is not currently available to most Cloud Bigtable customers. This
- feature might be changed in backward-incompatible ways and is not
- recommended for production use. It is not subject to any SLA or deprecation
- policy.
-
- Example:
- >>> from google.cloud import bigtable_admin_v2
- >>>
- >>> client = bigtable_admin_v2.BigtableTableAdminClient()
- >>>
- >>> parent = client.instance_path('[PROJECT]', '[INSTANCE]')
- >>>
- >>> # TODO: Initialize `table_id`:
- >>> table_id = ''
- >>> source_snapshot = client.snapshot_path('[PROJECT]', '[INSTANCE]', '[CLUSTER]', '[SNAPSHOT]')
- >>>
- >>> response = client.create_table_from_snapshot(parent, table_id, source_snapshot)
- >>>
- >>> def callback(operation_future):
- ... # Handle result.
- ... result = operation_future.result()
- >>>
- >>> response.add_done_callback(callback)
- >>>
- >>> # Handle metadata.
- >>> metadata = response.metadata()
-
- Args:
- parent (str): Required. The unique name of the instance in which to create the
- table. Values are of the form
- ``projects/{project}/instances/{instance}``.
- table_id (str): Required. The name by which the new table should be referred to
- within the parent instance, e.g., ``foobar`` rather than
- ``{parent}/tables/foobar``.
- source_snapshot (str): Required. The unique name of the snapshot from which to restore the
- table. The snapshot and the table must be in the same instance. Values
- are of the form
- ``projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}``.
- retry (Optional[google.api_core.retry.Retry]): A retry object used
- to retry requests. If ``None`` is specified, requests will
- be retried using a default configuration.
- timeout (Optional[float]): The amount of time, in seconds, to wait
- for the request to complete. Note that if ``retry`` is
- specified, the timeout applies to each individual attempt.
- metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
- that is provided to the method.
-
- Returns:
- A :class:`~google.cloud.bigtable_admin_v2.types._OperationFuture` instance.
-
- Raises:
- google.api_core.exceptions.GoogleAPICallError: If the request
- failed for any reason.
- google.api_core.exceptions.RetryError: If the request failed due
- to a retryable error and retry attempts failed.
- ValueError: If the parameters are invalid.
- """
- # Wrap the transport method to add retry and timeout logic.
- if "create_table_from_snapshot" not in self._inner_api_calls:
- self._inner_api_calls[
- "create_table_from_snapshot"
- ] = google.api_core.gapic_v1.method.wrap_method(
- self.transport.create_table_from_snapshot,
- default_retry=self._method_configs["CreateTableFromSnapshot"].retry,
- default_timeout=self._method_configs["CreateTableFromSnapshot"].timeout,
- client_info=self._client_info,
- )
-
- request = bigtable_table_admin_pb2.CreateTableFromSnapshotRequest(
- parent=parent, table_id=table_id, source_snapshot=source_snapshot,
- )
- if metadata is None:
- metadata = []
- metadata = list(metadata)
- try:
- routing_header = [("parent", parent)]
- except AttributeError:
- pass
- else:
- routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
- routing_header
- )
- metadata.append(routing_metadata)
-
- operation = self._inner_api_calls["create_table_from_snapshot"](
- request, retry=retry, timeout=timeout, metadata=metadata
- )
- return google.api_core.operation.from_gapic(
- operation,
- self.transport._operations_client,
- table_pb2.Table,
- metadata_type=bigtable_table_admin_pb2.CreateTableFromSnapshotMetadata,
- )
-
- def list_tables(
- self,
- parent,
- view=None,
- page_size=None,
- retry=google.api_core.gapic_v1.method.DEFAULT,
- timeout=google.api_core.gapic_v1.method.DEFAULT,
- metadata=None,
- ):
- """
- Lists all tables served from a specified instance.
-
- Example:
- >>> from google.cloud import bigtable_admin_v2
- >>>
- >>> client = bigtable_admin_v2.BigtableTableAdminClient()
- >>>
- >>> parent = client.instance_path('[PROJECT]', '[INSTANCE]')
- >>>
- >>> # Iterate over all results
- >>> for element in client.list_tables(parent):
- ... # process element
- ... pass
- >>>
- >>>
- >>> # Alternatively:
- >>>
- >>> # Iterate over results one page at a time
- >>> for page in client.list_tables(parent).pages:
- ... for element in page:
- ... # process element
- ... pass
-
- Args:
- parent (str): Required. The unique name of the instance for which tables should be
- listed. Values are of the form
- ``projects/{project}/instances/{instance}``.
- view (~google.cloud.bigtable_admin_v2.types.View): The view to be applied to the returned tables' fields. Only
- NAME_ONLY view (default) and REPLICATION_VIEW are supported.
- page_size (int): The maximum number of resources contained in the
- underlying API response. If page streaming is performed per-
- resource, this parameter does not affect the return value. If page
- streaming is performed per-page, this determines the maximum number
- of resources in a page.
- retry (Optional[google.api_core.retry.Retry]): A retry object used
- to retry requests. If ``None`` is specified, requests will
- be retried using a default configuration.
- timeout (Optional[float]): The amount of time, in seconds, to wait
- for the request to complete. Note that if ``retry`` is
- specified, the timeout applies to each individual attempt.
- metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
- that is provided to the method.
-
- Returns:
- A :class:`~google.api_core.page_iterator.PageIterator` instance.
- An iterable of :class:`~google.cloud.bigtable_admin_v2.types.Table` instances.
- You can also iterate over the pages of the response
- using its `pages` property.
-
- Raises:
- google.api_core.exceptions.GoogleAPICallError: If the request
- failed for any reason.
- google.api_core.exceptions.RetryError: If the request failed due
- to a retryable error and retry attempts failed.
- ValueError: If the parameters are invalid.
- """
- # Wrap the transport method to add retry and timeout logic.
- if "list_tables" not in self._inner_api_calls:
- self._inner_api_calls[
- "list_tables"
- ] = google.api_core.gapic_v1.method.wrap_method(
- self.transport.list_tables,
- default_retry=self._method_configs["ListTables"].retry,
- default_timeout=self._method_configs["ListTables"].timeout,
- client_info=self._client_info,
- )
-
- request = bigtable_table_admin_pb2.ListTablesRequest(
- parent=parent, view=view, page_size=page_size,
- )
- if metadata is None:
- metadata = []
- metadata = list(metadata)
- try:
- routing_header = [("parent", parent)]
- except AttributeError:
- pass
- else:
- routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
- routing_header
- )
- metadata.append(routing_metadata)
-
- iterator = google.api_core.page_iterator.GRPCIterator(
- client=None,
- method=functools.partial(
- self._inner_api_calls["list_tables"],
- retry=retry,
- timeout=timeout,
- metadata=metadata,
- ),
- request=request,
- items_field="tables",
- request_token_field="page_token",
- response_token_field="next_page_token",
- )
- return iterator
-
- def get_table(
- self,
- name,
- view=None,
- retry=google.api_core.gapic_v1.method.DEFAULT,
- timeout=google.api_core.gapic_v1.method.DEFAULT,
- metadata=None,
- ):
- """
- Gets metadata information about the specified table.
-
- Example:
- >>> from google.cloud import bigtable_admin_v2
- >>>
- >>> client = bigtable_admin_v2.BigtableTableAdminClient()
- >>>
- >>> name = client.table_path('[PROJECT]', '[INSTANCE]', '[TABLE]')
- >>>
- >>> response = client.get_table(name)
-
- Args:
- name (str): Required. The unique name of the requested table. Values are of the
- form ``projects/{project}/instances/{instance}/tables/{table}``.
- view (~google.cloud.bigtable_admin_v2.types.View): The view to be applied to the returned table's fields. Defaults to
- ``SCHEMA_VIEW`` if unspecified.
- retry (Optional[google.api_core.retry.Retry]): A retry object used
- to retry requests. If ``None`` is specified, requests will
- be retried using a default configuration.
- timeout (Optional[float]): The amount of time, in seconds, to wait
- for the request to complete. Note that if ``retry`` is
- specified, the timeout applies to each individual attempt.
- metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
- that is provided to the method.
-
- Returns:
- A :class:`~google.cloud.bigtable_admin_v2.types.Table` instance.
-
- Raises:
- google.api_core.exceptions.GoogleAPICallError: If the request
- failed for any reason.
- google.api_core.exceptions.RetryError: If the request failed due
- to a retryable error and retry attempts failed.
- ValueError: If the parameters are invalid.
- """
- # Wrap the transport method to add retry and timeout logic.
- if "get_table" not in self._inner_api_calls:
- self._inner_api_calls[
- "get_table"
- ] = google.api_core.gapic_v1.method.wrap_method(
- self.transport.get_table,
- default_retry=self._method_configs["GetTable"].retry,
- default_timeout=self._method_configs["GetTable"].timeout,
- client_info=self._client_info,
- )
-
- request = bigtable_table_admin_pb2.GetTableRequest(name=name, view=view,)
- if metadata is None:
- metadata = []
- metadata = list(metadata)
- try:
- routing_header = [("name", name)]
- except AttributeError:
- pass
- else:
- routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
- routing_header
- )
- metadata.append(routing_metadata)
-
- return self._inner_api_calls["get_table"](
- request, retry=retry, timeout=timeout, metadata=metadata
- )
-
- def delete_table(
- self,
- name,
- retry=google.api_core.gapic_v1.method.DEFAULT,
- timeout=google.api_core.gapic_v1.method.DEFAULT,
- metadata=None,
- ):
- """
- Permanently deletes a specified table and all of its data.
-
- Example:
- >>> from google.cloud import bigtable_admin_v2
- >>>
- >>> client = bigtable_admin_v2.BigtableTableAdminClient()
- >>>
- >>> name = client.table_path('[PROJECT]', '[INSTANCE]', '[TABLE]')
- >>>
- >>> client.delete_table(name)
-
- Args:
- name (str): Required. The unique name of the table to be deleted. Values are of
- the form ``projects/{project}/instances/{instance}/tables/{table}``.
- retry (Optional[google.api_core.retry.Retry]): A retry object used
- to retry requests. If ``None`` is specified, requests will
- be retried using a default configuration.
- timeout (Optional[float]): The amount of time, in seconds, to wait
- for the request to complete. Note that if ``retry`` is
- specified, the timeout applies to each individual attempt.
- metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
- that is provided to the method.
-
- Raises:
- google.api_core.exceptions.GoogleAPICallError: If the request
- failed for any reason.
- google.api_core.exceptions.RetryError: If the request failed due
- to a retryable error and retry attempts failed.
- ValueError: If the parameters are invalid.
- """
- # Wrap the transport method to add retry and timeout logic.
- if "delete_table" not in self._inner_api_calls:
- self._inner_api_calls[
- "delete_table"
- ] = google.api_core.gapic_v1.method.wrap_method(
- self.transport.delete_table,
- default_retry=self._method_configs["DeleteTable"].retry,
- default_timeout=self._method_configs["DeleteTable"].timeout,
- client_info=self._client_info,
- )
-
- request = bigtable_table_admin_pb2.DeleteTableRequest(name=name,)
- if metadata is None:
- metadata = []
- metadata = list(metadata)
- try:
- routing_header = [("name", name)]
- except AttributeError:
- pass
- else:
- routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
- routing_header
- )
- metadata.append(routing_metadata)
-
- self._inner_api_calls["delete_table"](
- request, retry=retry, timeout=timeout, metadata=metadata
- )
-
- def modify_column_families(
- self,
- name,
- modifications,
- retry=google.api_core.gapic_v1.method.DEFAULT,
- timeout=google.api_core.gapic_v1.method.DEFAULT,
- metadata=None,
- ):
- """
- Performs a series of column family modifications on the specified table.
- Either all or none of the modifications will occur before this method
- returns, but data requests received prior to that point may see a table
- where only some modifications have taken effect.
-
- Example:
- >>> from google.cloud import bigtable_admin_v2
- >>>
- >>> client = bigtable_admin_v2.BigtableTableAdminClient()
- >>>
- >>> name = client.table_path('[PROJECT]', '[INSTANCE]', '[TABLE]')
- >>>
- >>> # TODO: Initialize `modifications`:
- >>> modifications = []
- >>>
- >>> response = client.modify_column_families(name, modifications)
-
- Args:
- name (str): Required. The unique name of the table whose families should be
- modified. Values are of the form
- ``projects/{project}/instances/{instance}/tables/{table}``.
- modifications (list[Union[dict, ~google.cloud.bigtable_admin_v2.types.Modification]]): Required. Modifications to be atomically applied to the specified table's
- families. Entries are applied in order, meaning that earlier modifications
- can be masked by later ones (in the case of repeated updates to the same
- family, for example).
-
- If a dict is provided, it must be of the same form as the protobuf
- message :class:`~google.cloud.bigtable_admin_v2.types.Modification`
- retry (Optional[google.api_core.retry.Retry]): A retry object used
- to retry requests. If ``None`` is specified, requests will
- be retried using a default configuration.
- timeout (Optional[float]): The amount of time, in seconds, to wait
- for the request to complete. Note that if ``retry`` is
- specified, the timeout applies to each individual attempt.
- metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
- that is provided to the method.
-
- Returns:
- A :class:`~google.cloud.bigtable_admin_v2.types.Table` instance.
-
- Raises:
- google.api_core.exceptions.GoogleAPICallError: If the request
- failed for any reason.
- google.api_core.exceptions.RetryError: If the request failed due
- to a retryable error and retry attempts failed.
- ValueError: If the parameters are invalid.
- """
- # Wrap the transport method to add retry and timeout logic.
- if "modify_column_families" not in self._inner_api_calls:
- self._inner_api_calls[
- "modify_column_families"
- ] = google.api_core.gapic_v1.method.wrap_method(
- self.transport.modify_column_families,
- default_retry=self._method_configs["ModifyColumnFamilies"].retry,
- default_timeout=self._method_configs["ModifyColumnFamilies"].timeout,
- client_info=self._client_info,
- )
-
- request = bigtable_table_admin_pb2.ModifyColumnFamiliesRequest(
- name=name, modifications=modifications,
- )
- if metadata is None:
- metadata = []
- metadata = list(metadata)
- try:
- routing_header = [("name", name)]
- except AttributeError:
- pass
- else:
- routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
- routing_header
- )
- metadata.append(routing_metadata)
-
- return self._inner_api_calls["modify_column_families"](
- request, retry=retry, timeout=timeout, metadata=metadata
- )
-
- def drop_row_range(
- self,
- name,
- row_key_prefix=None,
- delete_all_data_from_table=None,
- retry=google.api_core.gapic_v1.method.DEFAULT,
- timeout=google.api_core.gapic_v1.method.DEFAULT,
- metadata=None,
- ):
- """
- Permanently drop/delete a row range from a specified table. The request can
- specify whether to delete all rows in a table, or only those that match a
- particular prefix.
-
- Example:
- >>> from google.cloud import bigtable_admin_v2
- >>>
- >>> client = bigtable_admin_v2.BigtableTableAdminClient()
- >>>
- >>> name = client.table_path('[PROJECT]', '[INSTANCE]', '[TABLE]')
- >>>
- >>> client.drop_row_range(name)
-
- Args:
- name (str): Required. The unique name of the table on which to drop a range of
- rows. Values are of the form
- ``projects/{project}/instances/{instance}/tables/{table}``.
- row_key_prefix (bytes): Delete all rows that start with this row key prefix. Prefix cannot be
- zero length.
- delete_all_data_from_table (bool): Delete all rows in the table. Setting this to false is a no-op.
- retry (Optional[google.api_core.retry.Retry]): A retry object used
- to retry requests. If ``None`` is specified, requests will
- be retried using a default configuration.
- timeout (Optional[float]): The amount of time, in seconds, to wait
- for the request to complete. Note that if ``retry`` is
- specified, the timeout applies to each individual attempt.
- metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
- that is provided to the method.
-
- Raises:
- google.api_core.exceptions.GoogleAPICallError: If the request
- failed for any reason.
- google.api_core.exceptions.RetryError: If the request failed due
- to a retryable error and retry attempts failed.
- ValueError: If the parameters are invalid.
- """
- # Wrap the transport method to add retry and timeout logic.
- if "drop_row_range" not in self._inner_api_calls:
- self._inner_api_calls[
- "drop_row_range"
- ] = google.api_core.gapic_v1.method.wrap_method(
- self.transport.drop_row_range,
- default_retry=self._method_configs["DropRowRange"].retry,
- default_timeout=self._method_configs["DropRowRange"].timeout,
- client_info=self._client_info,
- )
-
- # Sanity check: We have some fields which are mutually exclusive;
- # raise ValueError if more than one is sent.
- google.api_core.protobuf_helpers.check_oneof(
- row_key_prefix=row_key_prefix,
- delete_all_data_from_table=delete_all_data_from_table,
- )
-
- request = bigtable_table_admin_pb2.DropRowRangeRequest(
- name=name,
- row_key_prefix=row_key_prefix,
- delete_all_data_from_table=delete_all_data_from_table,
- )
- if metadata is None:
- metadata = []
- metadata = list(metadata)
- try:
- routing_header = [("name", name)]
- except AttributeError:
- pass
- else:
- routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
- routing_header
- )
- metadata.append(routing_metadata)
-
- self._inner_api_calls["drop_row_range"](
- request, retry=retry, timeout=timeout, metadata=metadata
- )
-
- def generate_consistency_token(
- self,
- name,
- retry=google.api_core.gapic_v1.method.DEFAULT,
- timeout=google.api_core.gapic_v1.method.DEFAULT,
- metadata=None,
- ):
- """
- Generates a consistency token for a Table, which can be used in
- CheckConsistency to check whether mutations to the table that finished
- before this call started have been replicated. The tokens will be available
- for 90 days.
-
- Example:
- >>> from google.cloud import bigtable_admin_v2
- >>>
- >>> client = bigtable_admin_v2.BigtableTableAdminClient()
- >>>
- >>> name = client.table_path('[PROJECT]', '[INSTANCE]', '[TABLE]')
- >>>
- >>> response = client.generate_consistency_token(name)
-
- Args:
- name (str): Required. The unique name of the Table for which to create a
- consistency token. Values are of the form
- ``projects/{project}/instances/{instance}/tables/{table}``.
- retry (Optional[google.api_core.retry.Retry]): A retry object used
- to retry requests. If ``None`` is specified, requests will
- be retried using a default configuration.
- timeout (Optional[float]): The amount of time, in seconds, to wait
- for the request to complete. Note that if ``retry`` is
- specified, the timeout applies to each individual attempt.
- metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
- that is provided to the method.
-
- Returns:
- A :class:`~google.cloud.bigtable_admin_v2.types.GenerateConsistencyTokenResponse` instance.
-
- Raises:
- google.api_core.exceptions.GoogleAPICallError: If the request
- failed for any reason.
- google.api_core.exceptions.RetryError: If the request failed due
- to a retryable error and retry attempts failed.
- ValueError: If the parameters are invalid.
- """
- # Wrap the transport method to add retry and timeout logic.
- if "generate_consistency_token" not in self._inner_api_calls:
- self._inner_api_calls[
- "generate_consistency_token"
- ] = google.api_core.gapic_v1.method.wrap_method(
- self.transport.generate_consistency_token,
- default_retry=self._method_configs["GenerateConsistencyToken"].retry,
- default_timeout=self._method_configs[
- "GenerateConsistencyToken"
- ].timeout,
- client_info=self._client_info,
- )
-
- request = bigtable_table_admin_pb2.GenerateConsistencyTokenRequest(name=name,)
- if metadata is None:
- metadata = []
- metadata = list(metadata)
- try:
- routing_header = [("name", name)]
- except AttributeError:
- pass
- else:
- routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
- routing_header
- )
- metadata.append(routing_metadata)
-
- return self._inner_api_calls["generate_consistency_token"](
- request, retry=retry, timeout=timeout, metadata=metadata
- )
-
- def check_consistency(
- self,
- name,
- consistency_token,
- retry=google.api_core.gapic_v1.method.DEFAULT,
- timeout=google.api_core.gapic_v1.method.DEFAULT,
- metadata=None,
- ):
- """
- Checks replication consistency based on a consistency token, that is, if
- replication has caught up based on the conditions specified in the token
- and the check request.
-
- Example:
- >>> from google.cloud import bigtable_admin_v2
- >>>
- >>> client = bigtable_admin_v2.BigtableTableAdminClient()
- >>>
- >>> name = client.table_path('[PROJECT]', '[INSTANCE]', '[TABLE]')
- >>>
- >>> # TODO: Initialize `consistency_token`:
- >>> consistency_token = ''
- >>>
- >>> response = client.check_consistency(name, consistency_token)
-
- Args:
- name (str): Required. The unique name of the Table for which to check
- replication consistency. Values are of the form
- ``projects/{project}/instances/{instance}/tables/{table}``.
- consistency_token (str): Required. The token created using GenerateConsistencyToken for the Table.
- retry (Optional[google.api_core.retry.Retry]): A retry object used
- to retry requests. If ``None`` is specified, requests will
- be retried using a default configuration.
- timeout (Optional[float]): The amount of time, in seconds, to wait
- for the request to complete. Note that if ``retry`` is
- specified, the timeout applies to each individual attempt.
- metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
- that is provided to the method.
-
- Returns:
- A :class:`~google.cloud.bigtable_admin_v2.types.CheckConsistencyResponse` instance.
-
- Raises:
- google.api_core.exceptions.GoogleAPICallError: If the request
- failed for any reason.
- google.api_core.exceptions.RetryError: If the request failed due
- to a retryable error and retry attempts failed.
- ValueError: If the parameters are invalid.
- """
- # Wrap the transport method to add retry and timeout logic.
- if "check_consistency" not in self._inner_api_calls:
- self._inner_api_calls[
- "check_consistency"
- ] = google.api_core.gapic_v1.method.wrap_method(
- self.transport.check_consistency,
- default_retry=self._method_configs["CheckConsistency"].retry,
- default_timeout=self._method_configs["CheckConsistency"].timeout,
- client_info=self._client_info,
- )
-
- request = bigtable_table_admin_pb2.CheckConsistencyRequest(
- name=name, consistency_token=consistency_token,
- )
- if metadata is None:
- metadata = []
- metadata = list(metadata)
- try:
- routing_header = [("name", name)]
- except AttributeError:
- pass
- else:
- routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
- routing_header
- )
- metadata.append(routing_metadata)
-
- return self._inner_api_calls["check_consistency"](
- request, retry=retry, timeout=timeout, metadata=metadata
- )
-
- def get_iam_policy(
- self,
- resource,
- options_=None,
- retry=google.api_core.gapic_v1.method.DEFAULT,
- timeout=google.api_core.gapic_v1.method.DEFAULT,
- metadata=None,
- ):
- """
- Gets the access control policy for a resource.
- Returns an empty policy if the resource exists but does not have a policy
- set.
-
- Example:
- >>> from google.cloud import bigtable_admin_v2
- >>>
- >>> client = bigtable_admin_v2.BigtableTableAdminClient()
- >>>
- >>> # TODO: Initialize `resource`:
- >>> resource = ''
- >>>
- >>> response = client.get_iam_policy(resource)
-
- Args:
- resource (str): REQUIRED: The resource for which the policy is being requested.
- See the operation documentation for the appropriate value for this field.
- options_ (Union[dict, ~google.cloud.bigtable_admin_v2.types.GetPolicyOptions]): OPTIONAL: A ``GetPolicyOptions`` object for specifying options to
- ``GetIamPolicy``. This field is only used by Cloud IAM.
-
- If a dict is provided, it must be of the same form as the protobuf
- message :class:`~google.cloud.bigtable_admin_v2.types.GetPolicyOptions`
- retry (Optional[google.api_core.retry.Retry]): A retry object used
- to retry requests. If ``None`` is specified, requests will
- be retried using a default configuration.
- timeout (Optional[float]): The amount of time, in seconds, to wait
- for the request to complete. Note that if ``retry`` is
- specified, the timeout applies to each individual attempt.
- metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
- that is provided to the method.
-
- Returns:
- A :class:`~google.cloud.bigtable_admin_v2.types.Policy` instance.
-
- Raises:
- google.api_core.exceptions.GoogleAPICallError: If the request
- failed for any reason.
- google.api_core.exceptions.RetryError: If the request failed due
- to a retryable error and retry attempts failed.
- ValueError: If the parameters are invalid.
- """
- # Wrap the transport method to add retry and timeout logic.
- if "get_iam_policy" not in self._inner_api_calls:
- self._inner_api_calls[
- "get_iam_policy"
- ] = google.api_core.gapic_v1.method.wrap_method(
- self.transport.get_iam_policy,
- default_retry=self._method_configs["GetIamPolicy"].retry,
- default_timeout=self._method_configs["GetIamPolicy"].timeout,
- client_info=self._client_info,
- )
-
- request = iam_policy_pb2.GetIamPolicyRequest(
- resource=resource, options=options_,
- )
- if metadata is None:
- metadata = []
- metadata = list(metadata)
- try:
- routing_header = [("resource", resource)]
- except AttributeError:
- pass
- else:
- routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
- routing_header
- )
- metadata.append(routing_metadata)
-
- return self._inner_api_calls["get_iam_policy"](
- request, retry=retry, timeout=timeout, metadata=metadata
- )
-
- def set_iam_policy(
- self,
- resource,
- policy,
- retry=google.api_core.gapic_v1.method.DEFAULT,
- timeout=google.api_core.gapic_v1.method.DEFAULT,
- metadata=None,
- ):
- """
- Sets the access control policy on a Table or Backup resource.
- Replaces any existing policy.
-
- Example:
- >>> from google.cloud import bigtable_admin_v2
- >>>
- >>> client = bigtable_admin_v2.BigtableTableAdminClient()
- >>>
- >>> # TODO: Initialize `resource`:
- >>> resource = ''
- >>>
- >>> # TODO: Initialize `policy`:
- >>> policy = {}
- >>>
- >>> response = client.set_iam_policy(resource, policy)
-
- Args:
- resource (str): REQUIRED: The resource for which the policy is being specified.
- See the operation documentation for the appropriate value for this field.
- policy (Union[dict, ~google.cloud.bigtable_admin_v2.types.Policy]): REQUIRED: The complete policy to be applied to the ``resource``. The
- size of the policy is limited to a few 10s of KB. An empty policy is a
- valid policy but certain Cloud Platform services (such as Projects)
- might reject them.
-
- If a dict is provided, it must be of the same form as the protobuf
- message :class:`~google.cloud.bigtable_admin_v2.types.Policy`
- retry (Optional[google.api_core.retry.Retry]): A retry object used
- to retry requests. If ``None`` is specified, requests will
- be retried using a default configuration.
- timeout (Optional[float]): The amount of time, in seconds, to wait
- for the request to complete. Note that if ``retry`` is
- specified, the timeout applies to each individual attempt.
- metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
- that is provided to the method.
-
- Returns:
- A :class:`~google.cloud.bigtable_admin_v2.types.Policy` instance.
-
- Raises:
- google.api_core.exceptions.GoogleAPICallError: If the request
- failed for any reason.
- google.api_core.exceptions.RetryError: If the request failed due
- to a retryable error and retry attempts failed.
- ValueError: If the parameters are invalid.
- """
- # Wrap the transport method to add retry and timeout logic.
- if "set_iam_policy" not in self._inner_api_calls:
- self._inner_api_calls[
- "set_iam_policy"
- ] = google.api_core.gapic_v1.method.wrap_method(
- self.transport.set_iam_policy,
- default_retry=self._method_configs["SetIamPolicy"].retry,
- default_timeout=self._method_configs["SetIamPolicy"].timeout,
- client_info=self._client_info,
- )
-
- request = iam_policy_pb2.SetIamPolicyRequest(resource=resource, policy=policy,)
- if metadata is None:
- metadata = []
- metadata = list(metadata)
- try:
- routing_header = [("resource", resource)]
- except AttributeError:
- pass
- else:
- routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
- routing_header
- )
- metadata.append(routing_metadata)
-
- return self._inner_api_calls["set_iam_policy"](
- request, retry=retry, timeout=timeout, metadata=metadata
- )
-
- def test_iam_permissions(
- self,
- resource,
- permissions,
- retry=google.api_core.gapic_v1.method.DEFAULT,
- timeout=google.api_core.gapic_v1.method.DEFAULT,
- metadata=None,
- ):
- """
- Returns permissions that the caller has on the specified table resource.
-
- Example:
- >>> from google.cloud import bigtable_admin_v2
- >>>
- >>> client = bigtable_admin_v2.BigtableTableAdminClient()
- >>>
- >>> # TODO: Initialize `resource`:
- >>> resource = ''
- >>>
- >>> # TODO: Initialize `permissions`:
- >>> permissions = []
- >>>
- >>> response = client.test_iam_permissions(resource, permissions)
-
- Args:
- resource (str): REQUIRED: The resource for which the policy detail is being requested.
- See the operation documentation for the appropriate value for this field.
- permissions (list[str]): The set of permissions to check for the ``resource``. Permissions
- with wildcards (such as '*' or 'storage.*') are not allowed. For more
- information see `IAM
- Overview `__.
- retry (Optional[google.api_core.retry.Retry]): A retry object used
- to retry requests. If ``None`` is specified, requests will
- be retried using a default configuration.
- timeout (Optional[float]): The amount of time, in seconds, to wait
- for the request to complete. Note that if ``retry`` is
- specified, the timeout applies to each individual attempt.
- metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
- that is provided to the method.
-
- Returns:
- A :class:`~google.cloud.bigtable_admin_v2.types.TestIamPermissionsResponse` instance.
-
- Raises:
- google.api_core.exceptions.GoogleAPICallError: If the request
- failed for any reason.
- google.api_core.exceptions.RetryError: If the request failed due
- to a retryable error and retry attempts failed.
- ValueError: If the parameters are invalid.
- """
- # Wrap the transport method to add retry and timeout logic.
- if "test_iam_permissions" not in self._inner_api_calls:
- self._inner_api_calls[
- "test_iam_permissions"
- ] = google.api_core.gapic_v1.method.wrap_method(
- self.transport.test_iam_permissions,
- default_retry=self._method_configs["TestIamPermissions"].retry,
- default_timeout=self._method_configs["TestIamPermissions"].timeout,
- client_info=self._client_info,
- )
-
- request = iam_policy_pb2.TestIamPermissionsRequest(
- resource=resource, permissions=permissions,
- )
- if metadata is None:
- metadata = []
- metadata = list(metadata)
- try:
- routing_header = [("resource", resource)]
- except AttributeError:
- pass
- else:
- routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
- routing_header
- )
- metadata.append(routing_metadata)
-
- return self._inner_api_calls["test_iam_permissions"](
- request, retry=retry, timeout=timeout, metadata=metadata
- )
-
- def snapshot_table(
- self,
- name,
- cluster,
- snapshot_id,
- ttl=None,
- description=None,
- retry=google.api_core.gapic_v1.method.DEFAULT,
- timeout=google.api_core.gapic_v1.method.DEFAULT,
- metadata=None,
- ):
- """
- Creates a new snapshot in the specified cluster from the specified
- source table. The cluster and the table must be in the same instance.
-
- Note: This is a private alpha release of Cloud Bigtable snapshots. This
- feature is not currently available to most Cloud Bigtable customers. This
- feature might be changed in backward-incompatible ways and is not
- recommended for production use. It is not subject to any SLA or deprecation
- policy.
-
- Example:
- >>> from google.cloud import bigtable_admin_v2
- >>>
- >>> client = bigtable_admin_v2.BigtableTableAdminClient()
- >>>
- >>> name = client.table_path('[PROJECT]', '[INSTANCE]', '[TABLE]')
- >>> cluster = client.cluster_path('[PROJECT]', '[INSTANCE]', '[CLUSTER]')
- >>>
- >>> # TODO: Initialize `snapshot_id`:
- >>> snapshot_id = ''
- >>>
- >>> response = client.snapshot_table(name, cluster, snapshot_id)
- >>>
- >>> def callback(operation_future):
- ... # Handle result.
- ... result = operation_future.result()
- >>>
- >>> response.add_done_callback(callback)
- >>>
- >>> # Handle metadata.
- >>> metadata = response.metadata()
-
- Args:
- name (str): Required. The unique name of the table to have the snapshot taken.
- Values are of the form
- ``projects/{project}/instances/{instance}/tables/{table}``.
- cluster (str): Required. The name of the cluster where the snapshot will be created
- in. Values are of the form
- ``projects/{project}/instances/{instance}/clusters/{cluster}``.
- snapshot_id (str): Required. The ID by which the new snapshot should be referred to
- within the parent cluster, e.g., ``mysnapshot`` of the form:
- ``[_a-zA-Z0-9][-_.a-zA-Z0-9]*`` rather than
- ``projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/mysnapshot``.
- ttl (Union[dict, ~google.cloud.bigtable_admin_v2.types.Duration]): The amount of time that the new snapshot can stay active after it is
- created. Once 'ttl' expires, the snapshot will get deleted. The maximum
- amount of time a snapshot can stay active is 7 days. If 'ttl' is not
- specified, the default value of 24 hours will be used.
-
- If a dict is provided, it must be of the same form as the protobuf
- message :class:`~google.cloud.bigtable_admin_v2.types.Duration`
- description (str): Description of the snapshot.
- retry (Optional[google.api_core.retry.Retry]): A retry object used
- to retry requests. If ``None`` is specified, requests will
- be retried using a default configuration.
- timeout (Optional[float]): The amount of time, in seconds, to wait
- for the request to complete. Note that if ``retry`` is
- specified, the timeout applies to each individual attempt.
- metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
- that is provided to the method.
-
- Returns:
- A :class:`~google.cloud.bigtable_admin_v2.types._OperationFuture` instance.
-
- Raises:
- google.api_core.exceptions.GoogleAPICallError: If the request
- failed for any reason.
- google.api_core.exceptions.RetryError: If the request failed due
- to a retryable error and retry attempts failed.
- ValueError: If the parameters are invalid.
- """
- # Wrap the transport method to add retry and timeout logic.
- if "snapshot_table" not in self._inner_api_calls:
- self._inner_api_calls[
- "snapshot_table"
- ] = google.api_core.gapic_v1.method.wrap_method(
- self.transport.snapshot_table,
- default_retry=self._method_configs["SnapshotTable"].retry,
- default_timeout=self._method_configs["SnapshotTable"].timeout,
- client_info=self._client_info,
- )
-
- request = bigtable_table_admin_pb2.SnapshotTableRequest(
- name=name,
- cluster=cluster,
- snapshot_id=snapshot_id,
- ttl=ttl,
- description=description,
- )
- if metadata is None:
- metadata = []
- metadata = list(metadata)
- try:
- routing_header = [("name", name)]
- except AttributeError:
- pass
- else:
- routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
- routing_header
- )
- metadata.append(routing_metadata)
-
- operation = self._inner_api_calls["snapshot_table"](
- request, retry=retry, timeout=timeout, metadata=metadata
- )
- return google.api_core.operation.from_gapic(
- operation,
- self.transport._operations_client,
- table_pb2.Snapshot,
- metadata_type=bigtable_table_admin_pb2.SnapshotTableMetadata,
- )
-
- def get_snapshot(
- self,
- name,
- retry=google.api_core.gapic_v1.method.DEFAULT,
- timeout=google.api_core.gapic_v1.method.DEFAULT,
- metadata=None,
- ):
- """
- Gets metadata information about the specified snapshot.
-
- Note: This is a private alpha release of Cloud Bigtable snapshots. This
- feature is not currently available to most Cloud Bigtable customers. This
- feature might be changed in backward-incompatible ways and is not
- recommended for production use. It is not subject to any SLA or deprecation
- policy.
-
- Example:
- >>> from google.cloud import bigtable_admin_v2
- >>>
- >>> client = bigtable_admin_v2.BigtableTableAdminClient()
- >>>
- >>> name = client.snapshot_path('[PROJECT]', '[INSTANCE]', '[CLUSTER]', '[SNAPSHOT]')
- >>>
- >>> response = client.get_snapshot(name)
-
- Args:
- name (str): Required. The unique name of the requested snapshot. Values are of
- the form
- ``projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}``.
- retry (Optional[google.api_core.retry.Retry]): A retry object used
- to retry requests. If ``None`` is specified, requests will
- be retried using a default configuration.
- timeout (Optional[float]): The amount of time, in seconds, to wait
- for the request to complete. Note that if ``retry`` is
- specified, the timeout applies to each individual attempt.
- metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
- that is provided to the method.
-
- Returns:
- A :class:`~google.cloud.bigtable_admin_v2.types.Snapshot` instance.
-
- Raises:
- google.api_core.exceptions.GoogleAPICallError: If the request
- failed for any reason.
- google.api_core.exceptions.RetryError: If the request failed due
- to a retryable error and retry attempts failed.
- ValueError: If the parameters are invalid.
- """
- # Wrap the transport method to add retry and timeout logic.
- if "get_snapshot" not in self._inner_api_calls:
- self._inner_api_calls[
- "get_snapshot"
- ] = google.api_core.gapic_v1.method.wrap_method(
- self.transport.get_snapshot,
- default_retry=self._method_configs["GetSnapshot"].retry,
- default_timeout=self._method_configs["GetSnapshot"].timeout,
- client_info=self._client_info,
- )
-
- request = bigtable_table_admin_pb2.GetSnapshotRequest(name=name,)
- if metadata is None:
- metadata = []
- metadata = list(metadata)
- try:
- routing_header = [("name", name)]
- except AttributeError:
- pass
- else:
- routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
- routing_header
- )
- metadata.append(routing_metadata)
-
- return self._inner_api_calls["get_snapshot"](
- request, retry=retry, timeout=timeout, metadata=metadata
- )
-
- def list_snapshots(
- self,
- parent,
- page_size=None,
- retry=google.api_core.gapic_v1.method.DEFAULT,
- timeout=google.api_core.gapic_v1.method.DEFAULT,
- metadata=None,
- ):
- """
- Lists all snapshots associated with the specified cluster.
-
- Note: This is a private alpha release of Cloud Bigtable snapshots. This
- feature is not currently available to most Cloud Bigtable customers. This
- feature might be changed in backward-incompatible ways and is not
- recommended for production use. It is not subject to any SLA or deprecation
- policy.
-
- Example:
- >>> from google.cloud import bigtable_admin_v2
- >>>
- >>> client = bigtable_admin_v2.BigtableTableAdminClient()
- >>>
- >>> parent = client.cluster_path('[PROJECT]', '[INSTANCE]', '[CLUSTER]')
- >>>
- >>> # Iterate over all results
- >>> for element in client.list_snapshots(parent):
- ... # process element
- ... pass
- >>>
- >>>
- >>> # Alternatively:
- >>>
- >>> # Iterate over results one page at a time
- >>> for page in client.list_snapshots(parent).pages:
- ... for element in page:
- ... # process element
- ... pass
-
- Args:
- parent (str): Required. The unique name of the cluster for which snapshots should
- be listed. Values are of the form
- ``projects/{project}/instances/{instance}/clusters/{cluster}``. Use
- ``{cluster} = '-'`` to list snapshots for all clusters in an instance,
- e.g., ``projects/{project}/instances/{instance}/clusters/-``.
- page_size (int): The maximum number of resources contained in the
- underlying API response. If page streaming is performed per-
- resource, this parameter does not affect the return value. If page
- streaming is performed per-page, this determines the maximum number
- of resources in a page.
- retry (Optional[google.api_core.retry.Retry]): A retry object used
- to retry requests. If ``None`` is specified, requests will
- be retried using a default configuration.
- timeout (Optional[float]): The amount of time, in seconds, to wait
- for the request to complete. Note that if ``retry`` is
- specified, the timeout applies to each individual attempt.
- metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
- that is provided to the method.
-
- Returns:
- A :class:`~google.api_core.page_iterator.PageIterator` instance.
- An iterable of :class:`~google.cloud.bigtable_admin_v2.types.Snapshot` instances.
- You can also iterate over the pages of the response
- using its `pages` property.
-
- Raises:
- google.api_core.exceptions.GoogleAPICallError: If the request
- failed for any reason.
- google.api_core.exceptions.RetryError: If the request failed due
- to a retryable error and retry attempts failed.
- ValueError: If the parameters are invalid.
- """
- # Wrap the transport method to add retry and timeout logic.
- if "list_snapshots" not in self._inner_api_calls:
- self._inner_api_calls[
- "list_snapshots"
- ] = google.api_core.gapic_v1.method.wrap_method(
- self.transport.list_snapshots,
- default_retry=self._method_configs["ListSnapshots"].retry,
- default_timeout=self._method_configs["ListSnapshots"].timeout,
- client_info=self._client_info,
- )
-
- request = bigtable_table_admin_pb2.ListSnapshotsRequest(
- parent=parent, page_size=page_size,
- )
- if metadata is None:
- metadata = []
- metadata = list(metadata)
- try:
- routing_header = [("parent", parent)]
- except AttributeError:
- pass
- else:
- routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
- routing_header
- )
- metadata.append(routing_metadata)
-
- iterator = google.api_core.page_iterator.GRPCIterator(
- client=None,
- method=functools.partial(
- self._inner_api_calls["list_snapshots"],
- retry=retry,
- timeout=timeout,
- metadata=metadata,
- ),
- request=request,
- items_field="snapshots",
- request_token_field="page_token",
- response_token_field="next_page_token",
- )
- return iterator
-
- def delete_snapshot(
- self,
- name,
- retry=google.api_core.gapic_v1.method.DEFAULT,
- timeout=google.api_core.gapic_v1.method.DEFAULT,
- metadata=None,
- ):
- """
- Permanently deletes the specified snapshot.
-
- Note: This is a private alpha release of Cloud Bigtable snapshots. This
- feature is not currently available to most Cloud Bigtable customers. This
- feature might be changed in backward-incompatible ways and is not
- recommended for production use. It is not subject to any SLA or deprecation
- policy.
-
- Example:
- >>> from google.cloud import bigtable_admin_v2
- >>>
- >>> client = bigtable_admin_v2.BigtableTableAdminClient()
- >>>
- >>> name = client.snapshot_path('[PROJECT]', '[INSTANCE]', '[CLUSTER]', '[SNAPSHOT]')
- >>>
- >>> client.delete_snapshot(name)
-
- Args:
- name (str): Required. The unique name of the snapshot to be deleted. Values are
- of the form
- ``projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}``.
- retry (Optional[google.api_core.retry.Retry]): A retry object used
- to retry requests. If ``None`` is specified, requests will
- be retried using a default configuration.
- timeout (Optional[float]): The amount of time, in seconds, to wait
- for the request to complete. Note that if ``retry`` is
- specified, the timeout applies to each individual attempt.
- metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
- that is provided to the method.
-
- Raises:
- google.api_core.exceptions.GoogleAPICallError: If the request
- failed for any reason.
- google.api_core.exceptions.RetryError: If the request failed due
- to a retryable error and retry attempts failed.
- ValueError: If the parameters are invalid.
- """
- # Wrap the transport method to add retry and timeout logic.
- if "delete_snapshot" not in self._inner_api_calls:
- self._inner_api_calls[
- "delete_snapshot"
- ] = google.api_core.gapic_v1.method.wrap_method(
- self.transport.delete_snapshot,
- default_retry=self._method_configs["DeleteSnapshot"].retry,
- default_timeout=self._method_configs["DeleteSnapshot"].timeout,
- client_info=self._client_info,
- )
-
- request = bigtable_table_admin_pb2.DeleteSnapshotRequest(name=name,)
- if metadata is None:
- metadata = []
- metadata = list(metadata)
- try:
- routing_header = [("name", name)]
- except AttributeError:
- pass
- else:
- routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
- routing_header
- )
- metadata.append(routing_metadata)
-
- self._inner_api_calls["delete_snapshot"](
- request, retry=retry, timeout=timeout, metadata=metadata
- )
-
- def create_backup(
- self,
- parent,
- backup_id,
- backup,
- retry=google.api_core.gapic_v1.method.DEFAULT,
- timeout=google.api_core.gapic_v1.method.DEFAULT,
- metadata=None,
- ):
- """
- Starts creating a new Cloud Bigtable Backup. The returned backup
- ``long-running operation`` can be used to track creation of the backup.
- The ``metadata`` field type is ``CreateBackupMetadata``. The
- ``response`` field type is ``Backup``, if successful. Cancelling the
- returned operation will stop the creation and delete the backup.
-
- Example:
- >>> from google.cloud import bigtable_admin_v2
- >>>
- >>> client = bigtable_admin_v2.BigtableTableAdminClient()
- >>>
- >>> parent = client.cluster_path('[PROJECT]', '[INSTANCE]', '[CLUSTER]')
- >>>
- >>> # TODO: Initialize `backup_id`:
- >>> backup_id = ''
- >>>
- >>> # TODO: Initialize `backup`:
- >>> backup = {}
- >>>
- >>> response = client.create_backup(parent, backup_id, backup)
- >>>
- >>> def callback(operation_future):
- ... # Handle result.
- ... result = operation_future.result()
- >>>
- >>> response.add_done_callback(callback)
- >>>
- >>> # Handle metadata.
- >>> metadata = response.metadata()
-
- Args:
- parent (str): Required. This must be one of the clusters in the instance in which
- this table is located. The backup will be stored in this cluster. Values
- are of the form
- ``projects/{project}/instances/{instance}/clusters/{cluster}``.
- backup_id (str): Required. The id of the backup to be created. The ``backup_id``
- along with the parent ``parent`` are combined as
- {parent}/backups/{backup_id} to create the full backup name, of the
- form:
- ``projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup_id}``.
- This string must be between 1 and 50 characters in length and match the
- regex [*a-zA-Z0-9][-*.a-zA-Z0-9]*.
- backup (Union[dict, ~google.cloud.bigtable_admin_v2.types.Backup]): Required. The backup to create.
-
- If a dict is provided, it must be of the same form as the protobuf
- message :class:`~google.cloud.bigtable_admin_v2.types.Backup`
- retry (Optional[google.api_core.retry.Retry]): A retry object used
- to retry requests. If ``None`` is specified, requests will
- be retried using a default configuration.
- timeout (Optional[float]): The amount of time, in seconds, to wait
- for the request to complete. Note that if ``retry`` is
- specified, the timeout applies to each individual attempt.
- metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
- that is provided to the method.
-
- Returns:
- A :class:`~google.cloud.bigtable_admin_v2.types._OperationFuture` instance.
-
- Raises:
- google.api_core.exceptions.GoogleAPICallError: If the request
- failed for any reason.
- google.api_core.exceptions.RetryError: If the request failed due
- to a retryable error and retry attempts failed.
- ValueError: If the parameters are invalid.
- """
- # Wrap the transport method to add retry and timeout logic.
- if "create_backup" not in self._inner_api_calls:
- self._inner_api_calls[
- "create_backup"
- ] = google.api_core.gapic_v1.method.wrap_method(
- self.transport.create_backup,
- default_retry=self._method_configs["CreateBackup"].retry,
- default_timeout=self._method_configs["CreateBackup"].timeout,
- client_info=self._client_info,
- )
-
- request = bigtable_table_admin_pb2.CreateBackupRequest(
- parent=parent, backup_id=backup_id, backup=backup,
- )
- if metadata is None:
- metadata = []
- metadata = list(metadata)
- try:
- routing_header = [("parent", parent)]
- except AttributeError:
- pass
- else:
- routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
- routing_header
- )
- metadata.append(routing_metadata)
-
- operation = self._inner_api_calls["create_backup"](
- request, retry=retry, timeout=timeout, metadata=metadata
- )
- return google.api_core.operation.from_gapic(
- operation,
- self.transport._operations_client,
- table_pb2.Backup,
- metadata_type=bigtable_table_admin_pb2.CreateBackupMetadata,
- )
-
- def get_backup(
- self,
- name,
- retry=google.api_core.gapic_v1.method.DEFAULT,
- timeout=google.api_core.gapic_v1.method.DEFAULT,
- metadata=None,
- ):
- """
- Gets metadata on a pending or completed Cloud Bigtable Backup.
-
- Example:
- >>> from google.cloud import bigtable_admin_v2
- >>>
- >>> client = bigtable_admin_v2.BigtableTableAdminClient()
- >>>
- >>> name = client.backup_path('[PROJECT]', '[INSTANCE]', '[CLUSTER]', '[BACKUP]')
- >>>
- >>> response = client.get_backup(name)
-
- Args:
- name (str): Required. Name of the backup. Values are of the form
- ``projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}``.
- retry (Optional[google.api_core.retry.Retry]): A retry object used
- to retry requests. If ``None`` is specified, requests will
- be retried using a default configuration.
- timeout (Optional[float]): The amount of time, in seconds, to wait
- for the request to complete. Note that if ``retry`` is
- specified, the timeout applies to each individual attempt.
- metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
- that is provided to the method.
-
- Returns:
- A :class:`~google.cloud.bigtable_admin_v2.types.Backup` instance.
-
- Raises:
- google.api_core.exceptions.GoogleAPICallError: If the request
- failed for any reason.
- google.api_core.exceptions.RetryError: If the request failed due
- to a retryable error and retry attempts failed.
- ValueError: If the parameters are invalid.
- """
- # Wrap the transport method to add retry and timeout logic.
- if "get_backup" not in self._inner_api_calls:
- self._inner_api_calls[
- "get_backup"
- ] = google.api_core.gapic_v1.method.wrap_method(
- self.transport.get_backup,
- default_retry=self._method_configs["GetBackup"].retry,
- default_timeout=self._method_configs["GetBackup"].timeout,
- client_info=self._client_info,
- )
-
- request = bigtable_table_admin_pb2.GetBackupRequest(name=name,)
- if metadata is None:
- metadata = []
- metadata = list(metadata)
- try:
- routing_header = [("name", name)]
- except AttributeError:
- pass
- else:
- routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
- routing_header
- )
- metadata.append(routing_metadata)
-
- return self._inner_api_calls["get_backup"](
- request, retry=retry, timeout=timeout, metadata=metadata
- )
-
- def list_backups(
- self,
- parent,
- filter_=None,
- order_by=None,
- page_size=None,
- retry=google.api_core.gapic_v1.method.DEFAULT,
- timeout=google.api_core.gapic_v1.method.DEFAULT,
- metadata=None,
- ):
- """
- Lists Cloud Bigtable backups. Returns both completed and pending
- backups.
-
- Example:
- >>> from google.cloud import bigtable_admin_v2
- >>>
- >>> client = bigtable_admin_v2.BigtableTableAdminClient()
- >>>
- >>> parent = client.cluster_path('[PROJECT]', '[INSTANCE]', '[CLUSTER]')
- >>>
- >>> # Iterate over all results
- >>> for element in client.list_backups(parent):
- ... # process element
- ... pass
- >>>
- >>>
- >>> # Alternatively:
- >>>
- >>> # Iterate over results one page at a time
- >>> for page in client.list_backups(parent).pages:
- ... for element in page:
- ... # process element
- ... pass
-
- Args:
- parent (str): Required. The cluster to list backups from. Values are of the form
- ``projects/{project}/instances/{instance}/clusters/{cluster}``. Use
- ``{cluster} = '-'`` to list backups for all clusters in an instance,
- e.g., ``projects/{project}/instances/{instance}/clusters/-``.
- filter_ (str): A filter expression that filters backups listed in the response. The
- expression must specify the field name, a comparison operator, and the
- value that you want to use for filtering. The value must be a string, a
- number, or a boolean. The comparison operator must be <, >, <=, >=, !=,
- =, or :. Colon ‘:’ represents a HAS operator which is roughly synonymous
- with equality. Filter rules are case insensitive.
-
- The fields eligible for filtering are:
-
- - ``name``
- - ``source_table``
- - ``state``
- - ``start_time`` (and values are of the format YYYY-MM-DDTHH:MM:SSZ)
- - ``end_time`` (and values are of the format YYYY-MM-DDTHH:MM:SSZ)
- - ``expire_time`` (and values are of the format YYYY-MM-DDTHH:MM:SSZ)
- - ``size_bytes``
-
- To filter on multiple expressions, provide each separate expression
- within parentheses. By default, each expression is an AND expression.
- However, you can include AND, OR, and NOT expressions explicitly.
-
- Some examples of using filters are:
-
- - ``name:"exact"`` --> The backup's name is the string "exact".
- - ``name:howl`` --> The backup's name contains the string "howl".
- - ``source_table:prod`` --> The source_table's name contains the string
- "prod".
- - ``state:CREATING`` --> The backup is pending creation.
- - ``state:READY`` --> The backup is fully created and ready for use.
- - ``(name:howl) AND (start_time < \"2018-03-28T14:50:00Z\")`` --> The
- backup name contains the string "howl" and start_time of the backup
- is before 2018-03-28T14:50:00Z.
- - ``size_bytes > 10000000000`` --> The backup's size is greater than
- 10GB
- order_by (str): An expression for specifying the sort order of the results of the
- request. The string value should specify one or more fields in
- ``Backup``. The full syntax is described at
- https://aip.dev/132#ordering.
-
- Fields supported are: \* name \* source_table \* expire_time \*
- start_time \* end_time \* size_bytes \* state
-
- For example, "start_time". The default sorting order is ascending. To
- specify descending order for the field, a suffix " desc" should be
- appended to the field name. For example, "start_time desc". Redundant
- space characters in the syntax are insigificant.
-
- If order_by is empty, results will be sorted by ``start_time`` in
- descending order starting from the most recently created backup.
- page_size (int): The maximum number of resources contained in the
- underlying API response. If page streaming is performed per-
- resource, this parameter does not affect the return value. If page
- streaming is performed per-page, this determines the maximum number
- of resources in a page.
- retry (Optional[google.api_core.retry.Retry]): A retry object used
- to retry requests. If ``None`` is specified, requests will
- be retried using a default configuration.
- timeout (Optional[float]): The amount of time, in seconds, to wait
- for the request to complete. Note that if ``retry`` is
- specified, the timeout applies to each individual attempt.
- metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
- that is provided to the method.
-
- Returns:
- A :class:`~google.api_core.page_iterator.PageIterator` instance.
- An iterable of :class:`~google.cloud.bigtable_admin_v2.types.Backup` instances.
- You can also iterate over the pages of the response
- using its `pages` property.
-
- Raises:
- google.api_core.exceptions.GoogleAPICallError: If the request
- failed for any reason.
- google.api_core.exceptions.RetryError: If the request failed due
- to a retryable error and retry attempts failed.
- ValueError: If the parameters are invalid.
- """
- # Wrap the transport method to add retry and timeout logic.
- if "list_backups" not in self._inner_api_calls:
- self._inner_api_calls[
- "list_backups"
- ] = google.api_core.gapic_v1.method.wrap_method(
- self.transport.list_backups,
- default_retry=self._method_configs["ListBackups"].retry,
- default_timeout=self._method_configs["ListBackups"].timeout,
- client_info=self._client_info,
- )
-
- request = bigtable_table_admin_pb2.ListBackupsRequest(
- parent=parent, filter=filter_, order_by=order_by, page_size=page_size,
- )
- if metadata is None:
- metadata = []
- metadata = list(metadata)
- try:
- routing_header = [("parent", parent)]
- except AttributeError:
- pass
- else:
- routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
- routing_header
- )
- metadata.append(routing_metadata)
-
- iterator = google.api_core.page_iterator.GRPCIterator(
- client=None,
- method=functools.partial(
- self._inner_api_calls["list_backups"],
- retry=retry,
- timeout=timeout,
- metadata=metadata,
- ),
- request=request,
- items_field="backups",
- request_token_field="page_token",
- response_token_field="next_page_token",
- )
- return iterator
-
- def update_backup(
- self,
- backup,
- update_mask,
- retry=google.api_core.gapic_v1.method.DEFAULT,
- timeout=google.api_core.gapic_v1.method.DEFAULT,
- metadata=None,
- ):
- """
- Updates a pending or completed Cloud Bigtable Backup.
-
- Example:
- >>> from google.cloud import bigtable_admin_v2
- >>>
- >>> client = bigtable_admin_v2.BigtableTableAdminClient()
- >>>
- >>> # TODO: Initialize `backup`:
- >>> backup = {}
- >>>
- >>> # TODO: Initialize `update_mask`:
- >>> update_mask = {}
- >>>
- >>> response = client.update_backup(backup, update_mask)
-
- Args:
- backup (Union[dict, ~google.cloud.bigtable_admin_v2.types.Backup]): Required. The backup to update. ``backup.name``, and the fields to
- be updated as specified by ``update_mask`` are required. Other fields
- are ignored. Update is only supported for the following fields:
-
- - ``backup.expire_time``.
-
- If a dict is provided, it must be of the same form as the protobuf
- message :class:`~google.cloud.bigtable_admin_v2.types.Backup`
- update_mask (Union[dict, ~google.cloud.bigtable_admin_v2.types.FieldMask]): Required. A mask specifying which fields (e.g. ``expire_time``) in
- the Backup resource should be updated. This mask is relative to the
- Backup resource, not to the request message. The field mask must always
- be specified; this prevents any future fields from being erased
- accidentally by clients that do not know about them.
-
- If a dict is provided, it must be of the same form as the protobuf
- message :class:`~google.cloud.bigtable_admin_v2.types.FieldMask`
- retry (Optional[google.api_core.retry.Retry]): A retry object used
- to retry requests. If ``None`` is specified, requests will
- be retried using a default configuration.
- timeout (Optional[float]): The amount of time, in seconds, to wait
- for the request to complete. Note that if ``retry`` is
- specified, the timeout applies to each individual attempt.
- metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
- that is provided to the method.
-
- Returns:
- A :class:`~google.cloud.bigtable_admin_v2.types.Backup` instance.
-
- Raises:
- google.api_core.exceptions.GoogleAPICallError: If the request
- failed for any reason.
- google.api_core.exceptions.RetryError: If the request failed due
- to a retryable error and retry attempts failed.
- ValueError: If the parameters are invalid.
- """
- # Wrap the transport method to add retry and timeout logic.
- if "update_backup" not in self._inner_api_calls:
- self._inner_api_calls[
- "update_backup"
- ] = google.api_core.gapic_v1.method.wrap_method(
- self.transport.update_backup,
- default_retry=self._method_configs["UpdateBackup"].retry,
- default_timeout=self._method_configs["UpdateBackup"].timeout,
- client_info=self._client_info,
- )
-
- request = bigtable_table_admin_pb2.UpdateBackupRequest(
- backup=backup, update_mask=update_mask,
- )
- if metadata is None:
- metadata = []
- metadata = list(metadata)
- try:
- routing_header = [("backup.name", backup.name)]
- except AttributeError:
- pass
- else:
- routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
- routing_header
- )
- metadata.append(routing_metadata)
-
- return self._inner_api_calls["update_backup"](
- request, retry=retry, timeout=timeout, metadata=metadata
- )
-
- def delete_backup(
- self,
- name,
- retry=google.api_core.gapic_v1.method.DEFAULT,
- timeout=google.api_core.gapic_v1.method.DEFAULT,
- metadata=None,
- ):
- """
- Deletes a pending or completed Cloud Bigtable backup.
-
- Example:
- >>> from google.cloud import bigtable_admin_v2
- >>>
- >>> client = bigtable_admin_v2.BigtableTableAdminClient()
- >>>
- >>> name = client.backup_path('[PROJECT]', '[INSTANCE]', '[CLUSTER]', '[BACKUP]')
- >>>
- >>> client.delete_backup(name)
-
- Args:
- name (str): Required. Name of the backup to delete. Values are of the form
- ``projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}``.
- retry (Optional[google.api_core.retry.Retry]): A retry object used
- to retry requests. If ``None`` is specified, requests will
- be retried using a default configuration.
- timeout (Optional[float]): The amount of time, in seconds, to wait
- for the request to complete. Note that if ``retry`` is
- specified, the timeout applies to each individual attempt.
- metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
- that is provided to the method.
-
- Raises:
- google.api_core.exceptions.GoogleAPICallError: If the request
- failed for any reason.
- google.api_core.exceptions.RetryError: If the request failed due
- to a retryable error and retry attempts failed.
- ValueError: If the parameters are invalid.
- """
- # Wrap the transport method to add retry and timeout logic.
- if "delete_backup" not in self._inner_api_calls:
- self._inner_api_calls[
- "delete_backup"
- ] = google.api_core.gapic_v1.method.wrap_method(
- self.transport.delete_backup,
- default_retry=self._method_configs["DeleteBackup"].retry,
- default_timeout=self._method_configs["DeleteBackup"].timeout,
- client_info=self._client_info,
- )
-
- request = bigtable_table_admin_pb2.DeleteBackupRequest(name=name,)
- if metadata is None:
- metadata = []
- metadata = list(metadata)
- try:
- routing_header = [("name", name)]
- except AttributeError:
- pass
- else:
- routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
- routing_header
- )
- metadata.append(routing_metadata)
-
- self._inner_api_calls["delete_backup"](
- request, retry=retry, timeout=timeout, metadata=metadata
- )
-
- def restore_table(
- self,
- parent=None,
- table_id=None,
- backup=None,
- retry=google.api_core.gapic_v1.method.DEFAULT,
- timeout=google.api_core.gapic_v1.method.DEFAULT,
- metadata=None,
- ):
- """
- Create a new table by restoring from a completed backup. The new
- table must be in the same instance as the instance containing the
- backup. The returned table ``long-running operation`` can be used to
- track the progress of the operation, and to cancel it. The ``metadata``
- field type is ``RestoreTableMetadata``. The ``response`` type is
- ``Table``, if successful.
-
- Example:
- >>> from google.cloud import bigtable_admin_v2
- >>>
- >>> client = bigtable_admin_v2.BigtableTableAdminClient()
- >>>
- >>> response = client.restore_table()
- >>>
- >>> def callback(operation_future):
- ... # Handle result.
- ... result = operation_future.result()
- >>>
- >>> response.add_done_callback(callback)
- >>>
- >>> # Handle metadata.
- >>> metadata = response.metadata()
-
- Args:
- parent (str): Required. The name of the instance in which to create the restored
- table. This instance must be the parent of the source backup. Values are
- of the form ``projects//instances/``.
- table_id (str): Required. The id of the table to create and restore to. This table
- must not already exist. The ``table_id`` appended to ``parent`` forms
- the full table name of the form
- ``projects//instances//tables/``.
- backup (str): Name of the backup from which to restore. Values are of the form
- ``projects//instances//clusters//backups/``.
- retry (Optional[google.api_core.retry.Retry]): A retry object used
- to retry requests. If ``None`` is specified, requests will
- be retried using a default configuration.
- timeout (Optional[float]): The amount of time, in seconds, to wait
- for the request to complete. Note that if ``retry`` is
- specified, the timeout applies to each individual attempt.
- metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata
- that is provided to the method.
-
- Returns:
- A :class:`~google.cloud.bigtable_admin_v2.types._OperationFuture` instance.
-
- Raises:
- google.api_core.exceptions.GoogleAPICallError: If the request
- failed for any reason.
- google.api_core.exceptions.RetryError: If the request failed due
- to a retryable error and retry attempts failed.
- ValueError: If the parameters are invalid.
- """
- # Wrap the transport method to add retry and timeout logic.
- if "restore_table" not in self._inner_api_calls:
- self._inner_api_calls[
- "restore_table"
- ] = google.api_core.gapic_v1.method.wrap_method(
- self.transport.restore_table,
- default_retry=self._method_configs["RestoreTable"].retry,
- default_timeout=self._method_configs["RestoreTable"].timeout,
- client_info=self._client_info,
- )
-
- # Sanity check: We have some fields which are mutually exclusive;
- # raise ValueError if more than one is sent.
- google.api_core.protobuf_helpers.check_oneof(backup=backup,)
-
- request = bigtable_table_admin_pb2.RestoreTableRequest(
- parent=parent, table_id=table_id, backup=backup,
- )
- if metadata is None:
- metadata = []
- metadata = list(metadata)
- try:
- routing_header = [("parent", parent)]
- except AttributeError:
- pass
- else:
- routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata(
- routing_header
- )
- metadata.append(routing_metadata)
-
- operation = self._inner_api_calls["restore_table"](
- request, retry=retry, timeout=timeout, metadata=metadata
- )
- return google.api_core.operation.from_gapic(
- operation,
- self.transport._operations_client,
- table_pb2.Table,
- metadata_type=bigtable_table_admin_pb2.RestoreTableMetadata,
- )
diff --git a/google/cloud/bigtable_admin_v2/gapic/bigtable_table_admin_client_config.py b/google/cloud/bigtable_admin_v2/gapic/bigtable_table_admin_client_config.py
deleted file mode 100644
index db60047bd..000000000
--- a/google/cloud/bigtable_admin_v2/gapic/bigtable_table_admin_client_config.py
+++ /dev/null
@@ -1,160 +0,0 @@
-config = {
- "interfaces": {
- "google.bigtable.admin.v2.BigtableTableAdmin": {
- "retry_codes": {
- "idempotent": ["DEADLINE_EXCEEDED", "UNAVAILABLE"],
- "non_idempotent": [],
- },
- "retry_params": {
- "idempotent_params": {
- "initial_retry_delay_millis": 1000,
- "retry_delay_multiplier": 2.0,
- "max_retry_delay_millis": 60000,
- "initial_rpc_timeout_millis": 60000,
- "rpc_timeout_multiplier": 1.0,
- "max_rpc_timeout_millis": 60000,
- "total_timeout_millis": 600000,
- },
- "non_idempotent_params": {
- "initial_retry_delay_millis": 0,
- "retry_delay_multiplier": 1.0,
- "max_retry_delay_millis": 0,
- "initial_rpc_timeout_millis": 60000,
- "rpc_timeout_multiplier": 1.0,
- "max_rpc_timeout_millis": 60000,
- "total_timeout_millis": 60000,
- },
- "non_idempotent_heavy_params": {
- "initial_retry_delay_millis": 0,
- "retry_delay_multiplier": 1.0,
- "max_retry_delay_millis": 0,
- "initial_rpc_timeout_millis": 300000,
- "rpc_timeout_multiplier": 1.0,
- "max_rpc_timeout_millis": 300000,
- "total_timeout_millis": 300000,
- },
- "drop_row_range_params": {
- "initial_retry_delay_millis": 0,
- "retry_delay_multiplier": 1.0,
- "max_retry_delay_millis": 0,
- "initial_rpc_timeout_millis": 3600000,
- "rpc_timeout_multiplier": 1.0,
- "max_rpc_timeout_millis": 3600000,
- "total_timeout_millis": 3600000,
- },
- },
- "methods": {
- "CreateTable": {
- "timeout_millis": 130000,
- "retry_codes_name": "non_idempotent",
- "retry_params_name": "non_idempotent_heavy_params",
- },
- "CreateTableFromSnapshot": {
- "timeout_millis": 60000,
- "retry_codes_name": "non_idempotent",
- "retry_params_name": "non_idempotent_params",
- },
- "ListTables": {
- "timeout_millis": 60000,
- "retry_codes_name": "idempotent",
- "retry_params_name": "idempotent_params",
- },
- "GetTable": {
- "timeout_millis": 60000,
- "retry_codes_name": "idempotent",
- "retry_params_name": "idempotent_params",
- },
- "DeleteTable": {
- "timeout_millis": 60000,
- "retry_codes_name": "non_idempotent",
- "retry_params_name": "non_idempotent_params",
- },
- "ModifyColumnFamilies": {
- "timeout_millis": 60000,
- "retry_codes_name": "non_idempotent",
- "retry_params_name": "non_idempotent_heavy_params",
- },
- "DropRowRange": {
- "timeout_millis": 900000,
- "retry_codes_name": "non_idempotent",
- "retry_params_name": "drop_row_range_params",
- },
- "GenerateConsistencyToken": {
- "timeout_millis": 60000,
- "retry_codes_name": "idempotent",
- "retry_params_name": "idempotent_params",
- },
- "CheckConsistency": {
- "timeout_millis": 60000,
- "retry_codes_name": "idempotent",
- "retry_params_name": "idempotent_params",
- },
- "GetIamPolicy": {
- "timeout_millis": 60000,
- "retry_codes_name": "idempotent",
- "retry_params_name": "idempotent_params",
- },
- "SetIamPolicy": {
- "timeout_millis": 60000,
- "retry_codes_name": "non_idempotent",
- "retry_params_name": "non_idempotent_params",
- },
- "TestIamPermissions": {
- "timeout_millis": 60000,
- "retry_codes_name": "idempotent",
- "retry_params_name": "idempotent_params",
- },
- "SnapshotTable": {
- "timeout_millis": 60000,
- "retry_codes_name": "non_idempotent",
- "retry_params_name": "non_idempotent_params",
- },
- "GetSnapshot": {
- "timeout_millis": 60000,
- "retry_codes_name": "idempotent",
- "retry_params_name": "idempotent_params",
- },
- "ListSnapshots": {
- "timeout_millis": 60000,
- "retry_codes_name": "idempotent",
- "retry_params_name": "idempotent_params",
- },
- "DeleteSnapshot": {
- "timeout_millis": 60000,
- "retry_codes_name": "non_idempotent",
- "retry_params_name": "non_idempotent_params",
- },
- "CreateBackup": {
- "timeout_millis": 60000,
- "retry_codes_name": "non_idempotent",
- "retry_params_name": "non_idempotent_params",
- },
- "GetBackup": {
- "timeout_millis": 60000,
- "retry_codes_name": "idempotent",
- "retry_params_name": "idempotent_params",
- },
- "ListBackups": {
- "timeout_millis": 60000,
- "retry_codes_name": "idempotent",
- "retry_params_name": "idempotent_params",
- },
- "UpdateBackup": {
- "timeout_millis": 60000,
- "retry_codes_name": "non_idempotent",
- "retry_params_name": "non_idempotent_params",
- },
- "DeleteBackup": {
- "timeout_millis": 60000,
- "retry_codes_name": "non_idempotent",
- "retry_params_name": "non_idempotent_params",
- },
- "RestoreTable": {
- "timeout_millis": 60000,
- "retry_codes_name": "non_idempotent",
- "retry_params_name": "non_idempotent_params",
- },
- },
- }
- }
-}
diff --git a/google/cloud/bigtable_admin_v2/gapic/enums.py b/google/cloud/bigtable_admin_v2/gapic/enums.py
deleted file mode 100644
index c71bee34b..000000000
--- a/google/cloud/bigtable_admin_v2/gapic/enums.py
+++ /dev/null
@@ -1,213 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# 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
-#
-# https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""Wrappers for protocol buffer enum types."""
-
-import enum
-
-
-class RestoreSourceType(enum.IntEnum):
- """
- Indicates the type of the restore source.
-
- Attributes:
- RESTORE_SOURCE_TYPE_UNSPECIFIED (int): No restore associated.
- BACKUP (int): A backup was used as the source of the restore.
- """
-
- RESTORE_SOURCE_TYPE_UNSPECIFIED = 0
- BACKUP = 1
-
-
-class StorageType(enum.IntEnum):
- """
- Storage media types for persisting Bigtable data.
-
- Attributes:
- STORAGE_TYPE_UNSPECIFIED (int): The user did not specify a storage type.
- SSD (int): Flash (SSD) storage should be used.
- HDD (int): Magnetic drive (HDD) storage should be used.
- """
-
- STORAGE_TYPE_UNSPECIFIED = 0
- SSD = 1
- HDD = 2
-
-
-class Backup(object):
- class State(enum.IntEnum):
- """
- Indicates the current state of the backup.
-
- Attributes:
- STATE_UNSPECIFIED (int): Not specified.
- CREATING (int): The pending backup is still being created. Operations on the backup
- may fail with ``FAILED_PRECONDITION`` in this state.
- READY (int): The backup is complete and ready for use.
- """
-
- STATE_UNSPECIFIED = 0
- CREATING = 1
- READY = 2
-
-
-class Cluster(object):
- class State(enum.IntEnum):
- """
- Possible states of a cluster.
-
- Attributes:
- STATE_NOT_KNOWN (int): The state of the cluster could not be determined.
- READY (int): The cluster has been successfully created and is ready to serve requests.
- CREATING (int): The cluster is currently being created, and may be destroyed
- if the creation process encounters an error.
- A cluster may not be able to serve requests while being created.
- RESIZING (int): The cluster is currently being resized, and may revert to its previous
- node count if the process encounters an error.
- A cluster is still capable of serving requests while being resized,
- but may exhibit performance as if its number of allocated nodes is
- between the starting and requested states.
- DISABLED (int): The cluster has no backing nodes. The data (tables) still
- exist, but no operations can be performed on the cluster.
- """
-
- STATE_NOT_KNOWN = 0
- READY = 1
- CREATING = 2
- RESIZING = 3
- DISABLED = 4
-
-
-class Instance(object):
- class State(enum.IntEnum):
- """
- Possible states of an instance.
-
- Attributes:
- STATE_NOT_KNOWN (int): The state of the instance could not be determined.
- READY (int): The instance has been successfully created and can serve requests
- to its tables.
- CREATING (int): The instance is currently being created, and may be destroyed
- if the creation process encounters an error.
- """
-
- STATE_NOT_KNOWN = 0
- READY = 1
- CREATING = 2
-
- class Type(enum.IntEnum):
- """
- The type of the instance.
-
- Attributes:
- TYPE_UNSPECIFIED (int): The type of the instance is unspecified. If set when creating an
- instance, a ``PRODUCTION`` instance will be created. If set when
- updating an instance, the type will be left unchanged.
- PRODUCTION (int): An instance meant for production use. ``serve_nodes`` must be set on
- the cluster.
- DEVELOPMENT (int): The instance is meant for development and testing purposes only; it
- has no performance or uptime guarantees and is not covered by SLA. After
- a development instance is created, it can be upgraded by updating the
- instance to type ``PRODUCTION``. An instance created as a production
- instance cannot be changed to a development instance. When creating a
- development instance, ``serve_nodes`` on the cluster must not be set.
- """
-
- TYPE_UNSPECIFIED = 0
- PRODUCTION = 1
- DEVELOPMENT = 2
-
-
-class Snapshot(object):
- class State(enum.IntEnum):
- """
- Possible states of a snapshot.
-
- Attributes:
- STATE_NOT_KNOWN (int): The state of the snapshot could not be determined.
- READY (int): The snapshot has been successfully created and can serve all requests.
- CREATING (int): The snapshot is currently being created, and may be destroyed if the
- creation process encounters an error. A snapshot may not be restored to a
- table while it is being created.
- """
-
- STATE_NOT_KNOWN = 0
- READY = 1
- CREATING = 2
-
-
-class Table(object):
- class TimestampGranularity(enum.IntEnum):
- """
- Possible timestamp granularities to use when keeping multiple versions
- of data in a table.
-
- Attributes:
- TIMESTAMP_GRANULARITY_UNSPECIFIED (int): The user did not specify a granularity. Should not be returned.
- When specified during table creation, MILLIS will be used.
- MILLIS (int): The table keeps data versioned at a granularity of 1ms.
- """
-
- TIMESTAMP_GRANULARITY_UNSPECIFIED = 0
- MILLIS = 1
-
- class View(enum.IntEnum):
- """
- Defines a view over a table's fields.
-
- Attributes:
- VIEW_UNSPECIFIED (int): Uses the default view for each method as documented in its request.
- NAME_ONLY (int): Only populates ``name``.
- SCHEMA_VIEW (int): Only populates ``name`` and fields related to the table's schema.
- REPLICATION_VIEW (int): Only populates ``name`` and fields related to the table's
- replication state.
- FULL (int): Populates all fields.
- """
-
- VIEW_UNSPECIFIED = 0
- NAME_ONLY = 1
- SCHEMA_VIEW = 2
- REPLICATION_VIEW = 3
- FULL = 4
-
- class ClusterState(object):
- class ReplicationState(enum.IntEnum):
- """
- Table replication states.
-
- Attributes:
- STATE_NOT_KNOWN (int): The replication state of the table is unknown in this cluster.
- INITIALIZING (int): The cluster was recently created, and the table must finish copying
- over pre-existing data from other clusters before it can begin
- receiving live replication updates and serving Data API requests.
- PLANNED_MAINTENANCE (int): The table is temporarily unable to serve Data API requests from this
- cluster due to planned internal maintenance.
- UNPLANNED_MAINTENANCE (int): The table is temporarily unable to serve Data API requests from this
- cluster due to unplanned or emergency maintenance.
- READY (int): The table can serve Data API requests from this cluster. Depending on
- replication delay, reads may not immediately reflect the state of the
- table in other clusters.
- READY_OPTIMIZING (int): The table is fully created and ready for use after a restore, and is
- being optimized for performance. When optimizations are complete, the
- table will transition to ``READY`` state.
- """
-
- STATE_NOT_KNOWN = 0
- INITIALIZING = 1
- PLANNED_MAINTENANCE = 2
- UNPLANNED_MAINTENANCE = 3
- READY = 4
- READY_OPTIMIZING = 5
diff --git a/google/cloud/bigtable_admin_v2/gapic/transports/bigtable_instance_admin_grpc_transport.py b/google/cloud/bigtable_admin_v2/gapic/transports/bigtable_instance_admin_grpc_transport.py
deleted file mode 100644
index 536629604..000000000
--- a/google/cloud/bigtable_admin_v2/gapic/transports/bigtable_instance_admin_grpc_transport.py
+++ /dev/null
@@ -1,380 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# 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
-#
-# https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT 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 google.api_core.grpc_helpers
-import google.api_core.operations_v1
-
-from google.cloud.bigtable_admin_v2.proto import bigtable_instance_admin_pb2_grpc
-
-
-class BigtableInstanceAdminGrpcTransport(object):
- """gRPC transport class providing stubs for
- google.bigtable.admin.v2 BigtableInstanceAdmin API.
-
- The transport provides access to the raw gRPC stubs,
- which can be used to take advantage of advanced
- features of gRPC.
- """
-
- # The scopes needed to make gRPC calls to all of the methods defined
- # in this service.
- _OAUTH_SCOPES = (
- "https://www.googleapis.com/auth/bigtable.admin",
- "https://www.googleapis.com/auth/bigtable.admin.cluster",
- "https://www.googleapis.com/auth/bigtable.admin.instance",
- "https://www.googleapis.com/auth/bigtable.admin.table",
- "https://www.googleapis.com/auth/cloud-bigtable.admin",
- "https://www.googleapis.com/auth/cloud-bigtable.admin.cluster",
- "https://www.googleapis.com/auth/cloud-bigtable.admin.table",
- "https://www.googleapis.com/auth/cloud-platform",
- "https://www.googleapis.com/auth/cloud-platform.read-only",
- )
-
- def __init__(
- self, channel=None, credentials=None, address="bigtableadmin.googleapis.com:443"
- ):
- """Instantiate the transport class.
-
- Args:
- channel (grpc.Channel): A ``Channel`` instance through
- which to make calls. This argument is mutually exclusive
- with ``credentials``; providing both will raise an exception.
- credentials (google.auth.credentials.Credentials): The
- authorization credentials to attach to requests. These
- credentials identify this application to the service. If none
- are specified, the client will attempt to ascertain the
- credentials from the environment.
- address (str): The address where the service is hosted.
- """
- # If both `channel` and `credentials` are specified, raise an
- # exception (channels come with credentials baked in already).
- if channel is not None and credentials is not None:
- raise ValueError(
- "The `channel` and `credentials` arguments are mutually " "exclusive.",
- )
-
- # Create the channel.
- if channel is None:
- channel = self.create_channel(
- address=address,
- credentials=credentials,
- options={
- "grpc.max_send_message_length": -1,
- "grpc.max_receive_message_length": -1,
- }.items(),
- )
-
- self._channel = channel
-
- # gRPC uses objects called "stubs" that are bound to the
- # channel and provide a basic method for each RPC.
- self._stubs = {
- "bigtable_instance_admin_stub": bigtable_instance_admin_pb2_grpc.BigtableInstanceAdminStub(
- channel
- ),
- }
-
- # Because this API includes a method that returns a
- # long-running operation (proto: google.longrunning.Operation),
- # instantiate an LRO client.
- self._operations_client = google.api_core.operations_v1.OperationsClient(
- channel
- )
-
- @classmethod
- def create_channel(
- cls, address="bigtableadmin.googleapis.com:443", credentials=None, **kwargs
- ):
- """Create and return a gRPC channel object.
-
- Args:
- address (str): The host for the channel to use.
- credentials (~.Credentials): The
- authorization credentials to attach to requests. These
- credentials identify this application to the service. If
- none are specified, the client will attempt to ascertain
- the credentials from the environment.
- kwargs (dict): Keyword arguments, which are passed to the
- channel creation.
-
- Returns:
- grpc.Channel: A gRPC channel object.
- """
- return google.api_core.grpc_helpers.create_channel(
- address, credentials=credentials, scopes=cls._OAUTH_SCOPES, **kwargs
- )
-
- @property
- def channel(self):
- """The gRPC channel used by the transport.
-
- Returns:
- grpc.Channel: A gRPC channel object.
- """
- return self._channel
-
- @property
- def create_instance(self):
- """Return the gRPC stub for :meth:`BigtableInstanceAdminClient.create_instance`.
-
- Create an instance within a project.
-
- Returns:
- Callable: A callable which accepts the appropriate
- deserialized request object and returns a
- deserialized response object.
- """
- return self._stubs["bigtable_instance_admin_stub"].CreateInstance
-
- @property
- def get_instance(self):
- """Return the gRPC stub for :meth:`BigtableInstanceAdminClient.get_instance`.
-
- Gets information about an instance.
-
- Returns:
- Callable: A callable which accepts the appropriate
- deserialized request object and returns a
- deserialized response object.
- """
- return self._stubs["bigtable_instance_admin_stub"].GetInstance
-
- @property
- def list_instances(self):
- """Return the gRPC stub for :meth:`BigtableInstanceAdminClient.list_instances`.
-
- Lists information about instances in a project.
-
- Returns:
- Callable: A callable which accepts the appropriate
- deserialized request object and returns a
- deserialized response object.
- """
- return self._stubs["bigtable_instance_admin_stub"].ListInstances
-
- @property
- def update_instance(self):
- """Return the gRPC stub for :meth:`BigtableInstanceAdminClient.update_instance`.
-
- Updates an instance within a project. This method updates only the display
- name and type for an Instance. To update other Instance properties, such as
- labels, use PartialUpdateInstance.
-
- Returns:
- Callable: A callable which accepts the appropriate
- deserialized request object and returns a
- deserialized response object.
- """
- return self._stubs["bigtable_instance_admin_stub"].UpdateInstance
-
- @property
- def partial_update_instance(self):
- """Return the gRPC stub for :meth:`BigtableInstanceAdminClient.partial_update_instance`.
-
- Partially updates an instance within a project. This method can modify all
- fields of an Instance and is the preferred way to update an Instance.
-
- Returns:
- Callable: A callable which accepts the appropriate
- deserialized request object and returns a
- deserialized response object.
- """
- return self._stubs["bigtable_instance_admin_stub"].PartialUpdateInstance
-
- @property
- def delete_instance(self):
- """Return the gRPC stub for :meth:`BigtableInstanceAdminClient.delete_instance`.
-
- Delete an instance from a project.
-
- Returns:
- Callable: A callable which accepts the appropriate
- deserialized request object and returns a
- deserialized response object.
- """
- return self._stubs["bigtable_instance_admin_stub"].DeleteInstance
-
- @property
- def create_cluster(self):
- """Return the gRPC stub for :meth:`BigtableInstanceAdminClient.create_cluster`.
-
- Creates a cluster within an instance.
-
- Returns:
- Callable: A callable which accepts the appropriate
- deserialized request object and returns a
- deserialized response object.
- """
- return self._stubs["bigtable_instance_admin_stub"].CreateCluster
-
- @property
- def get_cluster(self):
- """Return the gRPC stub for :meth:`BigtableInstanceAdminClient.get_cluster`.
-
- Gets information about a cluster.
-
- Returns:
- Callable: A callable which accepts the appropriate
- deserialized request object and returns a
- deserialized response object.
- """
- return self._stubs["bigtable_instance_admin_stub"].GetCluster
-
- @property
- def list_clusters(self):
- """Return the gRPC stub for :meth:`BigtableInstanceAdminClient.list_clusters`.
-
- Lists information about clusters in an instance.
-
- Returns:
- Callable: A callable which accepts the appropriate
- deserialized request object and returns a
- deserialized response object.
- """
- return self._stubs["bigtable_instance_admin_stub"].ListClusters
-
- @property
- def update_cluster(self):
- """Return the gRPC stub for :meth:`BigtableInstanceAdminClient.update_cluster`.
-
- Updates a cluster within an instance.
-
- Returns:
- Callable: A callable which accepts the appropriate
- deserialized request object and returns a
- deserialized response object.
- """
- return self._stubs["bigtable_instance_admin_stub"].UpdateCluster
-
- @property
- def delete_cluster(self):
- """Return the gRPC stub for :meth:`BigtableInstanceAdminClient.delete_cluster`.
-
- Deletes a cluster from an instance.
-
- Returns:
- Callable: A callable which accepts the appropriate
- deserialized request object and returns a
- deserialized response object.
- """
- return self._stubs["bigtable_instance_admin_stub"].DeleteCluster
-
- @property
- def create_app_profile(self):
- """Return the gRPC stub for :meth:`BigtableInstanceAdminClient.create_app_profile`.
-
- Creates an app profile within an instance.
-
- Returns:
- Callable: A callable which accepts the appropriate
- deserialized request object and returns a
- deserialized response object.
- """
- return self._stubs["bigtable_instance_admin_stub"].CreateAppProfile
-
- @property
- def get_app_profile(self):
- """Return the gRPC stub for :meth:`BigtableInstanceAdminClient.get_app_profile`.
-
- Gets information about an app profile.
-
- Returns:
- Callable: A callable which accepts the appropriate
- deserialized request object and returns a
- deserialized response object.
- """
- return self._stubs["bigtable_instance_admin_stub"].GetAppProfile
-
- @property
- def list_app_profiles(self):
- """Return the gRPC stub for :meth:`BigtableInstanceAdminClient.list_app_profiles`.
-
- Lists information about app profiles in an instance.
-
- Returns:
- Callable: A callable which accepts the appropriate
- deserialized request object and returns a
- deserialized response object.
- """
- return self._stubs["bigtable_instance_admin_stub"].ListAppProfiles
-
- @property
- def update_app_profile(self):
- """Return the gRPC stub for :meth:`BigtableInstanceAdminClient.update_app_profile`.
-
- Updates an app profile within an instance.
-
- Returns:
- Callable: A callable which accepts the appropriate
- deserialized request object and returns a
- deserialized response object.
- """
- return self._stubs["bigtable_instance_admin_stub"].UpdateAppProfile
-
- @property
- def delete_app_profile(self):
- """Return the gRPC stub for :meth:`BigtableInstanceAdminClient.delete_app_profile`.
-
- Deletes an app profile from an instance.
-
- Returns:
- Callable: A callable which accepts the appropriate
- deserialized request object and returns a
- deserialized response object.
- """
- return self._stubs["bigtable_instance_admin_stub"].DeleteAppProfile
-
- @property
- def get_iam_policy(self):
- """Return the gRPC stub for :meth:`BigtableInstanceAdminClient.get_iam_policy`.
-
- Gets the access control policy for an instance resource. Returns an empty
- policy if an instance exists but does not have a policy set.
-
- Returns:
- Callable: A callable which accepts the appropriate
- deserialized request object and returns a
- deserialized response object.
- """
- return self._stubs["bigtable_instance_admin_stub"].GetIamPolicy
-
- @property
- def set_iam_policy(self):
- """Return the gRPC stub for :meth:`BigtableInstanceAdminClient.set_iam_policy`.
-
- Sets the access control policy on an instance resource. Replaces any
- existing policy.
-
- Returns:
- Callable: A callable which accepts the appropriate
- deserialized request object and returns a
- deserialized response object.
- """
- return self._stubs["bigtable_instance_admin_stub"].SetIamPolicy
-
- @property
- def test_iam_permissions(self):
- """Return the gRPC stub for :meth:`BigtableInstanceAdminClient.test_iam_permissions`.
-
- Returns permissions that the caller has on the specified instance resource.
-
- Returns:
- Callable: A callable which accepts the appropriate
- deserialized request object and returns a
- deserialized response object.
- """
- return self._stubs["bigtable_instance_admin_stub"].TestIamPermissions
diff --git a/google/cloud/bigtable_admin_v2/gapic/transports/bigtable_table_admin_grpc_transport.py b/google/cloud/bigtable_admin_v2/gapic/transports/bigtable_table_admin_grpc_transport.py
deleted file mode 100644
index 281bad20a..000000000
--- a/google/cloud/bigtable_admin_v2/gapic/transports/bigtable_table_admin_grpc_transport.py
+++ /dev/null
@@ -1,471 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# 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
-#
-# https://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT 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 google.api_core.grpc_helpers
-import google.api_core.operations_v1
-
-from google.cloud.bigtable_admin_v2.proto import bigtable_table_admin_pb2_grpc
-
-
-class BigtableTableAdminGrpcTransport(object):
- """gRPC transport class providing stubs for
- google.bigtable.admin.v2 BigtableTableAdmin API.
-
- The transport provides access to the raw gRPC stubs,
- which can be used to take advantage of advanced
- features of gRPC.
- """
-
- # The scopes needed to make gRPC calls to all of the methods defined
- # in this service.
- _OAUTH_SCOPES = (
- "https://www.googleapis.com/auth/bigtable.admin",
- "https://www.googleapis.com/auth/bigtable.admin.cluster",
- "https://www.googleapis.com/auth/bigtable.admin.instance",
- "https://www.googleapis.com/auth/bigtable.admin.table",
- "https://www.googleapis.com/auth/cloud-bigtable.admin",
- "https://www.googleapis.com/auth/cloud-bigtable.admin.cluster",
- "https://www.googleapis.com/auth/cloud-bigtable.admin.table",
- "https://www.googleapis.com/auth/cloud-platform",
- "https://www.googleapis.com/auth/cloud-platform.read-only",
- )
-
- def __init__(
- self, channel=None, credentials=None, address="bigtableadmin.googleapis.com:443"
- ):
- """Instantiate the transport class.
-
- Args:
- channel (grpc.Channel): A ``Channel`` instance through
- which to make calls. This argument is mutually exclusive
- with ``credentials``; providing both will raise an exception.
- credentials (google.auth.credentials.Credentials): The
- authorization credentials to attach to requests. These
- credentials identify this application to the service. If none
- are specified, the client will attempt to ascertain the
- credentials from the environment.
- address (str): The address where the service is hosted.
- """
- # If both `channel` and `credentials` are specified, raise an
- # exception (channels come with credentials baked in already).
- if channel is not None and credentials is not None:
- raise ValueError(
- "The `channel` and `credentials` arguments are mutually " "exclusive.",
- )
-
- # Create the channel.
- if channel is None:
- channel = self.create_channel(
- address=address,
- credentials=credentials,
- options={
- "grpc.max_send_message_length": -1,
- "grpc.max_receive_message_length": -1,
- }.items(),
- )
-
- self._channel = channel
-
- # gRPC uses objects called "stubs" that are bound to the
- # channel and provide a basic method for each RPC.
- self._stubs = {
- "bigtable_table_admin_stub": bigtable_table_admin_pb2_grpc.BigtableTableAdminStub(
- channel
- ),
- }
-
- # Because this API includes a method that returns a
- # long-running operation (proto: google.longrunning.Operation),
- # instantiate an LRO client.
- self._operations_client = google.api_core.operations_v1.OperationsClient(
- channel
- )
-
- @classmethod
- def create_channel(
- cls, address="bigtableadmin.googleapis.com:443", credentials=None, **kwargs
- ):
- """Create and return a gRPC channel object.
-
- Args:
- address (str): The host for the channel to use.
- credentials (~.Credentials): The
- authorization credentials to attach to requests. These
- credentials identify this application to the service. If
- none are specified, the client will attempt to ascertain
- the credentials from the environment.
- kwargs (dict): Keyword arguments, which are passed to the
- channel creation.
-
- Returns:
- grpc.Channel: A gRPC channel object.
- """
- return google.api_core.grpc_helpers.create_channel(
- address, credentials=credentials, scopes=cls._OAUTH_SCOPES, **kwargs
- )
-
- @property
- def channel(self):
- """The gRPC channel used by the transport.
-
- Returns:
- grpc.Channel: A gRPC channel object.
- """
- return self._channel
-
- @property
- def create_table(self):
- """Return the gRPC stub for :meth:`BigtableTableAdminClient.create_table`.
-
- Creates a new table in the specified instance.
- The table can be created with a full set of initial column families,
- specified in the request.
-
- Returns:
- Callable: A callable which accepts the appropriate
- deserialized request object and returns a
- deserialized response object.
- """
- return self._stubs["bigtable_table_admin_stub"].CreateTable
-
- @property
- def create_table_from_snapshot(self):
- """Return the gRPC stub for :meth:`BigtableTableAdminClient.create_table_from_snapshot`.
-
- Creates a new table from the specified snapshot. The target table must
- not exist. The snapshot and the table must be in the same instance.
-
- Note: This is a private alpha release of Cloud Bigtable snapshots. This
- feature is not currently available to most Cloud Bigtable customers. This
- feature might be changed in backward-incompatible ways and is not
- recommended for production use. It is not subject to any SLA or deprecation
- policy.
-
- Returns:
- Callable: A callable which accepts the appropriate
- deserialized request object and returns a
- deserialized response object.
- """
- return self._stubs["bigtable_table_admin_stub"].CreateTableFromSnapshot
-
- @property
- def list_tables(self):
- """Return the gRPC stub for :meth:`BigtableTableAdminClient.list_tables`.
-
- Lists all tables served from a specified instance.
-
- Returns:
- Callable: A callable which accepts the appropriate
- deserialized request object and returns a
- deserialized response object.
- """
- return self._stubs["bigtable_table_admin_stub"].ListTables
-
- @property
- def get_table(self):
- """Return the gRPC stub for :meth:`BigtableTableAdminClient.get_table`.
-
- Gets metadata information about the specified table.
-
- Returns:
- Callable: A callable which accepts the appropriate
- deserialized request object and returns a
- deserialized response object.
- """
- return self._stubs["bigtable_table_admin_stub"].GetTable
-
- @property
- def delete_table(self):
- """Return the gRPC stub for :meth:`BigtableTableAdminClient.delete_table`.
-
- Permanently deletes a specified table and all of its data.
-
- Returns:
- Callable: A callable which accepts the appropriate
- deserialized request object and returns a
- deserialized response object.
- """
- return self._stubs["bigtable_table_admin_stub"].DeleteTable
-
- @property
- def modify_column_families(self):
- """Return the gRPC stub for :meth:`BigtableTableAdminClient.modify_column_families`.
-
- Performs a series of column family modifications on the specified table.
- Either all or none of the modifications will occur before this method
- returns, but data requests received prior to that point may see a table
- where only some modifications have taken effect.
-
- Returns:
- Callable: A callable which accepts the appropriate
- deserialized request object and returns a
- deserialized response object.
- """
- return self._stubs["bigtable_table_admin_stub"].ModifyColumnFamilies
-
- @property
- def drop_row_range(self):
- """Return the gRPC stub for :meth:`BigtableTableAdminClient.drop_row_range`.
-
- Permanently drop/delete a row range from a specified table. The request can
- specify whether to delete all rows in a table, or only those that match a
- particular prefix.
-
- Returns:
- Callable: A callable which accepts the appropriate
- deserialized request object and returns a
- deserialized response object.
- """
- return self._stubs["bigtable_table_admin_stub"].DropRowRange
-
- @property
- def generate_consistency_token(self):
- """Return the gRPC stub for :meth:`BigtableTableAdminClient.generate_consistency_token`.
-
- Generates a consistency token for a Table, which can be used in
- CheckConsistency to check whether mutations to the table that finished
- before this call started have been replicated. The tokens will be available
- for 90 days.
-
- Returns:
- Callable: A callable which accepts the appropriate
- deserialized request object and returns a
- deserialized response object.
- """
- return self._stubs["bigtable_table_admin_stub"].GenerateConsistencyToken
-
- @property
- def check_consistency(self):
- """Return the gRPC stub for :meth:`BigtableTableAdminClient.check_consistency`.
-
- Checks replication consistency based on a consistency token, that is, if
- replication has caught up based on the conditions specified in the token
- and the check request.
-
- Returns:
- Callable: A callable which accepts the appropriate
- deserialized request object and returns a
- deserialized response object.
- """
- return self._stubs["bigtable_table_admin_stub"].CheckConsistency
-
- @property
- def get_iam_policy(self):
- """Return the gRPC stub for :meth:`BigtableTableAdminClient.get_iam_policy`.
-
- Gets the access control policy for a resource.
- Returns an empty policy if the resource exists but does not have a policy
- set.
-
- Returns:
- Callable: A callable which accepts the appropriate
- deserialized request object and returns a
- deserialized response object.
- """
- return self._stubs["bigtable_table_admin_stub"].GetIamPolicy
-
- @property
- def set_iam_policy(self):
- """Return the gRPC stub for :meth:`BigtableTableAdminClient.set_iam_policy`.
-
- Sets the access control policy on a Table or Backup resource.
- Replaces any existing policy.
-
- Returns:
- Callable: A callable which accepts the appropriate
- deserialized request object and returns a
- deserialized response object.
- """
- return self._stubs["bigtable_table_admin_stub"].SetIamPolicy
-
- @property
- def test_iam_permissions(self):
- """Return the gRPC stub for :meth:`BigtableTableAdminClient.test_iam_permissions`.
-
- Returns permissions that the caller has on the specified table resource.
-
- Returns:
- Callable: A callable which accepts the appropriate
- deserialized request object and returns a
- deserialized response object.
- """
- return self._stubs["bigtable_table_admin_stub"].TestIamPermissions
-
- @property
- def snapshot_table(self):
- """Return the gRPC stub for :meth:`BigtableTableAdminClient.snapshot_table`.
-
- Creates a new snapshot in the specified cluster from the specified
- source table. The cluster and the table must be in the same instance.
-
- Note: This is a private alpha release of Cloud Bigtable snapshots. This
- feature is not currently available to most Cloud Bigtable customers. This
- feature might be changed in backward-incompatible ways and is not
- recommended for production use. It is not subject to any SLA or deprecation
- policy.
-
- Returns:
- Callable: A callable which accepts the appropriate
- deserialized request object and returns a
- deserialized response object.
- """
- return self._stubs["bigtable_table_admin_stub"].SnapshotTable
-
- @property
- def get_snapshot(self):
- """Return the gRPC stub for :meth:`BigtableTableAdminClient.get_snapshot`.
-
- Gets metadata information about the specified snapshot.
-
- Note: This is a private alpha release of Cloud Bigtable snapshots. This
- feature is not currently available to most Cloud Bigtable customers. This
- feature might be changed in backward-incompatible ways and is not
- recommended for production use. It is not subject to any SLA or deprecation
- policy.
-
- Returns:
- Callable: A callable which accepts the appropriate
- deserialized request object and returns a
- deserialized response object.
- """
- return self._stubs["bigtable_table_admin_stub"].GetSnapshot
-
- @property
- def list_snapshots(self):
- """Return the gRPC stub for :meth:`BigtableTableAdminClient.list_snapshots`.
-
- Lists all snapshots associated with the specified cluster.
-
- Note: This is a private alpha release of Cloud Bigtable snapshots. This
- feature is not currently available to most Cloud Bigtable customers. This
- feature might be changed in backward-incompatible ways and is not
- recommended for production use. It is not subject to any SLA or deprecation
- policy.
-
- Returns:
- Callable: A callable which accepts the appropriate
- deserialized request object and returns a
- deserialized response object.
- """
- return self._stubs["bigtable_table_admin_stub"].ListSnapshots
-
- @property
- def delete_snapshot(self):
- """Return the gRPC stub for :meth:`BigtableTableAdminClient.delete_snapshot`.
-
- Permanently deletes the specified snapshot.
-
- Note: This is a private alpha release of Cloud Bigtable snapshots. This
- feature is not currently available to most Cloud Bigtable customers. This
- feature might be changed in backward-incompatible ways and is not
- recommended for production use. It is not subject to any SLA or deprecation
- policy.
-
- Returns:
- Callable: A callable which accepts the appropriate
- deserialized request object and returns a
- deserialized response object.
- """
- return self._stubs["bigtable_table_admin_stub"].DeleteSnapshot
-
- @property
- def create_backup(self):
- """Return the gRPC stub for :meth:`BigtableTableAdminClient.create_backup`.
-
- Starts creating a new Cloud Bigtable Backup. The returned backup
- ``long-running operation`` can be used to track creation of the backup.
- The ``metadata`` field type is ``CreateBackupMetadata``. The
- ``response`` field type is ``Backup``, if successful. Cancelling the
- returned operation will stop the creation and delete the backup.
-
- Returns:
- Callable: A callable which accepts the appropriate
- deserialized request object and returns a
- deserialized response object.
- """
- return self._stubs["bigtable_table_admin_stub"].CreateBackup
-
- @property
- def get_backup(self):
- """Return the gRPC stub for :meth:`BigtableTableAdminClient.get_backup`.
-
- Gets metadata on a pending or completed Cloud Bigtable Backup.
-
- Returns:
- Callable: A callable which accepts the appropriate
- deserialized request object and returns a
- deserialized response object.
- """
- return self._stubs["bigtable_table_admin_stub"].GetBackup
-
- @property
- def list_backups(self):
- """Return the gRPC stub for :meth:`BigtableTableAdminClient.list_backups`.
-
- Lists Cloud Bigtable backups. Returns both completed and pending
- backups.
-
- Returns:
- Callable: A callable which accepts the appropriate
- deserialized request object and returns a
- deserialized response object.
- """
- return self._stubs["bigtable_table_admin_stub"].ListBackups
-
- @property
- def update_backup(self):
- """Return the gRPC stub for :meth:`BigtableTableAdminClient.update_backup`.
-
- Updates a pending or completed Cloud Bigtable Backup.
-
- Returns:
- Callable: A callable which accepts the appropriate
- deserialized request object and returns a
- deserialized response object.
- """
- return self._stubs["bigtable_table_admin_stub"].UpdateBackup
-
- @property
- def delete_backup(self):
- """Return the gRPC stub for :meth:`BigtableTableAdminClient.delete_backup`.
-
- Deletes a pending or completed Cloud Bigtable backup.
-
- Returns:
- Callable: A callable which accepts the appropriate
- deserialized request object and returns a
- deserialized response object.
- """
- return self._stubs["bigtable_table_admin_stub"].DeleteBackup
-
- @property
- def restore_table(self):
- """Return the gRPC stub for :meth:`BigtableTableAdminClient.restore_table`.
-
- Create a new table by restoring from a completed backup. The new
- table must be in the same instance as the instance containing the
- backup. The returned table ``long-running operation`` can be used to
- track the progress of the operation, and to cancel it. The ``metadata``
- field type is ``RestoreTableMetadata``. The ``response`` type is
- ``Table``, if successful.
-
- Returns:
- Callable: A callable which accepts the appropriate
- deserialized request object and returns a
- deserialized response object.
- """
- return self._stubs["bigtable_table_admin_stub"].RestoreTable
diff --git a/google/cloud/bigtable_admin_v2/gapic_metadata.json b/google/cloud/bigtable_admin_v2/gapic_metadata.json
new file mode 100644
index 000000000..9725d3384
--- /dev/null
+++ b/google/cloud/bigtable_admin_v2/gapic_metadata.json
@@ -0,0 +1,1037 @@
+ {
+ "comment": "This file maps proto services/RPCs to the corresponding library clients/methods",
+ "language": "python",
+ "libraryPackage": "google.cloud.bigtable_admin_v2",
+ "protoPackage": "google.bigtable.admin.v2",
+ "schema": "1.0",
+ "services": {
+ "BigtableInstanceAdmin": {
+ "clients": {
+ "grpc": {
+ "libraryClient": "BigtableInstanceAdminClient",
+ "rpcs": {
+ "CreateAppProfile": {
+ "methods": [
+ "create_app_profile"
+ ]
+ },
+ "CreateCluster": {
+ "methods": [
+ "create_cluster"
+ ]
+ },
+ "CreateInstance": {
+ "methods": [
+ "create_instance"
+ ]
+ },
+ "CreateLogicalView": {
+ "methods": [
+ "create_logical_view"
+ ]
+ },
+ "CreateMaterializedView": {
+ "methods": [
+ "create_materialized_view"
+ ]
+ },
+ "DeleteAppProfile": {
+ "methods": [
+ "delete_app_profile"
+ ]
+ },
+ "DeleteCluster": {
+ "methods": [
+ "delete_cluster"
+ ]
+ },
+ "DeleteInstance": {
+ "methods": [
+ "delete_instance"
+ ]
+ },
+ "DeleteLogicalView": {
+ "methods": [
+ "delete_logical_view"
+ ]
+ },
+ "DeleteMaterializedView": {
+ "methods": [
+ "delete_materialized_view"
+ ]
+ },
+ "GetAppProfile": {
+ "methods": [
+ "get_app_profile"
+ ]
+ },
+ "GetCluster": {
+ "methods": [
+ "get_cluster"
+ ]
+ },
+ "GetIamPolicy": {
+ "methods": [
+ "get_iam_policy"
+ ]
+ },
+ "GetInstance": {
+ "methods": [
+ "get_instance"
+ ]
+ },
+ "GetLogicalView": {
+ "methods": [
+ "get_logical_view"
+ ]
+ },
+ "GetMaterializedView": {
+ "methods": [
+ "get_materialized_view"
+ ]
+ },
+ "ListAppProfiles": {
+ "methods": [
+ "list_app_profiles"
+ ]
+ },
+ "ListClusters": {
+ "methods": [
+ "list_clusters"
+ ]
+ },
+ "ListHotTablets": {
+ "methods": [
+ "list_hot_tablets"
+ ]
+ },
+ "ListInstances": {
+ "methods": [
+ "list_instances"
+ ]
+ },
+ "ListLogicalViews": {
+ "methods": [
+ "list_logical_views"
+ ]
+ },
+ "ListMaterializedViews": {
+ "methods": [
+ "list_materialized_views"
+ ]
+ },
+ "PartialUpdateCluster": {
+ "methods": [
+ "partial_update_cluster"
+ ]
+ },
+ "PartialUpdateInstance": {
+ "methods": [
+ "partial_update_instance"
+ ]
+ },
+ "SetIamPolicy": {
+ "methods": [
+ "set_iam_policy"
+ ]
+ },
+ "TestIamPermissions": {
+ "methods": [
+ "test_iam_permissions"
+ ]
+ },
+ "UpdateAppProfile": {
+ "methods": [
+ "update_app_profile"
+ ]
+ },
+ "UpdateCluster": {
+ "methods": [
+ "update_cluster"
+ ]
+ },
+ "UpdateInstance": {
+ "methods": [
+ "update_instance"
+ ]
+ },
+ "UpdateLogicalView": {
+ "methods": [
+ "update_logical_view"
+ ]
+ },
+ "UpdateMaterializedView": {
+ "methods": [
+ "update_materialized_view"
+ ]
+ }
+ }
+ },
+ "grpc-async": {
+ "libraryClient": "BigtableInstanceAdminAsyncClient",
+ "rpcs": {
+ "CreateAppProfile": {
+ "methods": [
+ "create_app_profile"
+ ]
+ },
+ "CreateCluster": {
+ "methods": [
+ "create_cluster"
+ ]
+ },
+ "CreateInstance": {
+ "methods": [
+ "create_instance"
+ ]
+ },
+ "CreateLogicalView": {
+ "methods": [
+ "create_logical_view"
+ ]
+ },
+ "CreateMaterializedView": {
+ "methods": [
+ "create_materialized_view"
+ ]
+ },
+ "DeleteAppProfile": {
+ "methods": [
+ "delete_app_profile"
+ ]
+ },
+ "DeleteCluster": {
+ "methods": [
+ "delete_cluster"
+ ]
+ },
+ "DeleteInstance": {
+ "methods": [
+ "delete_instance"
+ ]
+ },
+ "DeleteLogicalView": {
+ "methods": [
+ "delete_logical_view"
+ ]
+ },
+ "DeleteMaterializedView": {
+ "methods": [
+ "delete_materialized_view"
+ ]
+ },
+ "GetAppProfile": {
+ "methods": [
+ "get_app_profile"
+ ]
+ },
+ "GetCluster": {
+ "methods": [
+ "get_cluster"
+ ]
+ },
+ "GetIamPolicy": {
+ "methods": [
+ "get_iam_policy"
+ ]
+ },
+ "GetInstance": {
+ "methods": [
+ "get_instance"
+ ]
+ },
+ "GetLogicalView": {
+ "methods": [
+ "get_logical_view"
+ ]
+ },
+ "GetMaterializedView": {
+ "methods": [
+ "get_materialized_view"
+ ]
+ },
+ "ListAppProfiles": {
+ "methods": [
+ "list_app_profiles"
+ ]
+ },
+ "ListClusters": {
+ "methods": [
+ "list_clusters"
+ ]
+ },
+ "ListHotTablets": {
+ "methods": [
+ "list_hot_tablets"
+ ]
+ },
+ "ListInstances": {
+ "methods": [
+ "list_instances"
+ ]
+ },
+ "ListLogicalViews": {
+ "methods": [
+ "list_logical_views"
+ ]
+ },
+ "ListMaterializedViews": {
+ "methods": [
+ "list_materialized_views"
+ ]
+ },
+ "PartialUpdateCluster": {
+ "methods": [
+ "partial_update_cluster"
+ ]
+ },
+ "PartialUpdateInstance": {
+ "methods": [
+ "partial_update_instance"
+ ]
+ },
+ "SetIamPolicy": {
+ "methods": [
+ "set_iam_policy"
+ ]
+ },
+ "TestIamPermissions": {
+ "methods": [
+ "test_iam_permissions"
+ ]
+ },
+ "UpdateAppProfile": {
+ "methods": [
+ "update_app_profile"
+ ]
+ },
+ "UpdateCluster": {
+ "methods": [
+ "update_cluster"
+ ]
+ },
+ "UpdateInstance": {
+ "methods": [
+ "update_instance"
+ ]
+ },
+ "UpdateLogicalView": {
+ "methods": [
+ "update_logical_view"
+ ]
+ },
+ "UpdateMaterializedView": {
+ "methods": [
+ "update_materialized_view"
+ ]
+ }
+ }
+ },
+ "rest": {
+ "libraryClient": "BigtableInstanceAdminClient",
+ "rpcs": {
+ "CreateAppProfile": {
+ "methods": [
+ "create_app_profile"
+ ]
+ },
+ "CreateCluster": {
+ "methods": [
+ "create_cluster"
+ ]
+ },
+ "CreateInstance": {
+ "methods": [
+ "create_instance"
+ ]
+ },
+ "CreateLogicalView": {
+ "methods": [
+ "create_logical_view"
+ ]
+ },
+ "CreateMaterializedView": {
+ "methods": [
+ "create_materialized_view"
+ ]
+ },
+ "DeleteAppProfile": {
+ "methods": [
+ "delete_app_profile"
+ ]
+ },
+ "DeleteCluster": {
+ "methods": [
+ "delete_cluster"
+ ]
+ },
+ "DeleteInstance": {
+ "methods": [
+ "delete_instance"
+ ]
+ },
+ "DeleteLogicalView": {
+ "methods": [
+ "delete_logical_view"
+ ]
+ },
+ "DeleteMaterializedView": {
+ "methods": [
+ "delete_materialized_view"
+ ]
+ },
+ "GetAppProfile": {
+ "methods": [
+ "get_app_profile"
+ ]
+ },
+ "GetCluster": {
+ "methods": [
+ "get_cluster"
+ ]
+ },
+ "GetIamPolicy": {
+ "methods": [
+ "get_iam_policy"
+ ]
+ },
+ "GetInstance": {
+ "methods": [
+ "get_instance"
+ ]
+ },
+ "GetLogicalView": {
+ "methods": [
+ "get_logical_view"
+ ]
+ },
+ "GetMaterializedView": {
+ "methods": [
+ "get_materialized_view"
+ ]
+ },
+ "ListAppProfiles": {
+ "methods": [
+ "list_app_profiles"
+ ]
+ },
+ "ListClusters": {
+ "methods": [
+ "list_clusters"
+ ]
+ },
+ "ListHotTablets": {
+ "methods": [
+ "list_hot_tablets"
+ ]
+ },
+ "ListInstances": {
+ "methods": [
+ "list_instances"
+ ]
+ },
+ "ListLogicalViews": {
+ "methods": [
+ "list_logical_views"
+ ]
+ },
+ "ListMaterializedViews": {
+ "methods": [
+ "list_materialized_views"
+ ]
+ },
+ "PartialUpdateCluster": {
+ "methods": [
+ "partial_update_cluster"
+ ]
+ },
+ "PartialUpdateInstance": {
+ "methods": [
+ "partial_update_instance"
+ ]
+ },
+ "SetIamPolicy": {
+ "methods": [
+ "set_iam_policy"
+ ]
+ },
+ "TestIamPermissions": {
+ "methods": [
+ "test_iam_permissions"
+ ]
+ },
+ "UpdateAppProfile": {
+ "methods": [
+ "update_app_profile"
+ ]
+ },
+ "UpdateCluster": {
+ "methods": [
+ "update_cluster"
+ ]
+ },
+ "UpdateInstance": {
+ "methods": [
+ "update_instance"
+ ]
+ },
+ "UpdateLogicalView": {
+ "methods": [
+ "update_logical_view"
+ ]
+ },
+ "UpdateMaterializedView": {
+ "methods": [
+ "update_materialized_view"
+ ]
+ }
+ }
+ }
+ }
+ },
+ "BigtableTableAdmin": {
+ "clients": {
+ "grpc": {
+ "libraryClient": "BaseBigtableTableAdminClient",
+ "rpcs": {
+ "CheckConsistency": {
+ "methods": [
+ "check_consistency"
+ ]
+ },
+ "CopyBackup": {
+ "methods": [
+ "copy_backup"
+ ]
+ },
+ "CreateAuthorizedView": {
+ "methods": [
+ "create_authorized_view"
+ ]
+ },
+ "CreateBackup": {
+ "methods": [
+ "create_backup"
+ ]
+ },
+ "CreateSchemaBundle": {
+ "methods": [
+ "create_schema_bundle"
+ ]
+ },
+ "CreateTable": {
+ "methods": [
+ "create_table"
+ ]
+ },
+ "CreateTableFromSnapshot": {
+ "methods": [
+ "create_table_from_snapshot"
+ ]
+ },
+ "DeleteAuthorizedView": {
+ "methods": [
+ "delete_authorized_view"
+ ]
+ },
+ "DeleteBackup": {
+ "methods": [
+ "delete_backup"
+ ]
+ },
+ "DeleteSchemaBundle": {
+ "methods": [
+ "delete_schema_bundle"
+ ]
+ },
+ "DeleteSnapshot": {
+ "methods": [
+ "delete_snapshot"
+ ]
+ },
+ "DeleteTable": {
+ "methods": [
+ "delete_table"
+ ]
+ },
+ "DropRowRange": {
+ "methods": [
+ "drop_row_range"
+ ]
+ },
+ "GenerateConsistencyToken": {
+ "methods": [
+ "generate_consistency_token"
+ ]
+ },
+ "GetAuthorizedView": {
+ "methods": [
+ "get_authorized_view"
+ ]
+ },
+ "GetBackup": {
+ "methods": [
+ "get_backup"
+ ]
+ },
+ "GetIamPolicy": {
+ "methods": [
+ "get_iam_policy"
+ ]
+ },
+ "GetSchemaBundle": {
+ "methods": [
+ "get_schema_bundle"
+ ]
+ },
+ "GetSnapshot": {
+ "methods": [
+ "get_snapshot"
+ ]
+ },
+ "GetTable": {
+ "methods": [
+ "get_table"
+ ]
+ },
+ "ListAuthorizedViews": {
+ "methods": [
+ "list_authorized_views"
+ ]
+ },
+ "ListBackups": {
+ "methods": [
+ "list_backups"
+ ]
+ },
+ "ListSchemaBundles": {
+ "methods": [
+ "list_schema_bundles"
+ ]
+ },
+ "ListSnapshots": {
+ "methods": [
+ "list_snapshots"
+ ]
+ },
+ "ListTables": {
+ "methods": [
+ "list_tables"
+ ]
+ },
+ "ModifyColumnFamilies": {
+ "methods": [
+ "modify_column_families"
+ ]
+ },
+ "RestoreTable": {
+ "methods": [
+ "_restore_table"
+ ]
+ },
+ "SetIamPolicy": {
+ "methods": [
+ "set_iam_policy"
+ ]
+ },
+ "SnapshotTable": {
+ "methods": [
+ "snapshot_table"
+ ]
+ },
+ "TestIamPermissions": {
+ "methods": [
+ "test_iam_permissions"
+ ]
+ },
+ "UndeleteTable": {
+ "methods": [
+ "undelete_table"
+ ]
+ },
+ "UpdateAuthorizedView": {
+ "methods": [
+ "update_authorized_view"
+ ]
+ },
+ "UpdateBackup": {
+ "methods": [
+ "update_backup"
+ ]
+ },
+ "UpdateSchemaBundle": {
+ "methods": [
+ "update_schema_bundle"
+ ]
+ },
+ "UpdateTable": {
+ "methods": [
+ "update_table"
+ ]
+ }
+ }
+ },
+ "grpc-async": {
+ "libraryClient": "BaseBigtableTableAdminAsyncClient",
+ "rpcs": {
+ "CheckConsistency": {
+ "methods": [
+ "check_consistency"
+ ]
+ },
+ "CopyBackup": {
+ "methods": [
+ "copy_backup"
+ ]
+ },
+ "CreateAuthorizedView": {
+ "methods": [
+ "create_authorized_view"
+ ]
+ },
+ "CreateBackup": {
+ "methods": [
+ "create_backup"
+ ]
+ },
+ "CreateSchemaBundle": {
+ "methods": [
+ "create_schema_bundle"
+ ]
+ },
+ "CreateTable": {
+ "methods": [
+ "create_table"
+ ]
+ },
+ "CreateTableFromSnapshot": {
+ "methods": [
+ "create_table_from_snapshot"
+ ]
+ },
+ "DeleteAuthorizedView": {
+ "methods": [
+ "delete_authorized_view"
+ ]
+ },
+ "DeleteBackup": {
+ "methods": [
+ "delete_backup"
+ ]
+ },
+ "DeleteSchemaBundle": {
+ "methods": [
+ "delete_schema_bundle"
+ ]
+ },
+ "DeleteSnapshot": {
+ "methods": [
+ "delete_snapshot"
+ ]
+ },
+ "DeleteTable": {
+ "methods": [
+ "delete_table"
+ ]
+ },
+ "DropRowRange": {
+ "methods": [
+ "drop_row_range"
+ ]
+ },
+ "GenerateConsistencyToken": {
+ "methods": [
+ "generate_consistency_token"
+ ]
+ },
+ "GetAuthorizedView": {
+ "methods": [
+ "get_authorized_view"
+ ]
+ },
+ "GetBackup": {
+ "methods": [
+ "get_backup"
+ ]
+ },
+ "GetIamPolicy": {
+ "methods": [
+ "get_iam_policy"
+ ]
+ },
+ "GetSchemaBundle": {
+ "methods": [
+ "get_schema_bundle"
+ ]
+ },
+ "GetSnapshot": {
+ "methods": [
+ "get_snapshot"
+ ]
+ },
+ "GetTable": {
+ "methods": [
+ "get_table"
+ ]
+ },
+ "ListAuthorizedViews": {
+ "methods": [
+ "list_authorized_views"
+ ]
+ },
+ "ListBackups": {
+ "methods": [
+ "list_backups"
+ ]
+ },
+ "ListSchemaBundles": {
+ "methods": [
+ "list_schema_bundles"
+ ]
+ },
+ "ListSnapshots": {
+ "methods": [
+ "list_snapshots"
+ ]
+ },
+ "ListTables": {
+ "methods": [
+ "list_tables"
+ ]
+ },
+ "ModifyColumnFamilies": {
+ "methods": [
+ "modify_column_families"
+ ]
+ },
+ "RestoreTable": {
+ "methods": [
+ "_restore_table"
+ ]
+ },
+ "SetIamPolicy": {
+ "methods": [
+ "set_iam_policy"
+ ]
+ },
+ "SnapshotTable": {
+ "methods": [
+ "snapshot_table"
+ ]
+ },
+ "TestIamPermissions": {
+ "methods": [
+ "test_iam_permissions"
+ ]
+ },
+ "UndeleteTable": {
+ "methods": [
+ "undelete_table"
+ ]
+ },
+ "UpdateAuthorizedView": {
+ "methods": [
+ "update_authorized_view"
+ ]
+ },
+ "UpdateBackup": {
+ "methods": [
+ "update_backup"
+ ]
+ },
+ "UpdateSchemaBundle": {
+ "methods": [
+ "update_schema_bundle"
+ ]
+ },
+ "UpdateTable": {
+ "methods": [
+ "update_table"
+ ]
+ }
+ }
+ },
+ "rest": {
+ "libraryClient": "BaseBigtableTableAdminClient",
+ "rpcs": {
+ "CheckConsistency": {
+ "methods": [
+ "check_consistency"
+ ]
+ },
+ "CopyBackup": {
+ "methods": [
+ "copy_backup"
+ ]
+ },
+ "CreateAuthorizedView": {
+ "methods": [
+ "create_authorized_view"
+ ]
+ },
+ "CreateBackup": {
+ "methods": [
+ "create_backup"
+ ]
+ },
+ "CreateSchemaBundle": {
+ "methods": [
+ "create_schema_bundle"
+ ]
+ },
+ "CreateTable": {
+ "methods": [
+ "create_table"
+ ]
+ },
+ "CreateTableFromSnapshot": {
+ "methods": [
+ "create_table_from_snapshot"
+ ]
+ },
+ "DeleteAuthorizedView": {
+ "methods": [
+ "delete_authorized_view"
+ ]
+ },
+ "DeleteBackup": {
+ "methods": [
+ "delete_backup"
+ ]
+ },
+ "DeleteSchemaBundle": {
+ "methods": [
+ "delete_schema_bundle"
+ ]
+ },
+ "DeleteSnapshot": {
+ "methods": [
+ "delete_snapshot"
+ ]
+ },
+ "DeleteTable": {
+ "methods": [
+ "delete_table"
+ ]
+ },
+ "DropRowRange": {
+ "methods": [
+ "drop_row_range"
+ ]
+ },
+ "GenerateConsistencyToken": {
+ "methods": [
+ "generate_consistency_token"
+ ]
+ },
+ "GetAuthorizedView": {
+ "methods": [
+ "get_authorized_view"
+ ]
+ },
+ "GetBackup": {
+ "methods": [
+ "get_backup"
+ ]
+ },
+ "GetIamPolicy": {
+ "methods": [
+ "get_iam_policy"
+ ]
+ },
+ "GetSchemaBundle": {
+ "methods": [
+ "get_schema_bundle"
+ ]
+ },
+ "GetSnapshot": {
+ "methods": [
+ "get_snapshot"
+ ]
+ },
+ "GetTable": {
+ "methods": [
+ "get_table"
+ ]
+ },
+ "ListAuthorizedViews": {
+ "methods": [
+ "list_authorized_views"
+ ]
+ },
+ "ListBackups": {
+ "methods": [
+ "list_backups"
+ ]
+ },
+ "ListSchemaBundles": {
+ "methods": [
+ "list_schema_bundles"
+ ]
+ },
+ "ListSnapshots": {
+ "methods": [
+ "list_snapshots"
+ ]
+ },
+ "ListTables": {
+ "methods": [
+ "list_tables"
+ ]
+ },
+ "ModifyColumnFamilies": {
+ "methods": [
+ "modify_column_families"
+ ]
+ },
+ "RestoreTable": {
+ "methods": [
+ "_restore_table"
+ ]
+ },
+ "SetIamPolicy": {
+ "methods": [
+ "set_iam_policy"
+ ]
+ },
+ "SnapshotTable": {
+ "methods": [
+ "snapshot_table"
+ ]
+ },
+ "TestIamPermissions": {
+ "methods": [
+ "test_iam_permissions"
+ ]
+ },
+ "UndeleteTable": {
+ "methods": [
+ "undelete_table"
+ ]
+ },
+ "UpdateAuthorizedView": {
+ "methods": [
+ "update_authorized_view"
+ ]
+ },
+ "UpdateBackup": {
+ "methods": [
+ "update_backup"
+ ]
+ },
+ "UpdateSchemaBundle": {
+ "methods": [
+ "update_schema_bundle"
+ ]
+ },
+ "UpdateTable": {
+ "methods": [
+ "update_table"
+ ]
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/google/cloud/bigtable_admin_v2/gapic_version.py b/google/cloud/bigtable_admin_v2/gapic_version.py
new file mode 100644
index 000000000..6d72a226d
--- /dev/null
+++ b/google/cloud/bigtable_admin_v2/gapic_version.py
@@ -0,0 +1,16 @@
+# -*- coding: utf-8 -*-
+# Copyright 2025 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.
+#
+__version__ = "2.35.0" # {x-release-please-version}
diff --git a/google/cloud/bigtable_admin_v2/overlay/__init__.py b/google/cloud/bigtable_admin_v2/overlay/__init__.py
new file mode 100644
index 000000000..f66c7f8dd
--- /dev/null
+++ b/google/cloud/bigtable_admin_v2/overlay/__init__.py
@@ -0,0 +1,49 @@
+# Copyright 2025 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.
+#
+# This directory and all its subdirectories are the only handwritten
+# components of the otherwise autogenerated google/cloud/bigtable/admin_v2.
+# The purpose of the overlay directory is to add additional functionality to
+# the autogenerated library while preserving its developer experience. These
+# handwritten additions currently consist of the following:
+#
+# 1. TODO: Document final GcRule design choice here
+# 2. An LRO class for restore_table that exposes an Operation for
+# OptimizeRestoreTable, if that LRO exists.
+# 3. New methods (wait_for_consistency and wait_for_replication) that return
+# a polling future class for automatically polling check_consistency.
+#
+# This directory is structured to mirror that of a typical autogenerated library (e.g.
+# services/types subdirectories), and the aforementioned handwritten additions are
+# currently implemented as either types under overlay/types or in methods in an overwritten
+# client class under overlay/services.
+
+from .types import (
+ AsyncRestoreTableOperation,
+ RestoreTableOperation,
+ WaitForConsistencyRequest,
+)
+
+from .services.bigtable_table_admin import (
+ BigtableTableAdminAsyncClient,
+ BigtableTableAdminClient,
+)
+
+__all__ = (
+ "AsyncRestoreTableOperation",
+ "RestoreTableOperation",
+ "BigtableTableAdminAsyncClient",
+ "BigtableTableAdminClient",
+ "WaitForConsistencyRequest",
+)
diff --git a/google/cloud/bigtable_admin_v2/overlay/services/__init__.py b/google/cloud/bigtable_admin_v2/overlay/services/__init__.py
new file mode 100644
index 000000000..ab7686e26
--- /dev/null
+++ b/google/cloud/bigtable_admin_v2/overlay/services/__init__.py
@@ -0,0 +1,13 @@
+# Copyright 2025 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.
diff --git a/google/cloud/bigtable_admin_v2/overlay/services/bigtable_table_admin/__init__.py b/google/cloud/bigtable_admin_v2/overlay/services/bigtable_table_admin/__init__.py
new file mode 100644
index 000000000..f80e3234f
--- /dev/null
+++ b/google/cloud/bigtable_admin_v2/overlay/services/bigtable_table_admin/__init__.py
@@ -0,0 +1,23 @@
+# Copyright 2025 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.
+
+# TODO: Add the async client after owlbot changes.
+
+from .async_client import BigtableTableAdminAsyncClient
+from .client import BigtableTableAdminClient
+
+__all__ = (
+ "BigtableTableAdminAsyncClient",
+ "BigtableTableAdminClient",
+)
diff --git a/google/cloud/bigtable_admin_v2/overlay/services/bigtable_table_admin/async_client.py b/google/cloud/bigtable_admin_v2/overlay/services/bigtable_table_admin/async_client.py
new file mode 100644
index 000000000..ee8e5757d
--- /dev/null
+++ b/google/cloud/bigtable_admin_v2/overlay/services/bigtable_table_admin/async_client.py
@@ -0,0 +1,375 @@
+# Copyright 2025 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.
+
+# -*- coding: utf-8 -*-
+# Copyright 2025 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.
+
+import copy
+import functools
+
+from typing import Callable, Optional, Sequence, Tuple, Union
+from google.api_core import gapic_v1
+from google.api_core import retry as retries
+
+try:
+ OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None]
+except AttributeError: # pragma: NO COVER
+ OptionalRetry = Union[retries.AsyncRetry, object, None] # type: ignore
+
+from google.api_core import client_options as client_options_lib
+from google.auth import credentials as ga_credentials # type: ignore
+
+from google.cloud.bigtable_admin_v2.types import bigtable_table_admin
+
+from google.cloud.bigtable_admin_v2.services.bigtable_table_admin import (
+ async_client as base_client,
+)
+from google.cloud.bigtable_admin_v2.services.bigtable_table_admin.transports.base import (
+ BigtableTableAdminTransport,
+)
+from google.cloud.bigtable_admin_v2.overlay.types import (
+ async_consistency,
+ async_restore_table,
+ wait_for_consistency_request,
+)
+
+from google.cloud.bigtable.gapic_version import __version__ as bigtable_version
+
+
+DEFAULT_CLIENT_INFO = copy.copy(base_client.DEFAULT_CLIENT_INFO)
+DEFAULT_CLIENT_INFO.client_library_version = f"{bigtable_version}-admin-overlay-async"
+
+
+class BigtableTableAdminAsyncClient(base_client.BaseBigtableTableAdminAsyncClient):
+ def __init__(
+ self,
+ *,
+ credentials: Optional[ga_credentials.Credentials] = None,
+ transport: Optional[
+ Union[
+ str,
+ BigtableTableAdminTransport,
+ Callable[..., BigtableTableAdminTransport],
+ ]
+ ] = "grpc_asyncio",
+ client_options: Optional[client_options_lib.ClientOptions] = None,
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
+ ) -> None:
+ """Instantiates the Bigtable table admin async client.
+
+ Args:
+ credentials (Optional[google.auth.credentials.Credentials]): The
+ authorization credentials to attach to requests. These
+ credentials identify the application to the service; if none
+ are specified, the client will attempt to ascertain the
+ credentials from the environment.
+ transport (Optional[Union[str,BigtableTableAdminTransport,Callable[..., BigtableTableAdminTransport]]]):
+ The transport to use, or a Callable that constructs and returns a new transport to use.
+ If a Callable is given, it will be called with the same set of initialization
+ arguments as used in the BigtableTableAdminTransport constructor.
+ If set to None, a transport is chosen automatically.
+ client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]):
+ Custom options for the client.
+
+ 1. The ``api_endpoint`` property can be used to override the
+ default endpoint provided by the client when ``transport`` is
+ not explicitly provided. Only if this property is not set and
+ ``transport`` was not explicitly provided, the endpoint is
+ determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment
+ variable, which have one of the following values:
+ "always" (always use the default mTLS endpoint), "never" (always
+ use the default regular endpoint) and "auto" (auto-switch to the
+ default mTLS endpoint if client certificate is present; this is
+ the default value).
+
+ 2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable
+ is "true", then the ``client_cert_source`` property can be used
+ to provide a client certificate for mTLS transport. If
+ not provided, the default SSL client certificate will be used if
+ present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not
+ set, no client certificate will be used.
+
+ 3. The ``universe_domain`` property can be used to override the
+ default "googleapis.com" universe. Note that ``api_endpoint``
+ property still takes precedence; and ``universe_domain`` is
+ currently not supported for mTLS.
+
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
+ The client info used to send a user-agent string along with
+ API requests. If ``None``, then default info will be used.
+ Generally, you only need to set this if you're developing
+ your own client library.
+
+ Raises:
+ google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
+ creation failed for any reason.
+ """
+ super(BigtableTableAdminAsyncClient, self).__init__(
+ credentials=credentials,
+ transport=transport,
+ client_options=client_options,
+ client_info=client_info,
+ )
+
+ async def restore_table(
+ self,
+ request: Optional[Union[bigtable_table_admin.RestoreTableRequest, dict]] = None,
+ *,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> async_restore_table.AsyncRestoreTableOperation:
+ r"""Create a new table by restoring from a completed backup. The
+ returned table :class:`long-running operation
+ `
+ can be used to track the progress of the operation, and to cancel it. The
+ :attr:`metadata ` field type is
+ :class:`RestoreTableMetadata `.
+ The :meth:`response ` type is
+ :class:`google.cloud.bigtable_admin_v2.types.Table`, if successful.
+
+ Additionally, the returned :class:`long-running-operation `
+ provides a method, :meth:`google.cloud.bigtable_admin_v2.overlay.types.async_restore_table.AsyncRestoreTableOperation.optimize_restore_table_operation` that
+ provides access to a :class:`google.api_core.operation_async.AsyncOperation` object representing the OptimizeRestoreTable long-running-operation
+ after the current one has completed.
+
+ .. code-block:: python
+
+ # This snippet should be regarded as a code template only.
+ #
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud.bigtable import admin_v2
+
+ async def sample_restore_table():
+ # Create a client
+ client = admin_v2.BigtableTableAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = admin_v2.RestoreTableRequest(
+ backup="backup_value",
+ parent="parent_value",
+ table_id="table_id_value",
+ )
+
+ # Make the request
+ operation = await client.restore_table(request=request)
+
+ print("Waiting for operation to complete...")
+
+ response = await operation.result()
+
+ # Handle the response
+ print(response)
+
+ # Handle LRO2
+ optimize_operation = await operation.optimize_restore_table_operation()
+
+ if optimize_operation:
+ print("Waiting for table optimization to complete...")
+
+ response = await optimize_operation.result()
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.RestoreTableRequest, dict]):
+ The request object. The request for
+ [RestoreTable][google.bigtable.admin.v2.BigtableTableAdmin.RestoreTable].
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.overlay.types.async_restore_table.AsyncRestoreTableOperation:
+ An object representing a long-running operation.
+
+ The result type for the operation will be :class:`google.cloud.bigtable_admin_v2.types.Table` A collection of user data indexed by row, column, and timestamp.
+ Each table is served using the resources of its
+ parent cluster.
+ """
+ operation = await self._restore_table(
+ request=request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ restore_table_operation = async_restore_table.AsyncRestoreTableOperation(
+ self._client._transport.operations_client, operation
+ )
+ return restore_table_operation
+
+ async def wait_for_consistency(
+ self,
+ request: Optional[
+ Union[wait_for_consistency_request.WaitForConsistencyRequest, dict]
+ ] = None,
+ *,
+ name: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> bool:
+ r"""Blocks until the mutations for the specified Table that have been
+ made before the call have been replicated or reads using an app profile with `DataBoostIsolationReadOnly`
+ can see all writes committed before the token was created. This is done by generating
+ a consistency token for the Table, then polling :meth:`check_consistency`
+ for the specified table until the call returns True.
+
+ .. code-block:: python
+
+ # This snippet should be regarded as a code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud.bigtable import admin_v2
+
+ async def sample_wait_for_consistency():
+ # Create a client
+ client = admin_v2.BigtableTableAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = admin_v2.WaitForConsistencyRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ print("Waiting for operation to complete...")
+
+ response = await client.wait_for_replication(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.overlay.types.WaitForConsistencyRequest, dict]):
+ The request object.
+ name (str):
+ Required. The unique name of the Table for which to
+ create a consistency token. Values are of the form
+ ``projects/{project}/instances/{instance}/tables/{table}``.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ bool:
+ If the `standard_read_remote_writes` mode is specified in the request object, returns
+ `True` after the mutations of the specified table have been fully replicated. If the
+ `data_boost_read_local_writes` mode is specified in the request object, returns `True`
+ after reads using an app profile with `DataBoostIsolationReadOnly` can see all writes
+ committed before the token was created.
+
+ Raises:
+ google.api_core.GoogleAPICallError: If the operation errors or if
+ the timeout is reached before the operation completes.
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(
+ request, wait_for_consistency_request.WaitForConsistencyRequest
+ ):
+ request = wait_for_consistency_request.WaitForConsistencyRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+
+ # Generate the consistency token.
+ generate_consistency_token_request = (
+ bigtable_table_admin.GenerateConsistencyTokenRequest(
+ name=request.name,
+ )
+ )
+
+ generate_consistency_response = await self.generate_consistency_token(
+ generate_consistency_token_request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Create the CheckConsistencyRequest object.
+ check_consistency_request = bigtable_table_admin.CheckConsistencyRequest(
+ name=request.name,
+ consistency_token=generate_consistency_response.consistency_token,
+ )
+
+ # Since the default values of StandardReadRemoteWrites and DataBoostReadLocalWrites evaluate to
+ # False in proto plus, we cannot do a simple "if request.standard_read_remote_writes" to check
+ # whether or not that field is defined in the original request object.
+ mode_oneof_field = request._pb.WhichOneof("mode")
+ if mode_oneof_field:
+ setattr(
+ check_consistency_request,
+ mode_oneof_field,
+ getattr(request, mode_oneof_field),
+ )
+
+ check_consistency_call = functools.partial(
+ self.check_consistency,
+ check_consistency_request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Block and wait until the polling harness returns True.
+ check_consistency_future = (
+ async_consistency._AsyncCheckConsistencyPollingFuture(
+ check_consistency_call
+ )
+ )
+ return await check_consistency_future.result()
diff --git a/google/cloud/bigtable_admin_v2/overlay/services/bigtable_table_admin/client.py b/google/cloud/bigtable_admin_v2/overlay/services/bigtable_table_admin/client.py
new file mode 100644
index 000000000..1b6770b10
--- /dev/null
+++ b/google/cloud/bigtable_admin_v2/overlay/services/bigtable_table_admin/client.py
@@ -0,0 +1,373 @@
+# Copyright 2025 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.
+
+# -*- coding: utf-8 -*-
+# Copyright 2025 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.
+
+import copy
+import functools
+
+from typing import Callable, Optional, Sequence, Tuple, Union
+from google.api_core import gapic_v1
+from google.api_core import retry as retries
+
+try:
+ OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault, None]
+except AttributeError: # pragma: NO COVER
+ OptionalRetry = Union[retries.Retry, object, None] # type: ignore
+
+from google.api_core import client_options as client_options_lib
+from google.auth import credentials as ga_credentials # type: ignore
+
+from google.cloud.bigtable_admin_v2.types import bigtable_table_admin
+
+from google.cloud.bigtable_admin_v2.services.bigtable_table_admin import (
+ client as base_client,
+)
+from google.cloud.bigtable_admin_v2.services.bigtable_table_admin.transports.base import (
+ BigtableTableAdminTransport,
+)
+from google.cloud.bigtable_admin_v2.overlay.types import (
+ consistency,
+ restore_table,
+ wait_for_consistency_request,
+)
+
+from google.cloud.bigtable.gapic_version import __version__ as bigtable_version
+
+
+DEFAULT_CLIENT_INFO = copy.copy(base_client.DEFAULT_CLIENT_INFO)
+DEFAULT_CLIENT_INFO.client_library_version = f"{bigtable_version}-admin-overlay"
+
+
+class BigtableTableAdminClient(base_client.BaseBigtableTableAdminClient):
+ def __init__(
+ self,
+ *,
+ credentials: Optional[ga_credentials.Credentials] = None,
+ transport: Optional[
+ Union[
+ str,
+ BigtableTableAdminTransport,
+ Callable[..., BigtableTableAdminTransport],
+ ]
+ ] = None,
+ client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None,
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
+ ) -> None:
+ """Instantiates the Bigtable table admin client.
+
+ Args:
+ credentials (Optional[google.auth.credentials.Credentials]): The
+ authorization credentials to attach to requests. These
+ credentials identify the application to the service; if none
+ are specified, the client will attempt to ascertain the
+ credentials from the environment.
+ transport (Optional[Union[str,BigtableTableAdminTransport,Callable[..., BigtableTableAdminTransport]]]):
+ The transport to use, or a Callable that constructs and returns a new transport.
+ If a Callable is given, it will be called with the same set of initialization
+ arguments as used in the BigtableTableAdminTransport constructor.
+ If set to None, a transport is chosen automatically.
+ client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]):
+ Custom options for the client.
+
+ 1. The ``api_endpoint`` property can be used to override the
+ default endpoint provided by the client when ``transport`` is
+ not explicitly provided. Only if this property is not set and
+ ``transport`` was not explicitly provided, the endpoint is
+ determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment
+ variable, which have one of the following values:
+ "always" (always use the default mTLS endpoint), "never" (always
+ use the default regular endpoint) and "auto" (auto-switch to the
+ default mTLS endpoint if client certificate is present; this is
+ the default value).
+
+ 2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable
+ is "true", then the ``client_cert_source`` property can be used
+ to provide a client certificate for mTLS transport. If
+ not provided, the default SSL client certificate will be used if
+ present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not
+ set, no client certificate will be used.
+
+ 3. The ``universe_domain`` property can be used to override the
+ default "googleapis.com" universe. Note that the ``api_endpoint``
+ property still takes precedence; and ``universe_domain`` is
+ currently not supported for mTLS.
+
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
+ The client info used to send a user-agent string along with
+ API requests. If ``None``, then default info will be used.
+ Generally, you only need to set this if you're developing
+ your own client library.
+
+ Raises:
+ google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport
+ creation failed for any reason.
+ """
+ super(BigtableTableAdminClient, self).__init__(
+ credentials=credentials,
+ transport=transport,
+ client_options=client_options,
+ client_info=client_info,
+ )
+
+ def restore_table(
+ self,
+ request: Optional[Union[bigtable_table_admin.RestoreTableRequest, dict]] = None,
+ *,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> restore_table.RestoreTableOperation:
+ r"""Create a new table by restoring from a completed backup. The
+ returned table :class:`long-running operation
+ `
+ can be used to track the progress of the operation, and to cancel it. The
+ :attr:`metadata ` field type is
+ :class:`RestoreTableMetadata `.
+ The :meth:`response ` type is
+ :class:`google.cloud.bigtable_admin_v2.types.Table`, if successful.
+
+ Additionally, the returned :class:`long-running-operation `
+ provides a method, :meth:`google.cloud.bigtable_admin_v2.overlay.types.restore_table.RestoreTableOperation.optimize_restore_table_operation` that
+ provides access to a :class:`google.api_core.operation.Operation` object representing the OptimizeRestoreTable long-running-operation
+ after the current one has completed.
+
+ .. code-block:: python
+
+ # This snippet should be regarded as a code template only.
+ #
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud.bigtable import admin_v2
+
+ def sample_restore_table():
+ # Create a client
+ client = admin_v2.BigtableTableAdminClient()
+
+ # Initialize request argument(s)
+ request = admin_v2.RestoreTableRequest(
+ backup="backup_value",
+ parent="parent_value",
+ table_id="table_id_value",
+ )
+
+ # Make the request
+ operation = client.restore_table(request=request)
+
+ print("Waiting for operation to complete...")
+
+ response = operation.result()
+
+ # Handle the response
+ print(response)
+
+ # Handle LRO2
+ optimize_operation = operation.optimize_restore_table_operation()
+
+ if optimize_operation:
+ print("Waiting for table optimization to complete...")
+
+ response = optimize_operation.result()
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.RestoreTableRequest, dict]):
+ The request object. The request for
+ [RestoreTable][google.bigtable.admin.v2.BigtableTableAdmin.RestoreTable].
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.overlay.types.restore_table.RestoreTableOperation:
+ An object representing a long-running operation.
+
+ The result type for the operation will be :class:`google.cloud.bigtable_admin_v2.types.Table` A collection of user data indexed by row, column, and timestamp.
+ Each table is served using the resources of its
+ parent cluster.
+ """
+ operation = self._restore_table(
+ request=request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ restore_table_operation = restore_table.RestoreTableOperation(
+ self._transport.operations_client, operation
+ )
+ return restore_table_operation
+
+ def wait_for_consistency(
+ self,
+ request: Optional[
+ Union[wait_for_consistency_request.WaitForConsistencyRequest, dict]
+ ] = None,
+ *,
+ name: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> bool:
+ r"""Blocks until the mutations for the specified Table that have been
+ made before the call have been replicated or reads using an app profile with `DataBoostIsolationReadOnly`
+ can see all writes committed before the token was created. This is done by generating
+ a consistency token for the Table, then polling :meth:`check_consistency`
+ for the specified table until the call returns True.
+
+ .. code-block:: python
+
+ # This snippet should be regarded as a code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud.bigtable import admin_v2
+
+ def sample_wait_for_consistency():
+ # Create a client
+ client = admin_v2.BigtableTableAdminClient()
+
+ # Initialize request argument(s)
+ request = admin_v2.WaitForConsistencyRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ print("Waiting for operation to complete...")
+
+ response = client.wait_for_replication(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.overlay.types.WaitForConsistencyRequest, dict]):
+ The request object.
+ name (str):
+ Required. The unique name of the Table for which to
+ create a consistency token. Values are of the form
+ ``projects/{project}/instances/{instance}/tables/{table}``.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ bool:
+ If the `standard_read_remote_writes` mode is specified in the request object, returns
+ `True` after the mutations of the specified table have been fully replicated. If the
+ `data_boost_read_local_writes` mode is specified in the request object, returns `True`
+ after reads using an app profile with `DataBoostIsolationReadOnly` can see all writes
+ committed before the token was created.
+
+ Raises:
+ google.api_core.GoogleAPICallError: If the operation errors or if
+ the timeout is reached before the operation completes.
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(
+ request, wait_for_consistency_request.WaitForConsistencyRequest
+ ):
+ request = wait_for_consistency_request.WaitForConsistencyRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+
+ # Generate the consistency token.
+ generate_consistency_token_request = (
+ bigtable_table_admin.GenerateConsistencyTokenRequest(
+ name=request.name,
+ )
+ )
+
+ generate_consistency_response = self.generate_consistency_token(
+ generate_consistency_token_request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Create the CheckConsistencyRequest object.
+ check_consistency_request = bigtable_table_admin.CheckConsistencyRequest(
+ name=request.name,
+ consistency_token=generate_consistency_response.consistency_token,
+ )
+
+ # Since the default values of StandardReadRemoteWrites and DataBoostReadLocalWrites evaluate to
+ # False in proto plus, we cannot do a simple "if request.standard_read_remote_writes" to check
+ # whether or not that field is defined in the original request object.
+ mode_oneof_field = request._pb.WhichOneof("mode")
+ if mode_oneof_field:
+ setattr(
+ check_consistency_request,
+ mode_oneof_field,
+ getattr(request, mode_oneof_field),
+ )
+
+ check_consistency_call = functools.partial(
+ self.check_consistency,
+ check_consistency_request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Block and wait until the polling harness returns True.
+ check_consistency_future = consistency._CheckConsistencyPollingFuture(
+ check_consistency_call
+ )
+ return check_consistency_future.result()
diff --git a/google/cloud/bigtable_admin_v2/overlay/types/__init__.py b/google/cloud/bigtable_admin_v2/overlay/types/__init__.py
new file mode 100644
index 000000000..16b032ac4
--- /dev/null
+++ b/google/cloud/bigtable_admin_v2/overlay/types/__init__.py
@@ -0,0 +1,31 @@
+# Copyright 2025 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 .async_restore_table import (
+ AsyncRestoreTableOperation,
+)
+
+from .restore_table import (
+ RestoreTableOperation,
+)
+
+from .wait_for_consistency_request import (
+ WaitForConsistencyRequest,
+)
+
+__all__ = (
+ "AsyncRestoreTableOperation",
+ "RestoreTableOperation",
+ "WaitForConsistencyRequest",
+)
diff --git a/google/cloud/bigtable_admin_v2/overlay/types/async_consistency.py b/google/cloud/bigtable_admin_v2/overlay/types/async_consistency.py
new file mode 100644
index 000000000..0703940d5
--- /dev/null
+++ b/google/cloud/bigtable_admin_v2/overlay/types/async_consistency.py
@@ -0,0 +1,104 @@
+# Copyright 2025 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 typing import Awaitable, Union, Callable
+
+from google.api_core.future import async_future
+from google.api_core import gapic_v1
+from google.api_core import retry as retries
+from google.cloud.bigtable_admin_v2.types import bigtable_table_admin
+
+try:
+ OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault, None]
+except AttributeError: # pragma: NO COVER
+ OptionalRetry = Union[retries.Retry, object, None] # type: ignore
+
+
+# The consistency check could take a very long time, so we wait indefinitely.
+DEFAULT_RETRY = async_future.DEFAULT_RETRY.with_timeout(None)
+
+
+class _AsyncCheckConsistencyPollingFuture(async_future.AsyncFuture):
+ """A Future that polls an underlying `check_consistency` operation until it returns True.
+
+ **This class should not be instantiated by users** and should only be instantiated by the admin
+ client's
+ :meth:`google.cloud.bigtable_admin_v2.overlay.services.bigtable_table_admin.AsyncBigtableTableAdminClient.wait_for_consistency`
+ or
+ :meth:`google.cloud.bigtable_admin_v2.overlay.services.bigtable_table_admin.AsyncBigtableTableAdminClient.wait_for_replication`
+ methods.
+
+ Args:
+ check_consistency_call(Callable[
+ [Optional[google.api_core.retry.Retry],
+ google.cloud.bigtable_admin_v2.types.CheckConsistencyResponse]):
+ A :meth:`check_consistency
+ `
+ call from the admin client. The call should fix every user parameter except for retry,
+ which will be done via :meth:`functools.partial`.
+ default_retry(Optional[google.api_core.retry.Retry]): The `retry` parameter passed in to either
+ :meth:`wait_for_consistency
+ `
+ or :meth:`wait_for_replication
+ `
+ retry (google.api_core.retry.AsyncRetry): The retry configuration used
+ when polling. This can be used to control how often :meth:`done`
+ is polled. Regardless of the retry's ``deadline``, it will be
+ overridden by the ``timeout`` argument to :meth:`result`.
+ """
+
+ def __init__(
+ self,
+ check_consistency_call: Callable[
+ [OptionalRetry], Awaitable[bigtable_table_admin.CheckConsistencyResponse]
+ ],
+ retry: retries.AsyncRetry = DEFAULT_RETRY,
+ **kwargs
+ ):
+ super(_AsyncCheckConsistencyPollingFuture, self).__init__(retry=retry, **kwargs)
+
+ # Done is called with two different scenarios, retry is specified or not specified.
+ # API_call will be a functools partial with everything except retry specified because of
+ # that.
+ self._check_consistency_call = check_consistency_call
+
+ async def done(self, retry: OptionalRetry = None):
+ """Polls the underlying `check_consistency` call to see if the future is complete.
+
+ Args:
+ retry (google.api_core.retry.Retry): (Optional) How to retry the
+ polling RPC (to not be confused with polling configuration. See
+ the documentation for :meth:`result `
+ for details).
+
+ Returns:
+ bool: True if the future is complete, False otherwise.
+ """
+ if self._future.done():
+ return True
+
+ try:
+ check_consistency_response = await self._check_consistency_call()
+ if check_consistency_response.consistent:
+ self.set_result(True)
+
+ return check_consistency_response.consistent
+ except Exception as e:
+ self.set_exception(e)
+
+ def cancel(self):
+ raise NotImplementedError("Cannot cancel consistency token operation")
+
+ def cancelled(self):
+ raise NotImplementedError("Cannot cancel consistency token operation")
diff --git a/google/cloud/bigtable_admin_v2/overlay/types/async_restore_table.py b/google/cloud/bigtable_admin_v2/overlay/types/async_restore_table.py
new file mode 100644
index 000000000..9edfb4963
--- /dev/null
+++ b/google/cloud/bigtable_admin_v2/overlay/types/async_restore_table.py
@@ -0,0 +1,99 @@
+# Copyright 2025 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 typing import Optional
+
+from google.api_core import exceptions
+from google.api_core import operation_async
+from google.protobuf import empty_pb2
+
+from google.cloud.bigtable_admin_v2.types import OptimizeRestoredTableMetadata
+
+
+class AsyncRestoreTableOperation(operation_async.AsyncOperation):
+ """A Future for interacting with Bigtable Admin's RestoreTable Long-Running Operation.
+
+ This is needed to expose a potential long-running operation that might run after this operation
+ finishes, OptimizeRestoreTable. This is exposed via the the :meth:`optimize_restore_table_operation`
+ method.
+
+ **This class should not be instantiated by users** and should only be instantiated by the admin
+ client's :meth:`restore_table
+ `
+ method.
+
+ Args:
+ operations_client (google.api_core.operations_v1.AbstractOperationsClient): The operations
+ client from the admin client class's transport.
+ restore_table_operation (google.api_core.operation_async.AsyncOperation): A
+ :class:`google.api_core.operation_async.AsyncOperation`
+ instance resembling a RestoreTable long-running operation
+ """
+
+ def __init__(
+ self, operations_client, restore_table_operation: operation_async.AsyncOperation
+ ):
+ self._operations_client = operations_client
+ self._optimize_restored_table_operation = None
+ super().__init__(
+ restore_table_operation._operation,
+ restore_table_operation._refresh,
+ restore_table_operation._cancel,
+ restore_table_operation._result_type,
+ restore_table_operation._metadata_type,
+ retry=restore_table_operation._retry,
+ )
+
+ async def optimize_restored_table_operation(
+ self,
+ ) -> Optional[operation_async.AsyncOperation]:
+ """Gets the OptimizeRestoredTable long-running operation that runs after this operation finishes.
+ The current operation might not trigger a follow-up OptimizeRestoredTable operation, in which case, this
+ method will return `None`.
+ This method must not be called before the parent restore_table operation is complete.
+ Returns:
+ An object representing a long-running operation, or None if there is no OptimizeRestoredTable operation
+ after this one.
+ Raises:
+ RuntimeError: raised when accessed before the restore_table operation is complete
+
+ Raises:
+ google.api_core.GoogleAPIError: raised when accessed before the restore_table operation is complete
+ """
+ if not await self.done():
+ raise exceptions.GoogleAPIError(
+ "optimize_restored_table operation can't be accessed until the restore_table operation is complete"
+ )
+
+ if self._optimize_restored_table_operation is not None:
+ return self._optimize_restored_table_operation
+
+ operation_name = self.metadata.optimize_table_operation_name
+
+ # When the RestoreTable operation finishes, it might not necessarily trigger
+ # an optimize operation.
+ if operation_name:
+ gapic_operation = await self._operations_client.get_operation(
+ name=operation_name
+ )
+ self._optimize_restored_table_operation = operation_async.from_gapic(
+ gapic_operation,
+ self._operations_client,
+ empty_pb2.Empty,
+ metadata_type=OptimizeRestoredTableMetadata,
+ )
+ return self._optimize_restored_table_operation
+ else:
+ # no optimize operation found
+ return None
diff --git a/google/cloud/bigtable_admin_v2/overlay/types/consistency.py b/google/cloud/bigtable_admin_v2/overlay/types/consistency.py
new file mode 100644
index 000000000..63a110975
--- /dev/null
+++ b/google/cloud/bigtable_admin_v2/overlay/types/consistency.py
@@ -0,0 +1,101 @@
+# Copyright 2025 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 typing import Union, Callable
+
+from google.api_core.future import polling
+from google.api_core import gapic_v1
+from google.api_core import retry as retries
+from google.cloud.bigtable_admin_v2.types import bigtable_table_admin
+
+try:
+ OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault, None]
+except AttributeError: # pragma: NO COVER
+ OptionalRetry = Union[retries.Retry, object, None] # type: ignore
+
+
+# The consistency check could take a very long time, so we wait indefinitely.
+DEFAULT_RETRY = polling.DEFAULT_POLLING.with_timeout(None)
+
+
+class _CheckConsistencyPollingFuture(polling.PollingFuture):
+ """A Future that polls an underlying `check_consistency` operation until it returns True.
+
+ **This class should not be instantiated by users** and should only be instantiated by the admin
+ client's
+ :meth:`google.cloud.bigtable_admin_v2.overlay.services.bigtable_table_admin.BigtableTableAdminClient.wait_for_consistency`
+ or
+ :meth:`google.cloud.bigtable_admin_v2.overlay.services.bigtable_table_admin.BigtableTableAdminClient.wait_for_replication`
+ methods.
+
+ Args:
+ check_consistency_call(Callable[
+ [Optional[google.api_core.retry.Retry],
+ google.cloud.bigtable_admin_v2.types.CheckConsistencyResponse]):
+ A :meth:`check_consistency
+ `
+ call from the admin client. The call should fix every user parameter,
+ which will be done via :meth:`functools.partial`.
+ polling (google.api_core.retry.Retry): The configuration used for polling.
+ This parameter controls how often :meth:`done` is polled. If the
+ ``timeout`` argument is specified in the :meth:`result
+ ` method it will
+ override the ``polling.timeout`` property.
+ """
+
+ def __init__(
+ self,
+ check_consistency_call: Callable[
+ [OptionalRetry], bigtable_table_admin.CheckConsistencyResponse
+ ],
+ polling: retries.Retry = DEFAULT_RETRY,
+ **kwargs
+ ):
+ super(_CheckConsistencyPollingFuture, self).__init__(polling=polling, **kwargs)
+
+ # Done is called with two different scenarios, retry is specified or not specified.
+ # API_call will be a functools partial with everything except retry specified because of
+ # that.
+ self._check_consistency_call = check_consistency_call
+
+ def done(self, retry: OptionalRetry = None):
+ """Polls the underlying `check_consistency` call to see if the future is complete.
+
+ Args:
+ retry (google.api_core.retry.Retry): (Optional) How to retry the
+ polling RPC (to not be confused with polling configuration. See
+ the documentation for :meth:`result `
+ for details).
+
+ Returns:
+ bool: True if the future is complete, False otherwise.
+ """
+
+ if self._result_set:
+ return True
+
+ try:
+ check_consistency_response = self._check_consistency_call()
+ if check_consistency_response.consistent:
+ self.set_result(True)
+
+ return check_consistency_response.consistent
+ except Exception as e:
+ self.set_exception(e)
+
+ def cancel(self):
+ raise NotImplementedError("Cannot cancel consistency token operation")
+
+ def cancelled(self):
+ raise NotImplementedError("Cannot cancel consistency token operation")
diff --git a/google/cloud/bigtable_admin_v2/overlay/types/restore_table.py b/google/cloud/bigtable_admin_v2/overlay/types/restore_table.py
new file mode 100644
index 000000000..84c9c5d91
--- /dev/null
+++ b/google/cloud/bigtable_admin_v2/overlay/types/restore_table.py
@@ -0,0 +1,102 @@
+# Copyright 2025 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 typing import Optional
+
+from google.api_core import exceptions
+from google.api_core import operation
+from google.protobuf import empty_pb2
+
+from google.cloud.bigtable_admin_v2.types import OptimizeRestoredTableMetadata
+
+
+class RestoreTableOperation(operation.Operation):
+ """A Future for interacting with Bigtable Admin's RestoreTable Long-Running Operation.
+
+ This is needed to expose a potential long-running operation that might run after this operation
+ finishes, OptimizeRestoreTable. This is exposed via the the :meth:`optimize_restore_table_operation`
+ method.
+
+ **This class should not be instantiated by users** and should only be instantiated by the admin
+ client's :meth:`restore_table
+ `
+ method.
+
+ Args:
+ operations_client (google.api_core.operations_v1.AbstractOperationsClient): The operations
+ client from the admin client class's transport.
+ restore_table_operation (google.api_core.operation.Operation): A :class:`google.api_core.operation.Operation`
+ instance resembling a RestoreTable long-running operation
+ """
+
+ def __init__(self, operations_client, restore_table_operation: operation.Operation):
+ self._operations_client = operations_client
+ self._optimize_restored_table_operation = None
+ super().__init__(
+ restore_table_operation._operation,
+ restore_table_operation._refresh,
+ restore_table_operation._cancel,
+ restore_table_operation._result_type,
+ restore_table_operation._metadata_type,
+ polling=restore_table_operation._polling,
+ )
+
+ def optimize_restored_table_operation(self) -> Optional[operation.Operation]:
+ """Gets the OptimizeRestoredTable long-running operation that runs after this operation finishes.
+
+ This must not be called before the parent restore_table operation is complete. You can guarantee
+ this happening by calling this function after this class's :meth:`google.api_core.operation.Operation.result`
+ method.
+
+ The follow-up operation has
+ :attr:`metadata ` type
+ :class:`OptimizeRestoredTableMetadata
+ `
+ and no return value, but can be waited for with `result`.
+
+ The current operation might not trigger a follow-up OptimizeRestoredTable operation, in which case, this
+ method will return `None`.
+
+ Returns:
+ Optional[google.api_core.operation.Operation]:
+ An object representing a long-running operation, or None if there is no OptimizeRestoredTable operation
+ after this one.
+
+ Raises:
+ google.api_core.GoogleAPIError: raised when accessed before the restore_table operation is complete
+ """
+ if not self.done():
+ raise exceptions.GoogleAPIError(
+ "optimize_restored_table operation can't be accessed until the restore_table operation is complete"
+ )
+
+ if self._optimize_restored_table_operation is not None:
+ return self._optimize_restored_table_operation
+
+ operation_name = self.metadata.optimize_table_operation_name
+
+ # When the RestoreTable operation finishes, it might not necessarily trigger
+ # an optimize operation.
+ if operation_name:
+ gapic_operation = self._operations_client.get_operation(name=operation_name)
+ self._optimize_restored_table_operation = operation.from_gapic(
+ gapic_operation,
+ self._operations_client,
+ empty_pb2.Empty,
+ metadata_type=OptimizeRestoredTableMetadata,
+ )
+ return self._optimize_restored_table_operation
+ else:
+ # no optimize operation found
+ return None
diff --git a/google/cloud/bigtable_admin_v2/overlay/types/wait_for_consistency_request.py b/google/cloud/bigtable_admin_v2/overlay/types/wait_for_consistency_request.py
new file mode 100644
index 000000000..51070230a
--- /dev/null
+++ b/google/cloud/bigtable_admin_v2/overlay/types/wait_for_consistency_request.py
@@ -0,0 +1,85 @@
+# -*- coding: utf-8 -*-
+# Copyright 2025 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.
+#
+
+import proto
+
+from google.cloud.bigtable_admin_v2.types import bigtable_table_admin
+
+__protobuf__ = proto.module(
+ package="google.bigtable.admin.v2",
+ manifest={
+ "WaitForConsistencyRequest",
+ },
+)
+
+
+# The WaitForConsistencyRequest object is not a real proto. It is a wrapper
+# class intended for the handwritten method wait_for_consistency. It is
+# constructed by extending a Proto Plus message class to get a developer
+# experience closest to that of an autogenerated GAPIC method, and to allow
+# developers to manipulate the wrapper class like they would a request proto
+# for an autogenerated call.
+class WaitForConsistencyRequest(proto.Message):
+ """Wrapper class for encapsulating parameters for the `wait_for_consistency` method in both
+ :class:`google.cloud.bigtable_admin_v2.overlay.services.bigtable_table_admin.client.BigtableTableAdminClient`
+ and :class:`google.cloud.bigtable_admin_v2.overlay.services.bigtable_table_admin.async_client.BigtableTableAdmiAsyncClient`.
+
+
+ This message has `oneof`_ fields (mutually exclusive fields).
+ For each oneof, at most one member field can be set at the same time.
+ Setting any member of the oneof automatically clears all other
+ members.
+
+ .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
+
+ Attributes:
+ name (str):
+ Required. The unique name of the Table for which to check
+ replication consistency. Values are of the form
+ ``projects/{project}/instances/{instance}/tables/{table}``.
+ standard_read_remote_writes (google.cloud.bigtable_admin_v2.types.StandardReadRemoteWrites):
+ Checks that reads using an app profile with
+ ``StandardIsolation`` can see all writes committed before
+ the token was created, even if the read and write target
+ different clusters.
+
+ This field is a member of `oneof`_ ``mode``.
+ data_boost_read_local_writes (google.cloud.bigtable_admin_v2.types.DataBoostReadLocalWrites):
+ Checks that reads using an app profile with
+ ``DataBoostIsolationReadOnly`` can see all writes committed
+ before the token was created, but only if the read and write
+ target the same cluster.
+
+ This field is a member of `oneof`_ ``mode``.
+ """
+
+ name: str = proto.Field(proto.STRING, number=1)
+ standard_read_remote_writes: bigtable_table_admin.StandardReadRemoteWrites = (
+ proto.Field(
+ proto.MESSAGE,
+ number=2,
+ oneof="mode",
+ message=bigtable_table_admin.StandardReadRemoteWrites,
+ )
+ )
+ data_boost_read_local_writes: bigtable_table_admin.DataBoostReadLocalWrites = (
+ proto.Field(
+ proto.MESSAGE,
+ number=3,
+ oneof="mode",
+ message=bigtable_table_admin.DataBoostReadLocalWrites,
+ )
+ )
diff --git a/google/cloud/bigtable_admin_v2/proto/bigtable_cluster_data.proto b/google/cloud/bigtable_admin_v2/proto/bigtable_cluster_data.proto
deleted file mode 100644
index ca3b663d8..000000000
--- a/google/cloud/bigtable_admin_v2/proto/bigtable_cluster_data.proto
+++ /dev/null
@@ -1,94 +0,0 @@
-// Copyright 2017 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-syntax = "proto3";
-
-package google.bigtable.admin.cluster.v1;
-
-import "google/api/annotations.proto";
-import "google/longrunning/operations.proto";
-import "google/protobuf/timestamp.proto";
-
-option go_package = "google.golang.org/genproto/googleapis/bigtable/admin/cluster/v1;cluster";
-option java_multiple_files = true;
-option java_outer_classname = "BigtableClusterDataProto";
-option java_package = "com.google.bigtable.admin.cluster.v1";
-
-
-// A physical location in which a particular project can allocate Cloud BigTable
-// resources.
-message Zone {
- // Possible states of a zone.
- enum Status {
- // The state of the zone is unknown or unspecified.
- UNKNOWN = 0;
-
- // The zone is in a good state.
- OK = 1;
-
- // The zone is down for planned maintenance.
- PLANNED_MAINTENANCE = 2;
-
- // The zone is down for emergency or unplanned maintenance.
- EMERGENCY_MAINENANCE = 3;
- }
-
- // A permanent unique identifier for the zone.
- // Values are of the form projects//zones/[a-z][-a-z0-9]*
- string name = 1;
-
- // The name of this zone as it appears in UIs.
- string display_name = 2;
-
- // The current state of this zone.
- Status status = 3;
-}
-
-// An isolated set of Cloud BigTable resources on which tables can be hosted.
-message Cluster {
- // A permanent unique identifier for the cluster. For technical reasons, the
- // zone in which the cluster resides is included here.
- // Values are of the form
- // projects//zones//clusters/[a-z][-a-z0-9]*
- string name = 1;
-
- // The operation currently running on the cluster, if any.
- // This cannot be set directly, only through CreateCluster, UpdateCluster,
- // or UndeleteCluster. Calls to these methods will be rejected if
- // "current_operation" is already set.
- google.longrunning.Operation current_operation = 3;
-
- // The descriptive name for this cluster as it appears in UIs.
- // Must be unique per zone.
- string display_name = 4;
-
- // The number of serve nodes allocated to this cluster.
- int32 serve_nodes = 5;
-
- // What storage type to use for tables in this cluster. Only configurable at
- // cluster creation time. If unspecified, STORAGE_SSD will be used.
- StorageType default_storage_type = 8;
-}
-
-enum StorageType {
- // The storage type used is unspecified.
- STORAGE_UNSPECIFIED = 0;
-
- // Data will be stored in SSD, providing low and consistent latencies.
- STORAGE_SSD = 1;
-
- // Data will be stored in HDD, providing high and less predictable
- // latencies.
- STORAGE_HDD = 2;
-}
diff --git a/google/cloud/bigtable_admin_v2/proto/bigtable_cluster_service.proto b/google/cloud/bigtable_admin_v2/proto/bigtable_cluster_service.proto
deleted file mode 100644
index 038fcc463..000000000
--- a/google/cloud/bigtable_admin_v2/proto/bigtable_cluster_service.proto
+++ /dev/null
@@ -1,130 +0,0 @@
-// Copyright 2017 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-syntax = "proto3";
-
-package google.bigtable.admin.cluster.v1;
-
-import "google/api/annotations.proto";
-import "google/bigtable/admin/cluster/v1/bigtable_cluster_data.proto";
-import "google/bigtable/admin/cluster/v1/bigtable_cluster_service_messages.proto";
-import "google/longrunning/operations.proto";
-import "google/protobuf/empty.proto";
-
-option go_package = "google.golang.org/genproto/googleapis/bigtable/admin/cluster/v1;cluster";
-option java_multiple_files = true;
-option java_outer_classname = "BigtableClusterServicesProto";
-option java_package = "com.google.bigtable.admin.cluster.v1";
-
-
-// Service for managing zonal Cloud Bigtable resources.
-service BigtableClusterService {
- // Lists the supported zones for the given project.
- rpc ListZones(ListZonesRequest) returns (ListZonesResponse) {
- option (google.api.http) = { get: "/v1/{name=projects/*}/zones" };
- }
-
- // Gets information about a particular cluster.
- rpc GetCluster(GetClusterRequest) returns (Cluster) {
- option (google.api.http) = { get: "/v1/{name=projects/*/zones/*/clusters/*}" };
- }
-
- // Lists all clusters in the given project, along with any zones for which
- // cluster information could not be retrieved.
- rpc ListClusters(ListClustersRequest) returns (ListClustersResponse) {
- option (google.api.http) = { get: "/v1/{name=projects/*}/aggregated/clusters" };
- }
-
- // Creates a cluster and begins preparing it to begin serving. The returned
- // cluster embeds as its "current_operation" a long-running operation which
- // can be used to track the progress of turning up the new cluster.
- // Immediately upon completion of this request:
- // * The cluster will be readable via the API, with all requested attributes
- // but no allocated resources.
- // Until completion of the embedded operation:
- // * Cancelling the operation will render the cluster immediately unreadable
- // via the API.
- // * All other attempts to modify or delete the cluster will be rejected.
- // Upon completion of the embedded operation:
- // * Billing for all successfully-allocated resources will begin (some types
- // may have lower than the requested levels).
- // * New tables can be created in the cluster.
- // * The cluster's allocated resource levels will be readable via the API.
- // The embedded operation's "metadata" field type is
- // [CreateClusterMetadata][google.bigtable.admin.cluster.v1.CreateClusterMetadata] The embedded operation's "response" field type is
- // [Cluster][google.bigtable.admin.cluster.v1.Cluster], if successful.
- rpc CreateCluster(CreateClusterRequest) returns (Cluster) {
- option (google.api.http) = { post: "/v1/{name=projects/*/zones/*}/clusters" body: "*" };
- }
-
- // Updates a cluster, and begins allocating or releasing resources as
- // requested. The returned cluster embeds as its "current_operation" a
- // long-running operation which can be used to track the progress of updating
- // the cluster.
- // Immediately upon completion of this request:
- // * For resource types where a decrease in the cluster's allocation has been
- // requested, billing will be based on the newly-requested level.
- // Until completion of the embedded operation:
- // * Cancelling the operation will set its metadata's "cancelled_at_time",
- // and begin restoring resources to their pre-request values. The operation
- // is guaranteed to succeed at undoing all resource changes, after which
- // point it will terminate with a CANCELLED status.
- // * All other attempts to modify or delete the cluster will be rejected.
- // * Reading the cluster via the API will continue to give the pre-request
- // resource levels.
- // Upon completion of the embedded operation:
- // * Billing will begin for all successfully-allocated resources (some types
- // may have lower than the requested levels).
- // * All newly-reserved resources will be available for serving the cluster's
- // tables.
- // * The cluster's new resource levels will be readable via the API.
- // [UpdateClusterMetadata][google.bigtable.admin.cluster.v1.UpdateClusterMetadata] The embedded operation's "response" field type is
- // [Cluster][google.bigtable.admin.cluster.v1.Cluster], if successful.
- rpc UpdateCluster(Cluster) returns (Cluster) {
- option (google.api.http) = { put: "/v1/{name=projects/*/zones/*/clusters/*}" body: "*" };
- }
-
- // Marks a cluster and all of its tables for permanent deletion in 7 days.
- // Immediately upon completion of the request:
- // * Billing will cease for all of the cluster's reserved resources.
- // * The cluster's "delete_time" field will be set 7 days in the future.
- // Soon afterward:
- // * All tables within the cluster will become unavailable.
- // Prior to the cluster's "delete_time":
- // * The cluster can be recovered with a call to UndeleteCluster.
- // * All other attempts to modify or delete the cluster will be rejected.
- // At the cluster's "delete_time":
- // * The cluster and *all of its tables* will immediately and irrevocably
- // disappear from the API, and their data will be permanently deleted.
- rpc DeleteCluster(DeleteClusterRequest) returns (google.protobuf.Empty) {
- option (google.api.http) = { delete: "/v1/{name=projects/*/zones/*/clusters/*}" };
- }
-
- // Cancels the scheduled deletion of an cluster and begins preparing it to
- // resume serving. The returned operation will also be embedded as the
- // cluster's "current_operation".
- // Immediately upon completion of this request:
- // * The cluster's "delete_time" field will be unset, protecting it from
- // automatic deletion.
- // Until completion of the returned operation:
- // * The operation cannot be cancelled.
- // Upon completion of the returned operation:
- // * Billing for the cluster's resources will resume.
- // * All tables within the cluster will be available.
- // [UndeleteClusterMetadata][google.bigtable.admin.cluster.v1.UndeleteClusterMetadata] The embedded operation's "response" field type is
- // [Cluster][google.bigtable.admin.cluster.v1.Cluster], if successful.
- rpc UndeleteCluster(UndeleteClusterRequest) returns (google.longrunning.Operation) {
- option (google.api.http) = { post: "/v1/{name=projects/*/zones/*/clusters/*}:undelete" body: "" };
- }
-}
diff --git a/google/cloud/bigtable_admin_v2/proto/bigtable_cluster_service_messages.proto b/google/cloud/bigtable_admin_v2/proto/bigtable_cluster_service_messages.proto
deleted file mode 100644
index 518d14dac..000000000
--- a/google/cloud/bigtable_admin_v2/proto/bigtable_cluster_service_messages.proto
+++ /dev/null
@@ -1,141 +0,0 @@
-// Copyright 2017 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-syntax = "proto3";
-
-package google.bigtable.admin.cluster.v1;
-
-import "google/bigtable/admin/cluster/v1/bigtable_cluster_data.proto";
-import "google/protobuf/timestamp.proto";
-
-option go_package = "google.golang.org/genproto/googleapis/bigtable/admin/cluster/v1;cluster";
-option java_multiple_files = true;
-option java_outer_classname = "BigtableClusterServiceMessagesProto";
-option java_package = "com.google.bigtable.admin.cluster.v1";
-
-
-// Request message for BigtableClusterService.ListZones.
-message ListZonesRequest {
- // The unique name of the project for which a list of supported zones is
- // requested.
- // Values are of the form projects/
- string name = 1;
-}
-
-// Response message for BigtableClusterService.ListZones.
-message ListZonesResponse {
- // The list of requested zones.
- repeated Zone zones = 1;
-}
-
-// Request message for BigtableClusterService.GetCluster.
-message GetClusterRequest {
- // The unique name of the requested cluster.
- // Values are of the form projects//zones//clusters/
- string name = 1;
-}
-
-// Request message for BigtableClusterService.ListClusters.
-message ListClustersRequest {
- // The unique name of the project for which a list of clusters is requested.
- // Values are of the form projects/
- string name = 1;
-}
-
-// Response message for BigtableClusterService.ListClusters.
-message ListClustersResponse {
- // The list of requested Clusters.
- repeated Cluster clusters = 1;
-
- // The zones for which clusters could not be retrieved.
- repeated Zone failed_zones = 2;
-}
-
-// Request message for BigtableClusterService.CreateCluster.
-message CreateClusterRequest {
- // The unique name of the zone in which to create the cluster.
- // Values are of the form projects//zones/
- string name = 1;
-
- // The id to be used when referring to the new cluster within its zone,
- // e.g. just the "test-cluster" section of the full name
- // "projects//zones//clusters/test-cluster".
- string cluster_id = 2;
-
- // The cluster to create.
- // The "name", "delete_time", and "current_operation" fields must be left
- // blank.
- Cluster cluster = 3;
-}
-
-// Metadata type for the operation returned by
-// BigtableClusterService.CreateCluster.
-message CreateClusterMetadata {
- // The request which prompted the creation of this operation.
- CreateClusterRequest original_request = 1;
-
- // The time at which original_request was received.
- google.protobuf.Timestamp request_time = 2;
-
- // The time at which this operation failed or was completed successfully.
- google.protobuf.Timestamp finish_time = 3;
-}
-
-// Metadata type for the operation returned by
-// BigtableClusterService.UpdateCluster.
-message UpdateClusterMetadata {
- // The request which prompted the creation of this operation.
- Cluster original_request = 1;
-
- // The time at which original_request was received.
- google.protobuf.Timestamp request_time = 2;
-
- // The time at which this operation was cancelled. If set, this operation is
- // in the process of undoing itself (which is guaranteed to succeed) and
- // cannot be cancelled again.
- google.protobuf.Timestamp cancel_time = 3;
-
- // The time at which this operation failed or was completed successfully.
- google.protobuf.Timestamp finish_time = 4;
-}
-
-// Request message for BigtableClusterService.DeleteCluster.
-message DeleteClusterRequest {
- // The unique name of the cluster to be deleted.
- // Values are of the form projects//zones//clusters/
- string name = 1;
-}
-
-// Request message for BigtableClusterService.UndeleteCluster.
-message UndeleteClusterRequest {
- // The unique name of the cluster to be un-deleted.
- // Values are of the form projects//zones//clusters/
- string name = 1;
-}
-
-// Metadata type for the operation returned by
-// BigtableClusterService.UndeleteCluster.
-message UndeleteClusterMetadata {
- // The time at which the original request was received.
- google.protobuf.Timestamp request_time = 1;
-
- // The time at which this operation failed or was completed successfully.
- google.protobuf.Timestamp finish_time = 2;
-}
-
-// Metadata type for operations initiated by the V2 BigtableAdmin service.
-// More complete information for such operations is available via the V2 API.
-message V2OperationMetadata {
-
-}
diff --git a/google/cloud/bigtable_admin_v2/proto/bigtable_instance_admin.proto b/google/cloud/bigtable_admin_v2/proto/bigtable_instance_admin.proto
deleted file mode 100644
index 8b19b5582..000000000
--- a/google/cloud/bigtable_admin_v2/proto/bigtable_instance_admin.proto
+++ /dev/null
@@ -1,573 +0,0 @@
-// 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.
-//
-
-syntax = "proto3";
-
-package google.bigtable.admin.v2;
-
-import "google/api/annotations.proto";
-import "google/api/client.proto";
-import "google/api/field_behavior.proto";
-import "google/api/resource.proto";
-import "google/bigtable/admin/v2/instance.proto";
-import "google/iam/v1/iam_policy.proto";
-import "google/iam/v1/policy.proto";
-import "google/longrunning/operations.proto";
-import "google/protobuf/empty.proto";
-import "google/protobuf/field_mask.proto";
-import "google/protobuf/timestamp.proto";
-
-option csharp_namespace = "Google.Cloud.Bigtable.Admin.V2";
-option go_package = "google.golang.org/genproto/googleapis/bigtable/admin/v2;admin";
-option java_multiple_files = true;
-option java_outer_classname = "BigtableInstanceAdminProto";
-option java_package = "com.google.bigtable.admin.v2";
-option php_namespace = "Google\\Cloud\\Bigtable\\Admin\\V2";
-option ruby_package = "Google::Cloud::Bigtable::Admin::V2";
-
-// Service for creating, configuring, and deleting Cloud Bigtable Instances and
-// Clusters. Provides access to the Instance and Cluster schemas only, not the
-// tables' metadata or data stored in those tables.
-service BigtableInstanceAdmin {
- option (google.api.default_host) = "bigtableadmin.googleapis.com";
- option (google.api.oauth_scopes) =
- "https://www.googleapis.com/auth/bigtable.admin,"
- "https://www.googleapis.com/auth/bigtable.admin.cluster,"
- "https://www.googleapis.com/auth/bigtable.admin.instance,"
- "https://www.googleapis.com/auth/cloud-bigtable.admin,"
- "https://www.googleapis.com/auth/cloud-bigtable.admin.cluster,"
- "https://www.googleapis.com/auth/cloud-platform,"
- "https://www.googleapis.com/auth/cloud-platform.read-only";
-
- // Create an instance within a project.
- rpc CreateInstance(CreateInstanceRequest) returns (google.longrunning.Operation) {
- option (google.api.http) = {
- post: "/v2/{parent=projects/*}/instances"
- body: "*"
- };
- option (google.api.method_signature) = "parent,instance_id,instance,clusters";
- option (google.longrunning.operation_info) = {
- response_type: "Instance"
- metadata_type: "CreateInstanceMetadata"
- };
- }
-
- // Gets information about an instance.
- rpc GetInstance(GetInstanceRequest) returns (Instance) {
- option (google.api.http) = {
- get: "/v2/{name=projects/*/instances/*}"
- };
- option (google.api.method_signature) = "name";
- }
-
- // Lists information about instances in a project.
- rpc ListInstances(ListInstancesRequest) returns (ListInstancesResponse) {
- option (google.api.http) = {
- get: "/v2/{parent=projects/*}/instances"
- };
- option (google.api.method_signature) = "parent";
- }
-
- // Updates an instance within a project. This method updates only the display
- // name and type for an Instance. To update other Instance properties, such as
- // labels, use PartialUpdateInstance.
- rpc UpdateInstance(Instance) returns (Instance) {
- option (google.api.http) = {
- put: "/v2/{name=projects/*/instances/*}"
- body: "*"
- };
- }
-
- // Partially updates an instance within a project. This method can modify all
- // fields of an Instance and is the preferred way to update an Instance.
- rpc PartialUpdateInstance(PartialUpdateInstanceRequest) returns (google.longrunning.Operation) {
- option (google.api.http) = {
- patch: "/v2/{instance.name=projects/*/instances/*}"
- body: "instance"
- };
- option (google.api.method_signature) = "instance,update_mask";
- option (google.longrunning.operation_info) = {
- response_type: "Instance"
- metadata_type: "UpdateInstanceMetadata"
- };
- }
-
- // Delete an instance from a project.
- rpc DeleteInstance(DeleteInstanceRequest) returns (google.protobuf.Empty) {
- option (google.api.http) = {
- delete: "/v2/{name=projects/*/instances/*}"
- };
- option (google.api.method_signature) = "name";
- }
-
- // Creates a cluster within an instance.
- rpc CreateCluster(CreateClusterRequest) returns (google.longrunning.Operation) {
- option (google.api.http) = {
- post: "/v2/{parent=projects/*/instances/*}/clusters"
- body: "cluster"
- };
- option (google.api.method_signature) = "parent,cluster_id,cluster";
- option (google.longrunning.operation_info) = {
- response_type: "Cluster"
- metadata_type: "CreateClusterMetadata"
- };
- }
-
- // Gets information about a cluster.
- rpc GetCluster(GetClusterRequest) returns (Cluster) {
- option (google.api.http) = {
- get: "/v2/{name=projects/*/instances/*/clusters/*}"
- };
- option (google.api.method_signature) = "name";
- }
-
- // Lists information about clusters in an instance.
- rpc ListClusters(ListClustersRequest) returns (ListClustersResponse) {
- option (google.api.http) = {
- get: "/v2/{parent=projects/*/instances/*}/clusters"
- };
- option (google.api.method_signature) = "parent";
- }
-
- // Updates a cluster within an instance.
- rpc UpdateCluster(Cluster) returns (google.longrunning.Operation) {
- option (google.api.http) = {
- put: "/v2/{name=projects/*/instances/*/clusters/*}"
- body: "*"
- };
- option (google.longrunning.operation_info) = {
- response_type: "Cluster"
- metadata_type: "UpdateClusterMetadata"
- };
- }
-
- // Deletes a cluster from an instance.
- rpc DeleteCluster(DeleteClusterRequest) returns (google.protobuf.Empty) {
- option (google.api.http) = {
- delete: "/v2/{name=projects/*/instances/*/clusters/*}"
- };
- option (google.api.method_signature) = "name";
- }
-
- // Creates an app profile within an instance.
- rpc CreateAppProfile(CreateAppProfileRequest) returns (AppProfile) {
- option (google.api.http) = {
- post: "/v2/{parent=projects/*/instances/*}/appProfiles"
- body: "app_profile"
- };
- option (google.api.method_signature) = "parent,app_profile_id,app_profile";
- }
-
- // Gets information about an app profile.
- rpc GetAppProfile(GetAppProfileRequest) returns (AppProfile) {
- option (google.api.http) = {
- get: "/v2/{name=projects/*/instances/*/appProfiles/*}"
- };
- option (google.api.method_signature) = "name";
- }
-
- // Lists information about app profiles in an instance.
- rpc ListAppProfiles(ListAppProfilesRequest) returns (ListAppProfilesResponse) {
- option (google.api.http) = {
- get: "/v2/{parent=projects/*/instances/*}/appProfiles"
- };
- option (google.api.method_signature) = "parent";
- }
-
- // Updates an app profile within an instance.
- rpc UpdateAppProfile(UpdateAppProfileRequest) returns (google.longrunning.Operation) {
- option (google.api.http) = {
- patch: "/v2/{app_profile.name=projects/*/instances/*/appProfiles/*}"
- body: "app_profile"
- };
- option (google.api.method_signature) = "app_profile,update_mask";
- option (google.longrunning.operation_info) = {
- response_type: "AppProfile"
- metadata_type: "UpdateAppProfileMetadata"
- };
- }
-
- // Deletes an app profile from an instance.
- rpc DeleteAppProfile(DeleteAppProfileRequest) returns (google.protobuf.Empty) {
- option (google.api.http) = {
- delete: "/v2/{name=projects/*/instances/*/appProfiles/*}"
- };
- option (google.api.method_signature) = "name";
- }
-
- // Gets the access control policy for an instance resource. Returns an empty
- // policy if an instance exists but does not have a policy set.
- rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) {
- option (google.api.http) = {
- post: "/v2/{resource=projects/*/instances/*}:getIamPolicy"
- body: "*"
- };
- option (google.api.method_signature) = "resource";
- }
-
- // Sets the access control policy on an instance resource. Replaces any
- // existing policy.
- rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) {
- option (google.api.http) = {
- post: "/v2/{resource=projects/*/instances/*}:setIamPolicy"
- body: "*"
- };
- option (google.api.method_signature) = "resource,policy";
- }
-
- // Returns permissions that the caller has on the specified instance resource.
- rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) {
- option (google.api.http) = {
- post: "/v2/{resource=projects/*/instances/*}:testIamPermissions"
- body: "*"
- };
- option (google.api.method_signature) = "resource,permissions";
- }
-}
-
-// Request message for BigtableInstanceAdmin.CreateInstance.
-message CreateInstanceRequest {
- // Required. The unique name of the project in which to create the new instance.
- // Values are of the form `projects/{project}`.
- string parent = 1 [
- (google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = {
- type: "cloudresourcemanager.googleapis.com/Project"
- }
- ];
-
- // Required. The ID to be used when referring to the new instance within its project,
- // e.g., just `myinstance` rather than
- // `projects/myproject/instances/myinstance`.
- string instance_id = 2 [(google.api.field_behavior) = REQUIRED];
-
- // Required. The instance to create.
- // Fields marked `OutputOnly` must be left blank.
- Instance instance = 3 [(google.api.field_behavior) = REQUIRED];
-
- // Required. The clusters to be created within the instance, mapped by desired
- // cluster ID, e.g., just `mycluster` rather than
- // `projects/myproject/instances/myinstance/clusters/mycluster`.
- // Fields marked `OutputOnly` must be left blank.
- // Currently, at most four clusters can be specified.
- map clusters = 4 [(google.api.field_behavior) = REQUIRED];
-}
-
-// Request message for BigtableInstanceAdmin.GetInstance.
-message GetInstanceRequest {
- // Required. The unique name of the requested instance. Values are of the form
- // `projects/{project}/instances/{instance}`.
- string name = 1 [
- (google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = {
- type: "bigtable.googleapis.com/Instance"
- }
- ];
-}
-
-// Request message for BigtableInstanceAdmin.ListInstances.
-message ListInstancesRequest {
- // Required. The unique name of the project for which a list of instances is requested.
- // Values are of the form `projects/{project}`.
- string parent = 1 [
- (google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = {
- type: "cloudresourcemanager.googleapis.com/Project"
- }
- ];
-
- // DEPRECATED: This field is unused and ignored.
- string page_token = 2;
-}
-
-// Response message for BigtableInstanceAdmin.ListInstances.
-message ListInstancesResponse {
- // The list of requested instances.
- repeated Instance instances = 1;
-
- // Locations from which Instance information could not be retrieved,
- // due to an outage or some other transient condition.
- // Instances whose Clusters are all in one of the failed locations
- // may be missing from `instances`, and Instances with at least one
- // Cluster in a failed location may only have partial information returned.
- // Values are of the form `projects//locations/`
- repeated string failed_locations = 2;
-
- // DEPRECATED: This field is unused and ignored.
- string next_page_token = 3;
-}
-
-// Request message for BigtableInstanceAdmin.PartialUpdateInstance.
-message PartialUpdateInstanceRequest {
- // Required. The Instance which will (partially) replace the current value.
- Instance instance = 1 [(google.api.field_behavior) = REQUIRED];
-
- // Required. The subset of Instance fields which should be replaced.
- // Must be explicitly set.
- google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED];
-}
-
-// Request message for BigtableInstanceAdmin.DeleteInstance.
-message DeleteInstanceRequest {
- // Required. The unique name of the instance to be deleted.
- // Values are of the form `projects/{project}/instances/{instance}`.
- string name = 1 [
- (google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = {
- type: "bigtable.googleapis.com/Instance"
- }
- ];
-}
-
-// Request message for BigtableInstanceAdmin.CreateCluster.
-message CreateClusterRequest {
- // Required. The unique name of the instance in which to create the new cluster.
- // Values are of the form
- // `projects/{project}/instances/{instance}`.
- string parent = 1 [
- (google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = {
- type: "bigtable.googleapis.com/Instance"
- }
- ];
-
- // Required. The ID to be used when referring to the new cluster within its instance,
- // e.g., just `mycluster` rather than
- // `projects/myproject/instances/myinstance/clusters/mycluster`.
- string cluster_id = 2 [(google.api.field_behavior) = REQUIRED];
-
- // Required. The cluster to be created.
- // Fields marked `OutputOnly` must be left blank.
- Cluster cluster = 3 [(google.api.field_behavior) = REQUIRED];
-}
-
-// Request message for BigtableInstanceAdmin.GetCluster.
-message GetClusterRequest {
- // Required. The unique name of the requested cluster. Values are of the form
- // `projects/{project}/instances/{instance}/clusters/{cluster}`.
- string name = 1 [
- (google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = {
- type: "bigtable.googleapis.com/Cluster"
- }
- ];
-}
-
-// Request message for BigtableInstanceAdmin.ListClusters.
-message ListClustersRequest {
- // Required. The unique name of the instance for which a list of clusters is requested.
- // Values are of the form `projects/{project}/instances/{instance}`.
- // Use `{instance} = '-'` to list Clusters for all Instances in a project,
- // e.g., `projects/myproject/instances/-`.
- string parent = 1 [
- (google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = {
- type: "bigtable.googleapis.com/Instance"
- }
- ];
-
- // DEPRECATED: This field is unused and ignored.
- string page_token = 2;
-}
-
-// Response message for BigtableInstanceAdmin.ListClusters.
-message ListClustersResponse {
- // The list of requested clusters.
- repeated Cluster clusters = 1;
-
- // Locations from which Cluster information could not be retrieved,
- // due to an outage or some other transient condition.
- // Clusters from these locations may be missing from `clusters`,
- // or may only have partial information returned.
- // Values are of the form `projects//locations/`
- repeated string failed_locations = 2;
-
- // DEPRECATED: This field is unused and ignored.
- string next_page_token = 3;
-}
-
-// Request message for BigtableInstanceAdmin.DeleteCluster.
-message DeleteClusterRequest {
- // Required. The unique name of the cluster to be deleted. Values are of the form
- // `projects/{project}/instances/{instance}/clusters/{cluster}`.
- string name = 1 [
- (google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = {
- type: "bigtable.googleapis.com/Cluster"
- }
- ];
-}
-
-// The metadata for the Operation returned by CreateInstance.
-message CreateInstanceMetadata {
- // The request that prompted the initiation of this CreateInstance operation.
- CreateInstanceRequest original_request = 1;
-
- // The time at which the original request was received.
- google.protobuf.Timestamp request_time = 2;
-
- // The time at which the operation failed or was completed successfully.
- google.protobuf.Timestamp finish_time = 3;
-}
-
-// The metadata for the Operation returned by UpdateInstance.
-message UpdateInstanceMetadata {
- // The request that prompted the initiation of this UpdateInstance operation.
- PartialUpdateInstanceRequest original_request = 1;
-
- // The time at which the original request was received.
- google.protobuf.Timestamp request_time = 2;
-
- // The time at which the operation failed or was completed successfully.
- google.protobuf.Timestamp finish_time = 3;
-}
-
-// The metadata for the Operation returned by CreateCluster.
-message CreateClusterMetadata {
- // The request that prompted the initiation of this CreateCluster operation.
- CreateClusterRequest original_request = 1;
-
- // The time at which the original request was received.
- google.protobuf.Timestamp request_time = 2;
-
- // The time at which the operation failed or was completed successfully.
- google.protobuf.Timestamp finish_time = 3;
-}
-
-// The metadata for the Operation returned by UpdateCluster.
-message UpdateClusterMetadata {
- // The request that prompted the initiation of this UpdateCluster operation.
- Cluster original_request = 1;
-
- // The time at which the original request was received.
- google.protobuf.Timestamp request_time = 2;
-
- // The time at which the operation failed or was completed successfully.
- google.protobuf.Timestamp finish_time = 3;
-}
-
-// Request message for BigtableInstanceAdmin.CreateAppProfile.
-message CreateAppProfileRequest {
- // Required. The unique name of the instance in which to create the new app profile.
- // Values are of the form
- // `projects/{project}/instances/{instance}`.
- string parent = 1 [
- (google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = {
- type: "bigtable.googleapis.com/Instance"
- }
- ];
-
- // Required. The ID to be used when referring to the new app profile within its
- // instance, e.g., just `myprofile` rather than
- // `projects/myproject/instances/myinstance/appProfiles/myprofile`.
- string app_profile_id = 2 [(google.api.field_behavior) = REQUIRED];
-
- // Required. The app profile to be created.
- // Fields marked `OutputOnly` will be ignored.
- AppProfile app_profile = 3 [(google.api.field_behavior) = REQUIRED];
-
- // If true, ignore safety checks when creating the app profile.
- bool ignore_warnings = 4;
-}
-
-// Request message for BigtableInstanceAdmin.GetAppProfile.
-message GetAppProfileRequest {
- // Required. The unique name of the requested app profile. Values are of the form
- // `projects/{project}/instances/{instance}/appProfiles/{app_profile}`.
- string name = 1 [
- (google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = {
- type: "bigtable.googleapis.com/AppProfile"
- }
- ];
-}
-
-// Request message for BigtableInstanceAdmin.ListAppProfiles.
-message ListAppProfilesRequest {
- // Required. The unique name of the instance for which a list of app profiles is
- // requested. Values are of the form
- // `projects/{project}/instances/{instance}`.
- // Use `{instance} = '-'` to list AppProfiles for all Instances in a project,
- // e.g., `projects/myproject/instances/-`.
- string parent = 1 [
- (google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = {
- type: "bigtable.googleapis.com/Instance"
- }
- ];
-
- // Maximum number of results per page.
- //
- // A page_size of zero lets the server choose the number of items to return.
- // A page_size which is strictly positive will return at most that many items.
- // A negative page_size will cause an error.
- //
- // Following the first request, subsequent paginated calls are not required
- // to pass a page_size. If a page_size is set in subsequent calls, it must
- // match the page_size given in the first request.
- int32 page_size = 3;
-
- // The value of `next_page_token` returned by a previous call.
- string page_token = 2;
-}
-
-// Response message for BigtableInstanceAdmin.ListAppProfiles.
-message ListAppProfilesResponse {
- // The list of requested app profiles.
- repeated AppProfile app_profiles = 1;
-
- // Set if not all app profiles could be returned in a single response.
- // Pass this value to `page_token` in another request to get the next
- // page of results.
- string next_page_token = 2;
-
- // Locations from which AppProfile information could not be retrieved,
- // due to an outage or some other transient condition.
- // AppProfiles from these locations may be missing from `app_profiles`.
- // Values are of the form `projects//locations/`
- repeated string failed_locations = 3;
-}
-
-// Request message for BigtableInstanceAdmin.UpdateAppProfile.
-message UpdateAppProfileRequest {
- // Required. The app profile which will (partially) replace the current value.
- AppProfile app_profile = 1 [(google.api.field_behavior) = REQUIRED];
-
- // Required. The subset of app profile fields which should be replaced.
- // If unset, all fields will be replaced.
- google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED];
-
- // If true, ignore safety checks when updating the app profile.
- bool ignore_warnings = 3;
-}
-
-// Request message for BigtableInstanceAdmin.DeleteAppProfile.
-message DeleteAppProfileRequest {
- // Required. The unique name of the app profile to be deleted. Values are of the form
- // `projects/{project}/instances/{instance}/appProfiles/{app_profile}`.
- string name = 1 [
- (google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = {
- type: "bigtable.googleapis.com/AppProfile"
- }
- ];
-
- // If true, ignore safety checks when deleting the app profile.
- bool ignore_warnings = 2;
-}
-
-// The metadata for the Operation returned by UpdateAppProfile.
-message UpdateAppProfileMetadata {}
diff --git a/google/cloud/bigtable_admin_v2/proto/bigtable_instance_admin_pb2.py b/google/cloud/bigtable_admin_v2/proto/bigtable_instance_admin_pb2.py
deleted file mode 100644
index 63590907a..000000000
--- a/google/cloud/bigtable_admin_v2/proto/bigtable_instance_admin_pb2.py
+++ /dev/null
@@ -1,2432 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/cloud/bigtable_admin_v2/proto/bigtable_instance_admin.proto
-"""Generated protocol buffer code."""
-from google.protobuf import descriptor as _descriptor
-from google.protobuf import message as _message
-from google.protobuf import reflection as _reflection
-from google.protobuf import symbol_database as _symbol_database
-
-# @@protoc_insertion_point(imports)
-
-_sym_db = _symbol_database.Default()
-
-
-from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2
-from google.api import client_pb2 as google_dot_api_dot_client__pb2
-from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2
-from google.api import resource_pb2 as google_dot_api_dot_resource__pb2
-from google.cloud.bigtable_admin_v2.proto import (
- instance_pb2 as google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_instance__pb2,
-)
-from google.iam.v1 import iam_policy_pb2 as google_dot_iam_dot_v1_dot_iam__policy__pb2
-from google.iam.v1 import policy_pb2 as google_dot_iam_dot_v1_dot_policy__pb2
-from google.longrunning import (
- operations_pb2 as google_dot_longrunning_dot_operations__pb2,
-)
-from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2
-from google.protobuf import field_mask_pb2 as google_dot_protobuf_dot_field__mask__pb2
-from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2
-
-
-DESCRIPTOR = _descriptor.FileDescriptor(
- name="google/cloud/bigtable_admin_v2/proto/bigtable_instance_admin.proto",
- package="google.bigtable.admin.v2",
- syntax="proto3",
- serialized_options=b'\n\034com.google.bigtable.admin.v2B\032BigtableInstanceAdminProtoP\001Z=google.golang.org/genproto/googleapis/bigtable/admin/v2;admin\252\002\036Google.Cloud.Bigtable.Admin.V2\312\002\036Google\\Cloud\\Bigtable\\Admin\\V2\352\002"Google::Cloud::Bigtable::Admin::V2',
- create_key=_descriptor._internal_create_key,
- serialized_pb=b'\nBgoogle/cloud/bigtable_admin_v2/proto/bigtable_instance_admin.proto\x12\x18google.bigtable.admin.v2\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x33google/cloud/bigtable_admin_v2/proto/instance.proto\x1a\x1egoogle/iam/v1/iam_policy.proto\x1a\x1agoogle/iam/v1/policy.proto\x1a#google/longrunning/operations.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto"\xdb\x02\n\x15\x43reateInstanceRequest\x12\x43\n\x06parent\x18\x01 \x01(\tB3\xe0\x41\x02\xfa\x41-\n+cloudresourcemanager.googleapis.com/Project\x12\x18\n\x0binstance_id\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x39\n\x08instance\x18\x03 \x01(\x0b\x32".google.bigtable.admin.v2.InstanceB\x03\xe0\x41\x02\x12T\n\x08\x63lusters\x18\x04 \x03(\x0b\x32=.google.bigtable.admin.v2.CreateInstanceRequest.ClustersEntryB\x03\xe0\x41\x02\x1aR\n\rClustersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x30\n\x05value\x18\x02 \x01(\x0b\x32!.google.bigtable.admin.v2.Cluster:\x02\x38\x01"L\n\x12GetInstanceRequest\x12\x36\n\x04name\x18\x01 \x01(\tB(\xe0\x41\x02\xfa\x41"\n bigtable.googleapis.com/Instance"o\n\x14ListInstancesRequest\x12\x43\n\x06parent\x18\x01 \x01(\tB3\xe0\x41\x02\xfa\x41-\n+cloudresourcemanager.googleapis.com/Project\x12\x12\n\npage_token\x18\x02 \x01(\t"\x81\x01\n\x15ListInstancesResponse\x12\x35\n\tinstances\x18\x01 \x03(\x0b\x32".google.bigtable.admin.v2.Instance\x12\x18\n\x10\x66\x61iled_locations\x18\x02 \x03(\t\x12\x17\n\x0fnext_page_token\x18\x03 \x01(\t"\x8f\x01\n\x1cPartialUpdateInstanceRequest\x12\x39\n\x08instance\x18\x01 \x01(\x0b\x32".google.bigtable.admin.v2.InstanceB\x03\xe0\x41\x02\x12\x34\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMaskB\x03\xe0\x41\x02"O\n\x15\x44\x65leteInstanceRequest\x12\x36\n\x04name\x18\x01 \x01(\tB(\xe0\x41\x02\xfa\x41"\n bigtable.googleapis.com/Instance"\xa2\x01\n\x14\x43reateClusterRequest\x12\x38\n\x06parent\x18\x01 \x01(\tB(\xe0\x41\x02\xfa\x41"\n bigtable.googleapis.com/Instance\x12\x17\n\ncluster_id\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x37\n\x07\x63luster\x18\x03 \x01(\x0b\x32!.google.bigtable.admin.v2.ClusterB\x03\xe0\x41\x02"J\n\x11GetClusterRequest\x12\x35\n\x04name\x18\x01 \x01(\tB\'\xe0\x41\x02\xfa\x41!\n\x1f\x62igtable.googleapis.com/Cluster"c\n\x13ListClustersRequest\x12\x38\n\x06parent\x18\x01 \x01(\tB(\xe0\x41\x02\xfa\x41"\n bigtable.googleapis.com/Instance\x12\x12\n\npage_token\x18\x02 \x01(\t"~\n\x14ListClustersResponse\x12\x33\n\x08\x63lusters\x18\x01 \x03(\x0b\x32!.google.bigtable.admin.v2.Cluster\x12\x18\n\x10\x66\x61iled_locations\x18\x02 \x03(\t\x12\x17\n\x0fnext_page_token\x18\x03 \x01(\t"M\n\x14\x44\x65leteClusterRequest\x12\x35\n\x04name\x18\x01 \x01(\tB\'\xe0\x41\x02\xfa\x41!\n\x1f\x62igtable.googleapis.com/Cluster"\xc6\x01\n\x16\x43reateInstanceMetadata\x12I\n\x10original_request\x18\x01 \x01(\x0b\x32/.google.bigtable.admin.v2.CreateInstanceRequest\x12\x30\n\x0crequest_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12/\n\x0b\x66inish_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp"\xcd\x01\n\x16UpdateInstanceMetadata\x12P\n\x10original_request\x18\x01 \x01(\x0b\x32\x36.google.bigtable.admin.v2.PartialUpdateInstanceRequest\x12\x30\n\x0crequest_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12/\n\x0b\x66inish_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp"\xc4\x01\n\x15\x43reateClusterMetadata\x12H\n\x10original_request\x18\x01 \x01(\x0b\x32..google.bigtable.admin.v2.CreateClusterRequest\x12\x30\n\x0crequest_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12/\n\x0b\x66inish_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp"\xb7\x01\n\x15UpdateClusterMetadata\x12;\n\x10original_request\x18\x01 \x01(\x0b\x32!.google.bigtable.admin.v2.Cluster\x12\x30\n\x0crequest_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12/\n\x0b\x66inish_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp"\xc9\x01\n\x17\x43reateAppProfileRequest\x12\x38\n\x06parent\x18\x01 \x01(\tB(\xe0\x41\x02\xfa\x41"\n bigtable.googleapis.com/Instance\x12\x1b\n\x0e\x61pp_profile_id\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12>\n\x0b\x61pp_profile\x18\x03 \x01(\x0b\x32$.google.bigtable.admin.v2.AppProfileB\x03\xe0\x41\x02\x12\x17\n\x0fignore_warnings\x18\x04 \x01(\x08"P\n\x14GetAppProfileRequest\x12\x38\n\x04name\x18\x01 \x01(\tB*\xe0\x41\x02\xfa\x41$\n"bigtable.googleapis.com/AppProfile"y\n\x16ListAppProfilesRequest\x12\x38\n\x06parent\x18\x01 \x01(\tB(\xe0\x41\x02\xfa\x41"\n bigtable.googleapis.com/Instance\x12\x11\n\tpage_size\x18\x03 \x01(\x05\x12\x12\n\npage_token\x18\x02 \x01(\t"\x88\x01\n\x17ListAppProfilesResponse\x12:\n\x0c\x61pp_profiles\x18\x01 \x03(\x0b\x32$.google.bigtable.admin.v2.AppProfile\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t\x12\x18\n\x10\x66\x61iled_locations\x18\x03 \x03(\t"\xa8\x01\n\x17UpdateAppProfileRequest\x12>\n\x0b\x61pp_profile\x18\x01 \x01(\x0b\x32$.google.bigtable.admin.v2.AppProfileB\x03\xe0\x41\x02\x12\x34\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMaskB\x03\xe0\x41\x02\x12\x17\n\x0fignore_warnings\x18\x03 \x01(\x08"l\n\x17\x44\x65leteAppProfileRequest\x12\x38\n\x04name\x18\x01 \x01(\tB*\xe0\x41\x02\xfa\x41$\n"bigtable.googleapis.com/AppProfile\x12\x17\n\x0fignore_warnings\x18\x02 \x01(\x08"\x1a\n\x18UpdateAppProfileMetadata2\x92\x1e\n\x15\x42igtableInstanceAdmin\x12\xda\x01\n\x0e\x43reateInstance\x12/.google.bigtable.admin.v2.CreateInstanceRequest\x1a\x1d.google.longrunning.Operation"x\x82\xd3\xe4\x93\x02&"!/v2/{parent=projects/*}/instances:\x01*\xda\x41$parent,instance_id,instance,clusters\xca\x41"\n\x08Instance\x12\x16\x43reateInstanceMetadata\x12\x91\x01\n\x0bGetInstance\x12,.google.bigtable.admin.v2.GetInstanceRequest\x1a".google.bigtable.admin.v2.Instance"0\x82\xd3\xe4\x93\x02#\x12!/v2/{name=projects/*/instances/*}\xda\x41\x04name\x12\xa4\x01\n\rListInstances\x12..google.bigtable.admin.v2.ListInstancesRequest\x1a/.google.bigtable.admin.v2.ListInstancesResponse"2\x82\xd3\xe4\x93\x02#\x12!/v2/{parent=projects/*}/instances\xda\x41\x06parent\x12\x86\x01\n\x0eUpdateInstance\x12".google.bigtable.admin.v2.Instance\x1a".google.bigtable.admin.v2.Instance",\x82\xd3\xe4\x93\x02&\x1a!/v2/{name=projects/*/instances/*}:\x01*\x12\xe8\x01\n\x15PartialUpdateInstance\x12\x36.google.bigtable.admin.v2.PartialUpdateInstanceRequest\x1a\x1d.google.longrunning.Operation"x\x82\xd3\xe4\x93\x02\x36\x32*/v2/{instance.name=projects/*/instances/*}:\x08instance\xda\x41\x14instance,update_mask\xca\x41"\n\x08Instance\x12\x16UpdateInstanceMetadata\x12\x8b\x01\n\x0e\x44\x65leteInstance\x12/.google.bigtable.admin.v2.DeleteInstanceRequest\x1a\x16.google.protobuf.Empty"0\x82\xd3\xe4\x93\x02#*!/v2/{name=projects/*/instances/*}\xda\x41\x04name\x12\xdc\x01\n\rCreateCluster\x12..google.bigtable.admin.v2.CreateClusterRequest\x1a\x1d.google.longrunning.Operation"|\x82\xd3\xe4\x93\x02\x37",/v2/{parent=projects/*/instances/*}/clusters:\x07\x63luster\xda\x41\x19parent,cluster_id,cluster\xca\x41 \n\x07\x43luster\x12\x15\x43reateClusterMetadata\x12\x99\x01\n\nGetCluster\x12+.google.bigtable.admin.v2.GetClusterRequest\x1a!.google.bigtable.admin.v2.Cluster";\x82\xd3\xe4\x93\x02.\x12,/v2/{name=projects/*/instances/*/clusters/*}\xda\x41\x04name\x12\xac\x01\n\x0cListClusters\x12-.google.bigtable.admin.v2.ListClustersRequest\x1a..google.bigtable.admin.v2.ListClustersResponse"=\x82\xd3\xe4\x93\x02.\x12,/v2/{parent=projects/*/instances/*}/clusters\xda\x41\x06parent\x12\xad\x01\n\rUpdateCluster\x12!.google.bigtable.admin.v2.Cluster\x1a\x1d.google.longrunning.Operation"Z\x82\xd3\xe4\x93\x02\x31\x1a,/v2/{name=projects/*/instances/*/clusters/*}:\x01*\xca\x41 \n\x07\x43luster\x12\x15UpdateClusterMetadata\x12\x94\x01\n\rDeleteCluster\x12..google.bigtable.admin.v2.DeleteClusterRequest\x1a\x16.google.protobuf.Empty";\x82\xd3\xe4\x93\x02.*,/v2/{name=projects/*/instances/*/clusters/*}\xda\x41\x04name\x12\xd5\x01\n\x10\x43reateAppProfile\x12\x31.google.bigtable.admin.v2.CreateAppProfileRequest\x1a$.google.bigtable.admin.v2.AppProfile"h\x82\xd3\xe4\x93\x02>"//v2/{parent=projects/*/instances/*}/appProfiles:\x0b\x61pp_profile\xda\x41!parent,app_profile_id,app_profile\x12\xa5\x01\n\rGetAppProfile\x12..google.bigtable.admin.v2.GetAppProfileRequest\x1a$.google.bigtable.admin.v2.AppProfile">\x82\xd3\xe4\x93\x02\x31\x12//v2/{name=projects/*/instances/*/appProfiles/*}\xda\x41\x04name\x12\xb8\x01\n\x0fListAppProfiles\x12\x30.google.bigtable.admin.v2.ListAppProfilesRequest\x1a\x31.google.bigtable.admin.v2.ListAppProfilesResponse"@\x82\xd3\xe4\x93\x02\x31\x12//v2/{parent=projects/*/instances/*}/appProfiles\xda\x41\x06parent\x12\xfa\x01\n\x10UpdateAppProfile\x12\x31.google.bigtable.admin.v2.UpdateAppProfileRequest\x1a\x1d.google.longrunning.Operation"\x93\x01\x82\xd3\xe4\x93\x02J2;/v2/{app_profile.name=projects/*/instances/*/appProfiles/*}:\x0b\x61pp_profile\xda\x41\x17\x61pp_profile,update_mask\xca\x41&\n\nAppProfile\x12\x18UpdateAppProfileMetadata\x12\x9d\x01\n\x10\x44\x65leteAppProfile\x12\x31.google.bigtable.admin.v2.DeleteAppProfileRequest\x1a\x16.google.protobuf.Empty">\x82\xd3\xe4\x93\x02\x31*//v2/{name=projects/*/instances/*/appProfiles/*}\xda\x41\x04name\x12\x93\x01\n\x0cGetIamPolicy\x12".google.iam.v1.GetIamPolicyRequest\x1a\x15.google.iam.v1.Policy"H\x82\xd3\xe4\x93\x02\x37"2/v2/{resource=projects/*/instances/*}:getIamPolicy:\x01*\xda\x41\x08resource\x12\x9a\x01\n\x0cSetIamPolicy\x12".google.iam.v1.SetIamPolicyRequest\x1a\x15.google.iam.v1.Policy"O\x82\xd3\xe4\x93\x02\x37"2/v2/{resource=projects/*/instances/*}:setIamPolicy:\x01*\xda\x41\x0fresource,policy\x12\xc5\x01\n\x12TestIamPermissions\x12(.google.iam.v1.TestIamPermissionsRequest\x1a).google.iam.v1.TestIamPermissionsResponse"Z\x82\xd3\xe4\x93\x02="8/v2/{resource=projects/*/instances/*}:testIamPermissions:\x01*\xda\x41\x14resource,permissions\x1a\x9a\x03\xca\x41\x1c\x62igtableadmin.googleapis.com\xd2\x41\xf7\x02https://www.googleapis.com/auth/bigtable.admin,https://www.googleapis.com/auth/bigtable.admin.cluster,https://www.googleapis.com/auth/bigtable.admin.instance,https://www.googleapis.com/auth/cloud-bigtable.admin,https://www.googleapis.com/auth/cloud-bigtable.admin.cluster,https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/cloud-platform.read-onlyB\xe2\x01\n\x1c\x63om.google.bigtable.admin.v2B\x1a\x42igtableInstanceAdminProtoP\x01Z=google.golang.org/genproto/googleapis/bigtable/admin/v2;admin\xaa\x02\x1eGoogle.Cloud.Bigtable.Admin.V2\xca\x02\x1eGoogle\\Cloud\\Bigtable\\Admin\\V2\xea\x02"Google::Cloud::Bigtable::Admin::V2b\x06proto3',
- dependencies=[
- google_dot_api_dot_annotations__pb2.DESCRIPTOR,
- google_dot_api_dot_client__pb2.DESCRIPTOR,
- google_dot_api_dot_field__behavior__pb2.DESCRIPTOR,
- google_dot_api_dot_resource__pb2.DESCRIPTOR,
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_instance__pb2.DESCRIPTOR,
- google_dot_iam_dot_v1_dot_iam__policy__pb2.DESCRIPTOR,
- google_dot_iam_dot_v1_dot_policy__pb2.DESCRIPTOR,
- google_dot_longrunning_dot_operations__pb2.DESCRIPTOR,
- google_dot_protobuf_dot_empty__pb2.DESCRIPTOR,
- google_dot_protobuf_dot_field__mask__pb2.DESCRIPTOR,
- google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR,
- ],
-)
-
-
-_CREATEINSTANCEREQUEST_CLUSTERSENTRY = _descriptor.Descriptor(
- name="ClustersEntry",
- full_name="google.bigtable.admin.v2.CreateInstanceRequest.ClustersEntry",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="key",
- full_name="google.bigtable.admin.v2.CreateInstanceRequest.ClustersEntry.key",
- index=0,
- number=1,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="value",
- full_name="google.bigtable.admin.v2.CreateInstanceRequest.ClustersEntry.value",
- index=1,
- number=2,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=b"8\001",
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=723,
- serialized_end=805,
-)
-
-_CREATEINSTANCEREQUEST = _descriptor.Descriptor(
- name="CreateInstanceRequest",
- full_name="google.bigtable.admin.v2.CreateInstanceRequest",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="parent",
- full_name="google.bigtable.admin.v2.CreateInstanceRequest.parent",
- index=0,
- number=1,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\002\372A-\n+cloudresourcemanager.googleapis.com/Project",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="instance_id",
- full_name="google.bigtable.admin.v2.CreateInstanceRequest.instance_id",
- index=1,
- number=2,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\002",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="instance",
- full_name="google.bigtable.admin.v2.CreateInstanceRequest.instance",
- index=2,
- number=3,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\002",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="clusters",
- full_name="google.bigtable.admin.v2.CreateInstanceRequest.clusters",
- index=3,
- number=4,
- type=11,
- cpp_type=10,
- label=3,
- has_default_value=False,
- default_value=[],
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\002",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[_CREATEINSTANCEREQUEST_CLUSTERSENTRY,],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=458,
- serialized_end=805,
-)
-
-
-_GETINSTANCEREQUEST = _descriptor.Descriptor(
- name="GetInstanceRequest",
- full_name="google.bigtable.admin.v2.GetInstanceRequest",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="name",
- full_name="google.bigtable.admin.v2.GetInstanceRequest.name",
- index=0,
- number=1,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b'\340A\002\372A"\n bigtable.googleapis.com/Instance',
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=807,
- serialized_end=883,
-)
-
-
-_LISTINSTANCESREQUEST = _descriptor.Descriptor(
- name="ListInstancesRequest",
- full_name="google.bigtable.admin.v2.ListInstancesRequest",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="parent",
- full_name="google.bigtable.admin.v2.ListInstancesRequest.parent",
- index=0,
- number=1,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\002\372A-\n+cloudresourcemanager.googleapis.com/Project",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="page_token",
- full_name="google.bigtable.admin.v2.ListInstancesRequest.page_token",
- index=1,
- number=2,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=885,
- serialized_end=996,
-)
-
-
-_LISTINSTANCESRESPONSE = _descriptor.Descriptor(
- name="ListInstancesResponse",
- full_name="google.bigtable.admin.v2.ListInstancesResponse",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="instances",
- full_name="google.bigtable.admin.v2.ListInstancesResponse.instances",
- index=0,
- number=1,
- type=11,
- cpp_type=10,
- label=3,
- has_default_value=False,
- default_value=[],
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="failed_locations",
- full_name="google.bigtable.admin.v2.ListInstancesResponse.failed_locations",
- index=1,
- number=2,
- type=9,
- cpp_type=9,
- label=3,
- has_default_value=False,
- default_value=[],
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="next_page_token",
- full_name="google.bigtable.admin.v2.ListInstancesResponse.next_page_token",
- index=2,
- number=3,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=999,
- serialized_end=1128,
-)
-
-
-_PARTIALUPDATEINSTANCEREQUEST = _descriptor.Descriptor(
- name="PartialUpdateInstanceRequest",
- full_name="google.bigtable.admin.v2.PartialUpdateInstanceRequest",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="instance",
- full_name="google.bigtable.admin.v2.PartialUpdateInstanceRequest.instance",
- index=0,
- number=1,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\002",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="update_mask",
- full_name="google.bigtable.admin.v2.PartialUpdateInstanceRequest.update_mask",
- index=1,
- number=2,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\002",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=1131,
- serialized_end=1274,
-)
-
-
-_DELETEINSTANCEREQUEST = _descriptor.Descriptor(
- name="DeleteInstanceRequest",
- full_name="google.bigtable.admin.v2.DeleteInstanceRequest",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="name",
- full_name="google.bigtable.admin.v2.DeleteInstanceRequest.name",
- index=0,
- number=1,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b'\340A\002\372A"\n bigtable.googleapis.com/Instance',
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=1276,
- serialized_end=1355,
-)
-
-
-_CREATECLUSTERREQUEST = _descriptor.Descriptor(
- name="CreateClusterRequest",
- full_name="google.bigtable.admin.v2.CreateClusterRequest",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="parent",
- full_name="google.bigtable.admin.v2.CreateClusterRequest.parent",
- index=0,
- number=1,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b'\340A\002\372A"\n bigtable.googleapis.com/Instance',
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="cluster_id",
- full_name="google.bigtable.admin.v2.CreateClusterRequest.cluster_id",
- index=1,
- number=2,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\002",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="cluster",
- full_name="google.bigtable.admin.v2.CreateClusterRequest.cluster",
- index=2,
- number=3,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\002",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=1358,
- serialized_end=1520,
-)
-
-
-_GETCLUSTERREQUEST = _descriptor.Descriptor(
- name="GetClusterRequest",
- full_name="google.bigtable.admin.v2.GetClusterRequest",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="name",
- full_name="google.bigtable.admin.v2.GetClusterRequest.name",
- index=0,
- number=1,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\002\372A!\n\037bigtable.googleapis.com/Cluster",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=1522,
- serialized_end=1596,
-)
-
-
-_LISTCLUSTERSREQUEST = _descriptor.Descriptor(
- name="ListClustersRequest",
- full_name="google.bigtable.admin.v2.ListClustersRequest",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="parent",
- full_name="google.bigtable.admin.v2.ListClustersRequest.parent",
- index=0,
- number=1,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b'\340A\002\372A"\n bigtable.googleapis.com/Instance',
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="page_token",
- full_name="google.bigtable.admin.v2.ListClustersRequest.page_token",
- index=1,
- number=2,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=1598,
- serialized_end=1697,
-)
-
-
-_LISTCLUSTERSRESPONSE = _descriptor.Descriptor(
- name="ListClustersResponse",
- full_name="google.bigtable.admin.v2.ListClustersResponse",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="clusters",
- full_name="google.bigtable.admin.v2.ListClustersResponse.clusters",
- index=0,
- number=1,
- type=11,
- cpp_type=10,
- label=3,
- has_default_value=False,
- default_value=[],
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="failed_locations",
- full_name="google.bigtable.admin.v2.ListClustersResponse.failed_locations",
- index=1,
- number=2,
- type=9,
- cpp_type=9,
- label=3,
- has_default_value=False,
- default_value=[],
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="next_page_token",
- full_name="google.bigtable.admin.v2.ListClustersResponse.next_page_token",
- index=2,
- number=3,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=1699,
- serialized_end=1825,
-)
-
-
-_DELETECLUSTERREQUEST = _descriptor.Descriptor(
- name="DeleteClusterRequest",
- full_name="google.bigtable.admin.v2.DeleteClusterRequest",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="name",
- full_name="google.bigtable.admin.v2.DeleteClusterRequest.name",
- index=0,
- number=1,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\002\372A!\n\037bigtable.googleapis.com/Cluster",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=1827,
- serialized_end=1904,
-)
-
-
-_CREATEINSTANCEMETADATA = _descriptor.Descriptor(
- name="CreateInstanceMetadata",
- full_name="google.bigtable.admin.v2.CreateInstanceMetadata",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="original_request",
- full_name="google.bigtable.admin.v2.CreateInstanceMetadata.original_request",
- index=0,
- number=1,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="request_time",
- full_name="google.bigtable.admin.v2.CreateInstanceMetadata.request_time",
- index=1,
- number=2,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="finish_time",
- full_name="google.bigtable.admin.v2.CreateInstanceMetadata.finish_time",
- index=2,
- number=3,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=1907,
- serialized_end=2105,
-)
-
-
-_UPDATEINSTANCEMETADATA = _descriptor.Descriptor(
- name="UpdateInstanceMetadata",
- full_name="google.bigtable.admin.v2.UpdateInstanceMetadata",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="original_request",
- full_name="google.bigtable.admin.v2.UpdateInstanceMetadata.original_request",
- index=0,
- number=1,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="request_time",
- full_name="google.bigtable.admin.v2.UpdateInstanceMetadata.request_time",
- index=1,
- number=2,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="finish_time",
- full_name="google.bigtable.admin.v2.UpdateInstanceMetadata.finish_time",
- index=2,
- number=3,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=2108,
- serialized_end=2313,
-)
-
-
-_CREATECLUSTERMETADATA = _descriptor.Descriptor(
- name="CreateClusterMetadata",
- full_name="google.bigtable.admin.v2.CreateClusterMetadata",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="original_request",
- full_name="google.bigtable.admin.v2.CreateClusterMetadata.original_request",
- index=0,
- number=1,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="request_time",
- full_name="google.bigtable.admin.v2.CreateClusterMetadata.request_time",
- index=1,
- number=2,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="finish_time",
- full_name="google.bigtable.admin.v2.CreateClusterMetadata.finish_time",
- index=2,
- number=3,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=2316,
- serialized_end=2512,
-)
-
-
-_UPDATECLUSTERMETADATA = _descriptor.Descriptor(
- name="UpdateClusterMetadata",
- full_name="google.bigtable.admin.v2.UpdateClusterMetadata",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="original_request",
- full_name="google.bigtable.admin.v2.UpdateClusterMetadata.original_request",
- index=0,
- number=1,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="request_time",
- full_name="google.bigtable.admin.v2.UpdateClusterMetadata.request_time",
- index=1,
- number=2,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="finish_time",
- full_name="google.bigtable.admin.v2.UpdateClusterMetadata.finish_time",
- index=2,
- number=3,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=2515,
- serialized_end=2698,
-)
-
-
-_CREATEAPPPROFILEREQUEST = _descriptor.Descriptor(
- name="CreateAppProfileRequest",
- full_name="google.bigtable.admin.v2.CreateAppProfileRequest",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="parent",
- full_name="google.bigtable.admin.v2.CreateAppProfileRequest.parent",
- index=0,
- number=1,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b'\340A\002\372A"\n bigtable.googleapis.com/Instance',
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="app_profile_id",
- full_name="google.bigtable.admin.v2.CreateAppProfileRequest.app_profile_id",
- index=1,
- number=2,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\002",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="app_profile",
- full_name="google.bigtable.admin.v2.CreateAppProfileRequest.app_profile",
- index=2,
- number=3,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\002",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="ignore_warnings",
- full_name="google.bigtable.admin.v2.CreateAppProfileRequest.ignore_warnings",
- index=3,
- number=4,
- type=8,
- cpp_type=7,
- label=1,
- has_default_value=False,
- default_value=False,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=2701,
- serialized_end=2902,
-)
-
-
-_GETAPPPROFILEREQUEST = _descriptor.Descriptor(
- name="GetAppProfileRequest",
- full_name="google.bigtable.admin.v2.GetAppProfileRequest",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="name",
- full_name="google.bigtable.admin.v2.GetAppProfileRequest.name",
- index=0,
- number=1,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b'\340A\002\372A$\n"bigtable.googleapis.com/AppProfile',
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=2904,
- serialized_end=2984,
-)
-
-
-_LISTAPPPROFILESREQUEST = _descriptor.Descriptor(
- name="ListAppProfilesRequest",
- full_name="google.bigtable.admin.v2.ListAppProfilesRequest",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="parent",
- full_name="google.bigtable.admin.v2.ListAppProfilesRequest.parent",
- index=0,
- number=1,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b'\340A\002\372A"\n bigtable.googleapis.com/Instance',
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="page_size",
- full_name="google.bigtable.admin.v2.ListAppProfilesRequest.page_size",
- index=1,
- number=3,
- type=5,
- cpp_type=1,
- label=1,
- has_default_value=False,
- default_value=0,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="page_token",
- full_name="google.bigtable.admin.v2.ListAppProfilesRequest.page_token",
- index=2,
- number=2,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=2986,
- serialized_end=3107,
-)
-
-
-_LISTAPPPROFILESRESPONSE = _descriptor.Descriptor(
- name="ListAppProfilesResponse",
- full_name="google.bigtable.admin.v2.ListAppProfilesResponse",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="app_profiles",
- full_name="google.bigtable.admin.v2.ListAppProfilesResponse.app_profiles",
- index=0,
- number=1,
- type=11,
- cpp_type=10,
- label=3,
- has_default_value=False,
- default_value=[],
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="next_page_token",
- full_name="google.bigtable.admin.v2.ListAppProfilesResponse.next_page_token",
- index=1,
- number=2,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="failed_locations",
- full_name="google.bigtable.admin.v2.ListAppProfilesResponse.failed_locations",
- index=2,
- number=3,
- type=9,
- cpp_type=9,
- label=3,
- has_default_value=False,
- default_value=[],
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=3110,
- serialized_end=3246,
-)
-
-
-_UPDATEAPPPROFILEREQUEST = _descriptor.Descriptor(
- name="UpdateAppProfileRequest",
- full_name="google.bigtable.admin.v2.UpdateAppProfileRequest",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="app_profile",
- full_name="google.bigtable.admin.v2.UpdateAppProfileRequest.app_profile",
- index=0,
- number=1,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\002",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="update_mask",
- full_name="google.bigtable.admin.v2.UpdateAppProfileRequest.update_mask",
- index=1,
- number=2,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\002",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="ignore_warnings",
- full_name="google.bigtable.admin.v2.UpdateAppProfileRequest.ignore_warnings",
- index=2,
- number=3,
- type=8,
- cpp_type=7,
- label=1,
- has_default_value=False,
- default_value=False,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=3249,
- serialized_end=3417,
-)
-
-
-_DELETEAPPPROFILEREQUEST = _descriptor.Descriptor(
- name="DeleteAppProfileRequest",
- full_name="google.bigtable.admin.v2.DeleteAppProfileRequest",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="name",
- full_name="google.bigtable.admin.v2.DeleteAppProfileRequest.name",
- index=0,
- number=1,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b'\340A\002\372A$\n"bigtable.googleapis.com/AppProfile',
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="ignore_warnings",
- full_name="google.bigtable.admin.v2.DeleteAppProfileRequest.ignore_warnings",
- index=1,
- number=2,
- type=8,
- cpp_type=7,
- label=1,
- has_default_value=False,
- default_value=False,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=3419,
- serialized_end=3527,
-)
-
-
-_UPDATEAPPPROFILEMETADATA = _descriptor.Descriptor(
- name="UpdateAppProfileMetadata",
- full_name="google.bigtable.admin.v2.UpdateAppProfileMetadata",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=3529,
- serialized_end=3555,
-)
-
-_CREATEINSTANCEREQUEST_CLUSTERSENTRY.fields_by_name[
- "value"
-].message_type = (
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_instance__pb2._CLUSTER
-)
-_CREATEINSTANCEREQUEST_CLUSTERSENTRY.containing_type = _CREATEINSTANCEREQUEST
-_CREATEINSTANCEREQUEST.fields_by_name[
- "instance"
-].message_type = (
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_instance__pb2._INSTANCE
-)
-_CREATEINSTANCEREQUEST.fields_by_name[
- "clusters"
-].message_type = _CREATEINSTANCEREQUEST_CLUSTERSENTRY
-_LISTINSTANCESRESPONSE.fields_by_name[
- "instances"
-].message_type = (
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_instance__pb2._INSTANCE
-)
-_PARTIALUPDATEINSTANCEREQUEST.fields_by_name[
- "instance"
-].message_type = (
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_instance__pb2._INSTANCE
-)
-_PARTIALUPDATEINSTANCEREQUEST.fields_by_name[
- "update_mask"
-].message_type = google_dot_protobuf_dot_field__mask__pb2._FIELDMASK
-_CREATECLUSTERREQUEST.fields_by_name[
- "cluster"
-].message_type = (
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_instance__pb2._CLUSTER
-)
-_LISTCLUSTERSRESPONSE.fields_by_name[
- "clusters"
-].message_type = (
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_instance__pb2._CLUSTER
-)
-_CREATEINSTANCEMETADATA.fields_by_name[
- "original_request"
-].message_type = _CREATEINSTANCEREQUEST
-_CREATEINSTANCEMETADATA.fields_by_name[
- "request_time"
-].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP
-_CREATEINSTANCEMETADATA.fields_by_name[
- "finish_time"
-].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP
-_UPDATEINSTANCEMETADATA.fields_by_name[
- "original_request"
-].message_type = _PARTIALUPDATEINSTANCEREQUEST
-_UPDATEINSTANCEMETADATA.fields_by_name[
- "request_time"
-].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP
-_UPDATEINSTANCEMETADATA.fields_by_name[
- "finish_time"
-].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP
-_CREATECLUSTERMETADATA.fields_by_name[
- "original_request"
-].message_type = _CREATECLUSTERREQUEST
-_CREATECLUSTERMETADATA.fields_by_name[
- "request_time"
-].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP
-_CREATECLUSTERMETADATA.fields_by_name[
- "finish_time"
-].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP
-_UPDATECLUSTERMETADATA.fields_by_name[
- "original_request"
-].message_type = (
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_instance__pb2._CLUSTER
-)
-_UPDATECLUSTERMETADATA.fields_by_name[
- "request_time"
-].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP
-_UPDATECLUSTERMETADATA.fields_by_name[
- "finish_time"
-].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP
-_CREATEAPPPROFILEREQUEST.fields_by_name[
- "app_profile"
-].message_type = (
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_instance__pb2._APPPROFILE
-)
-_LISTAPPPROFILESRESPONSE.fields_by_name[
- "app_profiles"
-].message_type = (
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_instance__pb2._APPPROFILE
-)
-_UPDATEAPPPROFILEREQUEST.fields_by_name[
- "app_profile"
-].message_type = (
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_instance__pb2._APPPROFILE
-)
-_UPDATEAPPPROFILEREQUEST.fields_by_name[
- "update_mask"
-].message_type = google_dot_protobuf_dot_field__mask__pb2._FIELDMASK
-DESCRIPTOR.message_types_by_name["CreateInstanceRequest"] = _CREATEINSTANCEREQUEST
-DESCRIPTOR.message_types_by_name["GetInstanceRequest"] = _GETINSTANCEREQUEST
-DESCRIPTOR.message_types_by_name["ListInstancesRequest"] = _LISTINSTANCESREQUEST
-DESCRIPTOR.message_types_by_name["ListInstancesResponse"] = _LISTINSTANCESRESPONSE
-DESCRIPTOR.message_types_by_name[
- "PartialUpdateInstanceRequest"
-] = _PARTIALUPDATEINSTANCEREQUEST
-DESCRIPTOR.message_types_by_name["DeleteInstanceRequest"] = _DELETEINSTANCEREQUEST
-DESCRIPTOR.message_types_by_name["CreateClusterRequest"] = _CREATECLUSTERREQUEST
-DESCRIPTOR.message_types_by_name["GetClusterRequest"] = _GETCLUSTERREQUEST
-DESCRIPTOR.message_types_by_name["ListClustersRequest"] = _LISTCLUSTERSREQUEST
-DESCRIPTOR.message_types_by_name["ListClustersResponse"] = _LISTCLUSTERSRESPONSE
-DESCRIPTOR.message_types_by_name["DeleteClusterRequest"] = _DELETECLUSTERREQUEST
-DESCRIPTOR.message_types_by_name["CreateInstanceMetadata"] = _CREATEINSTANCEMETADATA
-DESCRIPTOR.message_types_by_name["UpdateInstanceMetadata"] = _UPDATEINSTANCEMETADATA
-DESCRIPTOR.message_types_by_name["CreateClusterMetadata"] = _CREATECLUSTERMETADATA
-DESCRIPTOR.message_types_by_name["UpdateClusterMetadata"] = _UPDATECLUSTERMETADATA
-DESCRIPTOR.message_types_by_name["CreateAppProfileRequest"] = _CREATEAPPPROFILEREQUEST
-DESCRIPTOR.message_types_by_name["GetAppProfileRequest"] = _GETAPPPROFILEREQUEST
-DESCRIPTOR.message_types_by_name["ListAppProfilesRequest"] = _LISTAPPPROFILESREQUEST
-DESCRIPTOR.message_types_by_name["ListAppProfilesResponse"] = _LISTAPPPROFILESRESPONSE
-DESCRIPTOR.message_types_by_name["UpdateAppProfileRequest"] = _UPDATEAPPPROFILEREQUEST
-DESCRIPTOR.message_types_by_name["DeleteAppProfileRequest"] = _DELETEAPPPROFILEREQUEST
-DESCRIPTOR.message_types_by_name["UpdateAppProfileMetadata"] = _UPDATEAPPPROFILEMETADATA
-_sym_db.RegisterFileDescriptor(DESCRIPTOR)
-
-CreateInstanceRequest = _reflection.GeneratedProtocolMessageType(
- "CreateInstanceRequest",
- (_message.Message,),
- {
- "ClustersEntry": _reflection.GeneratedProtocolMessageType(
- "ClustersEntry",
- (_message.Message,),
- {
- "DESCRIPTOR": _CREATEINSTANCEREQUEST_CLUSTERSENTRY,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_instance_admin_pb2"
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.CreateInstanceRequest.ClustersEntry)
- },
- ),
- "DESCRIPTOR": _CREATEINSTANCEREQUEST,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_instance_admin_pb2",
- "__doc__": """Request message for BigtableInstanceAdmin.CreateInstance.
-
- Attributes:
- parent:
- Required. The unique name of the project in which to create
- the new instance. Values are of the form
- ``projects/{project}``.
- instance_id:
- Required. The ID to be used when referring to the new instance
- within its project, e.g., just ``myinstance`` rather than
- ``projects/myproject/instances/myinstance``.
- instance:
- Required. The instance to create. Fields marked ``OutputOnly``
- must be left blank.
- clusters:
- Required. The clusters to be created within the instance,
- mapped by desired cluster ID, e.g., just ``mycluster`` rather
- than ``projects/myproject/instances/myinstance/clusters/myclus
- ter``. Fields marked ``OutputOnly`` must be left blank.
- Currently, at most four clusters can be specified.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.CreateInstanceRequest)
- },
-)
-_sym_db.RegisterMessage(CreateInstanceRequest)
-_sym_db.RegisterMessage(CreateInstanceRequest.ClustersEntry)
-
-GetInstanceRequest = _reflection.GeneratedProtocolMessageType(
- "GetInstanceRequest",
- (_message.Message,),
- {
- "DESCRIPTOR": _GETINSTANCEREQUEST,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_instance_admin_pb2",
- "__doc__": """Request message for BigtableInstanceAdmin.GetInstance.
-
- Attributes:
- name:
- Required. The unique name of the requested instance. Values
- are of the form ``projects/{project}/instances/{instance}``.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.GetInstanceRequest)
- },
-)
-_sym_db.RegisterMessage(GetInstanceRequest)
-
-ListInstancesRequest = _reflection.GeneratedProtocolMessageType(
- "ListInstancesRequest",
- (_message.Message,),
- {
- "DESCRIPTOR": _LISTINSTANCESREQUEST,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_instance_admin_pb2",
- "__doc__": """Request message for BigtableInstanceAdmin.ListInstances.
-
- Attributes:
- parent:
- Required. The unique name of the project for which a list of
- instances is requested. Values are of the form
- ``projects/{project}``.
- page_token:
- DEPRECATED: This field is unused and ignored.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.ListInstancesRequest)
- },
-)
-_sym_db.RegisterMessage(ListInstancesRequest)
-
-ListInstancesResponse = _reflection.GeneratedProtocolMessageType(
- "ListInstancesResponse",
- (_message.Message,),
- {
- "DESCRIPTOR": _LISTINSTANCESRESPONSE,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_instance_admin_pb2",
- "__doc__": """Response message for BigtableInstanceAdmin.ListInstances.
-
- Attributes:
- instances:
- The list of requested instances.
- failed_locations:
- Locations from which Instance information could not be
- retrieved, due to an outage or some other transient condition.
- Instances whose Clusters are all in one of the failed
- locations may be missing from ``instances``, and Instances
- with at least one Cluster in a failed location may only have
- partial information returned. Values are of the form
- ``projects//locations/``
- next_page_token:
- DEPRECATED: This field is unused and ignored.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.ListInstancesResponse)
- },
-)
-_sym_db.RegisterMessage(ListInstancesResponse)
-
-PartialUpdateInstanceRequest = _reflection.GeneratedProtocolMessageType(
- "PartialUpdateInstanceRequest",
- (_message.Message,),
- {
- "DESCRIPTOR": _PARTIALUPDATEINSTANCEREQUEST,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_instance_admin_pb2",
- "__doc__": """Request message for BigtableInstanceAdmin.PartialUpdateInstance.
-
- Attributes:
- instance:
- Required. The Instance which will (partially) replace the
- current value.
- update_mask:
- Required. The subset of Instance fields which should be
- replaced. Must be explicitly set.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.PartialUpdateInstanceRequest)
- },
-)
-_sym_db.RegisterMessage(PartialUpdateInstanceRequest)
-
-DeleteInstanceRequest = _reflection.GeneratedProtocolMessageType(
- "DeleteInstanceRequest",
- (_message.Message,),
- {
- "DESCRIPTOR": _DELETEINSTANCEREQUEST,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_instance_admin_pb2",
- "__doc__": """Request message for BigtableInstanceAdmin.DeleteInstance.
-
- Attributes:
- name:
- Required. The unique name of the instance to be deleted.
- Values are of the form
- ``projects/{project}/instances/{instance}``.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.DeleteInstanceRequest)
- },
-)
-_sym_db.RegisterMessage(DeleteInstanceRequest)
-
-CreateClusterRequest = _reflection.GeneratedProtocolMessageType(
- "CreateClusterRequest",
- (_message.Message,),
- {
- "DESCRIPTOR": _CREATECLUSTERREQUEST,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_instance_admin_pb2",
- "__doc__": """Request message for BigtableInstanceAdmin.CreateCluster.
-
- Attributes:
- parent:
- Required. The unique name of the instance in which to create
- the new cluster. Values are of the form
- ``projects/{project}/instances/{instance}``.
- cluster_id:
- Required. The ID to be used when referring to the new cluster
- within its instance, e.g., just ``mycluster`` rather than ``pr
- ojects/myproject/instances/myinstance/clusters/mycluster``.
- cluster:
- Required. The cluster to be created. Fields marked
- ``OutputOnly`` must be left blank.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.CreateClusterRequest)
- },
-)
-_sym_db.RegisterMessage(CreateClusterRequest)
-
-GetClusterRequest = _reflection.GeneratedProtocolMessageType(
- "GetClusterRequest",
- (_message.Message,),
- {
- "DESCRIPTOR": _GETCLUSTERREQUEST,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_instance_admin_pb2",
- "__doc__": """Request message for BigtableInstanceAdmin.GetCluster.
-
- Attributes:
- name:
- Required. The unique name of the requested cluster. Values are
- of the form ``projects/{project}/instances/{instance}/clusters
- /{cluster}``.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.GetClusterRequest)
- },
-)
-_sym_db.RegisterMessage(GetClusterRequest)
-
-ListClustersRequest = _reflection.GeneratedProtocolMessageType(
- "ListClustersRequest",
- (_message.Message,),
- {
- "DESCRIPTOR": _LISTCLUSTERSREQUEST,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_instance_admin_pb2",
- "__doc__": """Request message for BigtableInstanceAdmin.ListClusters.
-
- Attributes:
- parent:
- Required. The unique name of the instance for which a list of
- clusters is requested. Values are of the form
- ``projects/{project}/instances/{instance}``. Use ``{instance}
- = '-'`` to list Clusters for all Instances in a project, e.g.,
- ``projects/myproject/instances/-``.
- page_token:
- DEPRECATED: This field is unused and ignored.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.ListClustersRequest)
- },
-)
-_sym_db.RegisterMessage(ListClustersRequest)
-
-ListClustersResponse = _reflection.GeneratedProtocolMessageType(
- "ListClustersResponse",
- (_message.Message,),
- {
- "DESCRIPTOR": _LISTCLUSTERSRESPONSE,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_instance_admin_pb2",
- "__doc__": """Response message for BigtableInstanceAdmin.ListClusters.
-
- Attributes:
- clusters:
- The list of requested clusters.
- failed_locations:
- Locations from which Cluster information could not be
- retrieved, due to an outage or some other transient condition.
- Clusters from these locations may be missing from
- ``clusters``, or may only have partial information returned.
- Values are of the form
- ``projects//locations/``
- next_page_token:
- DEPRECATED: This field is unused and ignored.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.ListClustersResponse)
- },
-)
-_sym_db.RegisterMessage(ListClustersResponse)
-
-DeleteClusterRequest = _reflection.GeneratedProtocolMessageType(
- "DeleteClusterRequest",
- (_message.Message,),
- {
- "DESCRIPTOR": _DELETECLUSTERREQUEST,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_instance_admin_pb2",
- "__doc__": """Request message for BigtableInstanceAdmin.DeleteCluster.
-
- Attributes:
- name:
- Required. The unique name of the cluster to be deleted. Values
- are of the form ``projects/{project}/instances/{instance}/clus
- ters/{cluster}``.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.DeleteClusterRequest)
- },
-)
-_sym_db.RegisterMessage(DeleteClusterRequest)
-
-CreateInstanceMetadata = _reflection.GeneratedProtocolMessageType(
- "CreateInstanceMetadata",
- (_message.Message,),
- {
- "DESCRIPTOR": _CREATEINSTANCEMETADATA,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_instance_admin_pb2",
- "__doc__": """The metadata for the Operation returned by CreateInstance.
-
- Attributes:
- original_request:
- The request that prompted the initiation of this
- CreateInstance operation.
- request_time:
- The time at which the original request was received.
- finish_time:
- The time at which the operation failed or was completed
- successfully.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.CreateInstanceMetadata)
- },
-)
-_sym_db.RegisterMessage(CreateInstanceMetadata)
-
-UpdateInstanceMetadata = _reflection.GeneratedProtocolMessageType(
- "UpdateInstanceMetadata",
- (_message.Message,),
- {
- "DESCRIPTOR": _UPDATEINSTANCEMETADATA,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_instance_admin_pb2",
- "__doc__": """The metadata for the Operation returned by UpdateInstance.
-
- Attributes:
- original_request:
- The request that prompted the initiation of this
- UpdateInstance operation.
- request_time:
- The time at which the original request was received.
- finish_time:
- The time at which the operation failed or was completed
- successfully.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.UpdateInstanceMetadata)
- },
-)
-_sym_db.RegisterMessage(UpdateInstanceMetadata)
-
-CreateClusterMetadata = _reflection.GeneratedProtocolMessageType(
- "CreateClusterMetadata",
- (_message.Message,),
- {
- "DESCRIPTOR": _CREATECLUSTERMETADATA,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_instance_admin_pb2",
- "__doc__": """The metadata for the Operation returned by CreateCluster.
-
- Attributes:
- original_request:
- The request that prompted the initiation of this CreateCluster
- operation.
- request_time:
- The time at which the original request was received.
- finish_time:
- The time at which the operation failed or was completed
- successfully.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.CreateClusterMetadata)
- },
-)
-_sym_db.RegisterMessage(CreateClusterMetadata)
-
-UpdateClusterMetadata = _reflection.GeneratedProtocolMessageType(
- "UpdateClusterMetadata",
- (_message.Message,),
- {
- "DESCRIPTOR": _UPDATECLUSTERMETADATA,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_instance_admin_pb2",
- "__doc__": """The metadata for the Operation returned by UpdateCluster.
-
- Attributes:
- original_request:
- The request that prompted the initiation of this UpdateCluster
- operation.
- request_time:
- The time at which the original request was received.
- finish_time:
- The time at which the operation failed or was completed
- successfully.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.UpdateClusterMetadata)
- },
-)
-_sym_db.RegisterMessage(UpdateClusterMetadata)
-
-CreateAppProfileRequest = _reflection.GeneratedProtocolMessageType(
- "CreateAppProfileRequest",
- (_message.Message,),
- {
- "DESCRIPTOR": _CREATEAPPPROFILEREQUEST,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_instance_admin_pb2",
- "__doc__": """Request message for BigtableInstanceAdmin.CreateAppProfile.
-
- Attributes:
- parent:
- Required. The unique name of the instance in which to create
- the new app profile. Values are of the form
- ``projects/{project}/instances/{instance}``.
- app_profile_id:
- Required. The ID to be used when referring to the new app
- profile within its instance, e.g., just ``myprofile`` rather
- than ``projects/myproject/instances/myinstance/appProfiles/myp
- rofile``.
- app_profile:
- Required. The app profile to be created. Fields marked
- ``OutputOnly`` will be ignored.
- ignore_warnings:
- If true, ignore safety checks when creating the app profile.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.CreateAppProfileRequest)
- },
-)
-_sym_db.RegisterMessage(CreateAppProfileRequest)
-
-GetAppProfileRequest = _reflection.GeneratedProtocolMessageType(
- "GetAppProfileRequest",
- (_message.Message,),
- {
- "DESCRIPTOR": _GETAPPPROFILEREQUEST,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_instance_admin_pb2",
- "__doc__": """Request message for BigtableInstanceAdmin.GetAppProfile.
-
- Attributes:
- name:
- Required. The unique name of the requested app profile. Values
- are of the form ``projects/{project}/instances/{instance}/appP
- rofiles/{app_profile}``.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.GetAppProfileRequest)
- },
-)
-_sym_db.RegisterMessage(GetAppProfileRequest)
-
-ListAppProfilesRequest = _reflection.GeneratedProtocolMessageType(
- "ListAppProfilesRequest",
- (_message.Message,),
- {
- "DESCRIPTOR": _LISTAPPPROFILESREQUEST,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_instance_admin_pb2",
- "__doc__": """Request message for BigtableInstanceAdmin.ListAppProfiles.
-
- Attributes:
- parent:
- Required. The unique name of the instance for which a list of
- app profiles is requested. Values are of the form
- ``projects/{project}/instances/{instance}``. Use ``{instance}
- = '-'`` to list AppProfiles for all Instances in a project,
- e.g., ``projects/myproject/instances/-``.
- page_size:
- Maximum number of results per page. A page_size of zero lets
- the server choose the number of items to return. A page_size
- which is strictly positive will return at most that many
- items. A negative page_size will cause an error. Following
- the first request, subsequent paginated calls are not required
- to pass a page_size. If a page_size is set in subsequent
- calls, it must match the page_size given in the first request.
- page_token:
- The value of ``next_page_token`` returned by a previous call.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.ListAppProfilesRequest)
- },
-)
-_sym_db.RegisterMessage(ListAppProfilesRequest)
-
-ListAppProfilesResponse = _reflection.GeneratedProtocolMessageType(
- "ListAppProfilesResponse",
- (_message.Message,),
- {
- "DESCRIPTOR": _LISTAPPPROFILESRESPONSE,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_instance_admin_pb2",
- "__doc__": """Response message for BigtableInstanceAdmin.ListAppProfiles.
-
- Attributes:
- app_profiles:
- The list of requested app profiles.
- next_page_token:
- Set if not all app profiles could be returned in a single
- response. Pass this value to ``page_token`` in another request
- to get the next page of results.
- failed_locations:
- Locations from which AppProfile information could not be
- retrieved, due to an outage or some other transient condition.
- AppProfiles from these locations may be missing from
- ``app_profiles``. Values are of the form
- ``projects//locations/``
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.ListAppProfilesResponse)
- },
-)
-_sym_db.RegisterMessage(ListAppProfilesResponse)
-
-UpdateAppProfileRequest = _reflection.GeneratedProtocolMessageType(
- "UpdateAppProfileRequest",
- (_message.Message,),
- {
- "DESCRIPTOR": _UPDATEAPPPROFILEREQUEST,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_instance_admin_pb2",
- "__doc__": """Request message for BigtableInstanceAdmin.UpdateAppProfile.
-
- Attributes:
- app_profile:
- Required. The app profile which will (partially) replace the
- current value.
- update_mask:
- Required. The subset of app profile fields which should be
- replaced. If unset, all fields will be replaced.
- ignore_warnings:
- If true, ignore safety checks when updating the app profile.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.UpdateAppProfileRequest)
- },
-)
-_sym_db.RegisterMessage(UpdateAppProfileRequest)
-
-DeleteAppProfileRequest = _reflection.GeneratedProtocolMessageType(
- "DeleteAppProfileRequest",
- (_message.Message,),
- {
- "DESCRIPTOR": _DELETEAPPPROFILEREQUEST,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_instance_admin_pb2",
- "__doc__": """Request message for BigtableInstanceAdmin.DeleteAppProfile.
-
- Attributes:
- name:
- Required. The unique name of the app profile to be deleted.
- Values are of the form ``projects/{project}/instances/{instanc
- e}/appProfiles/{app_profile}``.
- ignore_warnings:
- If true, ignore safety checks when deleting the app profile.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.DeleteAppProfileRequest)
- },
-)
-_sym_db.RegisterMessage(DeleteAppProfileRequest)
-
-UpdateAppProfileMetadata = _reflection.GeneratedProtocolMessageType(
- "UpdateAppProfileMetadata",
- (_message.Message,),
- {
- "DESCRIPTOR": _UPDATEAPPPROFILEMETADATA,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_instance_admin_pb2",
- "__doc__": """The metadata for the Operation returned by UpdateAppProfile.""",
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.UpdateAppProfileMetadata)
- },
-)
-_sym_db.RegisterMessage(UpdateAppProfileMetadata)
-
-
-DESCRIPTOR._options = None
-_CREATEINSTANCEREQUEST_CLUSTERSENTRY._options = None
-_CREATEINSTANCEREQUEST.fields_by_name["parent"]._options = None
-_CREATEINSTANCEREQUEST.fields_by_name["instance_id"]._options = None
-_CREATEINSTANCEREQUEST.fields_by_name["instance"]._options = None
-_CREATEINSTANCEREQUEST.fields_by_name["clusters"]._options = None
-_GETINSTANCEREQUEST.fields_by_name["name"]._options = None
-_LISTINSTANCESREQUEST.fields_by_name["parent"]._options = None
-_PARTIALUPDATEINSTANCEREQUEST.fields_by_name["instance"]._options = None
-_PARTIALUPDATEINSTANCEREQUEST.fields_by_name["update_mask"]._options = None
-_DELETEINSTANCEREQUEST.fields_by_name["name"]._options = None
-_CREATECLUSTERREQUEST.fields_by_name["parent"]._options = None
-_CREATECLUSTERREQUEST.fields_by_name["cluster_id"]._options = None
-_CREATECLUSTERREQUEST.fields_by_name["cluster"]._options = None
-_GETCLUSTERREQUEST.fields_by_name["name"]._options = None
-_LISTCLUSTERSREQUEST.fields_by_name["parent"]._options = None
-_DELETECLUSTERREQUEST.fields_by_name["name"]._options = None
-_CREATEAPPPROFILEREQUEST.fields_by_name["parent"]._options = None
-_CREATEAPPPROFILEREQUEST.fields_by_name["app_profile_id"]._options = None
-_CREATEAPPPROFILEREQUEST.fields_by_name["app_profile"]._options = None
-_GETAPPPROFILEREQUEST.fields_by_name["name"]._options = None
-_LISTAPPPROFILESREQUEST.fields_by_name["parent"]._options = None
-_UPDATEAPPPROFILEREQUEST.fields_by_name["app_profile"]._options = None
-_UPDATEAPPPROFILEREQUEST.fields_by_name["update_mask"]._options = None
-_DELETEAPPPROFILEREQUEST.fields_by_name["name"]._options = None
-
-_BIGTABLEINSTANCEADMIN = _descriptor.ServiceDescriptor(
- name="BigtableInstanceAdmin",
- full_name="google.bigtable.admin.v2.BigtableInstanceAdmin",
- file=DESCRIPTOR,
- index=0,
- serialized_options=b"\312A\034bigtableadmin.googleapis.com\322A\367\002https://www.googleapis.com/auth/bigtable.admin,https://www.googleapis.com/auth/bigtable.admin.cluster,https://www.googleapis.com/auth/bigtable.admin.instance,https://www.googleapis.com/auth/cloud-bigtable.admin,https://www.googleapis.com/auth/cloud-bigtable.admin.cluster,https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/cloud-platform.read-only",
- create_key=_descriptor._internal_create_key,
- serialized_start=3558,
- serialized_end=7416,
- methods=[
- _descriptor.MethodDescriptor(
- name="CreateInstance",
- full_name="google.bigtable.admin.v2.BigtableInstanceAdmin.CreateInstance",
- index=0,
- containing_service=None,
- input_type=_CREATEINSTANCEREQUEST,
- output_type=google_dot_longrunning_dot_operations__pb2._OPERATION,
- serialized_options=b'\202\323\344\223\002&"!/v2/{parent=projects/*}/instances:\001*\332A$parent,instance_id,instance,clusters\312A"\n\010Instance\022\026CreateInstanceMetadata',
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.MethodDescriptor(
- name="GetInstance",
- full_name="google.bigtable.admin.v2.BigtableInstanceAdmin.GetInstance",
- index=1,
- containing_service=None,
- input_type=_GETINSTANCEREQUEST,
- output_type=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_instance__pb2._INSTANCE,
- serialized_options=b"\202\323\344\223\002#\022!/v2/{name=projects/*/instances/*}\332A\004name",
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.MethodDescriptor(
- name="ListInstances",
- full_name="google.bigtable.admin.v2.BigtableInstanceAdmin.ListInstances",
- index=2,
- containing_service=None,
- input_type=_LISTINSTANCESREQUEST,
- output_type=_LISTINSTANCESRESPONSE,
- serialized_options=b"\202\323\344\223\002#\022!/v2/{parent=projects/*}/instances\332A\006parent",
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.MethodDescriptor(
- name="UpdateInstance",
- full_name="google.bigtable.admin.v2.BigtableInstanceAdmin.UpdateInstance",
- index=3,
- containing_service=None,
- input_type=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_instance__pb2._INSTANCE,
- output_type=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_instance__pb2._INSTANCE,
- serialized_options=b"\202\323\344\223\002&\032!/v2/{name=projects/*/instances/*}:\001*",
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.MethodDescriptor(
- name="PartialUpdateInstance",
- full_name="google.bigtable.admin.v2.BigtableInstanceAdmin.PartialUpdateInstance",
- index=4,
- containing_service=None,
- input_type=_PARTIALUPDATEINSTANCEREQUEST,
- output_type=google_dot_longrunning_dot_operations__pb2._OPERATION,
- serialized_options=b'\202\323\344\223\00262*/v2/{instance.name=projects/*/instances/*}:\010instance\332A\024instance,update_mask\312A"\n\010Instance\022\026UpdateInstanceMetadata',
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.MethodDescriptor(
- name="DeleteInstance",
- full_name="google.bigtable.admin.v2.BigtableInstanceAdmin.DeleteInstance",
- index=5,
- containing_service=None,
- input_type=_DELETEINSTANCEREQUEST,
- output_type=google_dot_protobuf_dot_empty__pb2._EMPTY,
- serialized_options=b"\202\323\344\223\002#*!/v2/{name=projects/*/instances/*}\332A\004name",
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.MethodDescriptor(
- name="CreateCluster",
- full_name="google.bigtable.admin.v2.BigtableInstanceAdmin.CreateCluster",
- index=6,
- containing_service=None,
- input_type=_CREATECLUSTERREQUEST,
- output_type=google_dot_longrunning_dot_operations__pb2._OPERATION,
- serialized_options=b'\202\323\344\223\0027",/v2/{parent=projects/*/instances/*}/clusters:\007cluster\332A\031parent,cluster_id,cluster\312A \n\007Cluster\022\025CreateClusterMetadata',
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.MethodDescriptor(
- name="GetCluster",
- full_name="google.bigtable.admin.v2.BigtableInstanceAdmin.GetCluster",
- index=7,
- containing_service=None,
- input_type=_GETCLUSTERREQUEST,
- output_type=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_instance__pb2._CLUSTER,
- serialized_options=b"\202\323\344\223\002.\022,/v2/{name=projects/*/instances/*/clusters/*}\332A\004name",
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.MethodDescriptor(
- name="ListClusters",
- full_name="google.bigtable.admin.v2.BigtableInstanceAdmin.ListClusters",
- index=8,
- containing_service=None,
- input_type=_LISTCLUSTERSREQUEST,
- output_type=_LISTCLUSTERSRESPONSE,
- serialized_options=b"\202\323\344\223\002.\022,/v2/{parent=projects/*/instances/*}/clusters\332A\006parent",
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.MethodDescriptor(
- name="UpdateCluster",
- full_name="google.bigtable.admin.v2.BigtableInstanceAdmin.UpdateCluster",
- index=9,
- containing_service=None,
- input_type=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_instance__pb2._CLUSTER,
- output_type=google_dot_longrunning_dot_operations__pb2._OPERATION,
- serialized_options=b"\202\323\344\223\0021\032,/v2/{name=projects/*/instances/*/clusters/*}:\001*\312A \n\007Cluster\022\025UpdateClusterMetadata",
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.MethodDescriptor(
- name="DeleteCluster",
- full_name="google.bigtable.admin.v2.BigtableInstanceAdmin.DeleteCluster",
- index=10,
- containing_service=None,
- input_type=_DELETECLUSTERREQUEST,
- output_type=google_dot_protobuf_dot_empty__pb2._EMPTY,
- serialized_options=b"\202\323\344\223\002.*,/v2/{name=projects/*/instances/*/clusters/*}\332A\004name",
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.MethodDescriptor(
- name="CreateAppProfile",
- full_name="google.bigtable.admin.v2.BigtableInstanceAdmin.CreateAppProfile",
- index=11,
- containing_service=None,
- input_type=_CREATEAPPPROFILEREQUEST,
- output_type=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_instance__pb2._APPPROFILE,
- serialized_options=b'\202\323\344\223\002>"//v2/{parent=projects/*/instances/*}/appProfiles:\013app_profile\332A!parent,app_profile_id,app_profile',
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.MethodDescriptor(
- name="GetAppProfile",
- full_name="google.bigtable.admin.v2.BigtableInstanceAdmin.GetAppProfile",
- index=12,
- containing_service=None,
- input_type=_GETAPPPROFILEREQUEST,
- output_type=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_instance__pb2._APPPROFILE,
- serialized_options=b"\202\323\344\223\0021\022//v2/{name=projects/*/instances/*/appProfiles/*}\332A\004name",
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.MethodDescriptor(
- name="ListAppProfiles",
- full_name="google.bigtable.admin.v2.BigtableInstanceAdmin.ListAppProfiles",
- index=13,
- containing_service=None,
- input_type=_LISTAPPPROFILESREQUEST,
- output_type=_LISTAPPPROFILESRESPONSE,
- serialized_options=b"\202\323\344\223\0021\022//v2/{parent=projects/*/instances/*}/appProfiles\332A\006parent",
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.MethodDescriptor(
- name="UpdateAppProfile",
- full_name="google.bigtable.admin.v2.BigtableInstanceAdmin.UpdateAppProfile",
- index=14,
- containing_service=None,
- input_type=_UPDATEAPPPROFILEREQUEST,
- output_type=google_dot_longrunning_dot_operations__pb2._OPERATION,
- serialized_options=b"\202\323\344\223\002J2;/v2/{app_profile.name=projects/*/instances/*/appProfiles/*}:\013app_profile\332A\027app_profile,update_mask\312A&\n\nAppProfile\022\030UpdateAppProfileMetadata",
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.MethodDescriptor(
- name="DeleteAppProfile",
- full_name="google.bigtable.admin.v2.BigtableInstanceAdmin.DeleteAppProfile",
- index=15,
- containing_service=None,
- input_type=_DELETEAPPPROFILEREQUEST,
- output_type=google_dot_protobuf_dot_empty__pb2._EMPTY,
- serialized_options=b"\202\323\344\223\0021*//v2/{name=projects/*/instances/*/appProfiles/*}\332A\004name",
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.MethodDescriptor(
- name="GetIamPolicy",
- full_name="google.bigtable.admin.v2.BigtableInstanceAdmin.GetIamPolicy",
- index=16,
- containing_service=None,
- input_type=google_dot_iam_dot_v1_dot_iam__policy__pb2._GETIAMPOLICYREQUEST,
- output_type=google_dot_iam_dot_v1_dot_policy__pb2._POLICY,
- serialized_options=b'\202\323\344\223\0027"2/v2/{resource=projects/*/instances/*}:getIamPolicy:\001*\332A\010resource',
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.MethodDescriptor(
- name="SetIamPolicy",
- full_name="google.bigtable.admin.v2.BigtableInstanceAdmin.SetIamPolicy",
- index=17,
- containing_service=None,
- input_type=google_dot_iam_dot_v1_dot_iam__policy__pb2._SETIAMPOLICYREQUEST,
- output_type=google_dot_iam_dot_v1_dot_policy__pb2._POLICY,
- serialized_options=b'\202\323\344\223\0027"2/v2/{resource=projects/*/instances/*}:setIamPolicy:\001*\332A\017resource,policy',
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.MethodDescriptor(
- name="TestIamPermissions",
- full_name="google.bigtable.admin.v2.BigtableInstanceAdmin.TestIamPermissions",
- index=18,
- containing_service=None,
- input_type=google_dot_iam_dot_v1_dot_iam__policy__pb2._TESTIAMPERMISSIONSREQUEST,
- output_type=google_dot_iam_dot_v1_dot_iam__policy__pb2._TESTIAMPERMISSIONSRESPONSE,
- serialized_options=b'\202\323\344\223\002="8/v2/{resource=projects/*/instances/*}:testIamPermissions:\001*\332A\024resource,permissions',
- create_key=_descriptor._internal_create_key,
- ),
- ],
-)
-_sym_db.RegisterServiceDescriptor(_BIGTABLEINSTANCEADMIN)
-
-DESCRIPTOR.services_by_name["BigtableInstanceAdmin"] = _BIGTABLEINSTANCEADMIN
-
-# @@protoc_insertion_point(module_scope)
diff --git a/google/cloud/bigtable_admin_v2/proto/bigtable_instance_admin_pb2_grpc.py b/google/cloud/bigtable_admin_v2/proto/bigtable_instance_admin_pb2_grpc.py
deleted file mode 100644
index 8b1395579..000000000
--- a/google/cloud/bigtable_admin_v2/proto/bigtable_instance_admin_pb2_grpc.py
+++ /dev/null
@@ -1,895 +0,0 @@
-# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
-"""Client and server classes corresponding to protobuf-defined services."""
-import grpc
-
-from google.cloud.bigtable_admin_v2.proto import (
- bigtable_instance_admin_pb2 as google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2,
-)
-from google.cloud.bigtable_admin_v2.proto import (
- instance_pb2 as google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_instance__pb2,
-)
-from google.iam.v1 import iam_policy_pb2 as google_dot_iam_dot_v1_dot_iam__policy__pb2
-from google.iam.v1 import policy_pb2 as google_dot_iam_dot_v1_dot_policy__pb2
-from google.longrunning import (
- operations_pb2 as google_dot_longrunning_dot_operations__pb2,
-)
-from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2
-
-
-class BigtableInstanceAdminStub(object):
- """Service for creating, configuring, and deleting Cloud Bigtable Instances and
- Clusters. Provides access to the Instance and Cluster schemas only, not the
- tables' metadata or data stored in those tables.
- """
-
- def __init__(self, channel):
- """Constructor.
-
- Args:
- channel: A grpc.Channel.
- """
- self.CreateInstance = channel.unary_unary(
- "/google.bigtable.admin.v2.BigtableInstanceAdmin/CreateInstance",
- request_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.CreateInstanceRequest.SerializeToString,
- response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString,
- )
- self.GetInstance = channel.unary_unary(
- "/google.bigtable.admin.v2.BigtableInstanceAdmin/GetInstance",
- request_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.GetInstanceRequest.SerializeToString,
- response_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_instance__pb2.Instance.FromString,
- )
- self.ListInstances = channel.unary_unary(
- "/google.bigtable.admin.v2.BigtableInstanceAdmin/ListInstances",
- request_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.ListInstancesRequest.SerializeToString,
- response_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.ListInstancesResponse.FromString,
- )
- self.UpdateInstance = channel.unary_unary(
- "/google.bigtable.admin.v2.BigtableInstanceAdmin/UpdateInstance",
- request_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_instance__pb2.Instance.SerializeToString,
- response_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_instance__pb2.Instance.FromString,
- )
- self.PartialUpdateInstance = channel.unary_unary(
- "/google.bigtable.admin.v2.BigtableInstanceAdmin/PartialUpdateInstance",
- request_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.PartialUpdateInstanceRequest.SerializeToString,
- response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString,
- )
- self.DeleteInstance = channel.unary_unary(
- "/google.bigtable.admin.v2.BigtableInstanceAdmin/DeleteInstance",
- request_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.DeleteInstanceRequest.SerializeToString,
- response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
- )
- self.CreateCluster = channel.unary_unary(
- "/google.bigtable.admin.v2.BigtableInstanceAdmin/CreateCluster",
- request_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.CreateClusterRequest.SerializeToString,
- response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString,
- )
- self.GetCluster = channel.unary_unary(
- "/google.bigtable.admin.v2.BigtableInstanceAdmin/GetCluster",
- request_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.GetClusterRequest.SerializeToString,
- response_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_instance__pb2.Cluster.FromString,
- )
- self.ListClusters = channel.unary_unary(
- "/google.bigtable.admin.v2.BigtableInstanceAdmin/ListClusters",
- request_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.ListClustersRequest.SerializeToString,
- response_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.ListClustersResponse.FromString,
- )
- self.UpdateCluster = channel.unary_unary(
- "/google.bigtable.admin.v2.BigtableInstanceAdmin/UpdateCluster",
- request_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_instance__pb2.Cluster.SerializeToString,
- response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString,
- )
- self.DeleteCluster = channel.unary_unary(
- "/google.bigtable.admin.v2.BigtableInstanceAdmin/DeleteCluster",
- request_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.DeleteClusterRequest.SerializeToString,
- response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
- )
- self.CreateAppProfile = channel.unary_unary(
- "/google.bigtable.admin.v2.BigtableInstanceAdmin/CreateAppProfile",
- request_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.CreateAppProfileRequest.SerializeToString,
- response_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_instance__pb2.AppProfile.FromString,
- )
- self.GetAppProfile = channel.unary_unary(
- "/google.bigtable.admin.v2.BigtableInstanceAdmin/GetAppProfile",
- request_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.GetAppProfileRequest.SerializeToString,
- response_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_instance__pb2.AppProfile.FromString,
- )
- self.ListAppProfiles = channel.unary_unary(
- "/google.bigtable.admin.v2.BigtableInstanceAdmin/ListAppProfiles",
- request_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.ListAppProfilesRequest.SerializeToString,
- response_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.ListAppProfilesResponse.FromString,
- )
- self.UpdateAppProfile = channel.unary_unary(
- "/google.bigtable.admin.v2.BigtableInstanceAdmin/UpdateAppProfile",
- request_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.UpdateAppProfileRequest.SerializeToString,
- response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString,
- )
- self.DeleteAppProfile = channel.unary_unary(
- "/google.bigtable.admin.v2.BigtableInstanceAdmin/DeleteAppProfile",
- request_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.DeleteAppProfileRequest.SerializeToString,
- response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
- )
- self.GetIamPolicy = channel.unary_unary(
- "/google.bigtable.admin.v2.BigtableInstanceAdmin/GetIamPolicy",
- request_serializer=google_dot_iam_dot_v1_dot_iam__policy__pb2.GetIamPolicyRequest.SerializeToString,
- response_deserializer=google_dot_iam_dot_v1_dot_policy__pb2.Policy.FromString,
- )
- self.SetIamPolicy = channel.unary_unary(
- "/google.bigtable.admin.v2.BigtableInstanceAdmin/SetIamPolicy",
- request_serializer=google_dot_iam_dot_v1_dot_iam__policy__pb2.SetIamPolicyRequest.SerializeToString,
- response_deserializer=google_dot_iam_dot_v1_dot_policy__pb2.Policy.FromString,
- )
- self.TestIamPermissions = channel.unary_unary(
- "/google.bigtable.admin.v2.BigtableInstanceAdmin/TestIamPermissions",
- request_serializer=google_dot_iam_dot_v1_dot_iam__policy__pb2.TestIamPermissionsRequest.SerializeToString,
- response_deserializer=google_dot_iam_dot_v1_dot_iam__policy__pb2.TestIamPermissionsResponse.FromString,
- )
-
-
-class BigtableInstanceAdminServicer(object):
- """Service for creating, configuring, and deleting Cloud Bigtable Instances and
- Clusters. Provides access to the Instance and Cluster schemas only, not the
- tables' metadata or data stored in those tables.
- """
-
- def CreateInstance(self, request, context):
- """Create an instance within a project.
- """
- context.set_code(grpc.StatusCode.UNIMPLEMENTED)
- context.set_details("Method not implemented!")
- raise NotImplementedError("Method not implemented!")
-
- def GetInstance(self, request, context):
- """Gets information about an instance.
- """
- context.set_code(grpc.StatusCode.UNIMPLEMENTED)
- context.set_details("Method not implemented!")
- raise NotImplementedError("Method not implemented!")
-
- def ListInstances(self, request, context):
- """Lists information about instances in a project.
- """
- context.set_code(grpc.StatusCode.UNIMPLEMENTED)
- context.set_details("Method not implemented!")
- raise NotImplementedError("Method not implemented!")
-
- def UpdateInstance(self, request, context):
- """Updates an instance within a project. This method updates only the display
- name and type for an Instance. To update other Instance properties, such as
- labels, use PartialUpdateInstance.
- """
- context.set_code(grpc.StatusCode.UNIMPLEMENTED)
- context.set_details("Method not implemented!")
- raise NotImplementedError("Method not implemented!")
-
- def PartialUpdateInstance(self, request, context):
- """Partially updates an instance within a project. This method can modify all
- fields of an Instance and is the preferred way to update an Instance.
- """
- context.set_code(grpc.StatusCode.UNIMPLEMENTED)
- context.set_details("Method not implemented!")
- raise NotImplementedError("Method not implemented!")
-
- def DeleteInstance(self, request, context):
- """Delete an instance from a project.
- """
- context.set_code(grpc.StatusCode.UNIMPLEMENTED)
- context.set_details("Method not implemented!")
- raise NotImplementedError("Method not implemented!")
-
- def CreateCluster(self, request, context):
- """Creates a cluster within an instance.
- """
- context.set_code(grpc.StatusCode.UNIMPLEMENTED)
- context.set_details("Method not implemented!")
- raise NotImplementedError("Method not implemented!")
-
- def GetCluster(self, request, context):
- """Gets information about a cluster.
- """
- context.set_code(grpc.StatusCode.UNIMPLEMENTED)
- context.set_details("Method not implemented!")
- raise NotImplementedError("Method not implemented!")
-
- def ListClusters(self, request, context):
- """Lists information about clusters in an instance.
- """
- context.set_code(grpc.StatusCode.UNIMPLEMENTED)
- context.set_details("Method not implemented!")
- raise NotImplementedError("Method not implemented!")
-
- def UpdateCluster(self, request, context):
- """Updates a cluster within an instance.
- """
- context.set_code(grpc.StatusCode.UNIMPLEMENTED)
- context.set_details("Method not implemented!")
- raise NotImplementedError("Method not implemented!")
-
- def DeleteCluster(self, request, context):
- """Deletes a cluster from an instance.
- """
- context.set_code(grpc.StatusCode.UNIMPLEMENTED)
- context.set_details("Method not implemented!")
- raise NotImplementedError("Method not implemented!")
-
- def CreateAppProfile(self, request, context):
- """Creates an app profile within an instance.
- """
- context.set_code(grpc.StatusCode.UNIMPLEMENTED)
- context.set_details("Method not implemented!")
- raise NotImplementedError("Method not implemented!")
-
- def GetAppProfile(self, request, context):
- """Gets information about an app profile.
- """
- context.set_code(grpc.StatusCode.UNIMPLEMENTED)
- context.set_details("Method not implemented!")
- raise NotImplementedError("Method not implemented!")
-
- def ListAppProfiles(self, request, context):
- """Lists information about app profiles in an instance.
- """
- context.set_code(grpc.StatusCode.UNIMPLEMENTED)
- context.set_details("Method not implemented!")
- raise NotImplementedError("Method not implemented!")
-
- def UpdateAppProfile(self, request, context):
- """Updates an app profile within an instance.
- """
- context.set_code(grpc.StatusCode.UNIMPLEMENTED)
- context.set_details("Method not implemented!")
- raise NotImplementedError("Method not implemented!")
-
- def DeleteAppProfile(self, request, context):
- """Deletes an app profile from an instance.
- """
- context.set_code(grpc.StatusCode.UNIMPLEMENTED)
- context.set_details("Method not implemented!")
- raise NotImplementedError("Method not implemented!")
-
- def GetIamPolicy(self, request, context):
- """Gets the access control policy for an instance resource. Returns an empty
- policy if an instance exists but does not have a policy set.
- """
- context.set_code(grpc.StatusCode.UNIMPLEMENTED)
- context.set_details("Method not implemented!")
- raise NotImplementedError("Method not implemented!")
-
- def SetIamPolicy(self, request, context):
- """Sets the access control policy on an instance resource. Replaces any
- existing policy.
- """
- context.set_code(grpc.StatusCode.UNIMPLEMENTED)
- context.set_details("Method not implemented!")
- raise NotImplementedError("Method not implemented!")
-
- def TestIamPermissions(self, request, context):
- """Returns permissions that the caller has on the specified instance resource.
- """
- context.set_code(grpc.StatusCode.UNIMPLEMENTED)
- context.set_details("Method not implemented!")
- raise NotImplementedError("Method not implemented!")
-
-
-def add_BigtableInstanceAdminServicer_to_server(servicer, server):
- rpc_method_handlers = {
- "CreateInstance": grpc.unary_unary_rpc_method_handler(
- servicer.CreateInstance,
- request_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.CreateInstanceRequest.FromString,
- response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString,
- ),
- "GetInstance": grpc.unary_unary_rpc_method_handler(
- servicer.GetInstance,
- request_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.GetInstanceRequest.FromString,
- response_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_instance__pb2.Instance.SerializeToString,
- ),
- "ListInstances": grpc.unary_unary_rpc_method_handler(
- servicer.ListInstances,
- request_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.ListInstancesRequest.FromString,
- response_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.ListInstancesResponse.SerializeToString,
- ),
- "UpdateInstance": grpc.unary_unary_rpc_method_handler(
- servicer.UpdateInstance,
- request_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_instance__pb2.Instance.FromString,
- response_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_instance__pb2.Instance.SerializeToString,
- ),
- "PartialUpdateInstance": grpc.unary_unary_rpc_method_handler(
- servicer.PartialUpdateInstance,
- request_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.PartialUpdateInstanceRequest.FromString,
- response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString,
- ),
- "DeleteInstance": grpc.unary_unary_rpc_method_handler(
- servicer.DeleteInstance,
- request_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.DeleteInstanceRequest.FromString,
- response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
- ),
- "CreateCluster": grpc.unary_unary_rpc_method_handler(
- servicer.CreateCluster,
- request_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.CreateClusterRequest.FromString,
- response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString,
- ),
- "GetCluster": grpc.unary_unary_rpc_method_handler(
- servicer.GetCluster,
- request_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.GetClusterRequest.FromString,
- response_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_instance__pb2.Cluster.SerializeToString,
- ),
- "ListClusters": grpc.unary_unary_rpc_method_handler(
- servicer.ListClusters,
- request_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.ListClustersRequest.FromString,
- response_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.ListClustersResponse.SerializeToString,
- ),
- "UpdateCluster": grpc.unary_unary_rpc_method_handler(
- servicer.UpdateCluster,
- request_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_instance__pb2.Cluster.FromString,
- response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString,
- ),
- "DeleteCluster": grpc.unary_unary_rpc_method_handler(
- servicer.DeleteCluster,
- request_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.DeleteClusterRequest.FromString,
- response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
- ),
- "CreateAppProfile": grpc.unary_unary_rpc_method_handler(
- servicer.CreateAppProfile,
- request_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.CreateAppProfileRequest.FromString,
- response_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_instance__pb2.AppProfile.SerializeToString,
- ),
- "GetAppProfile": grpc.unary_unary_rpc_method_handler(
- servicer.GetAppProfile,
- request_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.GetAppProfileRequest.FromString,
- response_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_instance__pb2.AppProfile.SerializeToString,
- ),
- "ListAppProfiles": grpc.unary_unary_rpc_method_handler(
- servicer.ListAppProfiles,
- request_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.ListAppProfilesRequest.FromString,
- response_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.ListAppProfilesResponse.SerializeToString,
- ),
- "UpdateAppProfile": grpc.unary_unary_rpc_method_handler(
- servicer.UpdateAppProfile,
- request_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.UpdateAppProfileRequest.FromString,
- response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString,
- ),
- "DeleteAppProfile": grpc.unary_unary_rpc_method_handler(
- servicer.DeleteAppProfile,
- request_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.DeleteAppProfileRequest.FromString,
- response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
- ),
- "GetIamPolicy": grpc.unary_unary_rpc_method_handler(
- servicer.GetIamPolicy,
- request_deserializer=google_dot_iam_dot_v1_dot_iam__policy__pb2.GetIamPolicyRequest.FromString,
- response_serializer=google_dot_iam_dot_v1_dot_policy__pb2.Policy.SerializeToString,
- ),
- "SetIamPolicy": grpc.unary_unary_rpc_method_handler(
- servicer.SetIamPolicy,
- request_deserializer=google_dot_iam_dot_v1_dot_iam__policy__pb2.SetIamPolicyRequest.FromString,
- response_serializer=google_dot_iam_dot_v1_dot_policy__pb2.Policy.SerializeToString,
- ),
- "TestIamPermissions": grpc.unary_unary_rpc_method_handler(
- servicer.TestIamPermissions,
- request_deserializer=google_dot_iam_dot_v1_dot_iam__policy__pb2.TestIamPermissionsRequest.FromString,
- response_serializer=google_dot_iam_dot_v1_dot_iam__policy__pb2.TestIamPermissionsResponse.SerializeToString,
- ),
- }
- generic_handler = grpc.method_handlers_generic_handler(
- "google.bigtable.admin.v2.BigtableInstanceAdmin", rpc_method_handlers
- )
- server.add_generic_rpc_handlers((generic_handler,))
-
-
-# This class is part of an EXPERIMENTAL API.
-class BigtableInstanceAdmin(object):
- """Service for creating, configuring, and deleting Cloud Bigtable Instances and
- Clusters. Provides access to the Instance and Cluster schemas only, not the
- tables' metadata or data stored in those tables.
- """
-
- @staticmethod
- def CreateInstance(
- request,
- target,
- options=(),
- channel_credentials=None,
- call_credentials=None,
- compression=None,
- wait_for_ready=None,
- timeout=None,
- metadata=None,
- ):
- return grpc.experimental.unary_unary(
- request,
- target,
- "/google.bigtable.admin.v2.BigtableInstanceAdmin/CreateInstance",
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.CreateInstanceRequest.SerializeToString,
- google_dot_longrunning_dot_operations__pb2.Operation.FromString,
- options,
- channel_credentials,
- call_credentials,
- compression,
- wait_for_ready,
- timeout,
- metadata,
- )
-
- @staticmethod
- def GetInstance(
- request,
- target,
- options=(),
- channel_credentials=None,
- call_credentials=None,
- compression=None,
- wait_for_ready=None,
- timeout=None,
- metadata=None,
- ):
- return grpc.experimental.unary_unary(
- request,
- target,
- "/google.bigtable.admin.v2.BigtableInstanceAdmin/GetInstance",
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.GetInstanceRequest.SerializeToString,
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_instance__pb2.Instance.FromString,
- options,
- channel_credentials,
- call_credentials,
- compression,
- wait_for_ready,
- timeout,
- metadata,
- )
-
- @staticmethod
- def ListInstances(
- request,
- target,
- options=(),
- channel_credentials=None,
- call_credentials=None,
- compression=None,
- wait_for_ready=None,
- timeout=None,
- metadata=None,
- ):
- return grpc.experimental.unary_unary(
- request,
- target,
- "/google.bigtable.admin.v2.BigtableInstanceAdmin/ListInstances",
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.ListInstancesRequest.SerializeToString,
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.ListInstancesResponse.FromString,
- options,
- channel_credentials,
- call_credentials,
- compression,
- wait_for_ready,
- timeout,
- metadata,
- )
-
- @staticmethod
- def UpdateInstance(
- request,
- target,
- options=(),
- channel_credentials=None,
- call_credentials=None,
- compression=None,
- wait_for_ready=None,
- timeout=None,
- metadata=None,
- ):
- return grpc.experimental.unary_unary(
- request,
- target,
- "/google.bigtable.admin.v2.BigtableInstanceAdmin/UpdateInstance",
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_instance__pb2.Instance.SerializeToString,
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_instance__pb2.Instance.FromString,
- options,
- channel_credentials,
- call_credentials,
- compression,
- wait_for_ready,
- timeout,
- metadata,
- )
-
- @staticmethod
- def PartialUpdateInstance(
- request,
- target,
- options=(),
- channel_credentials=None,
- call_credentials=None,
- compression=None,
- wait_for_ready=None,
- timeout=None,
- metadata=None,
- ):
- return grpc.experimental.unary_unary(
- request,
- target,
- "/google.bigtable.admin.v2.BigtableInstanceAdmin/PartialUpdateInstance",
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.PartialUpdateInstanceRequest.SerializeToString,
- google_dot_longrunning_dot_operations__pb2.Operation.FromString,
- options,
- channel_credentials,
- call_credentials,
- compression,
- wait_for_ready,
- timeout,
- metadata,
- )
-
- @staticmethod
- def DeleteInstance(
- request,
- target,
- options=(),
- channel_credentials=None,
- call_credentials=None,
- compression=None,
- wait_for_ready=None,
- timeout=None,
- metadata=None,
- ):
- return grpc.experimental.unary_unary(
- request,
- target,
- "/google.bigtable.admin.v2.BigtableInstanceAdmin/DeleteInstance",
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.DeleteInstanceRequest.SerializeToString,
- google_dot_protobuf_dot_empty__pb2.Empty.FromString,
- options,
- channel_credentials,
- call_credentials,
- compression,
- wait_for_ready,
- timeout,
- metadata,
- )
-
- @staticmethod
- def CreateCluster(
- request,
- target,
- options=(),
- channel_credentials=None,
- call_credentials=None,
- compression=None,
- wait_for_ready=None,
- timeout=None,
- metadata=None,
- ):
- return grpc.experimental.unary_unary(
- request,
- target,
- "/google.bigtable.admin.v2.BigtableInstanceAdmin/CreateCluster",
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.CreateClusterRequest.SerializeToString,
- google_dot_longrunning_dot_operations__pb2.Operation.FromString,
- options,
- channel_credentials,
- call_credentials,
- compression,
- wait_for_ready,
- timeout,
- metadata,
- )
-
- @staticmethod
- def GetCluster(
- request,
- target,
- options=(),
- channel_credentials=None,
- call_credentials=None,
- compression=None,
- wait_for_ready=None,
- timeout=None,
- metadata=None,
- ):
- return grpc.experimental.unary_unary(
- request,
- target,
- "/google.bigtable.admin.v2.BigtableInstanceAdmin/GetCluster",
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.GetClusterRequest.SerializeToString,
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_instance__pb2.Cluster.FromString,
- options,
- channel_credentials,
- call_credentials,
- compression,
- wait_for_ready,
- timeout,
- metadata,
- )
-
- @staticmethod
- def ListClusters(
- request,
- target,
- options=(),
- channel_credentials=None,
- call_credentials=None,
- compression=None,
- wait_for_ready=None,
- timeout=None,
- metadata=None,
- ):
- return grpc.experimental.unary_unary(
- request,
- target,
- "/google.bigtable.admin.v2.BigtableInstanceAdmin/ListClusters",
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.ListClustersRequest.SerializeToString,
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.ListClustersResponse.FromString,
- options,
- channel_credentials,
- call_credentials,
- compression,
- wait_for_ready,
- timeout,
- metadata,
- )
-
- @staticmethod
- def UpdateCluster(
- request,
- target,
- options=(),
- channel_credentials=None,
- call_credentials=None,
- compression=None,
- wait_for_ready=None,
- timeout=None,
- metadata=None,
- ):
- return grpc.experimental.unary_unary(
- request,
- target,
- "/google.bigtable.admin.v2.BigtableInstanceAdmin/UpdateCluster",
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_instance__pb2.Cluster.SerializeToString,
- google_dot_longrunning_dot_operations__pb2.Operation.FromString,
- options,
- channel_credentials,
- call_credentials,
- compression,
- wait_for_ready,
- timeout,
- metadata,
- )
-
- @staticmethod
- def DeleteCluster(
- request,
- target,
- options=(),
- channel_credentials=None,
- call_credentials=None,
- compression=None,
- wait_for_ready=None,
- timeout=None,
- metadata=None,
- ):
- return grpc.experimental.unary_unary(
- request,
- target,
- "/google.bigtable.admin.v2.BigtableInstanceAdmin/DeleteCluster",
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.DeleteClusterRequest.SerializeToString,
- google_dot_protobuf_dot_empty__pb2.Empty.FromString,
- options,
- channel_credentials,
- call_credentials,
- compression,
- wait_for_ready,
- timeout,
- metadata,
- )
-
- @staticmethod
- def CreateAppProfile(
- request,
- target,
- options=(),
- channel_credentials=None,
- call_credentials=None,
- compression=None,
- wait_for_ready=None,
- timeout=None,
- metadata=None,
- ):
- return grpc.experimental.unary_unary(
- request,
- target,
- "/google.bigtable.admin.v2.BigtableInstanceAdmin/CreateAppProfile",
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.CreateAppProfileRequest.SerializeToString,
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_instance__pb2.AppProfile.FromString,
- options,
- channel_credentials,
- call_credentials,
- compression,
- wait_for_ready,
- timeout,
- metadata,
- )
-
- @staticmethod
- def GetAppProfile(
- request,
- target,
- options=(),
- channel_credentials=None,
- call_credentials=None,
- compression=None,
- wait_for_ready=None,
- timeout=None,
- metadata=None,
- ):
- return grpc.experimental.unary_unary(
- request,
- target,
- "/google.bigtable.admin.v2.BigtableInstanceAdmin/GetAppProfile",
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.GetAppProfileRequest.SerializeToString,
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_instance__pb2.AppProfile.FromString,
- options,
- channel_credentials,
- call_credentials,
- compression,
- wait_for_ready,
- timeout,
- metadata,
- )
-
- @staticmethod
- def ListAppProfiles(
- request,
- target,
- options=(),
- channel_credentials=None,
- call_credentials=None,
- compression=None,
- wait_for_ready=None,
- timeout=None,
- metadata=None,
- ):
- return grpc.experimental.unary_unary(
- request,
- target,
- "/google.bigtable.admin.v2.BigtableInstanceAdmin/ListAppProfiles",
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.ListAppProfilesRequest.SerializeToString,
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.ListAppProfilesResponse.FromString,
- options,
- channel_credentials,
- call_credentials,
- compression,
- wait_for_ready,
- timeout,
- metadata,
- )
-
- @staticmethod
- def UpdateAppProfile(
- request,
- target,
- options=(),
- channel_credentials=None,
- call_credentials=None,
- compression=None,
- wait_for_ready=None,
- timeout=None,
- metadata=None,
- ):
- return grpc.experimental.unary_unary(
- request,
- target,
- "/google.bigtable.admin.v2.BigtableInstanceAdmin/UpdateAppProfile",
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.UpdateAppProfileRequest.SerializeToString,
- google_dot_longrunning_dot_operations__pb2.Operation.FromString,
- options,
- channel_credentials,
- call_credentials,
- compression,
- wait_for_ready,
- timeout,
- metadata,
- )
-
- @staticmethod
- def DeleteAppProfile(
- request,
- target,
- options=(),
- channel_credentials=None,
- call_credentials=None,
- compression=None,
- wait_for_ready=None,
- timeout=None,
- metadata=None,
- ):
- return grpc.experimental.unary_unary(
- request,
- target,
- "/google.bigtable.admin.v2.BigtableInstanceAdmin/DeleteAppProfile",
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__instance__admin__pb2.DeleteAppProfileRequest.SerializeToString,
- google_dot_protobuf_dot_empty__pb2.Empty.FromString,
- options,
- channel_credentials,
- call_credentials,
- compression,
- wait_for_ready,
- timeout,
- metadata,
- )
-
- @staticmethod
- def GetIamPolicy(
- request,
- target,
- options=(),
- channel_credentials=None,
- call_credentials=None,
- compression=None,
- wait_for_ready=None,
- timeout=None,
- metadata=None,
- ):
- return grpc.experimental.unary_unary(
- request,
- target,
- "/google.bigtable.admin.v2.BigtableInstanceAdmin/GetIamPolicy",
- google_dot_iam_dot_v1_dot_iam__policy__pb2.GetIamPolicyRequest.SerializeToString,
- google_dot_iam_dot_v1_dot_policy__pb2.Policy.FromString,
- options,
- channel_credentials,
- call_credentials,
- compression,
- wait_for_ready,
- timeout,
- metadata,
- )
-
- @staticmethod
- def SetIamPolicy(
- request,
- target,
- options=(),
- channel_credentials=None,
- call_credentials=None,
- compression=None,
- wait_for_ready=None,
- timeout=None,
- metadata=None,
- ):
- return grpc.experimental.unary_unary(
- request,
- target,
- "/google.bigtable.admin.v2.BigtableInstanceAdmin/SetIamPolicy",
- google_dot_iam_dot_v1_dot_iam__policy__pb2.SetIamPolicyRequest.SerializeToString,
- google_dot_iam_dot_v1_dot_policy__pb2.Policy.FromString,
- options,
- channel_credentials,
- call_credentials,
- compression,
- wait_for_ready,
- timeout,
- metadata,
- )
-
- @staticmethod
- def TestIamPermissions(
- request,
- target,
- options=(),
- channel_credentials=None,
- call_credentials=None,
- compression=None,
- wait_for_ready=None,
- timeout=None,
- metadata=None,
- ):
- return grpc.experimental.unary_unary(
- request,
- target,
- "/google.bigtable.admin.v2.BigtableInstanceAdmin/TestIamPermissions",
- google_dot_iam_dot_v1_dot_iam__policy__pb2.TestIamPermissionsRequest.SerializeToString,
- google_dot_iam_dot_v1_dot_iam__policy__pb2.TestIamPermissionsResponse.FromString,
- options,
- channel_credentials,
- call_credentials,
- compression,
- wait_for_ready,
- timeout,
- metadata,
- )
diff --git a/google/cloud/bigtable_admin_v2/proto/bigtable_table_admin.proto b/google/cloud/bigtable_admin_v2/proto/bigtable_table_admin.proto
deleted file mode 100644
index 6f434a473..000000000
--- a/google/cloud/bigtable_admin_v2/proto/bigtable_table_admin.proto
+++ /dev/null
@@ -1,994 +0,0 @@
-// 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.
-
-syntax = "proto3";
-
-package google.bigtable.admin.v2;
-
-import "google/api/annotations.proto";
-import "google/api/client.proto";
-import "google/api/field_behavior.proto";
-import "google/api/resource.proto";
-import "google/bigtable/admin/v2/common.proto";
-import "google/bigtable/admin/v2/table.proto";
-import "google/iam/v1/iam_policy.proto";
-import "google/iam/v1/policy.proto";
-import "google/longrunning/operations.proto";
-import "google/protobuf/duration.proto";
-import "google/protobuf/empty.proto";
-import "google/protobuf/field_mask.proto";
-import "google/protobuf/timestamp.proto";
-
-option csharp_namespace = "Google.Cloud.Bigtable.Admin.V2";
-option go_package = "google.golang.org/genproto/googleapis/bigtable/admin/v2;admin";
-option java_multiple_files = true;
-option java_outer_classname = "BigtableTableAdminProto";
-option java_package = "com.google.bigtable.admin.v2";
-option php_namespace = "Google\\Cloud\\Bigtable\\Admin\\V2";
-option ruby_package = "Google::Cloud::Bigtable::Admin::V2";
-
-// Service for creating, configuring, and deleting Cloud Bigtable tables.
-//
-//
-// Provides access to the table schemas only, not the data stored within
-// the tables.
-service BigtableTableAdmin {
- option (google.api.default_host) = "bigtableadmin.googleapis.com";
- option (google.api.oauth_scopes) =
- "https://www.googleapis.com/auth/bigtable.admin,"
- "https://www.googleapis.com/auth/bigtable.admin.table,"
- "https://www.googleapis.com/auth/cloud-bigtable.admin,"
- "https://www.googleapis.com/auth/cloud-bigtable.admin.table,"
- "https://www.googleapis.com/auth/cloud-platform,"
- "https://www.googleapis.com/auth/cloud-platform.read-only";
-
- // Creates a new table in the specified instance.
- // The table can be created with a full set of initial column families,
- // specified in the request.
- rpc CreateTable(CreateTableRequest) returns (Table) {
- option (google.api.http) = {
- post: "/v2/{parent=projects/*/instances/*}/tables"
- body: "*"
- };
- option (google.api.method_signature) = "parent,table_id,table";
- }
-
- // Creates a new table from the specified snapshot. The target table must
- // not exist. The snapshot and the table must be in the same instance.
- //
- // Note: This is a private alpha release of Cloud Bigtable snapshots. This
- // feature is not currently available to most Cloud Bigtable customers. This
- // feature might be changed in backward-incompatible ways and is not
- // recommended for production use. It is not subject to any SLA or deprecation
- // policy.
- rpc CreateTableFromSnapshot(CreateTableFromSnapshotRequest)
- returns (google.longrunning.Operation) {
- option (google.api.http) = {
- post: "/v2/{parent=projects/*/instances/*}/tables:createFromSnapshot"
- body: "*"
- };
- option (google.api.method_signature) = "parent,table_id,source_snapshot";
- option (google.longrunning.operation_info) = {
- response_type: "Table"
- metadata_type: "CreateTableFromSnapshotMetadata"
- };
- }
-
- // Lists all tables served from a specified instance.
- rpc ListTables(ListTablesRequest) returns (ListTablesResponse) {
- option (google.api.http) = {
- get: "/v2/{parent=projects/*/instances/*}/tables"
- };
- option (google.api.method_signature) = "parent";
- }
-
- // Gets metadata information about the specified table.
- rpc GetTable(GetTableRequest) returns (Table) {
- option (google.api.http) = {
- get: "/v2/{name=projects/*/instances/*/tables/*}"
- };
- option (google.api.method_signature) = "name";
- }
-
- // Permanently deletes a specified table and all of its data.
- rpc DeleteTable(DeleteTableRequest) returns (google.protobuf.Empty) {
- option (google.api.http) = {
- delete: "/v2/{name=projects/*/instances/*/tables/*}"
- };
- option (google.api.method_signature) = "name";
- }
-
- // Performs a series of column family modifications on the specified table.
- // Either all or none of the modifications will occur before this method
- // returns, but data requests received prior to that point may see a table
- // where only some modifications have taken effect.
- rpc ModifyColumnFamilies(ModifyColumnFamiliesRequest) returns (Table) {
- option (google.api.http) = {
- post: "/v2/{name=projects/*/instances/*/tables/*}:modifyColumnFamilies"
- body: "*"
- };
- option (google.api.method_signature) = "name,modifications";
- }
-
- // Permanently drop/delete a row range from a specified table. The request can
- // specify whether to delete all rows in a table, or only those that match a
- // particular prefix.
- rpc DropRowRange(DropRowRangeRequest) returns (google.protobuf.Empty) {
- option (google.api.http) = {
- post: "/v2/{name=projects/*/instances/*/tables/*}:dropRowRange"
- body: "*"
- };
- }
-
- // Generates a consistency token for a Table, which can be used in
- // CheckConsistency to check whether mutations to the table that finished
- // before this call started have been replicated. The tokens will be available
- // for 90 days.
- rpc GenerateConsistencyToken(GenerateConsistencyTokenRequest)
- returns (GenerateConsistencyTokenResponse) {
- option (google.api.http) = {
- post: "/v2/{name=projects/*/instances/*/tables/*}:generateConsistencyToken"
- body: "*"
- };
- option (google.api.method_signature) = "name";
- }
-
- // Checks replication consistency based on a consistency token, that is, if
- // replication has caught up based on the conditions specified in the token
- // and the check request.
- rpc CheckConsistency(CheckConsistencyRequest)
- returns (CheckConsistencyResponse) {
- option (google.api.http) = {
- post: "/v2/{name=projects/*/instances/*/tables/*}:checkConsistency"
- body: "*"
- };
- option (google.api.method_signature) = "name,consistency_token";
- }
-
- // Creates a new snapshot in the specified cluster from the specified
- // source table. The cluster and the table must be in the same instance.
- //
- // Note: This is a private alpha release of Cloud Bigtable snapshots. This
- // feature is not currently available to most Cloud Bigtable customers. This
- // feature might be changed in backward-incompatible ways and is not
- // recommended for production use. It is not subject to any SLA or deprecation
- // policy.
- rpc SnapshotTable(SnapshotTableRequest)
- returns (google.longrunning.Operation) {
- option (google.api.http) = {
- post: "/v2/{name=projects/*/instances/*/tables/*}:snapshot"
- body: "*"
- };
- option (google.api.method_signature) =
- "name,cluster,snapshot_id,description";
- option (google.longrunning.operation_info) = {
- response_type: "Snapshot"
- metadata_type: "SnapshotTableMetadata"
- };
- }
-
- // Gets metadata information about the specified snapshot.
- //
- // Note: This is a private alpha release of Cloud Bigtable snapshots. This
- // feature is not currently available to most Cloud Bigtable customers. This
- // feature might be changed in backward-incompatible ways and is not
- // recommended for production use. It is not subject to any SLA or deprecation
- // policy.
- rpc GetSnapshot(GetSnapshotRequest) returns (Snapshot) {
- option (google.api.http) = {
- get: "/v2/{name=projects/*/instances/*/clusters/*/snapshots/*}"
- };
- option (google.api.method_signature) = "name";
- }
-
- // Lists all snapshots associated with the specified cluster.
- //
- // Note: This is a private alpha release of Cloud Bigtable snapshots. This
- // feature is not currently available to most Cloud Bigtable customers. This
- // feature might be changed in backward-incompatible ways and is not
- // recommended for production use. It is not subject to any SLA or deprecation
- // policy.
- rpc ListSnapshots(ListSnapshotsRequest) returns (ListSnapshotsResponse) {
- option (google.api.http) = {
- get: "/v2/{parent=projects/*/instances/*/clusters/*}/snapshots"
- };
- option (google.api.method_signature) = "parent";
- }
-
- // Permanently deletes the specified snapshot.
- //
- // Note: This is a private alpha release of Cloud Bigtable snapshots. This
- // feature is not currently available to most Cloud Bigtable customers. This
- // feature might be changed in backward-incompatible ways and is not
- // recommended for production use. It is not subject to any SLA or deprecation
- // policy.
- rpc DeleteSnapshot(DeleteSnapshotRequest) returns (google.protobuf.Empty) {
- option (google.api.http) = {
- delete: "/v2/{name=projects/*/instances/*/clusters/*/snapshots/*}"
- };
- option (google.api.method_signature) = "name";
- }
-
- // Starts creating a new Cloud Bigtable Backup. The returned backup
- // [long-running operation][google.longrunning.Operation] can be used to
- // track creation of the backup. The
- // [metadata][google.longrunning.Operation.metadata] field type is
- // [CreateBackupMetadata][google.bigtable.admin.v2.CreateBackupMetadata]. The
- // [response][google.longrunning.Operation.response] field type is
- // [Backup][google.bigtable.admin.v2.Backup], if successful. Cancelling the
- // returned operation will stop the creation and delete the backup.
- rpc CreateBackup(CreateBackupRequest) returns (google.longrunning.Operation) {
- option (google.api.http) = {
- post: "/v2/{parent=projects/*/instances/*/clusters/*}/backups"
- body: "backup"
- };
- option (google.longrunning.operation_info) = {
- response_type: "Backup"
- metadata_type: "CreateBackupMetadata"
- };
- option (google.api.method_signature) = "parent,backup_id,backup";
- }
-
- // Gets metadata on a pending or completed Cloud Bigtable Backup.
- rpc GetBackup(GetBackupRequest) returns (Backup) {
- option (google.api.http) = {
- get: "/v2/{name=projects/*/instances/*/clusters/*/backups/*}"
- };
- option (google.api.method_signature) = "name";
- }
-
- // Updates a pending or completed Cloud Bigtable Backup.
- rpc UpdateBackup(UpdateBackupRequest) returns (Backup) {
- option (google.api.http) = {
- patch: "/v2/{backup.name=projects/*/instances/*/clusters/*/backups/*}"
- body: "backup"
- };
- option (google.api.method_signature) = "backup,update_mask";
- }
-
- // Deletes a pending or completed Cloud Bigtable backup.
- rpc DeleteBackup(DeleteBackupRequest) returns (google.protobuf.Empty) {
- option (google.api.http) = {
- delete: "/v2/{name=projects/*/instances/*/clusters/*/backups/*}"
- };
- option (google.api.method_signature) = "name";
- }
-
- // Lists Cloud Bigtable backups. Returns both completed and pending
- // backups.
- rpc ListBackups(ListBackupsRequest) returns (ListBackupsResponse) {
- option (google.api.http) = {
- get: "/v2/{parent=projects/*/instances/*/clusters/*}/backups"
- };
- option (google.api.method_signature) = "parent";
- }
-
- // Create a new table by restoring from a completed backup. The new table
- // must be in the same instance as the instance containing the backup. The
- // returned table [long-running operation][google.longrunning.Operation] can
- // be used to track the progress of the operation, and to cancel it. The
- // [metadata][google.longrunning.Operation.metadata] field type is
- // [RestoreTableMetadata][google.bigtable.admin.RestoreTableMetadata]. The
- // [response][google.longrunning.Operation.response] type is
- // [Table][google.bigtable.admin.v2.Table], if successful.
- rpc RestoreTable(RestoreTableRequest) returns (google.longrunning.Operation) {
- option (google.api.http) = {
- post: "/v2/{parent=projects/*/instances/*}/tables:restore"
- body: "*"
- };
- option (google.longrunning.operation_info) = {
- response_type: "Table"
- metadata_type: "RestoreTableMetadata"
- };
- }
-
- // Gets the access control policy for a resource.
- // Returns an empty policy if the resource exists but does not have a policy
- // set.
- rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest)
- returns (google.iam.v1.Policy) {
- option (google.api.http) = {
- post: "/v2/{resource=projects/*/instances/*/tables/*}:getIamPolicy"
- body: "*"
- };
- option (google.api.method_signature) = "resource";
- }
-
- // Sets the access control policy on a Table or Backup resource.
- // Replaces any existing policy.
- rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest)
- returns (google.iam.v1.Policy) {
- option (google.api.http) = {
- post: "/v2/{resource=projects/*/instances/*/tables/*}:setIamPolicy"
- body: "*"
- additional_bindings {
- post: "/v2/{resource=projects/*/instances/*/clusters/*/backups/*}:setIamPolicy"
- body: "*"
- }
- };
- option (google.api.method_signature) = "resource,policy";
- }
-
- // Returns permissions that the caller has on the specified table resource.
- rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest)
- returns (google.iam.v1.TestIamPermissionsResponse) {
- option (google.api.http) = {
- post: "/v2/{resource=projects/*/instances/*/tables/*}:testIamPermissions"
- body: "*"
- additional_bindings {
- post: "/v2/{resource=projects/*/instances/*/clusters/*/backups/*}:testIamPermissions"
- body: "*"
- }
- };
- option (google.api.method_signature) = "resource,permissions";
- }
-}
-
-// Request message for
-// [google.bigtable.admin.v2.BigtableTableAdmin.CreateTable][google.bigtable.admin.v2.BigtableTableAdmin.CreateTable]
-message CreateTableRequest {
- // An initial split point for a newly created table.
- message Split {
- // Row key to use as an initial tablet boundary.
- bytes key = 1;
- }
-
- // Required. The unique name of the instance in which to create the table.
- // Values are of the form `projects/{project}/instances/{instance}`.
- string parent = 1 [
- (google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = {
- type: "bigtable.googleapis.com/Instance"
- }
- ];
-
- // Required. The name by which the new table should be referred to within the
- // parent instance, e.g., `foobar` rather than `{parent}/tables/foobar`.
- // Maximum 50 characters.
- string table_id = 2 [(google.api.field_behavior) = REQUIRED];
-
- // Required. The Table to create.
- Table table = 3 [(google.api.field_behavior) = REQUIRED];
-
- // The optional list of row keys that will be used to initially split the
- // table into several tablets (tablets are similar to HBase regions).
- // Given two split keys, `s1` and `s2`, three tablets will be created,
- // spanning the key ranges: `[, s1), [s1, s2), [s2, )`.
- //
- // Example:
- //
- // * Row keys := `["a", "apple", "custom", "customer_1", "customer_2",`
- // `"other", "zz"]`
- // * initial_split_keys := `["apple", "customer_1", "customer_2", "other"]`
- // * Key assignment:
- // - Tablet 1 `[, apple) => {"a"}.`
- // - Tablet 2 `[apple, customer_1) => {"apple", "custom"}.`
- // - Tablet 3 `[customer_1, customer_2) => {"customer_1"}.`
- // - Tablet 4 `[customer_2, other) => {"customer_2"}.`
- // - Tablet 5 `[other, ) => {"other", "zz"}.`
- repeated Split initial_splits = 4;
-}
-
-// Request message for
-// [google.bigtable.admin.v2.BigtableTableAdmin.CreateTableFromSnapshot][google.bigtable.admin.v2.BigtableTableAdmin.CreateTableFromSnapshot]
-//
-// Note: This is a private alpha release of Cloud Bigtable snapshots. This
-// feature is not currently available to most Cloud Bigtable customers. This
-// feature might be changed in backward-incompatible ways and is not recommended
-// for production use. It is not subject to any SLA or deprecation policy.
-message CreateTableFromSnapshotRequest {
- // Required. The unique name of the instance in which to create the table.
- // Values are of the form `projects/{project}/instances/{instance}`.
- string parent = 1 [
- (google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = {
- type: "bigtable.googleapis.com/Instance"
- }
- ];
-
- // Required. The name by which the new table should be referred to within the
- // parent instance, e.g., `foobar` rather than `{parent}/tables/foobar`.
- string table_id = 2 [(google.api.field_behavior) = REQUIRED];
-
- // Required. The unique name of the snapshot from which to restore the table.
- // The snapshot and the table must be in the same instance. Values are of the
- // form
- // `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`.
- string source_snapshot = 3 [
- (google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = {
- type: "bigtable.googleapis.com/Snapshot"
- }
- ];
-}
-
-// Request message for
-// [google.bigtable.admin.v2.BigtableTableAdmin.DropRowRange][google.bigtable.admin.v2.BigtableTableAdmin.DropRowRange]
-message DropRowRangeRequest {
- // Required. The unique name of the table on which to drop a range of rows.
- // Values are of the form
- // `projects/{project}/instances/{instance}/tables/{table}`.
- string name = 1 [
- (google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = { type: "bigtable.googleapis.com/Table" }
- ];
-
- // Delete all rows or by prefix.
- oneof target {
- // Delete all rows that start with this row key prefix. Prefix cannot be
- // zero length.
- bytes row_key_prefix = 2;
-
- // Delete all rows in the table. Setting this to false is a no-op.
- bool delete_all_data_from_table = 3;
- }
-}
-
-// Request message for
-// [google.bigtable.admin.v2.BigtableTableAdmin.ListTables][google.bigtable.admin.v2.BigtableTableAdmin.ListTables]
-message ListTablesRequest {
- // Required. The unique name of the instance for which tables should be
- // listed. Values are of the form `projects/{project}/instances/{instance}`.
- string parent = 1 [
- (google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = {
- type: "bigtable.googleapis.com/Instance"
- }
- ];
-
- // The view to be applied to the returned tables' fields.
- // Only NAME_ONLY view (default) and REPLICATION_VIEW are supported.
- Table.View view = 2;
-
- // Maximum number of results per page.
- //
- // A page_size of zero lets the server choose the number of items to return.
- // A page_size which is strictly positive will return at most that many items.
- // A negative page_size will cause an error.
- //
- // Following the first request, subsequent paginated calls are not required
- // to pass a page_size. If a page_size is set in subsequent calls, it must
- // match the page_size given in the first request.
- int32 page_size = 4;
-
- // The value of `next_page_token` returned by a previous call.
- string page_token = 3;
-}
-
-// Response message for
-// [google.bigtable.admin.v2.BigtableTableAdmin.ListTables][google.bigtable.admin.v2.BigtableTableAdmin.ListTables]
-message ListTablesResponse {
- // The tables present in the requested instance.
- repeated Table tables = 1;
-
- // Set if not all tables could be returned in a single response.
- // Pass this value to `page_token` in another request to get the next
- // page of results.
- string next_page_token = 2;
-}
-
-// Request message for
-// [google.bigtable.admin.v2.BigtableTableAdmin.GetTable][google.bigtable.admin.v2.BigtableTableAdmin.GetTable]
-message GetTableRequest {
- // Required. The unique name of the requested table.
- // Values are of the form
- // `projects/{project}/instances/{instance}/tables/{table}`.
- string name = 1 [
- (google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = { type: "bigtable.googleapis.com/Table" }
- ];
-
- // The view to be applied to the returned table's fields.
- // Defaults to `SCHEMA_VIEW` if unspecified.
- Table.View view = 2;
-}
-
-// Request message for
-// [google.bigtable.admin.v2.BigtableTableAdmin.DeleteTable][google.bigtable.admin.v2.BigtableTableAdmin.DeleteTable]
-message DeleteTableRequest {
- // Required. The unique name of the table to be deleted.
- // Values are of the form
- // `projects/{project}/instances/{instance}/tables/{table}`.
- string name = 1 [
- (google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = { type: "bigtable.googleapis.com/Table" }
- ];
-}
-
-// Request message for
-// [google.bigtable.admin.v2.BigtableTableAdmin.ModifyColumnFamilies][google.bigtable.admin.v2.BigtableTableAdmin.ModifyColumnFamilies]
-message ModifyColumnFamiliesRequest {
- // A create, update, or delete of a particular column family.
- message Modification {
- // The ID of the column family to be modified.
- string id = 1;
-
- // Column familiy modifications.
- oneof mod {
- // Create a new column family with the specified schema, or fail if
- // one already exists with the given ID.
- ColumnFamily create = 2;
-
- // Update an existing column family to the specified schema, or fail
- // if no column family exists with the given ID.
- ColumnFamily update = 3;
-
- // Drop (delete) the column family with the given ID, or fail if no such
- // family exists.
- bool drop = 4;
- }
- }
-
- // Required. The unique name of the table whose families should be modified.
- // Values are of the form
- // `projects/{project}/instances/{instance}/tables/{table}`.
- string name = 1 [
- (google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = { type: "bigtable.googleapis.com/Table" }
- ];
-
- // Required. Modifications to be atomically applied to the specified table's
- // families. Entries are applied in order, meaning that earlier modifications
- // can be masked by later ones (in the case of repeated updates to the same
- // family, for example).
- repeated Modification modifications = 2
- [(google.api.field_behavior) = REQUIRED];
-}
-
-// Request message for
-// [google.bigtable.admin.v2.BigtableTableAdmin.GenerateConsistencyToken][google.bigtable.admin.v2.BigtableTableAdmin.GenerateConsistencyToken]
-message GenerateConsistencyTokenRequest {
- // Required. The unique name of the Table for which to create a consistency
- // token. Values are of the form
- // `projects/{project}/instances/{instance}/tables/{table}`.
- string name = 1 [
- (google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = { type: "bigtable.googleapis.com/Table" }
- ];
-}
-
-// Response message for
-// [google.bigtable.admin.v2.BigtableTableAdmin.GenerateConsistencyToken][google.bigtable.admin.v2.BigtableTableAdmin.GenerateConsistencyToken]
-message GenerateConsistencyTokenResponse {
- // The generated consistency token.
- string consistency_token = 1;
-}
-
-// Request message for
-// [google.bigtable.admin.v2.BigtableTableAdmin.CheckConsistency][google.bigtable.admin.v2.BigtableTableAdmin.CheckConsistency]
-message CheckConsistencyRequest {
- // Required. The unique name of the Table for which to check replication
- // consistency. Values are of the form
- // `projects/{project}/instances/{instance}/tables/{table}`.
- string name = 1 [
- (google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = { type: "bigtable.googleapis.com/Table" }
- ];
-
- // Required. The token created using GenerateConsistencyToken for the Table.
- string consistency_token = 2 [(google.api.field_behavior) = REQUIRED];
-}
-
-// Response message for
-// [google.bigtable.admin.v2.BigtableTableAdmin.CheckConsistency][google.bigtable.admin.v2.BigtableTableAdmin.CheckConsistency]
-message CheckConsistencyResponse {
- // True only if the token is consistent. A token is consistent if replication
- // has caught up with the restrictions specified in the request.
- bool consistent = 1;
-}
-
-// Request message for
-// [google.bigtable.admin.v2.BigtableTableAdmin.SnapshotTable][google.bigtable.admin.v2.BigtableTableAdmin.SnapshotTable]
-//
-// Note: This is a private alpha release of Cloud Bigtable snapshots. This
-// feature is not currently available to most Cloud Bigtable customers. This
-// feature might be changed in backward-incompatible ways and is not recommended
-// for production use. It is not subject to any SLA or deprecation policy.
-message SnapshotTableRequest {
- // Required. The unique name of the table to have the snapshot taken.
- // Values are of the form
- // `projects/{project}/instances/{instance}/tables/{table}`.
- string name = 1 [
- (google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = { type: "bigtable.googleapis.com/Table" }
- ];
-
- // Required. The name of the cluster where the snapshot will be created in.
- // Values are of the form
- // `projects/{project}/instances/{instance}/clusters/{cluster}`.
- string cluster = 2 [
- (google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = {
- type: "bigtable.googleapis.com/Cluster"
- }
- ];
-
- // Required. The ID by which the new snapshot should be referred to within the
- // parent cluster, e.g., `mysnapshot` of the form:
- // `[_a-zA-Z0-9][-_.a-zA-Z0-9]*` rather than
- // `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/mysnapshot`.
- string snapshot_id = 3 [(google.api.field_behavior) = REQUIRED];
-
- // The amount of time that the new snapshot can stay active after it is
- // created. Once 'ttl' expires, the snapshot will get deleted. The maximum
- // amount of time a snapshot can stay active is 7 days. If 'ttl' is not
- // specified, the default value of 24 hours will be used.
- google.protobuf.Duration ttl = 4;
-
- // Description of the snapshot.
- string description = 5;
-}
-
-// Request message for
-// [google.bigtable.admin.v2.BigtableTableAdmin.GetSnapshot][google.bigtable.admin.v2.BigtableTableAdmin.GetSnapshot]
-//
-// Note: This is a private alpha release of Cloud Bigtable snapshots. This
-// feature is not currently available to most Cloud Bigtable customers. This
-// feature might be changed in backward-incompatible ways and is not recommended
-// for production use. It is not subject to any SLA or deprecation policy.
-message GetSnapshotRequest {
- // Required. The unique name of the requested snapshot.
- // Values are of the form
- // `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`.
- string name = 1 [
- (google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = {
- type: "bigtable.googleapis.com/Snapshot"
- }
- ];
-}
-
-// Request message for
-// [google.bigtable.admin.v2.BigtableTableAdmin.ListSnapshots][google.bigtable.admin.v2.BigtableTableAdmin.ListSnapshots]
-//
-// Note: This is a private alpha release of Cloud Bigtable snapshots. This
-// feature is not currently available to most Cloud Bigtable customers. This
-// feature might be changed in backward-incompatible ways and is not recommended
-// for production use. It is not subject to any SLA or deprecation policy.
-message ListSnapshotsRequest {
- // Required. The unique name of the cluster for which snapshots should be
- // listed. Values are of the form
- // `projects/{project}/instances/{instance}/clusters/{cluster}`.
- // Use `{cluster} = '-'` to list snapshots for all clusters in an instance,
- // e.g., `projects/{project}/instances/{instance}/clusters/-`.
- string parent = 1 [
- (google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = {
- type: "bigtable.googleapis.com/Cluster"
- }
- ];
-
- // The maximum number of snapshots to return per page.
- // CURRENTLY UNIMPLEMENTED AND IGNORED.
- int32 page_size = 2;
-
- // The value of `next_page_token` returned by a previous call.
- string page_token = 3;
-}
-
-// Response message for
-// [google.bigtable.admin.v2.BigtableTableAdmin.ListSnapshots][google.bigtable.admin.v2.BigtableTableAdmin.ListSnapshots]
-//
-// Note: This is a private alpha release of Cloud Bigtable snapshots. This
-// feature is not currently available to most Cloud Bigtable customers. This
-// feature might be changed in backward-incompatible ways and is not recommended
-// for production use. It is not subject to any SLA or deprecation policy.
-message ListSnapshotsResponse {
- // The snapshots present in the requested cluster.
- repeated Snapshot snapshots = 1;
-
- // Set if not all snapshots could be returned in a single response.
- // Pass this value to `page_token` in another request to get the next
- // page of results.
- string next_page_token = 2;
-}
-
-// Request message for
-// [google.bigtable.admin.v2.BigtableTableAdmin.DeleteSnapshot][google.bigtable.admin.v2.BigtableTableAdmin.DeleteSnapshot]
-//
-// Note: This is a private alpha release of Cloud Bigtable snapshots. This
-// feature is not currently available to most Cloud Bigtable customers. This
-// feature might be changed in backward-incompatible ways and is not recommended
-// for production use. It is not subject to any SLA or deprecation policy.
-message DeleteSnapshotRequest {
- // Required. The unique name of the snapshot to be deleted.
- // Values are of the form
- // `projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}`.
- string name = 1 [
- (google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = {
- type: "bigtable.googleapis.com/Snapshot"
- }
- ];
-}
-
-// The metadata for the Operation returned by SnapshotTable.
-//
-// Note: This is a private alpha release of Cloud Bigtable snapshots. This
-// feature is not currently available to most Cloud Bigtable customers. This
-// feature might be changed in backward-incompatible ways and is not recommended
-// for production use. It is not subject to any SLA or deprecation policy.
-message SnapshotTableMetadata {
- // The request that prompted the initiation of this SnapshotTable operation.
- SnapshotTableRequest original_request = 1;
-
- // The time at which the original request was received.
- google.protobuf.Timestamp request_time = 2;
-
- // The time at which the operation failed or was completed successfully.
- google.protobuf.Timestamp finish_time = 3;
-}
-
-// The metadata for the Operation returned by CreateTableFromSnapshot.
-//
-// Note: This is a private alpha release of Cloud Bigtable snapshots. This
-// feature is not currently available to most Cloud Bigtable customers. This
-// feature might be changed in backward-incompatible ways and is not recommended
-// for production use. It is not subject to any SLA or deprecation policy.
-message CreateTableFromSnapshotMetadata {
- // The request that prompted the initiation of this CreateTableFromSnapshot
- // operation.
- CreateTableFromSnapshotRequest original_request = 1;
-
- // The time at which the original request was received.
- google.protobuf.Timestamp request_time = 2;
-
- // The time at which the operation failed or was completed successfully.
- google.protobuf.Timestamp finish_time = 3;
-}
-
-// The request for
-// [CreateBackup][google.bigtable.admin.v2.BigtableTableAdmin.CreateBackup].
-message CreateBackupRequest {
- // Required. This must be one of the clusters in the instance in which this
- // table is located. The backup will be stored in this cluster. Values are
- // of the form `projects/{project}/instances/{instance}/clusters/{cluster}`.
- string parent = 1 [
- (google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = {
- type: "bigtable.googleapis.com/Cluster"
- }
- ];
-
- // Required. The id of the backup to be created. The `backup_id` along with
- // the parent `parent` are combined as {parent}/backups/{backup_id} to create
- // the full backup name, of the form:
- // `projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup_id}`.
- // This string must be between 1 and 50 characters in length and match the
- // regex [_a-zA-Z0-9][-_.a-zA-Z0-9]*.
- string backup_id = 2 [(google.api.field_behavior) = REQUIRED];
-
- // Required. The backup to create.
- Backup backup = 3 [(google.api.field_behavior) = REQUIRED];
-}
-
-// Metadata type for the operation returned by
-// [CreateBackup][google.bigtable.admin.v2.BigtableTableAdmin.CreateBackup].
-message CreateBackupMetadata {
- // The name of the backup being created.
- string name = 1;
-
- // The name of the table the backup is created from.
- string source_table = 2;
-
- // The time at which this operation started.
- google.protobuf.Timestamp start_time = 3;
-
- // If set, the time at which this operation finished or was cancelled.
- google.protobuf.Timestamp end_time = 4;
-}
-
-// The request for
-// [GetBackup][google.bigtable.admin.v2.BigtableTableAdmin.GetBackup].
-message GetBackupRequest {
- // Required. Name of the backup.
- // Values are of the form
- // `projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}`.
- string name = 1 [
- (google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = { type: "bigtable.googleapis.com/Backup" }
- ];
-}
-
-// The request for
-// [UpdateBackup][google.bigtable.admin.v2.BigtableTableAdmin.UpdateBackup].
-message UpdateBackupRequest {
- // Required. The backup to update. `backup.name`, and the fields to be updated
- // as specified by `update_mask` are required. Other fields are ignored.
- // Update is only supported for the following fields:
- // * `backup.expire_time`.
- Backup backup = 1 [(google.api.field_behavior) = REQUIRED];
-
- // Required. A mask specifying which fields (e.g. `expire_time`) in the
- // Backup resource should be updated. This mask is relative to the Backup
- // resource, not to the request message. The field mask must always be
- // specified; this prevents any future fields from being erased accidentally
- // by clients that do not know about them.
- google.protobuf.FieldMask update_mask = 2
- [(google.api.field_behavior) = REQUIRED];
-}
-
-// The request for
-// [DeleteBackup][google.bigtable.admin.v2.BigtableTableAdmin.DeleteBackup].
-message DeleteBackupRequest {
- // Required. Name of the backup to delete.
- // Values are of the form
- // `projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}`.
- string name = 1 [
- (google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = { type: "bigtable.googleapis.com/Backup" }
- ];
-}
-
-// The request for
-// [ListBackups][google.bigtable.admin.v2.BigtableTableAdmin.ListBackups].
-message ListBackupsRequest {
- // Required. The cluster to list backups from. Values are of the
- // form `projects/{project}/instances/{instance}/clusters/{cluster}`.
- // Use `{cluster} = '-'` to list backups for all clusters in an instance,
- // e.g., `projects/{project}/instances/{instance}/clusters/-`.
- string parent = 1 [
- (google.api.field_behavior) = REQUIRED,
- (google.api.resource_reference) = {
- type: "bigtable.googleapis.com/Cluster"
- }
- ];
-
- // A filter expression that filters backups listed in the response.
- // The expression must specify the field name, a comparison operator,
- // and the value that you want to use for filtering. The value must be a
- // string, a number, or a boolean. The comparison operator must be
- // <, >, <=, >=, !=, =, or :. Colon ‘:’ represents a HAS operator which is
- // roughly synonymous with equality. Filter rules are case insensitive.
- //
- // The fields eligible for filtering are:
- // * `name`
- // * `source_table`
- // * `state`
- // * `start_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ)
- // * `end_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ)
- // * `expire_time` (and values are of the format YYYY-MM-DDTHH:MM:SSZ)
- // * `size_bytes`
- //
- // To filter on multiple expressions, provide each separate expression within
- // parentheses. By default, each expression is an AND expression. However,
- // you can include AND, OR, and NOT expressions explicitly.
- //
- // Some examples of using filters are:
- //
- // * `name:"exact"` --> The backup's name is the string "exact".
- // * `name:howl` --> The backup's name contains the string "howl".
- // * `source_table:prod`
- // --> The source_table's name contains the string "prod".
- // * `state:CREATING` --> The backup is pending creation.
- // * `state:READY` --> The backup is fully created and ready for use.
- // * `(name:howl) AND (start_time < \"2018-03-28T14:50:00Z\")`
- // --> The backup name contains the string "howl" and start_time
- // of the backup is before 2018-03-28T14:50:00Z.
- // * `size_bytes > 10000000000` --> The backup's size is greater than 10GB
- string filter = 2;
-
- // An expression for specifying the sort order of the results of the request.
- // The string value should specify one or more fields in
- // [Backup][google.bigtable.admin.v2.Backup]. The full syntax is described at
- // https://aip.dev/132#ordering.
- //
- // Fields supported are:
- // * name
- // * source_table
- // * expire_time
- // * start_time
- // * end_time
- // * size_bytes
- // * state
- //
- // For example, "start_time". The default sorting order is ascending.
- // To specify descending order for the field, a suffix " desc" should
- // be appended to the field name. For example, "start_time desc".
- // Redundant space characters in the syntax are insigificant.
- //
- // If order_by is empty, results will be sorted by `start_time` in descending
- // order starting from the most recently created backup.
- string order_by = 3;
-
- // Number of backups to be returned in the response. If 0 or
- // less, defaults to the server's maximum allowed page size.
- int32 page_size = 4;
-
- // If non-empty, `page_token` should contain a
- // [next_page_token][google.bigtable.admin.v2.ListBackupsResponse.next_page_token]
- // from a previous
- // [ListBackupsResponse][google.bigtable.admin.v2.ListBackupsResponse] to the
- // same `parent` and with the same `filter`.
- string page_token = 5;
-}
-
-// The response for
-// [ListBackups][google.bigtable.admin.v2.BigtableTableAdmin.ListBackups].
-message ListBackupsResponse {
- // The list of matching backups.
- repeated Backup backups = 1;
-
- // `next_page_token` can be sent in a subsequent
- // [ListBackups][google.bigtable.admin.v2.BigtableTableAdmin.ListBackups] call
- // to fetch more of the matching backups.
- string next_page_token = 2;
-}
-
-// The request for
-// [RestoreTable][google.bigtable.admin.v2.BigtableTableAdmin.RestoreTable].
-message RestoreTableRequest {
- // Required. The name of the instance in which to create the restored
- // table. This instance must be the parent of the source backup. Values are
- // of the form `projects//instances/`.
- string parent = 1;
-
- // Required. The id of the table to create and restore to. This
- // table must not already exist. The `table_id` appended to
- // `parent` forms the full table name of the form
- // `projects//instances//tables/`.
- string table_id = 2;
-
- // Required. The source from which to restore.
- oneof source {
- // Name of the backup from which to restore. Values are of the form
- // `projects//instances//clusters//backups/`.
- string backup = 3;
- }
-}
-
-// Metadata type for the long-running operation returned by
-// [RestoreTable][google.bigtable.admin.v2.BigtableTableAdmin.RestoreTable].
-message RestoreTableMetadata {
- // Name of the table being created and restored to.
- string name = 1;
-
- // The type of the restore source.
- RestoreSourceType source_type = 2;
-
- // Information about the source used to restore the table, as specified by
- // `source` in
- // [RestoreTableRequest][google.bigtable.admin.v2.RestoreTableRequest].
- oneof source_info {
- BackupInfo backup_info = 3;
- }
-
- // If exists, the name of the long-running operation that will be used to
- // track the post-restore optimization process to optimize the performance of
- // the restored table. The metadata type of the long-running operation is
- // [OptimizeRestoreTableMetadata][]. The response type is
- // [Empty][google.protobuf.Empty]. This long-running operation may be
- // automatically created by the system if applicable after the
- // RestoreTable long-running operation completes successfully. This operation
- // may not be created if the table is already optimized or the restore was
- // not successful.
- string optimize_table_operation_name = 4;
-
- // The progress of the
- // [RestoreTable][google.bigtable.admin.v2.BigtableTableAdmin.RestoreTable]
- // operation.
- OperationProgress progress = 5;
-}
-
-// Metadata type for the long-running operation used to track the progress
-// of optimizations performed on a newly restored table. This long-running
-// operation is automatically created by the system after the successful
-// completion of a table restore, and cannot be cancelled.
-message OptimizeRestoredTableMetadata {
- // Name of the restored table being optimized.
- string name = 1;
-
- // The progress of the post-restore optimizations.
- OperationProgress progress = 2;
-}
diff --git a/google/cloud/bigtable_admin_v2/proto/bigtable_table_admin_pb2.py b/google/cloud/bigtable_admin_v2/proto/bigtable_table_admin_pb2.py
deleted file mode 100644
index 5ca167d87..000000000
--- a/google/cloud/bigtable_admin_v2/proto/bigtable_table_admin_pb2.py
+++ /dev/null
@@ -1,3574 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/cloud/bigtable_admin_v2/proto/bigtable_table_admin.proto
-"""Generated protocol buffer code."""
-from google.protobuf import descriptor as _descriptor
-from google.protobuf import message as _message
-from google.protobuf import reflection as _reflection
-from google.protobuf import symbol_database as _symbol_database
-
-# @@protoc_insertion_point(imports)
-
-_sym_db = _symbol_database.Default()
-
-
-from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2
-from google.api import client_pb2 as google_dot_api_dot_client__pb2
-from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2
-from google.api import resource_pb2 as google_dot_api_dot_resource__pb2
-from google.cloud.bigtable_admin_v2.proto import (
- common_pb2 as google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_common__pb2,
-)
-from google.cloud.bigtable_admin_v2.proto import (
- table_pb2 as google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_table__pb2,
-)
-from google.iam.v1 import iam_policy_pb2 as google_dot_iam_dot_v1_dot_iam__policy__pb2
-from google.iam.v1 import policy_pb2 as google_dot_iam_dot_v1_dot_policy__pb2
-from google.longrunning import (
- operations_pb2 as google_dot_longrunning_dot_operations__pb2,
-)
-from google.protobuf import duration_pb2 as google_dot_protobuf_dot_duration__pb2
-from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2
-from google.protobuf import field_mask_pb2 as google_dot_protobuf_dot_field__mask__pb2
-from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2
-
-
-DESCRIPTOR = _descriptor.FileDescriptor(
- name="google/cloud/bigtable_admin_v2/proto/bigtable_table_admin.proto",
- package="google.bigtable.admin.v2",
- syntax="proto3",
- serialized_options=b'\n\034com.google.bigtable.admin.v2B\027BigtableTableAdminProtoP\001Z=google.golang.org/genproto/googleapis/bigtable/admin/v2;admin\252\002\036Google.Cloud.Bigtable.Admin.V2\312\002\036Google\\Cloud\\Bigtable\\Admin\\V2\352\002"Google::Cloud::Bigtable::Admin::V2',
- create_key=_descriptor._internal_create_key,
- serialized_pb=b'\n?google/cloud/bigtable_admin_v2/proto/bigtable_table_admin.proto\x12\x18google.bigtable.admin.v2\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x31google/cloud/bigtable_admin_v2/proto/common.proto\x1a\x30google/cloud/bigtable_admin_v2/proto/table.proto\x1a\x1egoogle/iam/v1/iam_policy.proto\x1a\x1agoogle/iam/v1/policy.proto\x1a#google/longrunning/operations.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto"\xfc\x01\n\x12\x43reateTableRequest\x12\x38\n\x06parent\x18\x01 \x01(\tB(\xe0\x41\x02\xfa\x41"\n bigtable.googleapis.com/Instance\x12\x15\n\x08table_id\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x33\n\x05table\x18\x03 \x01(\x0b\x32\x1f.google.bigtable.admin.v2.TableB\x03\xe0\x41\x02\x12J\n\x0einitial_splits\x18\x04 \x03(\x0b\x32\x32.google.bigtable.admin.v2.CreateTableRequest.Split\x1a\x14\n\x05Split\x12\x0b\n\x03key\x18\x01 \x01(\x0c"\xb4\x01\n\x1e\x43reateTableFromSnapshotRequest\x12\x38\n\x06parent\x18\x01 \x01(\tB(\xe0\x41\x02\xfa\x41"\n bigtable.googleapis.com/Instance\x12\x15\n\x08table_id\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x41\n\x0fsource_snapshot\x18\x03 \x01(\tB(\xe0\x41\x02\xfa\x41"\n bigtable.googleapis.com/Snapshot"\x94\x01\n\x13\x44ropRowRangeRequest\x12\x33\n\x04name\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1d\x62igtable.googleapis.com/Table\x12\x18\n\x0erow_key_prefix\x18\x02 \x01(\x0cH\x00\x12$\n\x1a\x64\x65lete_all_data_from_table\x18\x03 \x01(\x08H\x00\x42\x08\n\x06target"\xa8\x01\n\x11ListTablesRequest\x12\x38\n\x06parent\x18\x01 \x01(\tB(\xe0\x41\x02\xfa\x41"\n bigtable.googleapis.com/Instance\x12\x32\n\x04view\x18\x02 \x01(\x0e\x32$.google.bigtable.admin.v2.Table.View\x12\x11\n\tpage_size\x18\x04 \x01(\x05\x12\x12\n\npage_token\x18\x03 \x01(\t"^\n\x12ListTablesResponse\x12/\n\x06tables\x18\x01 \x03(\x0b\x32\x1f.google.bigtable.admin.v2.Table\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t"z\n\x0fGetTableRequest\x12\x33\n\x04name\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1d\x62igtable.googleapis.com/Table\x12\x32\n\x04view\x18\x02 \x01(\x0e\x32$.google.bigtable.admin.v2.Table.View"I\n\x12\x44\x65leteTableRequest\x12\x33\n\x04name\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1d\x62igtable.googleapis.com/Table"\xda\x02\n\x1bModifyColumnFamiliesRequest\x12\x33\n\x04name\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1d\x62igtable.googleapis.com/Table\x12^\n\rmodifications\x18\x02 \x03(\x0b\x32\x42.google.bigtable.admin.v2.ModifyColumnFamiliesRequest.ModificationB\x03\xe0\x41\x02\x1a\xa5\x01\n\x0cModification\x12\n\n\x02id\x18\x01 \x01(\t\x12\x38\n\x06\x63reate\x18\x02 \x01(\x0b\x32&.google.bigtable.admin.v2.ColumnFamilyH\x00\x12\x38\n\x06update\x18\x03 \x01(\x0b\x32&.google.bigtable.admin.v2.ColumnFamilyH\x00\x12\x0e\n\x04\x64rop\x18\x04 \x01(\x08H\x00\x42\x05\n\x03mod"V\n\x1fGenerateConsistencyTokenRequest\x12\x33\n\x04name\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1d\x62igtable.googleapis.com/Table"=\n GenerateConsistencyTokenResponse\x12\x19\n\x11\x63onsistency_token\x18\x01 \x01(\t"n\n\x17\x43heckConsistencyRequest\x12\x33\n\x04name\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1d\x62igtable.googleapis.com/Table\x12\x1e\n\x11\x63onsistency_token\x18\x02 \x01(\tB\x03\xe0\x41\x02".\n\x18\x43heckConsistencyResponse\x12\x12\n\nconsistent\x18\x01 \x01(\x08"\xdc\x01\n\x14SnapshotTableRequest\x12\x33\n\x04name\x18\x01 \x01(\tB%\xe0\x41\x02\xfa\x41\x1f\n\x1d\x62igtable.googleapis.com/Table\x12\x38\n\x07\x63luster\x18\x02 \x01(\tB\'\xe0\x41\x02\xfa\x41!\n\x1f\x62igtable.googleapis.com/Cluster\x12\x18\n\x0bsnapshot_id\x18\x03 \x01(\tB\x03\xe0\x41\x02\x12&\n\x03ttl\x18\x04 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x13\n\x0b\x64\x65scription\x18\x05 \x01(\t"L\n\x12GetSnapshotRequest\x12\x36\n\x04name\x18\x01 \x01(\tB(\xe0\x41\x02\xfa\x41"\n bigtable.googleapis.com/Snapshot"v\n\x14ListSnapshotsRequest\x12\x37\n\x06parent\x18\x01 \x01(\tB\'\xe0\x41\x02\xfa\x41!\n\x1f\x62igtable.googleapis.com/Cluster\x12\x11\n\tpage_size\x18\x02 \x01(\x05\x12\x12\n\npage_token\x18\x03 \x01(\t"g\n\x15ListSnapshotsResponse\x12\x35\n\tsnapshots\x18\x01 \x03(\x0b\x32".google.bigtable.admin.v2.Snapshot\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t"O\n\x15\x44\x65leteSnapshotRequest\x12\x36\n\x04name\x18\x01 \x01(\tB(\xe0\x41\x02\xfa\x41"\n bigtable.googleapis.com/Snapshot"\xc4\x01\n\x15SnapshotTableMetadata\x12H\n\x10original_request\x18\x01 \x01(\x0b\x32..google.bigtable.admin.v2.SnapshotTableRequest\x12\x30\n\x0crequest_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12/\n\x0b\x66inish_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp"\xd8\x01\n\x1f\x43reateTableFromSnapshotMetadata\x12R\n\x10original_request\x18\x01 \x01(\x0b\x32\x38.google.bigtable.admin.v2.CreateTableFromSnapshotRequest\x12\x30\n\x0crequest_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12/\n\x0b\x66inish_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp"\x9d\x01\n\x13\x43reateBackupRequest\x12\x37\n\x06parent\x18\x01 \x01(\tB\'\xe0\x41\x02\xfa\x41!\n\x1f\x62igtable.googleapis.com/Cluster\x12\x16\n\tbackup_id\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x35\n\x06\x62\x61\x63kup\x18\x03 \x01(\x0b\x32 .google.bigtable.admin.v2.BackupB\x03\xe0\x41\x02"\x98\x01\n\x14\x43reateBackupMetadata\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x14\n\x0csource_table\x18\x02 \x01(\t\x12.\n\nstart_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12,\n\x08\x65nd_time\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.Timestamp"H\n\x10GetBackupRequest\x12\x34\n\x04name\x18\x01 \x01(\tB&\xe0\x41\x02\xfa\x41 \n\x1e\x62igtable.googleapis.com/Backup"\x82\x01\n\x13UpdateBackupRequest\x12\x35\n\x06\x62\x61\x63kup\x18\x01 \x01(\x0b\x32 .google.bigtable.admin.v2.BackupB\x03\xe0\x41\x02\x12\x34\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMaskB\x03\xe0\x41\x02"K\n\x13\x44\x65leteBackupRequest\x12\x34\n\x04name\x18\x01 \x01(\tB&\xe0\x41\x02\xfa\x41 \n\x1e\x62igtable.googleapis.com/Backup"\x96\x01\n\x12ListBackupsRequest\x12\x37\n\x06parent\x18\x01 \x01(\tB\'\xe0\x41\x02\xfa\x41!\n\x1f\x62igtable.googleapis.com/Cluster\x12\x0e\n\x06\x66ilter\x18\x02 \x01(\t\x12\x10\n\x08order_by\x18\x03 \x01(\t\x12\x11\n\tpage_size\x18\x04 \x01(\x05\x12\x12\n\npage_token\x18\x05 \x01(\t"a\n\x13ListBackupsResponse\x12\x31\n\x07\x62\x61\x63kups\x18\x01 \x03(\x0b\x32 .google.bigtable.admin.v2.Backup\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t"S\n\x13RestoreTableRequest\x12\x0e\n\x06parent\x18\x01 \x01(\t\x12\x10\n\x08table_id\x18\x02 \x01(\t\x12\x10\n\x06\x62\x61\x63kup\x18\x03 \x01(\tH\x00\x42\x08\n\x06source"\x98\x02\n\x14RestoreTableMetadata\x12\x0c\n\x04name\x18\x01 \x01(\t\x12@\n\x0bsource_type\x18\x02 \x01(\x0e\x32+.google.bigtable.admin.v2.RestoreSourceType\x12;\n\x0b\x62\x61\x63kup_info\x18\x03 \x01(\x0b\x32$.google.bigtable.admin.v2.BackupInfoH\x00\x12%\n\x1doptimize_table_operation_name\x18\x04 \x01(\t\x12=\n\x08progress\x18\x05 \x01(\x0b\x32+.google.bigtable.admin.v2.OperationProgressB\r\n\x0bsource_info"l\n\x1dOptimizeRestoredTableMetadata\x12\x0c\n\x04name\x18\x01 \x01(\t\x12=\n\x08progress\x18\x02 \x01(\x0b\x32+.google.bigtable.admin.v2.OperationProgress2\xc8$\n\x12\x42igtableTableAdmin\x12\xab\x01\n\x0b\x43reateTable\x12,.google.bigtable.admin.v2.CreateTableRequest\x1a\x1f.google.bigtable.admin.v2.Table"M\x82\xd3\xe4\x93\x02/"*/v2/{parent=projects/*/instances/*}/tables:\x01*\xda\x41\x15parent,table_id,table\x12\x8a\x02\n\x17\x43reateTableFromSnapshot\x12\x38.google.bigtable.admin.v2.CreateTableFromSnapshotRequest\x1a\x1d.google.longrunning.Operation"\x95\x01\x82\xd3\xe4\x93\x02\x42"=/v2/{parent=projects/*/instances/*}/tables:createFromSnapshot:\x01*\xda\x41\x1fparent,table_id,source_snapshot\xca\x41(\n\x05Table\x12\x1f\x43reateTableFromSnapshotMetadata\x12\xa4\x01\n\nListTables\x12+.google.bigtable.admin.v2.ListTablesRequest\x1a,.google.bigtable.admin.v2.ListTablesResponse";\x82\xd3\xe4\x93\x02,\x12*/v2/{parent=projects/*/instances/*}/tables\xda\x41\x06parent\x12\x91\x01\n\x08GetTable\x12).google.bigtable.admin.v2.GetTableRequest\x1a\x1f.google.bigtable.admin.v2.Table"9\x82\xd3\xe4\x93\x02,\x12*/v2/{name=projects/*/instances/*/tables/*}\xda\x41\x04name\x12\x8e\x01\n\x0b\x44\x65leteTable\x12,.google.bigtable.admin.v2.DeleteTableRequest\x1a\x16.google.protobuf.Empty"9\x82\xd3\xe4\x93\x02,**/v2/{name=projects/*/instances/*/tables/*}\xda\x41\x04name\x12\xcf\x01\n\x14ModifyColumnFamilies\x12\x35.google.bigtable.admin.v2.ModifyColumnFamiliesRequest\x1a\x1f.google.bigtable.admin.v2.Table"_\x82\xd3\xe4\x93\x02\x44"?/v2/{name=projects/*/instances/*/tables/*}:modifyColumnFamilies:\x01*\xda\x41\x12name,modifications\x12\x99\x01\n\x0c\x44ropRowRange\x12-.google.bigtable.admin.v2.DropRowRangeRequest\x1a\x16.google.protobuf.Empty"B\x82\xd3\xe4\x93\x02<"7/v2/{name=projects/*/instances/*/tables/*}:dropRowRange:\x01*\x12\xe8\x01\n\x18GenerateConsistencyToken\x12\x39.google.bigtable.admin.v2.GenerateConsistencyTokenRequest\x1a:.google.bigtable.admin.v2.GenerateConsistencyTokenResponse"U\x82\xd3\xe4\x93\x02H"C/v2/{name=projects/*/instances/*/tables/*}:generateConsistencyToken:\x01*\xda\x41\x04name\x12\xda\x01\n\x10\x43heckConsistency\x12\x31.google.bigtable.admin.v2.CheckConsistencyRequest\x1a\x32.google.bigtable.admin.v2.CheckConsistencyResponse"_\x82\xd3\xe4\x93\x02@";/v2/{name=projects/*/instances/*/tables/*}:checkConsistency:\x01*\xda\x41\x16name,consistency_token\x12\xea\x01\n\rSnapshotTable\x12..google.bigtable.admin.v2.SnapshotTableRequest\x1a\x1d.google.longrunning.Operation"\x89\x01\x82\xd3\xe4\x93\x02\x38"3/v2/{name=projects/*/instances/*/tables/*}:snapshot:\x01*\xda\x41$name,cluster,snapshot_id,description\xca\x41!\n\x08Snapshot\x12\x15SnapshotTableMetadata\x12\xa8\x01\n\x0bGetSnapshot\x12,.google.bigtable.admin.v2.GetSnapshotRequest\x1a".google.bigtable.admin.v2.Snapshot"G\x82\xd3\xe4\x93\x02:\x12\x38/v2/{name=projects/*/instances/*/clusters/*/snapshots/*}\xda\x41\x04name\x12\xbb\x01\n\rListSnapshots\x12..google.bigtable.admin.v2.ListSnapshotsRequest\x1a/.google.bigtable.admin.v2.ListSnapshotsResponse"I\x82\xd3\xe4\x93\x02:\x12\x38/v2/{parent=projects/*/instances/*/clusters/*}/snapshots\xda\x41\x06parent\x12\xa2\x01\n\x0e\x44\x65leteSnapshot\x12/.google.bigtable.admin.v2.DeleteSnapshotRequest\x1a\x16.google.protobuf.Empty"G\x82\xd3\xe4\x93\x02:*8/v2/{name=projects/*/instances/*/clusters/*/snapshots/*}\xda\x41\x04name\x12\xe0\x01\n\x0c\x43reateBackup\x12-.google.bigtable.admin.v2.CreateBackupRequest\x1a\x1d.google.longrunning.Operation"\x81\x01\x82\xd3\xe4\x93\x02@"6/v2/{parent=projects/*/instances/*/clusters/*}/backups:\x06\x62\x61\x63kup\xca\x41\x1e\n\x06\x42\x61\x63kup\x12\x14\x43reateBackupMetadata\xda\x41\x17parent,backup_id,backup\x12\xa0\x01\n\tGetBackup\x12*.google.bigtable.admin.v2.GetBackupRequest\x1a .google.bigtable.admin.v2.Backup"E\x82\xd3\xe4\x93\x02\x38\x12\x36/v2/{name=projects/*/instances/*/clusters/*/backups/*}\xda\x41\x04name\x12\xc3\x01\n\x0cUpdateBackup\x12-.google.bigtable.admin.v2.UpdateBackupRequest\x1a .google.bigtable.admin.v2.Backup"b\x82\xd3\xe4\x93\x02G2=/v2/{backup.name=projects/*/instances/*/clusters/*/backups/*}:\x06\x62\x61\x63kup\xda\x41\x12\x62\x61\x63kup,update_mask\x12\x9c\x01\n\x0c\x44\x65leteBackup\x12-.google.bigtable.admin.v2.DeleteBackupRequest\x1a\x16.google.protobuf.Empty"E\x82\xd3\xe4\x93\x02\x38*6/v2/{name=projects/*/instances/*/clusters/*/backups/*}\xda\x41\x04name\x12\xb3\x01\n\x0bListBackups\x12,.google.bigtable.admin.v2.ListBackupsRequest\x1a-.google.bigtable.admin.v2.ListBackupsResponse"G\x82\xd3\xe4\x93\x02\x38\x12\x36/v2/{parent=projects/*/instances/*/clusters/*}/backups\xda\x41\x06parent\x12\xbb\x01\n\x0cRestoreTable\x12-.google.bigtable.admin.v2.RestoreTableRequest\x1a\x1d.google.longrunning.Operation"]\x82\xd3\xe4\x93\x02\x37"2/v2/{parent=projects/*/instances/*}/tables:restore:\x01*\xca\x41\x1d\n\x05Table\x12\x14RestoreTableMetadata\x12\x9c\x01\n\x0cGetIamPolicy\x12".google.iam.v1.GetIamPolicyRequest\x1a\x15.google.iam.v1.Policy"Q\x82\xd3\xe4\x93\x02@";/v2/{resource=projects/*/instances/*/tables/*}:getIamPolicy:\x01*\xda\x41\x08resource\x12\xf3\x01\n\x0cSetIamPolicy\x12".google.iam.v1.SetIamPolicyRequest\x1a\x15.google.iam.v1.Policy"\xa7\x01\x82\xd3\xe4\x93\x02\x8e\x01";/v2/{resource=projects/*/instances/*/tables/*}:setIamPolicy:\x01*ZL"G/v2/{resource=projects/*/instances/*/clusters/*/backups/*}:setIamPolicy:\x01*\xda\x41\x0fresource,policy\x12\xa4\x02\n\x12TestIamPermissions\x12(.google.iam.v1.TestIamPermissionsRequest\x1a).google.iam.v1.TestIamPermissionsResponse"\xb8\x01\x82\xd3\xe4\x93\x02\x9a\x01"A/v2/{resource=projects/*/instances/*/tables/*}:testIamPermissions:\x01*ZR"M/v2/{resource=projects/*/instances/*/clusters/*/backups/*}:testIamPermissions:\x01*\xda\x41\x14resource,permissions\x1a\xde\x02\xca\x41\x1c\x62igtableadmin.googleapis.com\xd2\x41\xbb\x02https://www.googleapis.com/auth/bigtable.admin,https://www.googleapis.com/auth/bigtable.admin.table,https://www.googleapis.com/auth/cloud-bigtable.admin,https://www.googleapis.com/auth/cloud-bigtable.admin.table,https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/cloud-platform.read-onlyB\xdf\x01\n\x1c\x63om.google.bigtable.admin.v2B\x17\x42igtableTableAdminProtoP\x01Z=google.golang.org/genproto/googleapis/bigtable/admin/v2;admin\xaa\x02\x1eGoogle.Cloud.Bigtable.Admin.V2\xca\x02\x1eGoogle\\Cloud\\Bigtable\\Admin\\V2\xea\x02"Google::Cloud::Bigtable::Admin::V2b\x06proto3',
- dependencies=[
- google_dot_api_dot_annotations__pb2.DESCRIPTOR,
- google_dot_api_dot_client__pb2.DESCRIPTOR,
- google_dot_api_dot_field__behavior__pb2.DESCRIPTOR,
- google_dot_api_dot_resource__pb2.DESCRIPTOR,
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_common__pb2.DESCRIPTOR,
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_table__pb2.DESCRIPTOR,
- google_dot_iam_dot_v1_dot_iam__policy__pb2.DESCRIPTOR,
- google_dot_iam_dot_v1_dot_policy__pb2.DESCRIPTOR,
- google_dot_longrunning_dot_operations__pb2.DESCRIPTOR,
- google_dot_protobuf_dot_duration__pb2.DESCRIPTOR,
- google_dot_protobuf_dot_empty__pb2.DESCRIPTOR,
- google_dot_protobuf_dot_field__mask__pb2.DESCRIPTOR,
- google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR,
- ],
-)
-
-
-_CREATETABLEREQUEST_SPLIT = _descriptor.Descriptor(
- name="Split",
- full_name="google.bigtable.admin.v2.CreateTableRequest.Split",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="key",
- full_name="google.bigtable.admin.v2.CreateTableRequest.Split.key",
- index=0,
- number=1,
- type=12,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"",
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=767,
- serialized_end=787,
-)
-
-_CREATETABLEREQUEST = _descriptor.Descriptor(
- name="CreateTableRequest",
- full_name="google.bigtable.admin.v2.CreateTableRequest",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="parent",
- full_name="google.bigtable.admin.v2.CreateTableRequest.parent",
- index=0,
- number=1,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b'\340A\002\372A"\n bigtable.googleapis.com/Instance',
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="table_id",
- full_name="google.bigtable.admin.v2.CreateTableRequest.table_id",
- index=1,
- number=2,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\002",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="table",
- full_name="google.bigtable.admin.v2.CreateTableRequest.table",
- index=2,
- number=3,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\002",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="initial_splits",
- full_name="google.bigtable.admin.v2.CreateTableRequest.initial_splits",
- index=3,
- number=4,
- type=11,
- cpp_type=10,
- label=3,
- has_default_value=False,
- default_value=[],
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[_CREATETABLEREQUEST_SPLIT,],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=535,
- serialized_end=787,
-)
-
-
-_CREATETABLEFROMSNAPSHOTREQUEST = _descriptor.Descriptor(
- name="CreateTableFromSnapshotRequest",
- full_name="google.bigtable.admin.v2.CreateTableFromSnapshotRequest",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="parent",
- full_name="google.bigtable.admin.v2.CreateTableFromSnapshotRequest.parent",
- index=0,
- number=1,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b'\340A\002\372A"\n bigtable.googleapis.com/Instance',
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="table_id",
- full_name="google.bigtable.admin.v2.CreateTableFromSnapshotRequest.table_id",
- index=1,
- number=2,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\002",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="source_snapshot",
- full_name="google.bigtable.admin.v2.CreateTableFromSnapshotRequest.source_snapshot",
- index=2,
- number=3,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b'\340A\002\372A"\n bigtable.googleapis.com/Snapshot',
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=790,
- serialized_end=970,
-)
-
-
-_DROPROWRANGEREQUEST = _descriptor.Descriptor(
- name="DropRowRangeRequest",
- full_name="google.bigtable.admin.v2.DropRowRangeRequest",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="name",
- full_name="google.bigtable.admin.v2.DropRowRangeRequest.name",
- index=0,
- number=1,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\002\372A\037\n\035bigtable.googleapis.com/Table",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="row_key_prefix",
- full_name="google.bigtable.admin.v2.DropRowRangeRequest.row_key_prefix",
- index=1,
- number=2,
- type=12,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"",
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="delete_all_data_from_table",
- full_name="google.bigtable.admin.v2.DropRowRangeRequest.delete_all_data_from_table",
- index=2,
- number=3,
- type=8,
- cpp_type=7,
- label=1,
- has_default_value=False,
- default_value=False,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[
- _descriptor.OneofDescriptor(
- name="target",
- full_name="google.bigtable.admin.v2.DropRowRangeRequest.target",
- index=0,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[],
- ),
- ],
- serialized_start=973,
- serialized_end=1121,
-)
-
-
-_LISTTABLESREQUEST = _descriptor.Descriptor(
- name="ListTablesRequest",
- full_name="google.bigtable.admin.v2.ListTablesRequest",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="parent",
- full_name="google.bigtable.admin.v2.ListTablesRequest.parent",
- index=0,
- number=1,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b'\340A\002\372A"\n bigtable.googleapis.com/Instance',
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="view",
- full_name="google.bigtable.admin.v2.ListTablesRequest.view",
- index=1,
- number=2,
- type=14,
- cpp_type=8,
- label=1,
- has_default_value=False,
- default_value=0,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="page_size",
- full_name="google.bigtable.admin.v2.ListTablesRequest.page_size",
- index=2,
- number=4,
- type=5,
- cpp_type=1,
- label=1,
- has_default_value=False,
- default_value=0,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="page_token",
- full_name="google.bigtable.admin.v2.ListTablesRequest.page_token",
- index=3,
- number=3,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=1124,
- serialized_end=1292,
-)
-
-
-_LISTTABLESRESPONSE = _descriptor.Descriptor(
- name="ListTablesResponse",
- full_name="google.bigtable.admin.v2.ListTablesResponse",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="tables",
- full_name="google.bigtable.admin.v2.ListTablesResponse.tables",
- index=0,
- number=1,
- type=11,
- cpp_type=10,
- label=3,
- has_default_value=False,
- default_value=[],
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="next_page_token",
- full_name="google.bigtable.admin.v2.ListTablesResponse.next_page_token",
- index=1,
- number=2,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=1294,
- serialized_end=1388,
-)
-
-
-_GETTABLEREQUEST = _descriptor.Descriptor(
- name="GetTableRequest",
- full_name="google.bigtable.admin.v2.GetTableRequest",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="name",
- full_name="google.bigtable.admin.v2.GetTableRequest.name",
- index=0,
- number=1,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\002\372A\037\n\035bigtable.googleapis.com/Table",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="view",
- full_name="google.bigtable.admin.v2.GetTableRequest.view",
- index=1,
- number=2,
- type=14,
- cpp_type=8,
- label=1,
- has_default_value=False,
- default_value=0,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=1390,
- serialized_end=1512,
-)
-
-
-_DELETETABLEREQUEST = _descriptor.Descriptor(
- name="DeleteTableRequest",
- full_name="google.bigtable.admin.v2.DeleteTableRequest",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="name",
- full_name="google.bigtable.admin.v2.DeleteTableRequest.name",
- index=0,
- number=1,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\002\372A\037\n\035bigtable.googleapis.com/Table",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=1514,
- serialized_end=1587,
-)
-
-
-_MODIFYCOLUMNFAMILIESREQUEST_MODIFICATION = _descriptor.Descriptor(
- name="Modification",
- full_name="google.bigtable.admin.v2.ModifyColumnFamiliesRequest.Modification",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="id",
- full_name="google.bigtable.admin.v2.ModifyColumnFamiliesRequest.Modification.id",
- index=0,
- number=1,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="create",
- full_name="google.bigtable.admin.v2.ModifyColumnFamiliesRequest.Modification.create",
- index=1,
- number=2,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="update",
- full_name="google.bigtable.admin.v2.ModifyColumnFamiliesRequest.Modification.update",
- index=2,
- number=3,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="drop",
- full_name="google.bigtable.admin.v2.ModifyColumnFamiliesRequest.Modification.drop",
- index=3,
- number=4,
- type=8,
- cpp_type=7,
- label=1,
- has_default_value=False,
- default_value=False,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[
- _descriptor.OneofDescriptor(
- name="mod",
- full_name="google.bigtable.admin.v2.ModifyColumnFamiliesRequest.Modification.mod",
- index=0,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[],
- ),
- ],
- serialized_start=1771,
- serialized_end=1936,
-)
-
-_MODIFYCOLUMNFAMILIESREQUEST = _descriptor.Descriptor(
- name="ModifyColumnFamiliesRequest",
- full_name="google.bigtable.admin.v2.ModifyColumnFamiliesRequest",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="name",
- full_name="google.bigtable.admin.v2.ModifyColumnFamiliesRequest.name",
- index=0,
- number=1,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\002\372A\037\n\035bigtable.googleapis.com/Table",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="modifications",
- full_name="google.bigtable.admin.v2.ModifyColumnFamiliesRequest.modifications",
- index=1,
- number=2,
- type=11,
- cpp_type=10,
- label=3,
- has_default_value=False,
- default_value=[],
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\002",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[_MODIFYCOLUMNFAMILIESREQUEST_MODIFICATION,],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=1590,
- serialized_end=1936,
-)
-
-
-_GENERATECONSISTENCYTOKENREQUEST = _descriptor.Descriptor(
- name="GenerateConsistencyTokenRequest",
- full_name="google.bigtable.admin.v2.GenerateConsistencyTokenRequest",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="name",
- full_name="google.bigtable.admin.v2.GenerateConsistencyTokenRequest.name",
- index=0,
- number=1,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\002\372A\037\n\035bigtable.googleapis.com/Table",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=1938,
- serialized_end=2024,
-)
-
-
-_GENERATECONSISTENCYTOKENRESPONSE = _descriptor.Descriptor(
- name="GenerateConsistencyTokenResponse",
- full_name="google.bigtable.admin.v2.GenerateConsistencyTokenResponse",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="consistency_token",
- full_name="google.bigtable.admin.v2.GenerateConsistencyTokenResponse.consistency_token",
- index=0,
- number=1,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=2026,
- serialized_end=2087,
-)
-
-
-_CHECKCONSISTENCYREQUEST = _descriptor.Descriptor(
- name="CheckConsistencyRequest",
- full_name="google.bigtable.admin.v2.CheckConsistencyRequest",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="name",
- full_name="google.bigtable.admin.v2.CheckConsistencyRequest.name",
- index=0,
- number=1,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\002\372A\037\n\035bigtable.googleapis.com/Table",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="consistency_token",
- full_name="google.bigtable.admin.v2.CheckConsistencyRequest.consistency_token",
- index=1,
- number=2,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\002",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=2089,
- serialized_end=2199,
-)
-
-
-_CHECKCONSISTENCYRESPONSE = _descriptor.Descriptor(
- name="CheckConsistencyResponse",
- full_name="google.bigtable.admin.v2.CheckConsistencyResponse",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="consistent",
- full_name="google.bigtable.admin.v2.CheckConsistencyResponse.consistent",
- index=0,
- number=1,
- type=8,
- cpp_type=7,
- label=1,
- has_default_value=False,
- default_value=False,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=2201,
- serialized_end=2247,
-)
-
-
-_SNAPSHOTTABLEREQUEST = _descriptor.Descriptor(
- name="SnapshotTableRequest",
- full_name="google.bigtable.admin.v2.SnapshotTableRequest",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="name",
- full_name="google.bigtable.admin.v2.SnapshotTableRequest.name",
- index=0,
- number=1,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\002\372A\037\n\035bigtable.googleapis.com/Table",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="cluster",
- full_name="google.bigtable.admin.v2.SnapshotTableRequest.cluster",
- index=1,
- number=2,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\002\372A!\n\037bigtable.googleapis.com/Cluster",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="snapshot_id",
- full_name="google.bigtable.admin.v2.SnapshotTableRequest.snapshot_id",
- index=2,
- number=3,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\002",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="ttl",
- full_name="google.bigtable.admin.v2.SnapshotTableRequest.ttl",
- index=3,
- number=4,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="description",
- full_name="google.bigtable.admin.v2.SnapshotTableRequest.description",
- index=4,
- number=5,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=2250,
- serialized_end=2470,
-)
-
-
-_GETSNAPSHOTREQUEST = _descriptor.Descriptor(
- name="GetSnapshotRequest",
- full_name="google.bigtable.admin.v2.GetSnapshotRequest",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="name",
- full_name="google.bigtable.admin.v2.GetSnapshotRequest.name",
- index=0,
- number=1,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b'\340A\002\372A"\n bigtable.googleapis.com/Snapshot',
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=2472,
- serialized_end=2548,
-)
-
-
-_LISTSNAPSHOTSREQUEST = _descriptor.Descriptor(
- name="ListSnapshotsRequest",
- full_name="google.bigtable.admin.v2.ListSnapshotsRequest",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="parent",
- full_name="google.bigtable.admin.v2.ListSnapshotsRequest.parent",
- index=0,
- number=1,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\002\372A!\n\037bigtable.googleapis.com/Cluster",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="page_size",
- full_name="google.bigtable.admin.v2.ListSnapshotsRequest.page_size",
- index=1,
- number=2,
- type=5,
- cpp_type=1,
- label=1,
- has_default_value=False,
- default_value=0,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="page_token",
- full_name="google.bigtable.admin.v2.ListSnapshotsRequest.page_token",
- index=2,
- number=3,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=2550,
- serialized_end=2668,
-)
-
-
-_LISTSNAPSHOTSRESPONSE = _descriptor.Descriptor(
- name="ListSnapshotsResponse",
- full_name="google.bigtable.admin.v2.ListSnapshotsResponse",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="snapshots",
- full_name="google.bigtable.admin.v2.ListSnapshotsResponse.snapshots",
- index=0,
- number=1,
- type=11,
- cpp_type=10,
- label=3,
- has_default_value=False,
- default_value=[],
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="next_page_token",
- full_name="google.bigtable.admin.v2.ListSnapshotsResponse.next_page_token",
- index=1,
- number=2,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=2670,
- serialized_end=2773,
-)
-
-
-_DELETESNAPSHOTREQUEST = _descriptor.Descriptor(
- name="DeleteSnapshotRequest",
- full_name="google.bigtable.admin.v2.DeleteSnapshotRequest",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="name",
- full_name="google.bigtable.admin.v2.DeleteSnapshotRequest.name",
- index=0,
- number=1,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b'\340A\002\372A"\n bigtable.googleapis.com/Snapshot',
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=2775,
- serialized_end=2854,
-)
-
-
-_SNAPSHOTTABLEMETADATA = _descriptor.Descriptor(
- name="SnapshotTableMetadata",
- full_name="google.bigtable.admin.v2.SnapshotTableMetadata",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="original_request",
- full_name="google.bigtable.admin.v2.SnapshotTableMetadata.original_request",
- index=0,
- number=1,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="request_time",
- full_name="google.bigtable.admin.v2.SnapshotTableMetadata.request_time",
- index=1,
- number=2,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="finish_time",
- full_name="google.bigtable.admin.v2.SnapshotTableMetadata.finish_time",
- index=2,
- number=3,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=2857,
- serialized_end=3053,
-)
-
-
-_CREATETABLEFROMSNAPSHOTMETADATA = _descriptor.Descriptor(
- name="CreateTableFromSnapshotMetadata",
- full_name="google.bigtable.admin.v2.CreateTableFromSnapshotMetadata",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="original_request",
- full_name="google.bigtable.admin.v2.CreateTableFromSnapshotMetadata.original_request",
- index=0,
- number=1,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="request_time",
- full_name="google.bigtable.admin.v2.CreateTableFromSnapshotMetadata.request_time",
- index=1,
- number=2,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="finish_time",
- full_name="google.bigtable.admin.v2.CreateTableFromSnapshotMetadata.finish_time",
- index=2,
- number=3,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=3056,
- serialized_end=3272,
-)
-
-
-_CREATEBACKUPREQUEST = _descriptor.Descriptor(
- name="CreateBackupRequest",
- full_name="google.bigtable.admin.v2.CreateBackupRequest",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="parent",
- full_name="google.bigtable.admin.v2.CreateBackupRequest.parent",
- index=0,
- number=1,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\002\372A!\n\037bigtable.googleapis.com/Cluster",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="backup_id",
- full_name="google.bigtable.admin.v2.CreateBackupRequest.backup_id",
- index=1,
- number=2,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\002",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="backup",
- full_name="google.bigtable.admin.v2.CreateBackupRequest.backup",
- index=2,
- number=3,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\002",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=3275,
- serialized_end=3432,
-)
-
-
-_CREATEBACKUPMETADATA = _descriptor.Descriptor(
- name="CreateBackupMetadata",
- full_name="google.bigtable.admin.v2.CreateBackupMetadata",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="name",
- full_name="google.bigtable.admin.v2.CreateBackupMetadata.name",
- index=0,
- number=1,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="source_table",
- full_name="google.bigtable.admin.v2.CreateBackupMetadata.source_table",
- index=1,
- number=2,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="start_time",
- full_name="google.bigtable.admin.v2.CreateBackupMetadata.start_time",
- index=2,
- number=3,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="end_time",
- full_name="google.bigtable.admin.v2.CreateBackupMetadata.end_time",
- index=3,
- number=4,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=3435,
- serialized_end=3587,
-)
-
-
-_GETBACKUPREQUEST = _descriptor.Descriptor(
- name="GetBackupRequest",
- full_name="google.bigtable.admin.v2.GetBackupRequest",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="name",
- full_name="google.bigtable.admin.v2.GetBackupRequest.name",
- index=0,
- number=1,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\002\372A \n\036bigtable.googleapis.com/Backup",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=3589,
- serialized_end=3661,
-)
-
-
-_UPDATEBACKUPREQUEST = _descriptor.Descriptor(
- name="UpdateBackupRequest",
- full_name="google.bigtable.admin.v2.UpdateBackupRequest",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="backup",
- full_name="google.bigtable.admin.v2.UpdateBackupRequest.backup",
- index=0,
- number=1,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\002",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="update_mask",
- full_name="google.bigtable.admin.v2.UpdateBackupRequest.update_mask",
- index=1,
- number=2,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\002",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=3664,
- serialized_end=3794,
-)
-
-
-_DELETEBACKUPREQUEST = _descriptor.Descriptor(
- name="DeleteBackupRequest",
- full_name="google.bigtable.admin.v2.DeleteBackupRequest",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="name",
- full_name="google.bigtable.admin.v2.DeleteBackupRequest.name",
- index=0,
- number=1,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\002\372A \n\036bigtable.googleapis.com/Backup",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=3796,
- serialized_end=3871,
-)
-
-
-_LISTBACKUPSREQUEST = _descriptor.Descriptor(
- name="ListBackupsRequest",
- full_name="google.bigtable.admin.v2.ListBackupsRequest",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="parent",
- full_name="google.bigtable.admin.v2.ListBackupsRequest.parent",
- index=0,
- number=1,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\002\372A!\n\037bigtable.googleapis.com/Cluster",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="filter",
- full_name="google.bigtable.admin.v2.ListBackupsRequest.filter",
- index=1,
- number=2,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="order_by",
- full_name="google.bigtable.admin.v2.ListBackupsRequest.order_by",
- index=2,
- number=3,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="page_size",
- full_name="google.bigtable.admin.v2.ListBackupsRequest.page_size",
- index=3,
- number=4,
- type=5,
- cpp_type=1,
- label=1,
- has_default_value=False,
- default_value=0,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="page_token",
- full_name="google.bigtable.admin.v2.ListBackupsRequest.page_token",
- index=4,
- number=5,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=3874,
- serialized_end=4024,
-)
-
-
-_LISTBACKUPSRESPONSE = _descriptor.Descriptor(
- name="ListBackupsResponse",
- full_name="google.bigtable.admin.v2.ListBackupsResponse",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="backups",
- full_name="google.bigtable.admin.v2.ListBackupsResponse.backups",
- index=0,
- number=1,
- type=11,
- cpp_type=10,
- label=3,
- has_default_value=False,
- default_value=[],
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="next_page_token",
- full_name="google.bigtable.admin.v2.ListBackupsResponse.next_page_token",
- index=1,
- number=2,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=4026,
- serialized_end=4123,
-)
-
-
-_RESTORETABLEREQUEST = _descriptor.Descriptor(
- name="RestoreTableRequest",
- full_name="google.bigtable.admin.v2.RestoreTableRequest",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="parent",
- full_name="google.bigtable.admin.v2.RestoreTableRequest.parent",
- index=0,
- number=1,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="table_id",
- full_name="google.bigtable.admin.v2.RestoreTableRequest.table_id",
- index=1,
- number=2,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="backup",
- full_name="google.bigtable.admin.v2.RestoreTableRequest.backup",
- index=2,
- number=3,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[
- _descriptor.OneofDescriptor(
- name="source",
- full_name="google.bigtable.admin.v2.RestoreTableRequest.source",
- index=0,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[],
- ),
- ],
- serialized_start=4125,
- serialized_end=4208,
-)
-
-
-_RESTORETABLEMETADATA = _descriptor.Descriptor(
- name="RestoreTableMetadata",
- full_name="google.bigtable.admin.v2.RestoreTableMetadata",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="name",
- full_name="google.bigtable.admin.v2.RestoreTableMetadata.name",
- index=0,
- number=1,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="source_type",
- full_name="google.bigtable.admin.v2.RestoreTableMetadata.source_type",
- index=1,
- number=2,
- type=14,
- cpp_type=8,
- label=1,
- has_default_value=False,
- default_value=0,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="backup_info",
- full_name="google.bigtable.admin.v2.RestoreTableMetadata.backup_info",
- index=2,
- number=3,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="optimize_table_operation_name",
- full_name="google.bigtable.admin.v2.RestoreTableMetadata.optimize_table_operation_name",
- index=3,
- number=4,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="progress",
- full_name="google.bigtable.admin.v2.RestoreTableMetadata.progress",
- index=4,
- number=5,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[
- _descriptor.OneofDescriptor(
- name="source_info",
- full_name="google.bigtable.admin.v2.RestoreTableMetadata.source_info",
- index=0,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[],
- ),
- ],
- serialized_start=4211,
- serialized_end=4491,
-)
-
-
-_OPTIMIZERESTOREDTABLEMETADATA = _descriptor.Descriptor(
- name="OptimizeRestoredTableMetadata",
- full_name="google.bigtable.admin.v2.OptimizeRestoredTableMetadata",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="name",
- full_name="google.bigtable.admin.v2.OptimizeRestoredTableMetadata.name",
- index=0,
- number=1,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="progress",
- full_name="google.bigtable.admin.v2.OptimizeRestoredTableMetadata.progress",
- index=1,
- number=2,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=4493,
- serialized_end=4601,
-)
-
-_CREATETABLEREQUEST_SPLIT.containing_type = _CREATETABLEREQUEST
-_CREATETABLEREQUEST.fields_by_name[
- "table"
-].message_type = (
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_table__pb2._TABLE
-)
-_CREATETABLEREQUEST.fields_by_name[
- "initial_splits"
-].message_type = _CREATETABLEREQUEST_SPLIT
-_DROPROWRANGEREQUEST.oneofs_by_name["target"].fields.append(
- _DROPROWRANGEREQUEST.fields_by_name["row_key_prefix"]
-)
-_DROPROWRANGEREQUEST.fields_by_name[
- "row_key_prefix"
-].containing_oneof = _DROPROWRANGEREQUEST.oneofs_by_name["target"]
-_DROPROWRANGEREQUEST.oneofs_by_name["target"].fields.append(
- _DROPROWRANGEREQUEST.fields_by_name["delete_all_data_from_table"]
-)
-_DROPROWRANGEREQUEST.fields_by_name[
- "delete_all_data_from_table"
-].containing_oneof = _DROPROWRANGEREQUEST.oneofs_by_name["target"]
-_LISTTABLESREQUEST.fields_by_name[
- "view"
-].enum_type = (
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_table__pb2._TABLE_VIEW
-)
-_LISTTABLESRESPONSE.fields_by_name[
- "tables"
-].message_type = (
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_table__pb2._TABLE
-)
-_GETTABLEREQUEST.fields_by_name[
- "view"
-].enum_type = (
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_table__pb2._TABLE_VIEW
-)
-_MODIFYCOLUMNFAMILIESREQUEST_MODIFICATION.fields_by_name[
- "create"
-].message_type = (
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_table__pb2._COLUMNFAMILY
-)
-_MODIFYCOLUMNFAMILIESREQUEST_MODIFICATION.fields_by_name[
- "update"
-].message_type = (
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_table__pb2._COLUMNFAMILY
-)
-_MODIFYCOLUMNFAMILIESREQUEST_MODIFICATION.containing_type = _MODIFYCOLUMNFAMILIESREQUEST
-_MODIFYCOLUMNFAMILIESREQUEST_MODIFICATION.oneofs_by_name["mod"].fields.append(
- _MODIFYCOLUMNFAMILIESREQUEST_MODIFICATION.fields_by_name["create"]
-)
-_MODIFYCOLUMNFAMILIESREQUEST_MODIFICATION.fields_by_name[
- "create"
-].containing_oneof = _MODIFYCOLUMNFAMILIESREQUEST_MODIFICATION.oneofs_by_name["mod"]
-_MODIFYCOLUMNFAMILIESREQUEST_MODIFICATION.oneofs_by_name["mod"].fields.append(
- _MODIFYCOLUMNFAMILIESREQUEST_MODIFICATION.fields_by_name["update"]
-)
-_MODIFYCOLUMNFAMILIESREQUEST_MODIFICATION.fields_by_name[
- "update"
-].containing_oneof = _MODIFYCOLUMNFAMILIESREQUEST_MODIFICATION.oneofs_by_name["mod"]
-_MODIFYCOLUMNFAMILIESREQUEST_MODIFICATION.oneofs_by_name["mod"].fields.append(
- _MODIFYCOLUMNFAMILIESREQUEST_MODIFICATION.fields_by_name["drop"]
-)
-_MODIFYCOLUMNFAMILIESREQUEST_MODIFICATION.fields_by_name[
- "drop"
-].containing_oneof = _MODIFYCOLUMNFAMILIESREQUEST_MODIFICATION.oneofs_by_name["mod"]
-_MODIFYCOLUMNFAMILIESREQUEST.fields_by_name[
- "modifications"
-].message_type = _MODIFYCOLUMNFAMILIESREQUEST_MODIFICATION
-_SNAPSHOTTABLEREQUEST.fields_by_name[
- "ttl"
-].message_type = google_dot_protobuf_dot_duration__pb2._DURATION
-_LISTSNAPSHOTSRESPONSE.fields_by_name[
- "snapshots"
-].message_type = (
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_table__pb2._SNAPSHOT
-)
-_SNAPSHOTTABLEMETADATA.fields_by_name[
- "original_request"
-].message_type = _SNAPSHOTTABLEREQUEST
-_SNAPSHOTTABLEMETADATA.fields_by_name[
- "request_time"
-].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP
-_SNAPSHOTTABLEMETADATA.fields_by_name[
- "finish_time"
-].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP
-_CREATETABLEFROMSNAPSHOTMETADATA.fields_by_name[
- "original_request"
-].message_type = _CREATETABLEFROMSNAPSHOTREQUEST
-_CREATETABLEFROMSNAPSHOTMETADATA.fields_by_name[
- "request_time"
-].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP
-_CREATETABLEFROMSNAPSHOTMETADATA.fields_by_name[
- "finish_time"
-].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP
-_CREATEBACKUPREQUEST.fields_by_name[
- "backup"
-].message_type = (
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_table__pb2._BACKUP
-)
-_CREATEBACKUPMETADATA.fields_by_name[
- "start_time"
-].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP
-_CREATEBACKUPMETADATA.fields_by_name[
- "end_time"
-].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP
-_UPDATEBACKUPREQUEST.fields_by_name[
- "backup"
-].message_type = (
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_table__pb2._BACKUP
-)
-_UPDATEBACKUPREQUEST.fields_by_name[
- "update_mask"
-].message_type = google_dot_protobuf_dot_field__mask__pb2._FIELDMASK
-_LISTBACKUPSRESPONSE.fields_by_name[
- "backups"
-].message_type = (
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_table__pb2._BACKUP
-)
-_RESTORETABLEREQUEST.oneofs_by_name["source"].fields.append(
- _RESTORETABLEREQUEST.fields_by_name["backup"]
-)
-_RESTORETABLEREQUEST.fields_by_name[
- "backup"
-].containing_oneof = _RESTORETABLEREQUEST.oneofs_by_name["source"]
-_RESTORETABLEMETADATA.fields_by_name[
- "source_type"
-].enum_type = (
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_table__pb2._RESTORESOURCETYPE
-)
-_RESTORETABLEMETADATA.fields_by_name[
- "backup_info"
-].message_type = (
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_table__pb2._BACKUPINFO
-)
-_RESTORETABLEMETADATA.fields_by_name[
- "progress"
-].message_type = (
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_common__pb2._OPERATIONPROGRESS
-)
-_RESTORETABLEMETADATA.oneofs_by_name["source_info"].fields.append(
- _RESTORETABLEMETADATA.fields_by_name["backup_info"]
-)
-_RESTORETABLEMETADATA.fields_by_name[
- "backup_info"
-].containing_oneof = _RESTORETABLEMETADATA.oneofs_by_name["source_info"]
-_OPTIMIZERESTOREDTABLEMETADATA.fields_by_name[
- "progress"
-].message_type = (
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_common__pb2._OPERATIONPROGRESS
-)
-DESCRIPTOR.message_types_by_name["CreateTableRequest"] = _CREATETABLEREQUEST
-DESCRIPTOR.message_types_by_name[
- "CreateTableFromSnapshotRequest"
-] = _CREATETABLEFROMSNAPSHOTREQUEST
-DESCRIPTOR.message_types_by_name["DropRowRangeRequest"] = _DROPROWRANGEREQUEST
-DESCRIPTOR.message_types_by_name["ListTablesRequest"] = _LISTTABLESREQUEST
-DESCRIPTOR.message_types_by_name["ListTablesResponse"] = _LISTTABLESRESPONSE
-DESCRIPTOR.message_types_by_name["GetTableRequest"] = _GETTABLEREQUEST
-DESCRIPTOR.message_types_by_name["DeleteTableRequest"] = _DELETETABLEREQUEST
-DESCRIPTOR.message_types_by_name[
- "ModifyColumnFamiliesRequest"
-] = _MODIFYCOLUMNFAMILIESREQUEST
-DESCRIPTOR.message_types_by_name[
- "GenerateConsistencyTokenRequest"
-] = _GENERATECONSISTENCYTOKENREQUEST
-DESCRIPTOR.message_types_by_name[
- "GenerateConsistencyTokenResponse"
-] = _GENERATECONSISTENCYTOKENRESPONSE
-DESCRIPTOR.message_types_by_name["CheckConsistencyRequest"] = _CHECKCONSISTENCYREQUEST
-DESCRIPTOR.message_types_by_name["CheckConsistencyResponse"] = _CHECKCONSISTENCYRESPONSE
-DESCRIPTOR.message_types_by_name["SnapshotTableRequest"] = _SNAPSHOTTABLEREQUEST
-DESCRIPTOR.message_types_by_name["GetSnapshotRequest"] = _GETSNAPSHOTREQUEST
-DESCRIPTOR.message_types_by_name["ListSnapshotsRequest"] = _LISTSNAPSHOTSREQUEST
-DESCRIPTOR.message_types_by_name["ListSnapshotsResponse"] = _LISTSNAPSHOTSRESPONSE
-DESCRIPTOR.message_types_by_name["DeleteSnapshotRequest"] = _DELETESNAPSHOTREQUEST
-DESCRIPTOR.message_types_by_name["SnapshotTableMetadata"] = _SNAPSHOTTABLEMETADATA
-DESCRIPTOR.message_types_by_name[
- "CreateTableFromSnapshotMetadata"
-] = _CREATETABLEFROMSNAPSHOTMETADATA
-DESCRIPTOR.message_types_by_name["CreateBackupRequest"] = _CREATEBACKUPREQUEST
-DESCRIPTOR.message_types_by_name["CreateBackupMetadata"] = _CREATEBACKUPMETADATA
-DESCRIPTOR.message_types_by_name["GetBackupRequest"] = _GETBACKUPREQUEST
-DESCRIPTOR.message_types_by_name["UpdateBackupRequest"] = _UPDATEBACKUPREQUEST
-DESCRIPTOR.message_types_by_name["DeleteBackupRequest"] = _DELETEBACKUPREQUEST
-DESCRIPTOR.message_types_by_name["ListBackupsRequest"] = _LISTBACKUPSREQUEST
-DESCRIPTOR.message_types_by_name["ListBackupsResponse"] = _LISTBACKUPSRESPONSE
-DESCRIPTOR.message_types_by_name["RestoreTableRequest"] = _RESTORETABLEREQUEST
-DESCRIPTOR.message_types_by_name["RestoreTableMetadata"] = _RESTORETABLEMETADATA
-DESCRIPTOR.message_types_by_name[
- "OptimizeRestoredTableMetadata"
-] = _OPTIMIZERESTOREDTABLEMETADATA
-_sym_db.RegisterFileDescriptor(DESCRIPTOR)
-
-CreateTableRequest = _reflection.GeneratedProtocolMessageType(
- "CreateTableRequest",
- (_message.Message,),
- {
- "Split": _reflection.GeneratedProtocolMessageType(
- "Split",
- (_message.Message,),
- {
- "DESCRIPTOR": _CREATETABLEREQUEST_SPLIT,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_table_admin_pb2",
- "__doc__": """An initial split point for a newly created table.
-
- Attributes:
- key:
- Row key to use as an initial tablet boundary.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.CreateTableRequest.Split)
- },
- ),
- "DESCRIPTOR": _CREATETABLEREQUEST,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_table_admin_pb2",
- "__doc__": """Request message for [google.bigtable.admin.v2.BigtableTableAdmin.Creat
- eTable][google.bigtable.admin.v2.BigtableTableAdmin.CreateTable]
-
- Attributes:
- parent:
- Required. The unique name of the instance in which to create
- the table. Values are of the form
- ``projects/{project}/instances/{instance}``.
- table_id:
- Required. The name by which the new table should be referred
- to within the parent instance, e.g., ``foobar`` rather than
- ``{parent}/tables/foobar``. Maximum 50 characters.
- table:
- Required. The Table to create.
- initial_splits:
- The optional list of row keys that will be used to initially
- split the table into several tablets (tablets are similar to
- HBase regions). Given two split keys, ``s1`` and ``s2``, three
- tablets will be created, spanning the key ranges: ``[, s1),
- [s1, s2), [s2, )``. Example: - Row keys := ``["a", "apple",
- "custom", "customer_1", "customer_2",`` ``"other", "zz"]``
- - initial_split_keys := ``["apple", "customer_1",
- "customer_2", "other"]`` - Key assignment: - Tablet 1
- ``[, apple) => {"a"}.`` - Tablet 2
- ``[apple, customer_1) => {"apple", "custom"}.`` -
- Tablet 3 ``[customer_1, customer_2) => {"customer_1"}.`` -
- Tablet 4 ``[customer_2, other) => {"customer_2"}.`` -
- Tablet 5 ``[other, ) => {"other", "zz"}.``
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.CreateTableRequest)
- },
-)
-_sym_db.RegisterMessage(CreateTableRequest)
-_sym_db.RegisterMessage(CreateTableRequest.Split)
-
-CreateTableFromSnapshotRequest = _reflection.GeneratedProtocolMessageType(
- "CreateTableFromSnapshotRequest",
- (_message.Message,),
- {
- "DESCRIPTOR": _CREATETABLEFROMSNAPSHOTREQUEST,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_table_admin_pb2",
- "__doc__": """Request message for [google.bigtable.admin.v2.BigtableTableAdmin.Creat
- eTableFromSnapshot][google.bigtable.admin.v2.BigtableTableAdmin.Create
- TableFromSnapshot] Note: This is a private alpha release of Cloud
- Bigtable snapshots. This feature is not currently available to most
- Cloud Bigtable customers. This feature might be changed in backward-
- incompatible ways and is not recommended for production use. It is not
- subject to any SLA or deprecation policy.
-
- Attributes:
- parent:
- Required. The unique name of the instance in which to create
- the table. Values are of the form
- ``projects/{project}/instances/{instance}``.
- table_id:
- Required. The name by which the new table should be referred
- to within the parent instance, e.g., ``foobar`` rather than
- ``{parent}/tables/foobar``.
- source_snapshot:
- Required. The unique name of the snapshot from which to
- restore the table. The snapshot and the table must be in the
- same instance. Values are of the form ``projects/{project}/ins
- tances/{instance}/clusters/{cluster}/snapshots/{snapshot}``.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.CreateTableFromSnapshotRequest)
- },
-)
-_sym_db.RegisterMessage(CreateTableFromSnapshotRequest)
-
-DropRowRangeRequest = _reflection.GeneratedProtocolMessageType(
- "DropRowRangeRequest",
- (_message.Message,),
- {
- "DESCRIPTOR": _DROPROWRANGEREQUEST,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_table_admin_pb2",
- "__doc__": """Request message for [google.bigtable.admin.v2.BigtableTableAdmin.DropR
- owRange][google.bigtable.admin.v2.BigtableTableAdmin.DropRowRange]
-
- Attributes:
- name:
- Required. The unique name of the table on which to drop a
- range of rows. Values are of the form
- ``projects/{project}/instances/{instance}/tables/{table}``.
- target:
- Delete all rows or by prefix.
- row_key_prefix:
- Delete all rows that start with this row key prefix. Prefix
- cannot be zero length.
- delete_all_data_from_table:
- Delete all rows in the table. Setting this to false is a no-
- op.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.DropRowRangeRequest)
- },
-)
-_sym_db.RegisterMessage(DropRowRangeRequest)
-
-ListTablesRequest = _reflection.GeneratedProtocolMessageType(
- "ListTablesRequest",
- (_message.Message,),
- {
- "DESCRIPTOR": _LISTTABLESREQUEST,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_table_admin_pb2",
- "__doc__": """Request message for [google.bigtable.admin.v2.BigtableTableAdmin.ListT
- ables][google.bigtable.admin.v2.BigtableTableAdmin.ListTables]
-
- Attributes:
- parent:
- Required. The unique name of the instance for which tables
- should be listed. Values are of the form
- ``projects/{project}/instances/{instance}``.
- view:
- The view to be applied to the returned tables’ fields. Only
- NAME_ONLY view (default) and REPLICATION_VIEW are supported.
- page_size:
- Maximum number of results per page. A page_size of zero lets
- the server choose the number of items to return. A page_size
- which is strictly positive will return at most that many
- items. A negative page_size will cause an error. Following
- the first request, subsequent paginated calls are not required
- to pass a page_size. If a page_size is set in subsequent
- calls, it must match the page_size given in the first request.
- page_token:
- The value of ``next_page_token`` returned by a previous call.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.ListTablesRequest)
- },
-)
-_sym_db.RegisterMessage(ListTablesRequest)
-
-ListTablesResponse = _reflection.GeneratedProtocolMessageType(
- "ListTablesResponse",
- (_message.Message,),
- {
- "DESCRIPTOR": _LISTTABLESRESPONSE,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_table_admin_pb2",
- "__doc__": """Response message for [google.bigtable.admin.v2.BigtableTableAdmin.List
- Tables][google.bigtable.admin.v2.BigtableTableAdmin.ListTables]
-
- Attributes:
- tables:
- The tables present in the requested instance.
- next_page_token:
- Set if not all tables could be returned in a single response.
- Pass this value to ``page_token`` in another request to get
- the next page of results.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.ListTablesResponse)
- },
-)
-_sym_db.RegisterMessage(ListTablesResponse)
-
-GetTableRequest = _reflection.GeneratedProtocolMessageType(
- "GetTableRequest",
- (_message.Message,),
- {
- "DESCRIPTOR": _GETTABLEREQUEST,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_table_admin_pb2",
- "__doc__": """Request message for [google.bigtable.admin.v2.BigtableTableAdmin.GetTa
- ble][google.bigtable.admin.v2.BigtableTableAdmin.GetTable]
-
- Attributes:
- name:
- Required. The unique name of the requested table. Values are
- of the form
- ``projects/{project}/instances/{instance}/tables/{table}``.
- view:
- The view to be applied to the returned table’s fields.
- Defaults to ``SCHEMA_VIEW`` if unspecified.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.GetTableRequest)
- },
-)
-_sym_db.RegisterMessage(GetTableRequest)
-
-DeleteTableRequest = _reflection.GeneratedProtocolMessageType(
- "DeleteTableRequest",
- (_message.Message,),
- {
- "DESCRIPTOR": _DELETETABLEREQUEST,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_table_admin_pb2",
- "__doc__": """Request message for [google.bigtable.admin.v2.BigtableTableAdmin.Delet
- eTable][google.bigtable.admin.v2.BigtableTableAdmin.DeleteTable]
-
- Attributes:
- name:
- Required. The unique name of the table to be deleted. Values
- are of the form
- ``projects/{project}/instances/{instance}/tables/{table}``.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.DeleteTableRequest)
- },
-)
-_sym_db.RegisterMessage(DeleteTableRequest)
-
-ModifyColumnFamiliesRequest = _reflection.GeneratedProtocolMessageType(
- "ModifyColumnFamiliesRequest",
- (_message.Message,),
- {
- "Modification": _reflection.GeneratedProtocolMessageType(
- "Modification",
- (_message.Message,),
- {
- "DESCRIPTOR": _MODIFYCOLUMNFAMILIESREQUEST_MODIFICATION,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_table_admin_pb2",
- "__doc__": """A create, update, or delete of a particular column family.
-
- Attributes:
- id:
- The ID of the column family to be modified.
- mod:
- Column familiy modifications.
- create:
- Create a new column family with the specified schema, or fail
- if one already exists with the given ID.
- update:
- Update an existing column family to the specified schema, or
- fail if no column family exists with the given ID.
- drop:
- Drop (delete) the column family with the given ID, or fail if
- no such family exists.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.ModifyColumnFamiliesRequest.Modification)
- },
- ),
- "DESCRIPTOR": _MODIFYCOLUMNFAMILIESREQUEST,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_table_admin_pb2",
- "__doc__": """Request message for [google.bigtable.admin.v2.BigtableTableAdmin.Modif
- yColumnFamilies][google.bigtable.admin.v2.BigtableTableAdmin.ModifyCol
- umnFamilies]
-
- Attributes:
- name:
- Required. The unique name of the table whose families should
- be modified. Values are of the form
- ``projects/{project}/instances/{instance}/tables/{table}``.
- modifications:
- Required. Modifications to be atomically applied to the
- specified table’s families. Entries are applied in order,
- meaning that earlier modifications can be masked by later ones
- (in the case of repeated updates to the same family, for
- example).
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.ModifyColumnFamiliesRequest)
- },
-)
-_sym_db.RegisterMessage(ModifyColumnFamiliesRequest)
-_sym_db.RegisterMessage(ModifyColumnFamiliesRequest.Modification)
-
-GenerateConsistencyTokenRequest = _reflection.GeneratedProtocolMessageType(
- "GenerateConsistencyTokenRequest",
- (_message.Message,),
- {
- "DESCRIPTOR": _GENERATECONSISTENCYTOKENREQUEST,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_table_admin_pb2",
- "__doc__": """Request message for [google.bigtable.admin.v2.BigtableTableAdmin.Gener
- ateConsistencyToken][google.bigtable.admin.v2.BigtableTableAdmin.Gener
- ateConsistencyToken]
-
- Attributes:
- name:
- Required. The unique name of the Table for which to create a
- consistency token. Values are of the form
- ``projects/{project}/instances/{instance}/tables/{table}``.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.GenerateConsistencyTokenRequest)
- },
-)
-_sym_db.RegisterMessage(GenerateConsistencyTokenRequest)
-
-GenerateConsistencyTokenResponse = _reflection.GeneratedProtocolMessageType(
- "GenerateConsistencyTokenResponse",
- (_message.Message,),
- {
- "DESCRIPTOR": _GENERATECONSISTENCYTOKENRESPONSE,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_table_admin_pb2",
- "__doc__": """Response message for [google.bigtable.admin.v2.BigtableTableAdmin.Gene
- rateConsistencyToken][google.bigtable.admin.v2.BigtableTableAdmin.Gene
- rateConsistencyToken]
-
- Attributes:
- consistency_token:
- The generated consistency token.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.GenerateConsistencyTokenResponse)
- },
-)
-_sym_db.RegisterMessage(GenerateConsistencyTokenResponse)
-
-CheckConsistencyRequest = _reflection.GeneratedProtocolMessageType(
- "CheckConsistencyRequest",
- (_message.Message,),
- {
- "DESCRIPTOR": _CHECKCONSISTENCYREQUEST,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_table_admin_pb2",
- "__doc__": """Request message for [google.bigtable.admin.v2.BigtableTableAdmin.Check
- Consistency][google.bigtable.admin.v2.BigtableTableAdmin.CheckConsiste
- ncy]
-
- Attributes:
- name:
- Required. The unique name of the Table for which to check
- replication consistency. Values are of the form
- ``projects/{project}/instances/{instance}/tables/{table}``.
- consistency_token:
- Required. The token created using GenerateConsistencyToken for
- the Table.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.CheckConsistencyRequest)
- },
-)
-_sym_db.RegisterMessage(CheckConsistencyRequest)
-
-CheckConsistencyResponse = _reflection.GeneratedProtocolMessageType(
- "CheckConsistencyResponse",
- (_message.Message,),
- {
- "DESCRIPTOR": _CHECKCONSISTENCYRESPONSE,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_table_admin_pb2",
- "__doc__": """Response message for [google.bigtable.admin.v2.BigtableTableAdmin.Chec
- kConsistency][google.bigtable.admin.v2.BigtableTableAdmin.CheckConsist
- ency]
-
- Attributes:
- consistent:
- True only if the token is consistent. A token is consistent if
- replication has caught up with the restrictions specified in
- the request.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.CheckConsistencyResponse)
- },
-)
-_sym_db.RegisterMessage(CheckConsistencyResponse)
-
-SnapshotTableRequest = _reflection.GeneratedProtocolMessageType(
- "SnapshotTableRequest",
- (_message.Message,),
- {
- "DESCRIPTOR": _SNAPSHOTTABLEREQUEST,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_table_admin_pb2",
- "__doc__": """Request message for [google.bigtable.admin.v2.BigtableTableAdmin.Snaps
- hotTable][google.bigtable.admin.v2.BigtableTableAdmin.SnapshotTable]
- Note: This is a private alpha release of Cloud Bigtable snapshots.
- This feature is not currently available to most Cloud Bigtable
- customers. This feature might be changed in backward-incompatible ways
- and is not recommended for production use. It is not subject to any
- SLA or deprecation policy.
-
- Attributes:
- name:
- Required. The unique name of the table to have the snapshot
- taken. Values are of the form
- ``projects/{project}/instances/{instance}/tables/{table}``.
- cluster:
- Required. The name of the cluster where the snapshot will be
- created in. Values are of the form ``projects/{project}/instan
- ces/{instance}/clusters/{cluster}``.
- snapshot_id:
- Required. The ID by which the new snapshot should be referred
- to within the parent cluster, e.g., ``mysnapshot`` of the
- form: ``[_a-zA-Z0-9][-_.a-zA-Z0-9]*`` rather than ``projects/{
- project}/instances/{instance}/clusters/{cluster}/snapshots/mys
- napshot``.
- ttl:
- The amount of time that the new snapshot can stay active after
- it is created. Once ‘ttl’ expires, the snapshot will get
- deleted. The maximum amount of time a snapshot can stay active
- is 7 days. If ‘ttl’ is not specified, the default value of 24
- hours will be used.
- description:
- Description of the snapshot.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.SnapshotTableRequest)
- },
-)
-_sym_db.RegisterMessage(SnapshotTableRequest)
-
-GetSnapshotRequest = _reflection.GeneratedProtocolMessageType(
- "GetSnapshotRequest",
- (_message.Message,),
- {
- "DESCRIPTOR": _GETSNAPSHOTREQUEST,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_table_admin_pb2",
- "__doc__": """Request message for [google.bigtable.admin.v2.BigtableTableAdmin.GetSn
- apshot][google.bigtable.admin.v2.BigtableTableAdmin.GetSnapshot]
- Note: This is a private alpha release of Cloud Bigtable snapshots.
- This feature is not currently available to most Cloud Bigtable
- customers. This feature might be changed in backward-incompatible ways
- and is not recommended for production use. It is not subject to any
- SLA or deprecation policy.
-
- Attributes:
- name:
- Required. The unique name of the requested snapshot. Values
- are of the form ``projects/{project}/instances/{instance}/clus
- ters/{cluster}/snapshots/{snapshot}``.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.GetSnapshotRequest)
- },
-)
-_sym_db.RegisterMessage(GetSnapshotRequest)
-
-ListSnapshotsRequest = _reflection.GeneratedProtocolMessageType(
- "ListSnapshotsRequest",
- (_message.Message,),
- {
- "DESCRIPTOR": _LISTSNAPSHOTSREQUEST,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_table_admin_pb2",
- "__doc__": """Request message for [google.bigtable.admin.v2.BigtableTableAdmin.ListS
- napshots][google.bigtable.admin.v2.BigtableTableAdmin.ListSnapshots]
- Note: This is a private alpha release of Cloud Bigtable snapshots.
- This feature is not currently available to most Cloud Bigtable
- customers. This feature might be changed in backward-incompatible ways
- and is not recommended for production use. It is not subject to any
- SLA or deprecation policy.
-
- Attributes:
- parent:
- Required. The unique name of the cluster for which snapshots
- should be listed. Values are of the form ``projects/{project}/
- instances/{instance}/clusters/{cluster}``. Use ``{cluster} =
- '-'`` to list snapshots for all clusters in an instance, e.g.,
- ``projects/{project}/instances/{instance}/clusters/-``.
- page_size:
- The maximum number of snapshots to return per page. CURRENTLY
- UNIMPLEMENTED AND IGNORED.
- page_token:
- The value of ``next_page_token`` returned by a previous call.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.ListSnapshotsRequest)
- },
-)
-_sym_db.RegisterMessage(ListSnapshotsRequest)
-
-ListSnapshotsResponse = _reflection.GeneratedProtocolMessageType(
- "ListSnapshotsResponse",
- (_message.Message,),
- {
- "DESCRIPTOR": _LISTSNAPSHOTSRESPONSE,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_table_admin_pb2",
- "__doc__": """Response message for [google.bigtable.admin.v2.BigtableTableAdmin.List
- Snapshots][google.bigtable.admin.v2.BigtableTableAdmin.ListSnapshots]
- Note: This is a private alpha release of Cloud Bigtable snapshots.
- This feature is not currently available to most Cloud Bigtable
- customers. This feature might be changed in backward-incompatible ways
- and is not recommended for production use. It is not subject to any
- SLA or deprecation policy.
-
- Attributes:
- snapshots:
- The snapshots present in the requested cluster.
- next_page_token:
- Set if not all snapshots could be returned in a single
- response. Pass this value to ``page_token`` in another request
- to get the next page of results.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.ListSnapshotsResponse)
- },
-)
-_sym_db.RegisterMessage(ListSnapshotsResponse)
-
-DeleteSnapshotRequest = _reflection.GeneratedProtocolMessageType(
- "DeleteSnapshotRequest",
- (_message.Message,),
- {
- "DESCRIPTOR": _DELETESNAPSHOTREQUEST,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_table_admin_pb2",
- "__doc__": """Request message for [google.bigtable.admin.v2.BigtableTableAdmin.Delet
- eSnapshot][google.bigtable.admin.v2.BigtableTableAdmin.DeleteSnapshot]
- Note: This is a private alpha release of Cloud Bigtable snapshots.
- This feature is not currently available to most Cloud Bigtable
- customers. This feature might be changed in backward-incompatible ways
- and is not recommended for production use. It is not subject to any
- SLA or deprecation policy.
-
- Attributes:
- name:
- Required. The unique name of the snapshot to be deleted.
- Values are of the form ``projects/{project}/instances/{instanc
- e}/clusters/{cluster}/snapshots/{snapshot}``.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.DeleteSnapshotRequest)
- },
-)
-_sym_db.RegisterMessage(DeleteSnapshotRequest)
-
-SnapshotTableMetadata = _reflection.GeneratedProtocolMessageType(
- "SnapshotTableMetadata",
- (_message.Message,),
- {
- "DESCRIPTOR": _SNAPSHOTTABLEMETADATA,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_table_admin_pb2",
- "__doc__": """The metadata for the Operation returned by SnapshotTable. Note: This
- is a private alpha release of Cloud Bigtable snapshots. This feature
- is not currently available to most Cloud Bigtable customers. This
- feature might be changed in backward-incompatible ways and is not
- recommended for production use. It is not subject to any SLA or
- deprecation policy.
-
- Attributes:
- original_request:
- The request that prompted the initiation of this SnapshotTable
- operation.
- request_time:
- The time at which the original request was received.
- finish_time:
- The time at which the operation failed or was completed
- successfully.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.SnapshotTableMetadata)
- },
-)
-_sym_db.RegisterMessage(SnapshotTableMetadata)
-
-CreateTableFromSnapshotMetadata = _reflection.GeneratedProtocolMessageType(
- "CreateTableFromSnapshotMetadata",
- (_message.Message,),
- {
- "DESCRIPTOR": _CREATETABLEFROMSNAPSHOTMETADATA,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_table_admin_pb2",
- "__doc__": """The metadata for the Operation returned by CreateTableFromSnapshot.
- Note: This is a private alpha release of Cloud Bigtable snapshots.
- This feature is not currently available to most Cloud Bigtable
- customers. This feature might be changed in backward-incompatible ways
- and is not recommended for production use. It is not subject to any
- SLA or deprecation policy.
-
- Attributes:
- original_request:
- The request that prompted the initiation of this
- CreateTableFromSnapshot operation.
- request_time:
- The time at which the original request was received.
- finish_time:
- The time at which the operation failed or was completed
- successfully.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.CreateTableFromSnapshotMetadata)
- },
-)
-_sym_db.RegisterMessage(CreateTableFromSnapshotMetadata)
-
-CreateBackupRequest = _reflection.GeneratedProtocolMessageType(
- "CreateBackupRequest",
- (_message.Message,),
- {
- "DESCRIPTOR": _CREATEBACKUPREQUEST,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_table_admin_pb2",
- "__doc__": """The request for [CreateBackup][google.bigtable.admin.v2.BigtableTableA
- dmin.CreateBackup].
-
- Attributes:
- parent:
- Required. This must be one of the clusters in the instance in
- which this table is located. The backup will be stored in this
- cluster. Values are of the form ``projects/{project}/instances
- /{instance}/clusters/{cluster}``.
- backup_id:
- Required. The id of the backup to be created. The
- ``backup_id`` along with the parent ``parent`` are combined as
- {parent}/backups/{backup_id} to create the full backup name,
- of the form: ``projects/{project}/instances/{instance}/cluster
- s/{cluster}/backups/{backup_id}``. This string must be between
- 1 and 50 characters in length and match the regex [_a-
- zA-Z0-9][-_.a-zA-Z0-9]*.
- backup:
- Required. The backup to create.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.CreateBackupRequest)
- },
-)
-_sym_db.RegisterMessage(CreateBackupRequest)
-
-CreateBackupMetadata = _reflection.GeneratedProtocolMessageType(
- "CreateBackupMetadata",
- (_message.Message,),
- {
- "DESCRIPTOR": _CREATEBACKUPMETADATA,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_table_admin_pb2",
- "__doc__": """Metadata type for the operation returned by [CreateBackup][google.bigt
- able.admin.v2.BigtableTableAdmin.CreateBackup].
-
- Attributes:
- name:
- The name of the backup being created.
- source_table:
- The name of the table the backup is created from.
- start_time:
- The time at which this operation started.
- end_time:
- If set, the time at which this operation finished or was
- cancelled.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.CreateBackupMetadata)
- },
-)
-_sym_db.RegisterMessage(CreateBackupMetadata)
-
-GetBackupRequest = _reflection.GeneratedProtocolMessageType(
- "GetBackupRequest",
- (_message.Message,),
- {
- "DESCRIPTOR": _GETBACKUPREQUEST,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_table_admin_pb2",
- "__doc__": """The request for
- [GetBackup][google.bigtable.admin.v2.BigtableTableAdmin.GetBackup].
-
- Attributes:
- name:
- Required. Name of the backup. Values are of the form ``project
- s/{project}/instances/{instance}/clusters/{cluster}/backups/{b
- ackup}``.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.GetBackupRequest)
- },
-)
-_sym_db.RegisterMessage(GetBackupRequest)
-
-UpdateBackupRequest = _reflection.GeneratedProtocolMessageType(
- "UpdateBackupRequest",
- (_message.Message,),
- {
- "DESCRIPTOR": _UPDATEBACKUPREQUEST,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_table_admin_pb2",
- "__doc__": """The request for [UpdateBackup][google.bigtable.admin.v2.BigtableTableA
- dmin.UpdateBackup].
-
- Attributes:
- backup:
- Required. The backup to update. ``backup.name``, and the
- fields to be updated as specified by ``update_mask`` are
- required. Other fields are ignored. Update is only supported
- for the following fields: \* ``backup.expire_time``.
- update_mask:
- Required. A mask specifying which fields (e.g.
- ``expire_time``) in the Backup resource should be updated.
- This mask is relative to the Backup resource, not to the
- request message. The field mask must always be specified; this
- prevents any future fields from being erased accidentally by
- clients that do not know about them.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.UpdateBackupRequest)
- },
-)
-_sym_db.RegisterMessage(UpdateBackupRequest)
-
-DeleteBackupRequest = _reflection.GeneratedProtocolMessageType(
- "DeleteBackupRequest",
- (_message.Message,),
- {
- "DESCRIPTOR": _DELETEBACKUPREQUEST,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_table_admin_pb2",
- "__doc__": """The request for [DeleteBackup][google.bigtable.admin.v2.BigtableTableA
- dmin.DeleteBackup].
-
- Attributes:
- name:
- Required. Name of the backup to delete. Values are of the form
- ``projects/{project}/instances/{instance}/clusters/{cluster}/b
- ackups/{backup}``.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.DeleteBackupRequest)
- },
-)
-_sym_db.RegisterMessage(DeleteBackupRequest)
-
-ListBackupsRequest = _reflection.GeneratedProtocolMessageType(
- "ListBackupsRequest",
- (_message.Message,),
- {
- "DESCRIPTOR": _LISTBACKUPSREQUEST,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_table_admin_pb2",
- "__doc__": """The request for [ListBackups][google.bigtable.admin.v2.BigtableTableAd
- min.ListBackups].
-
- Attributes:
- parent:
- Required. The cluster to list backups from. Values are of the
- form ``projects/{project}/instances/{instance}/clusters/{clust
- er}``. Use ``{cluster} = '-'`` to list backups for all
- clusters in an instance, e.g.,
- ``projects/{project}/instances/{instance}/clusters/-``.
- filter:
- A filter expression that filters backups listed in the
- response. The expression must specify the field name, a
- comparison operator, and the value that you want to use for
- filtering. The value must be a string, a number, or a boolean.
- The comparison operator must be <, >, <=, >=, !=, =, or :.
- Colon ‘:’ represents a HAS operator which is roughly
- synonymous with equality. Filter rules are case insensitive.
- The fields eligible for filtering are: \* ``name`` \*
- ``source_table`` \* ``state`` \* ``start_time`` (and values
- are of the format YYYY-MM-DDTHH:MM:SSZ) \* ``end_time`` (and
- values are of the format YYYY-MM-DDTHH:MM:SSZ) \*
- ``expire_time`` (and values are of the format YYYY-MM-
- DDTHH:MM:SSZ) \* ``size_bytes`` To filter on multiple
- expressions, provide each separate expression within
- parentheses. By default, each expression is an AND expression.
- However, you can include AND, OR, and NOT expressions
- explicitly. Some examples of using filters are: -
- ``name:"exact"`` –> The backup’s name is the string “exact”. -
- ``name:howl`` –> The backup’s name contains the string “howl”.
- - ``source_table:prod`` –> The source_table’s name contains
- the string “prod”. - ``state:CREATING`` –> The backup is
- pending creation. - ``state:READY`` –> The backup is fully
- created and ready for use. - ``(name:howl) AND (start_time <
- \"2018-03-28T14:50:00Z\")`` –> The backup name contains the
- string “howl” and start_time of the backup is before
- 2018-03-28T14:50:00Z. - ``size_bytes > 10000000000`` –> The
- backup’s size is greater than 10GB
- order_by:
- An expression for specifying the sort order of the results of
- the request. The string value should specify one or more
- fields in [Backup][google.bigtable.admin.v2.Backup]. The full
- syntax is described at https://aip.dev/132#ordering. Fields
- supported are: \* name \* source_table \* expire_time \*
- start_time \* end_time \* size_bytes \* state For example,
- “start_time”. The default sorting order is ascending. To
- specify descending order for the field, a suffix " desc"
- should be appended to the field name. For example, “start_time
- desc”. Redundant space characters in the syntax are
- insigificant. If order_by is empty, results will be sorted by
- ``start_time`` in descending order starting from the most
- recently created backup.
- page_size:
- Number of backups to be returned in the response. If 0 or
- less, defaults to the server’s maximum allowed page size.
- page_token:
- If non-empty, ``page_token`` should contain a [next_page_token
- ][google.bigtable.admin.v2.ListBackupsResponse.next_page_token
- ] from a previous [ListBackupsResponse][google.bigtable.admin.
- v2.ListBackupsResponse] to the same ``parent`` and with the
- same ``filter``.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.ListBackupsRequest)
- },
-)
-_sym_db.RegisterMessage(ListBackupsRequest)
-
-ListBackupsResponse = _reflection.GeneratedProtocolMessageType(
- "ListBackupsResponse",
- (_message.Message,),
- {
- "DESCRIPTOR": _LISTBACKUPSRESPONSE,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_table_admin_pb2",
- "__doc__": """The response for [ListBackups][google.bigtable.admin.v2.BigtableTableA
- dmin.ListBackups].
-
- Attributes:
- backups:
- The list of matching backups.
- next_page_token:
- \ ``next_page_token`` can be sent in a subsequent [ListBackups
- ][google.bigtable.admin.v2.BigtableTableAdmin.ListBackups]
- call to fetch more of the matching backups.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.ListBackupsResponse)
- },
-)
-_sym_db.RegisterMessage(ListBackupsResponse)
-
-RestoreTableRequest = _reflection.GeneratedProtocolMessageType(
- "RestoreTableRequest",
- (_message.Message,),
- {
- "DESCRIPTOR": _RESTORETABLEREQUEST,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_table_admin_pb2",
- "__doc__": """The request for [RestoreTable][google.bigtable.admin.v2.BigtableTableA
- dmin.RestoreTable].
-
- Attributes:
- parent:
- Required. The name of the instance in which to create the
- restored table. This instance must be the parent of the source
- backup. Values are of the form
- ``projects//instances/``.
- table_id:
- Required. The id of the table to create and restore to. This
- table must not already exist. The ``table_id`` appended to
- ``parent`` forms the full table name of the form
- ``projects//instances//tables/``.
- source:
- Required. The source from which to restore.
- backup:
- Name of the backup from which to restore. Values are of the
- form ``projects//instances//clusters//backups/``.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.RestoreTableRequest)
- },
-)
-_sym_db.RegisterMessage(RestoreTableRequest)
-
-RestoreTableMetadata = _reflection.GeneratedProtocolMessageType(
- "RestoreTableMetadata",
- (_message.Message,),
- {
- "DESCRIPTOR": _RESTORETABLEMETADATA,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_table_admin_pb2",
- "__doc__": """Metadata type for the long-running operation returned by [RestoreTable
- ][google.bigtable.admin.v2.BigtableTableAdmin.RestoreTable].
-
- Attributes:
- name:
- Name of the table being created and restored to.
- source_type:
- The type of the restore source.
- source_info:
- Information about the source used to restore the table, as
- specified by ``source`` in [RestoreTableRequest][google.bigtab
- le.admin.v2.RestoreTableRequest].
- optimize_table_operation_name:
- If exists, the name of the long-running operation that will be
- used to track the post-restore optimization process to
- optimize the performance of the restored table. The metadata
- type of the long-running operation is
- [OptimizeRestoreTableMetadata][]. The response type is
- [Empty][google.protobuf.Empty]. This long-running operation
- may be automatically created by the system if applicable after
- the RestoreTable long-running operation completes
- successfully. This operation may not be created if the table
- is already optimized or the restore was not successful.
- progress:
- The progress of the [RestoreTable][google.bigtable.admin.v2.Bi
- gtableTableAdmin.RestoreTable] operation.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.RestoreTableMetadata)
- },
-)
-_sym_db.RegisterMessage(RestoreTableMetadata)
-
-OptimizeRestoredTableMetadata = _reflection.GeneratedProtocolMessageType(
- "OptimizeRestoredTableMetadata",
- (_message.Message,),
- {
- "DESCRIPTOR": _OPTIMIZERESTOREDTABLEMETADATA,
- "__module__": "google.cloud.bigtable_admin_v2.proto.bigtable_table_admin_pb2",
- "__doc__": """Metadata type for the long-running operation used to track the
- progress of optimizations performed on a newly restored table. This
- long-running operation is automatically created by the system after
- the successful completion of a table restore, and cannot be cancelled.
-
- Attributes:
- name:
- Name of the restored table being optimized.
- progress:
- The progress of the post-restore optimizations.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.OptimizeRestoredTableMetadata)
- },
-)
-_sym_db.RegisterMessage(OptimizeRestoredTableMetadata)
-
-
-DESCRIPTOR._options = None
-_CREATETABLEREQUEST.fields_by_name["parent"]._options = None
-_CREATETABLEREQUEST.fields_by_name["table_id"]._options = None
-_CREATETABLEREQUEST.fields_by_name["table"]._options = None
-_CREATETABLEFROMSNAPSHOTREQUEST.fields_by_name["parent"]._options = None
-_CREATETABLEFROMSNAPSHOTREQUEST.fields_by_name["table_id"]._options = None
-_CREATETABLEFROMSNAPSHOTREQUEST.fields_by_name["source_snapshot"]._options = None
-_DROPROWRANGEREQUEST.fields_by_name["name"]._options = None
-_LISTTABLESREQUEST.fields_by_name["parent"]._options = None
-_GETTABLEREQUEST.fields_by_name["name"]._options = None
-_DELETETABLEREQUEST.fields_by_name["name"]._options = None
-_MODIFYCOLUMNFAMILIESREQUEST.fields_by_name["name"]._options = None
-_MODIFYCOLUMNFAMILIESREQUEST.fields_by_name["modifications"]._options = None
-_GENERATECONSISTENCYTOKENREQUEST.fields_by_name["name"]._options = None
-_CHECKCONSISTENCYREQUEST.fields_by_name["name"]._options = None
-_CHECKCONSISTENCYREQUEST.fields_by_name["consistency_token"]._options = None
-_SNAPSHOTTABLEREQUEST.fields_by_name["name"]._options = None
-_SNAPSHOTTABLEREQUEST.fields_by_name["cluster"]._options = None
-_SNAPSHOTTABLEREQUEST.fields_by_name["snapshot_id"]._options = None
-_GETSNAPSHOTREQUEST.fields_by_name["name"]._options = None
-_LISTSNAPSHOTSREQUEST.fields_by_name["parent"]._options = None
-_DELETESNAPSHOTREQUEST.fields_by_name["name"]._options = None
-_CREATEBACKUPREQUEST.fields_by_name["parent"]._options = None
-_CREATEBACKUPREQUEST.fields_by_name["backup_id"]._options = None
-_CREATEBACKUPREQUEST.fields_by_name["backup"]._options = None
-_GETBACKUPREQUEST.fields_by_name["name"]._options = None
-_UPDATEBACKUPREQUEST.fields_by_name["backup"]._options = None
-_UPDATEBACKUPREQUEST.fields_by_name["update_mask"]._options = None
-_DELETEBACKUPREQUEST.fields_by_name["name"]._options = None
-_LISTBACKUPSREQUEST.fields_by_name["parent"]._options = None
-
-_BIGTABLETABLEADMIN = _descriptor.ServiceDescriptor(
- name="BigtableTableAdmin",
- full_name="google.bigtable.admin.v2.BigtableTableAdmin",
- file=DESCRIPTOR,
- index=0,
- serialized_options=b"\312A\034bigtableadmin.googleapis.com\322A\273\002https://www.googleapis.com/auth/bigtable.admin,https://www.googleapis.com/auth/bigtable.admin.table,https://www.googleapis.com/auth/cloud-bigtable.admin,https://www.googleapis.com/auth/cloud-bigtable.admin.table,https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/cloud-platform.read-only",
- create_key=_descriptor._internal_create_key,
- serialized_start=4604,
- serialized_end=9284,
- methods=[
- _descriptor.MethodDescriptor(
- name="CreateTable",
- full_name="google.bigtable.admin.v2.BigtableTableAdmin.CreateTable",
- index=0,
- containing_service=None,
- input_type=_CREATETABLEREQUEST,
- output_type=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_table__pb2._TABLE,
- serialized_options=b'\202\323\344\223\002/"*/v2/{parent=projects/*/instances/*}/tables:\001*\332A\025parent,table_id,table',
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.MethodDescriptor(
- name="CreateTableFromSnapshot",
- full_name="google.bigtable.admin.v2.BigtableTableAdmin.CreateTableFromSnapshot",
- index=1,
- containing_service=None,
- input_type=_CREATETABLEFROMSNAPSHOTREQUEST,
- output_type=google_dot_longrunning_dot_operations__pb2._OPERATION,
- serialized_options=b'\202\323\344\223\002B"=/v2/{parent=projects/*/instances/*}/tables:createFromSnapshot:\001*\332A\037parent,table_id,source_snapshot\312A(\n\005Table\022\037CreateTableFromSnapshotMetadata',
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.MethodDescriptor(
- name="ListTables",
- full_name="google.bigtable.admin.v2.BigtableTableAdmin.ListTables",
- index=2,
- containing_service=None,
- input_type=_LISTTABLESREQUEST,
- output_type=_LISTTABLESRESPONSE,
- serialized_options=b"\202\323\344\223\002,\022*/v2/{parent=projects/*/instances/*}/tables\332A\006parent",
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.MethodDescriptor(
- name="GetTable",
- full_name="google.bigtable.admin.v2.BigtableTableAdmin.GetTable",
- index=3,
- containing_service=None,
- input_type=_GETTABLEREQUEST,
- output_type=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_table__pb2._TABLE,
- serialized_options=b"\202\323\344\223\002,\022*/v2/{name=projects/*/instances/*/tables/*}\332A\004name",
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.MethodDescriptor(
- name="DeleteTable",
- full_name="google.bigtable.admin.v2.BigtableTableAdmin.DeleteTable",
- index=4,
- containing_service=None,
- input_type=_DELETETABLEREQUEST,
- output_type=google_dot_protobuf_dot_empty__pb2._EMPTY,
- serialized_options=b"\202\323\344\223\002,**/v2/{name=projects/*/instances/*/tables/*}\332A\004name",
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.MethodDescriptor(
- name="ModifyColumnFamilies",
- full_name="google.bigtable.admin.v2.BigtableTableAdmin.ModifyColumnFamilies",
- index=5,
- containing_service=None,
- input_type=_MODIFYCOLUMNFAMILIESREQUEST,
- output_type=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_table__pb2._TABLE,
- serialized_options=b'\202\323\344\223\002D"?/v2/{name=projects/*/instances/*/tables/*}:modifyColumnFamilies:\001*\332A\022name,modifications',
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.MethodDescriptor(
- name="DropRowRange",
- full_name="google.bigtable.admin.v2.BigtableTableAdmin.DropRowRange",
- index=6,
- containing_service=None,
- input_type=_DROPROWRANGEREQUEST,
- output_type=google_dot_protobuf_dot_empty__pb2._EMPTY,
- serialized_options=b'\202\323\344\223\002<"7/v2/{name=projects/*/instances/*/tables/*}:dropRowRange:\001*',
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.MethodDescriptor(
- name="GenerateConsistencyToken",
- full_name="google.bigtable.admin.v2.BigtableTableAdmin.GenerateConsistencyToken",
- index=7,
- containing_service=None,
- input_type=_GENERATECONSISTENCYTOKENREQUEST,
- output_type=_GENERATECONSISTENCYTOKENRESPONSE,
- serialized_options=b'\202\323\344\223\002H"C/v2/{name=projects/*/instances/*/tables/*}:generateConsistencyToken:\001*\332A\004name',
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.MethodDescriptor(
- name="CheckConsistency",
- full_name="google.bigtable.admin.v2.BigtableTableAdmin.CheckConsistency",
- index=8,
- containing_service=None,
- input_type=_CHECKCONSISTENCYREQUEST,
- output_type=_CHECKCONSISTENCYRESPONSE,
- serialized_options=b'\202\323\344\223\002@";/v2/{name=projects/*/instances/*/tables/*}:checkConsistency:\001*\332A\026name,consistency_token',
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.MethodDescriptor(
- name="SnapshotTable",
- full_name="google.bigtable.admin.v2.BigtableTableAdmin.SnapshotTable",
- index=9,
- containing_service=None,
- input_type=_SNAPSHOTTABLEREQUEST,
- output_type=google_dot_longrunning_dot_operations__pb2._OPERATION,
- serialized_options=b'\202\323\344\223\0028"3/v2/{name=projects/*/instances/*/tables/*}:snapshot:\001*\332A$name,cluster,snapshot_id,description\312A!\n\010Snapshot\022\025SnapshotTableMetadata',
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.MethodDescriptor(
- name="GetSnapshot",
- full_name="google.bigtable.admin.v2.BigtableTableAdmin.GetSnapshot",
- index=10,
- containing_service=None,
- input_type=_GETSNAPSHOTREQUEST,
- output_type=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_table__pb2._SNAPSHOT,
- serialized_options=b"\202\323\344\223\002:\0228/v2/{name=projects/*/instances/*/clusters/*/snapshots/*}\332A\004name",
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.MethodDescriptor(
- name="ListSnapshots",
- full_name="google.bigtable.admin.v2.BigtableTableAdmin.ListSnapshots",
- index=11,
- containing_service=None,
- input_type=_LISTSNAPSHOTSREQUEST,
- output_type=_LISTSNAPSHOTSRESPONSE,
- serialized_options=b"\202\323\344\223\002:\0228/v2/{parent=projects/*/instances/*/clusters/*}/snapshots\332A\006parent",
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.MethodDescriptor(
- name="DeleteSnapshot",
- full_name="google.bigtable.admin.v2.BigtableTableAdmin.DeleteSnapshot",
- index=12,
- containing_service=None,
- input_type=_DELETESNAPSHOTREQUEST,
- output_type=google_dot_protobuf_dot_empty__pb2._EMPTY,
- serialized_options=b"\202\323\344\223\002:*8/v2/{name=projects/*/instances/*/clusters/*/snapshots/*}\332A\004name",
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.MethodDescriptor(
- name="CreateBackup",
- full_name="google.bigtable.admin.v2.BigtableTableAdmin.CreateBackup",
- index=13,
- containing_service=None,
- input_type=_CREATEBACKUPREQUEST,
- output_type=google_dot_longrunning_dot_operations__pb2._OPERATION,
- serialized_options=b'\202\323\344\223\002@"6/v2/{parent=projects/*/instances/*/clusters/*}/backups:\006backup\312A\036\n\006Backup\022\024CreateBackupMetadata\332A\027parent,backup_id,backup',
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.MethodDescriptor(
- name="GetBackup",
- full_name="google.bigtable.admin.v2.BigtableTableAdmin.GetBackup",
- index=14,
- containing_service=None,
- input_type=_GETBACKUPREQUEST,
- output_type=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_table__pb2._BACKUP,
- serialized_options=b"\202\323\344\223\0028\0226/v2/{name=projects/*/instances/*/clusters/*/backups/*}\332A\004name",
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.MethodDescriptor(
- name="UpdateBackup",
- full_name="google.bigtable.admin.v2.BigtableTableAdmin.UpdateBackup",
- index=15,
- containing_service=None,
- input_type=_UPDATEBACKUPREQUEST,
- output_type=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_table__pb2._BACKUP,
- serialized_options=b"\202\323\344\223\002G2=/v2/{backup.name=projects/*/instances/*/clusters/*/backups/*}:\006backup\332A\022backup,update_mask",
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.MethodDescriptor(
- name="DeleteBackup",
- full_name="google.bigtable.admin.v2.BigtableTableAdmin.DeleteBackup",
- index=16,
- containing_service=None,
- input_type=_DELETEBACKUPREQUEST,
- output_type=google_dot_protobuf_dot_empty__pb2._EMPTY,
- serialized_options=b"\202\323\344\223\0028*6/v2/{name=projects/*/instances/*/clusters/*/backups/*}\332A\004name",
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.MethodDescriptor(
- name="ListBackups",
- full_name="google.bigtable.admin.v2.BigtableTableAdmin.ListBackups",
- index=17,
- containing_service=None,
- input_type=_LISTBACKUPSREQUEST,
- output_type=_LISTBACKUPSRESPONSE,
- serialized_options=b"\202\323\344\223\0028\0226/v2/{parent=projects/*/instances/*/clusters/*}/backups\332A\006parent",
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.MethodDescriptor(
- name="RestoreTable",
- full_name="google.bigtable.admin.v2.BigtableTableAdmin.RestoreTable",
- index=18,
- containing_service=None,
- input_type=_RESTORETABLEREQUEST,
- output_type=google_dot_longrunning_dot_operations__pb2._OPERATION,
- serialized_options=b'\202\323\344\223\0027"2/v2/{parent=projects/*/instances/*}/tables:restore:\001*\312A\035\n\005Table\022\024RestoreTableMetadata',
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.MethodDescriptor(
- name="GetIamPolicy",
- full_name="google.bigtable.admin.v2.BigtableTableAdmin.GetIamPolicy",
- index=19,
- containing_service=None,
- input_type=google_dot_iam_dot_v1_dot_iam__policy__pb2._GETIAMPOLICYREQUEST,
- output_type=google_dot_iam_dot_v1_dot_policy__pb2._POLICY,
- serialized_options=b'\202\323\344\223\002@";/v2/{resource=projects/*/instances/*/tables/*}:getIamPolicy:\001*\332A\010resource',
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.MethodDescriptor(
- name="SetIamPolicy",
- full_name="google.bigtable.admin.v2.BigtableTableAdmin.SetIamPolicy",
- index=20,
- containing_service=None,
- input_type=google_dot_iam_dot_v1_dot_iam__policy__pb2._SETIAMPOLICYREQUEST,
- output_type=google_dot_iam_dot_v1_dot_policy__pb2._POLICY,
- serialized_options=b'\202\323\344\223\002\216\001";/v2/{resource=projects/*/instances/*/tables/*}:setIamPolicy:\001*ZL"G/v2/{resource=projects/*/instances/*/clusters/*/backups/*}:setIamPolicy:\001*\332A\017resource,policy',
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.MethodDescriptor(
- name="TestIamPermissions",
- full_name="google.bigtable.admin.v2.BigtableTableAdmin.TestIamPermissions",
- index=21,
- containing_service=None,
- input_type=google_dot_iam_dot_v1_dot_iam__policy__pb2._TESTIAMPERMISSIONSREQUEST,
- output_type=google_dot_iam_dot_v1_dot_iam__policy__pb2._TESTIAMPERMISSIONSRESPONSE,
- serialized_options=b'\202\323\344\223\002\232\001"A/v2/{resource=projects/*/instances/*/tables/*}:testIamPermissions:\001*ZR"M/v2/{resource=projects/*/instances/*/clusters/*/backups/*}:testIamPermissions:\001*\332A\024resource,permissions',
- create_key=_descriptor._internal_create_key,
- ),
- ],
-)
-_sym_db.RegisterServiceDescriptor(_BIGTABLETABLEADMIN)
-
-DESCRIPTOR.services_by_name["BigtableTableAdmin"] = _BIGTABLETABLEADMIN
-
-# @@protoc_insertion_point(module_scope)
diff --git a/google/cloud/bigtable_admin_v2/proto/bigtable_table_admin_pb2_grpc.py b/google/cloud/bigtable_admin_v2/proto/bigtable_table_admin_pb2_grpc.py
deleted file mode 100644
index 2b8d46e20..000000000
--- a/google/cloud/bigtable_admin_v2/proto/bigtable_table_admin_pb2_grpc.py
+++ /dev/null
@@ -1,1090 +0,0 @@
-# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
-"""Client and server classes corresponding to protobuf-defined services."""
-import grpc
-
-from google.cloud.bigtable_admin_v2.proto import (
- bigtable_table_admin_pb2 as google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2,
-)
-from google.cloud.bigtable_admin_v2.proto import (
- table_pb2 as google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_table__pb2,
-)
-from google.iam.v1 import iam_policy_pb2 as google_dot_iam_dot_v1_dot_iam__policy__pb2
-from google.iam.v1 import policy_pb2 as google_dot_iam_dot_v1_dot_policy__pb2
-from google.longrunning import (
- operations_pb2 as google_dot_longrunning_dot_operations__pb2,
-)
-from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2
-
-
-class BigtableTableAdminStub(object):
- """Service for creating, configuring, and deleting Cloud Bigtable tables.
-
-
- Provides access to the table schemas only, not the data stored within
- the tables.
- """
-
- def __init__(self, channel):
- """Constructor.
-
- Args:
- channel: A grpc.Channel.
- """
- self.CreateTable = channel.unary_unary(
- "/google.bigtable.admin.v2.BigtableTableAdmin/CreateTable",
- request_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.CreateTableRequest.SerializeToString,
- response_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_table__pb2.Table.FromString,
- )
- self.CreateTableFromSnapshot = channel.unary_unary(
- "/google.bigtable.admin.v2.BigtableTableAdmin/CreateTableFromSnapshot",
- request_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.CreateTableFromSnapshotRequest.SerializeToString,
- response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString,
- )
- self.ListTables = channel.unary_unary(
- "/google.bigtable.admin.v2.BigtableTableAdmin/ListTables",
- request_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.ListTablesRequest.SerializeToString,
- response_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.ListTablesResponse.FromString,
- )
- self.GetTable = channel.unary_unary(
- "/google.bigtable.admin.v2.BigtableTableAdmin/GetTable",
- request_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.GetTableRequest.SerializeToString,
- response_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_table__pb2.Table.FromString,
- )
- self.DeleteTable = channel.unary_unary(
- "/google.bigtable.admin.v2.BigtableTableAdmin/DeleteTable",
- request_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.DeleteTableRequest.SerializeToString,
- response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
- )
- self.ModifyColumnFamilies = channel.unary_unary(
- "/google.bigtable.admin.v2.BigtableTableAdmin/ModifyColumnFamilies",
- request_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.ModifyColumnFamiliesRequest.SerializeToString,
- response_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_table__pb2.Table.FromString,
- )
- self.DropRowRange = channel.unary_unary(
- "/google.bigtable.admin.v2.BigtableTableAdmin/DropRowRange",
- request_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.DropRowRangeRequest.SerializeToString,
- response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
- )
- self.GenerateConsistencyToken = channel.unary_unary(
- "/google.bigtable.admin.v2.BigtableTableAdmin/GenerateConsistencyToken",
- request_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.GenerateConsistencyTokenRequest.SerializeToString,
- response_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.GenerateConsistencyTokenResponse.FromString,
- )
- self.CheckConsistency = channel.unary_unary(
- "/google.bigtable.admin.v2.BigtableTableAdmin/CheckConsistency",
- request_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.CheckConsistencyRequest.SerializeToString,
- response_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.CheckConsistencyResponse.FromString,
- )
- self.SnapshotTable = channel.unary_unary(
- "/google.bigtable.admin.v2.BigtableTableAdmin/SnapshotTable",
- request_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.SnapshotTableRequest.SerializeToString,
- response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString,
- )
- self.GetSnapshot = channel.unary_unary(
- "/google.bigtable.admin.v2.BigtableTableAdmin/GetSnapshot",
- request_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.GetSnapshotRequest.SerializeToString,
- response_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_table__pb2.Snapshot.FromString,
- )
- self.ListSnapshots = channel.unary_unary(
- "/google.bigtable.admin.v2.BigtableTableAdmin/ListSnapshots",
- request_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.ListSnapshotsRequest.SerializeToString,
- response_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.ListSnapshotsResponse.FromString,
- )
- self.DeleteSnapshot = channel.unary_unary(
- "/google.bigtable.admin.v2.BigtableTableAdmin/DeleteSnapshot",
- request_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.DeleteSnapshotRequest.SerializeToString,
- response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
- )
- self.CreateBackup = channel.unary_unary(
- "/google.bigtable.admin.v2.BigtableTableAdmin/CreateBackup",
- request_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.CreateBackupRequest.SerializeToString,
- response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString,
- )
- self.GetBackup = channel.unary_unary(
- "/google.bigtable.admin.v2.BigtableTableAdmin/GetBackup",
- request_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.GetBackupRequest.SerializeToString,
- response_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_table__pb2.Backup.FromString,
- )
- self.UpdateBackup = channel.unary_unary(
- "/google.bigtable.admin.v2.BigtableTableAdmin/UpdateBackup",
- request_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.UpdateBackupRequest.SerializeToString,
- response_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_table__pb2.Backup.FromString,
- )
- self.DeleteBackup = channel.unary_unary(
- "/google.bigtable.admin.v2.BigtableTableAdmin/DeleteBackup",
- request_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.DeleteBackupRequest.SerializeToString,
- response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
- )
- self.ListBackups = channel.unary_unary(
- "/google.bigtable.admin.v2.BigtableTableAdmin/ListBackups",
- request_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.ListBackupsRequest.SerializeToString,
- response_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.ListBackupsResponse.FromString,
- )
- self.RestoreTable = channel.unary_unary(
- "/google.bigtable.admin.v2.BigtableTableAdmin/RestoreTable",
- request_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.RestoreTableRequest.SerializeToString,
- response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString,
- )
- self.GetIamPolicy = channel.unary_unary(
- "/google.bigtable.admin.v2.BigtableTableAdmin/GetIamPolicy",
- request_serializer=google_dot_iam_dot_v1_dot_iam__policy__pb2.GetIamPolicyRequest.SerializeToString,
- response_deserializer=google_dot_iam_dot_v1_dot_policy__pb2.Policy.FromString,
- )
- self.SetIamPolicy = channel.unary_unary(
- "/google.bigtable.admin.v2.BigtableTableAdmin/SetIamPolicy",
- request_serializer=google_dot_iam_dot_v1_dot_iam__policy__pb2.SetIamPolicyRequest.SerializeToString,
- response_deserializer=google_dot_iam_dot_v1_dot_policy__pb2.Policy.FromString,
- )
- self.TestIamPermissions = channel.unary_unary(
- "/google.bigtable.admin.v2.BigtableTableAdmin/TestIamPermissions",
- request_serializer=google_dot_iam_dot_v1_dot_iam__policy__pb2.TestIamPermissionsRequest.SerializeToString,
- response_deserializer=google_dot_iam_dot_v1_dot_iam__policy__pb2.TestIamPermissionsResponse.FromString,
- )
-
-
-class BigtableTableAdminServicer(object):
- """Service for creating, configuring, and deleting Cloud Bigtable tables.
-
-
- Provides access to the table schemas only, not the data stored within
- the tables.
- """
-
- def CreateTable(self, request, context):
- """Creates a new table in the specified instance.
- The table can be created with a full set of initial column families,
- specified in the request.
- """
- context.set_code(grpc.StatusCode.UNIMPLEMENTED)
- context.set_details("Method not implemented!")
- raise NotImplementedError("Method not implemented!")
-
- def CreateTableFromSnapshot(self, request, context):
- """Creates a new table from the specified snapshot. The target table must
- not exist. The snapshot and the table must be in the same instance.
-
- Note: This is a private alpha release of Cloud Bigtable snapshots. This
- feature is not currently available to most Cloud Bigtable customers. This
- feature might be changed in backward-incompatible ways and is not
- recommended for production use. It is not subject to any SLA or deprecation
- policy.
- """
- context.set_code(grpc.StatusCode.UNIMPLEMENTED)
- context.set_details("Method not implemented!")
- raise NotImplementedError("Method not implemented!")
-
- def ListTables(self, request, context):
- """Lists all tables served from a specified instance.
- """
- context.set_code(grpc.StatusCode.UNIMPLEMENTED)
- context.set_details("Method not implemented!")
- raise NotImplementedError("Method not implemented!")
-
- def GetTable(self, request, context):
- """Gets metadata information about the specified table.
- """
- context.set_code(grpc.StatusCode.UNIMPLEMENTED)
- context.set_details("Method not implemented!")
- raise NotImplementedError("Method not implemented!")
-
- def DeleteTable(self, request, context):
- """Permanently deletes a specified table and all of its data.
- """
- context.set_code(grpc.StatusCode.UNIMPLEMENTED)
- context.set_details("Method not implemented!")
- raise NotImplementedError("Method not implemented!")
-
- def ModifyColumnFamilies(self, request, context):
- """Performs a series of column family modifications on the specified table.
- Either all or none of the modifications will occur before this method
- returns, but data requests received prior to that point may see a table
- where only some modifications have taken effect.
- """
- context.set_code(grpc.StatusCode.UNIMPLEMENTED)
- context.set_details("Method not implemented!")
- raise NotImplementedError("Method not implemented!")
-
- def DropRowRange(self, request, context):
- """Permanently drop/delete a row range from a specified table. The request can
- specify whether to delete all rows in a table, or only those that match a
- particular prefix.
- """
- context.set_code(grpc.StatusCode.UNIMPLEMENTED)
- context.set_details("Method not implemented!")
- raise NotImplementedError("Method not implemented!")
-
- def GenerateConsistencyToken(self, request, context):
- """Generates a consistency token for a Table, which can be used in
- CheckConsistency to check whether mutations to the table that finished
- before this call started have been replicated. The tokens will be available
- for 90 days.
- """
- context.set_code(grpc.StatusCode.UNIMPLEMENTED)
- context.set_details("Method not implemented!")
- raise NotImplementedError("Method not implemented!")
-
- def CheckConsistency(self, request, context):
- """Checks replication consistency based on a consistency token, that is, if
- replication has caught up based on the conditions specified in the token
- and the check request.
- """
- context.set_code(grpc.StatusCode.UNIMPLEMENTED)
- context.set_details("Method not implemented!")
- raise NotImplementedError("Method not implemented!")
-
- def SnapshotTable(self, request, context):
- """Creates a new snapshot in the specified cluster from the specified
- source table. The cluster and the table must be in the same instance.
-
- Note: This is a private alpha release of Cloud Bigtable snapshots. This
- feature is not currently available to most Cloud Bigtable customers. This
- feature might be changed in backward-incompatible ways and is not
- recommended for production use. It is not subject to any SLA or deprecation
- policy.
- """
- context.set_code(grpc.StatusCode.UNIMPLEMENTED)
- context.set_details("Method not implemented!")
- raise NotImplementedError("Method not implemented!")
-
- def GetSnapshot(self, request, context):
- """Gets metadata information about the specified snapshot.
-
- Note: This is a private alpha release of Cloud Bigtable snapshots. This
- feature is not currently available to most Cloud Bigtable customers. This
- feature might be changed in backward-incompatible ways and is not
- recommended for production use. It is not subject to any SLA or deprecation
- policy.
- """
- context.set_code(grpc.StatusCode.UNIMPLEMENTED)
- context.set_details("Method not implemented!")
- raise NotImplementedError("Method not implemented!")
-
- def ListSnapshots(self, request, context):
- """Lists all snapshots associated with the specified cluster.
-
- Note: This is a private alpha release of Cloud Bigtable snapshots. This
- feature is not currently available to most Cloud Bigtable customers. This
- feature might be changed in backward-incompatible ways and is not
- recommended for production use. It is not subject to any SLA or deprecation
- policy.
- """
- context.set_code(grpc.StatusCode.UNIMPLEMENTED)
- context.set_details("Method not implemented!")
- raise NotImplementedError("Method not implemented!")
-
- def DeleteSnapshot(self, request, context):
- """Permanently deletes the specified snapshot.
-
- Note: This is a private alpha release of Cloud Bigtable snapshots. This
- feature is not currently available to most Cloud Bigtable customers. This
- feature might be changed in backward-incompatible ways and is not
- recommended for production use. It is not subject to any SLA or deprecation
- policy.
- """
- context.set_code(grpc.StatusCode.UNIMPLEMENTED)
- context.set_details("Method not implemented!")
- raise NotImplementedError("Method not implemented!")
-
- def CreateBackup(self, request, context):
- """Starts creating a new Cloud Bigtable Backup. The returned backup
- [long-running operation][google.longrunning.Operation] can be used to
- track creation of the backup. The
- [metadata][google.longrunning.Operation.metadata] field type is
- [CreateBackupMetadata][google.bigtable.admin.v2.CreateBackupMetadata]. The
- [response][google.longrunning.Operation.response] field type is
- [Backup][google.bigtable.admin.v2.Backup], if successful. Cancelling the
- returned operation will stop the creation and delete the backup.
- """
- context.set_code(grpc.StatusCode.UNIMPLEMENTED)
- context.set_details("Method not implemented!")
- raise NotImplementedError("Method not implemented!")
-
- def GetBackup(self, request, context):
- """Gets metadata on a pending or completed Cloud Bigtable Backup.
- """
- context.set_code(grpc.StatusCode.UNIMPLEMENTED)
- context.set_details("Method not implemented!")
- raise NotImplementedError("Method not implemented!")
-
- def UpdateBackup(self, request, context):
- """Updates a pending or completed Cloud Bigtable Backup.
- """
- context.set_code(grpc.StatusCode.UNIMPLEMENTED)
- context.set_details("Method not implemented!")
- raise NotImplementedError("Method not implemented!")
-
- def DeleteBackup(self, request, context):
- """Deletes a pending or completed Cloud Bigtable backup.
- """
- context.set_code(grpc.StatusCode.UNIMPLEMENTED)
- context.set_details("Method not implemented!")
- raise NotImplementedError("Method not implemented!")
-
- def ListBackups(self, request, context):
- """Lists Cloud Bigtable backups. Returns both completed and pending
- backups.
- """
- context.set_code(grpc.StatusCode.UNIMPLEMENTED)
- context.set_details("Method not implemented!")
- raise NotImplementedError("Method not implemented!")
-
- def RestoreTable(self, request, context):
- """Create a new table by restoring from a completed backup. The new table
- must be in the same instance as the instance containing the backup. The
- returned table [long-running operation][google.longrunning.Operation] can
- be used to track the progress of the operation, and to cancel it. The
- [metadata][google.longrunning.Operation.metadata] field type is
- [RestoreTableMetadata][google.bigtable.admin.RestoreTableMetadata]. The
- [response][google.longrunning.Operation.response] type is
- [Table][google.bigtable.admin.v2.Table], if successful.
- """
- context.set_code(grpc.StatusCode.UNIMPLEMENTED)
- context.set_details("Method not implemented!")
- raise NotImplementedError("Method not implemented!")
-
- def GetIamPolicy(self, request, context):
- """Gets the access control policy for a resource.
- Returns an empty policy if the resource exists but does not have a policy
- set.
- """
- context.set_code(grpc.StatusCode.UNIMPLEMENTED)
- context.set_details("Method not implemented!")
- raise NotImplementedError("Method not implemented!")
-
- def SetIamPolicy(self, request, context):
- """Sets the access control policy on a Table or Backup resource.
- Replaces any existing policy.
- """
- context.set_code(grpc.StatusCode.UNIMPLEMENTED)
- context.set_details("Method not implemented!")
- raise NotImplementedError("Method not implemented!")
-
- def TestIamPermissions(self, request, context):
- """Returns permissions that the caller has on the specified table resource.
- """
- context.set_code(grpc.StatusCode.UNIMPLEMENTED)
- context.set_details("Method not implemented!")
- raise NotImplementedError("Method not implemented!")
-
-
-def add_BigtableTableAdminServicer_to_server(servicer, server):
- rpc_method_handlers = {
- "CreateTable": grpc.unary_unary_rpc_method_handler(
- servicer.CreateTable,
- request_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.CreateTableRequest.FromString,
- response_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_table__pb2.Table.SerializeToString,
- ),
- "CreateTableFromSnapshot": grpc.unary_unary_rpc_method_handler(
- servicer.CreateTableFromSnapshot,
- request_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.CreateTableFromSnapshotRequest.FromString,
- response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString,
- ),
- "ListTables": grpc.unary_unary_rpc_method_handler(
- servicer.ListTables,
- request_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.ListTablesRequest.FromString,
- response_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.ListTablesResponse.SerializeToString,
- ),
- "GetTable": grpc.unary_unary_rpc_method_handler(
- servicer.GetTable,
- request_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.GetTableRequest.FromString,
- response_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_table__pb2.Table.SerializeToString,
- ),
- "DeleteTable": grpc.unary_unary_rpc_method_handler(
- servicer.DeleteTable,
- request_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.DeleteTableRequest.FromString,
- response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
- ),
- "ModifyColumnFamilies": grpc.unary_unary_rpc_method_handler(
- servicer.ModifyColumnFamilies,
- request_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.ModifyColumnFamiliesRequest.FromString,
- response_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_table__pb2.Table.SerializeToString,
- ),
- "DropRowRange": grpc.unary_unary_rpc_method_handler(
- servicer.DropRowRange,
- request_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.DropRowRangeRequest.FromString,
- response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
- ),
- "GenerateConsistencyToken": grpc.unary_unary_rpc_method_handler(
- servicer.GenerateConsistencyToken,
- request_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.GenerateConsistencyTokenRequest.FromString,
- response_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.GenerateConsistencyTokenResponse.SerializeToString,
- ),
- "CheckConsistency": grpc.unary_unary_rpc_method_handler(
- servicer.CheckConsistency,
- request_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.CheckConsistencyRequest.FromString,
- response_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.CheckConsistencyResponse.SerializeToString,
- ),
- "SnapshotTable": grpc.unary_unary_rpc_method_handler(
- servicer.SnapshotTable,
- request_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.SnapshotTableRequest.FromString,
- response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString,
- ),
- "GetSnapshot": grpc.unary_unary_rpc_method_handler(
- servicer.GetSnapshot,
- request_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.GetSnapshotRequest.FromString,
- response_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_table__pb2.Snapshot.SerializeToString,
- ),
- "ListSnapshots": grpc.unary_unary_rpc_method_handler(
- servicer.ListSnapshots,
- request_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.ListSnapshotsRequest.FromString,
- response_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.ListSnapshotsResponse.SerializeToString,
- ),
- "DeleteSnapshot": grpc.unary_unary_rpc_method_handler(
- servicer.DeleteSnapshot,
- request_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.DeleteSnapshotRequest.FromString,
- response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
- ),
- "CreateBackup": grpc.unary_unary_rpc_method_handler(
- servicer.CreateBackup,
- request_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.CreateBackupRequest.FromString,
- response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString,
- ),
- "GetBackup": grpc.unary_unary_rpc_method_handler(
- servicer.GetBackup,
- request_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.GetBackupRequest.FromString,
- response_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_table__pb2.Backup.SerializeToString,
- ),
- "UpdateBackup": grpc.unary_unary_rpc_method_handler(
- servicer.UpdateBackup,
- request_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.UpdateBackupRequest.FromString,
- response_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_table__pb2.Backup.SerializeToString,
- ),
- "DeleteBackup": grpc.unary_unary_rpc_method_handler(
- servicer.DeleteBackup,
- request_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.DeleteBackupRequest.FromString,
- response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
- ),
- "ListBackups": grpc.unary_unary_rpc_method_handler(
- servicer.ListBackups,
- request_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.ListBackupsRequest.FromString,
- response_serializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.ListBackupsResponse.SerializeToString,
- ),
- "RestoreTable": grpc.unary_unary_rpc_method_handler(
- servicer.RestoreTable,
- request_deserializer=google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.RestoreTableRequest.FromString,
- response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString,
- ),
- "GetIamPolicy": grpc.unary_unary_rpc_method_handler(
- servicer.GetIamPolicy,
- request_deserializer=google_dot_iam_dot_v1_dot_iam__policy__pb2.GetIamPolicyRequest.FromString,
- response_serializer=google_dot_iam_dot_v1_dot_policy__pb2.Policy.SerializeToString,
- ),
- "SetIamPolicy": grpc.unary_unary_rpc_method_handler(
- servicer.SetIamPolicy,
- request_deserializer=google_dot_iam_dot_v1_dot_iam__policy__pb2.SetIamPolicyRequest.FromString,
- response_serializer=google_dot_iam_dot_v1_dot_policy__pb2.Policy.SerializeToString,
- ),
- "TestIamPermissions": grpc.unary_unary_rpc_method_handler(
- servicer.TestIamPermissions,
- request_deserializer=google_dot_iam_dot_v1_dot_iam__policy__pb2.TestIamPermissionsRequest.FromString,
- response_serializer=google_dot_iam_dot_v1_dot_iam__policy__pb2.TestIamPermissionsResponse.SerializeToString,
- ),
- }
- generic_handler = grpc.method_handlers_generic_handler(
- "google.bigtable.admin.v2.BigtableTableAdmin", rpc_method_handlers
- )
- server.add_generic_rpc_handlers((generic_handler,))
-
-
-# This class is part of an EXPERIMENTAL API.
-class BigtableTableAdmin(object):
- """Service for creating, configuring, and deleting Cloud Bigtable tables.
-
-
- Provides access to the table schemas only, not the data stored within
- the tables.
- """
-
- @staticmethod
- def CreateTable(
- request,
- target,
- options=(),
- channel_credentials=None,
- call_credentials=None,
- compression=None,
- wait_for_ready=None,
- timeout=None,
- metadata=None,
- ):
- return grpc.experimental.unary_unary(
- request,
- target,
- "/google.bigtable.admin.v2.BigtableTableAdmin/CreateTable",
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.CreateTableRequest.SerializeToString,
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_table__pb2.Table.FromString,
- options,
- channel_credentials,
- call_credentials,
- compression,
- wait_for_ready,
- timeout,
- metadata,
- )
-
- @staticmethod
- def CreateTableFromSnapshot(
- request,
- target,
- options=(),
- channel_credentials=None,
- call_credentials=None,
- compression=None,
- wait_for_ready=None,
- timeout=None,
- metadata=None,
- ):
- return grpc.experimental.unary_unary(
- request,
- target,
- "/google.bigtable.admin.v2.BigtableTableAdmin/CreateTableFromSnapshot",
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.CreateTableFromSnapshotRequest.SerializeToString,
- google_dot_longrunning_dot_operations__pb2.Operation.FromString,
- options,
- channel_credentials,
- call_credentials,
- compression,
- wait_for_ready,
- timeout,
- metadata,
- )
-
- @staticmethod
- def ListTables(
- request,
- target,
- options=(),
- channel_credentials=None,
- call_credentials=None,
- compression=None,
- wait_for_ready=None,
- timeout=None,
- metadata=None,
- ):
- return grpc.experimental.unary_unary(
- request,
- target,
- "/google.bigtable.admin.v2.BigtableTableAdmin/ListTables",
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.ListTablesRequest.SerializeToString,
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.ListTablesResponse.FromString,
- options,
- channel_credentials,
- call_credentials,
- compression,
- wait_for_ready,
- timeout,
- metadata,
- )
-
- @staticmethod
- def GetTable(
- request,
- target,
- options=(),
- channel_credentials=None,
- call_credentials=None,
- compression=None,
- wait_for_ready=None,
- timeout=None,
- metadata=None,
- ):
- return grpc.experimental.unary_unary(
- request,
- target,
- "/google.bigtable.admin.v2.BigtableTableAdmin/GetTable",
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.GetTableRequest.SerializeToString,
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_table__pb2.Table.FromString,
- options,
- channel_credentials,
- call_credentials,
- compression,
- wait_for_ready,
- timeout,
- metadata,
- )
-
- @staticmethod
- def DeleteTable(
- request,
- target,
- options=(),
- channel_credentials=None,
- call_credentials=None,
- compression=None,
- wait_for_ready=None,
- timeout=None,
- metadata=None,
- ):
- return grpc.experimental.unary_unary(
- request,
- target,
- "/google.bigtable.admin.v2.BigtableTableAdmin/DeleteTable",
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.DeleteTableRequest.SerializeToString,
- google_dot_protobuf_dot_empty__pb2.Empty.FromString,
- options,
- channel_credentials,
- call_credentials,
- compression,
- wait_for_ready,
- timeout,
- metadata,
- )
-
- @staticmethod
- def ModifyColumnFamilies(
- request,
- target,
- options=(),
- channel_credentials=None,
- call_credentials=None,
- compression=None,
- wait_for_ready=None,
- timeout=None,
- metadata=None,
- ):
- return grpc.experimental.unary_unary(
- request,
- target,
- "/google.bigtable.admin.v2.BigtableTableAdmin/ModifyColumnFamilies",
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.ModifyColumnFamiliesRequest.SerializeToString,
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_table__pb2.Table.FromString,
- options,
- channel_credentials,
- call_credentials,
- compression,
- wait_for_ready,
- timeout,
- metadata,
- )
-
- @staticmethod
- def DropRowRange(
- request,
- target,
- options=(),
- channel_credentials=None,
- call_credentials=None,
- compression=None,
- wait_for_ready=None,
- timeout=None,
- metadata=None,
- ):
- return grpc.experimental.unary_unary(
- request,
- target,
- "/google.bigtable.admin.v2.BigtableTableAdmin/DropRowRange",
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.DropRowRangeRequest.SerializeToString,
- google_dot_protobuf_dot_empty__pb2.Empty.FromString,
- options,
- channel_credentials,
- call_credentials,
- compression,
- wait_for_ready,
- timeout,
- metadata,
- )
-
- @staticmethod
- def GenerateConsistencyToken(
- request,
- target,
- options=(),
- channel_credentials=None,
- call_credentials=None,
- compression=None,
- wait_for_ready=None,
- timeout=None,
- metadata=None,
- ):
- return grpc.experimental.unary_unary(
- request,
- target,
- "/google.bigtable.admin.v2.BigtableTableAdmin/GenerateConsistencyToken",
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.GenerateConsistencyTokenRequest.SerializeToString,
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.GenerateConsistencyTokenResponse.FromString,
- options,
- channel_credentials,
- call_credentials,
- compression,
- wait_for_ready,
- timeout,
- metadata,
- )
-
- @staticmethod
- def CheckConsistency(
- request,
- target,
- options=(),
- channel_credentials=None,
- call_credentials=None,
- compression=None,
- wait_for_ready=None,
- timeout=None,
- metadata=None,
- ):
- return grpc.experimental.unary_unary(
- request,
- target,
- "/google.bigtable.admin.v2.BigtableTableAdmin/CheckConsistency",
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.CheckConsistencyRequest.SerializeToString,
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.CheckConsistencyResponse.FromString,
- options,
- channel_credentials,
- call_credentials,
- compression,
- wait_for_ready,
- timeout,
- metadata,
- )
-
- @staticmethod
- def SnapshotTable(
- request,
- target,
- options=(),
- channel_credentials=None,
- call_credentials=None,
- compression=None,
- wait_for_ready=None,
- timeout=None,
- metadata=None,
- ):
- return grpc.experimental.unary_unary(
- request,
- target,
- "/google.bigtable.admin.v2.BigtableTableAdmin/SnapshotTable",
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.SnapshotTableRequest.SerializeToString,
- google_dot_longrunning_dot_operations__pb2.Operation.FromString,
- options,
- channel_credentials,
- call_credentials,
- compression,
- wait_for_ready,
- timeout,
- metadata,
- )
-
- @staticmethod
- def GetSnapshot(
- request,
- target,
- options=(),
- channel_credentials=None,
- call_credentials=None,
- compression=None,
- wait_for_ready=None,
- timeout=None,
- metadata=None,
- ):
- return grpc.experimental.unary_unary(
- request,
- target,
- "/google.bigtable.admin.v2.BigtableTableAdmin/GetSnapshot",
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.GetSnapshotRequest.SerializeToString,
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_table__pb2.Snapshot.FromString,
- options,
- channel_credentials,
- call_credentials,
- compression,
- wait_for_ready,
- timeout,
- metadata,
- )
-
- @staticmethod
- def ListSnapshots(
- request,
- target,
- options=(),
- channel_credentials=None,
- call_credentials=None,
- compression=None,
- wait_for_ready=None,
- timeout=None,
- metadata=None,
- ):
- return grpc.experimental.unary_unary(
- request,
- target,
- "/google.bigtable.admin.v2.BigtableTableAdmin/ListSnapshots",
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.ListSnapshotsRequest.SerializeToString,
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.ListSnapshotsResponse.FromString,
- options,
- channel_credentials,
- call_credentials,
- compression,
- wait_for_ready,
- timeout,
- metadata,
- )
-
- @staticmethod
- def DeleteSnapshot(
- request,
- target,
- options=(),
- channel_credentials=None,
- call_credentials=None,
- compression=None,
- wait_for_ready=None,
- timeout=None,
- metadata=None,
- ):
- return grpc.experimental.unary_unary(
- request,
- target,
- "/google.bigtable.admin.v2.BigtableTableAdmin/DeleteSnapshot",
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.DeleteSnapshotRequest.SerializeToString,
- google_dot_protobuf_dot_empty__pb2.Empty.FromString,
- options,
- channel_credentials,
- call_credentials,
- compression,
- wait_for_ready,
- timeout,
- metadata,
- )
-
- @staticmethod
- def CreateBackup(
- request,
- target,
- options=(),
- channel_credentials=None,
- call_credentials=None,
- compression=None,
- wait_for_ready=None,
- timeout=None,
- metadata=None,
- ):
- return grpc.experimental.unary_unary(
- request,
- target,
- "/google.bigtable.admin.v2.BigtableTableAdmin/CreateBackup",
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.CreateBackupRequest.SerializeToString,
- google_dot_longrunning_dot_operations__pb2.Operation.FromString,
- options,
- channel_credentials,
- call_credentials,
- compression,
- wait_for_ready,
- timeout,
- metadata,
- )
-
- @staticmethod
- def GetBackup(
- request,
- target,
- options=(),
- channel_credentials=None,
- call_credentials=None,
- compression=None,
- wait_for_ready=None,
- timeout=None,
- metadata=None,
- ):
- return grpc.experimental.unary_unary(
- request,
- target,
- "/google.bigtable.admin.v2.BigtableTableAdmin/GetBackup",
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.GetBackupRequest.SerializeToString,
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_table__pb2.Backup.FromString,
- options,
- channel_credentials,
- call_credentials,
- compression,
- wait_for_ready,
- timeout,
- metadata,
- )
-
- @staticmethod
- def UpdateBackup(
- request,
- target,
- options=(),
- channel_credentials=None,
- call_credentials=None,
- compression=None,
- wait_for_ready=None,
- timeout=None,
- metadata=None,
- ):
- return grpc.experimental.unary_unary(
- request,
- target,
- "/google.bigtable.admin.v2.BigtableTableAdmin/UpdateBackup",
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.UpdateBackupRequest.SerializeToString,
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_table__pb2.Backup.FromString,
- options,
- channel_credentials,
- call_credentials,
- compression,
- wait_for_ready,
- timeout,
- metadata,
- )
-
- @staticmethod
- def DeleteBackup(
- request,
- target,
- options=(),
- channel_credentials=None,
- call_credentials=None,
- compression=None,
- wait_for_ready=None,
- timeout=None,
- metadata=None,
- ):
- return grpc.experimental.unary_unary(
- request,
- target,
- "/google.bigtable.admin.v2.BigtableTableAdmin/DeleteBackup",
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.DeleteBackupRequest.SerializeToString,
- google_dot_protobuf_dot_empty__pb2.Empty.FromString,
- options,
- channel_credentials,
- call_credentials,
- compression,
- wait_for_ready,
- timeout,
- metadata,
- )
-
- @staticmethod
- def ListBackups(
- request,
- target,
- options=(),
- channel_credentials=None,
- call_credentials=None,
- compression=None,
- wait_for_ready=None,
- timeout=None,
- metadata=None,
- ):
- return grpc.experimental.unary_unary(
- request,
- target,
- "/google.bigtable.admin.v2.BigtableTableAdmin/ListBackups",
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.ListBackupsRequest.SerializeToString,
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.ListBackupsResponse.FromString,
- options,
- channel_credentials,
- call_credentials,
- compression,
- wait_for_ready,
- timeout,
- metadata,
- )
-
- @staticmethod
- def RestoreTable(
- request,
- target,
- options=(),
- channel_credentials=None,
- call_credentials=None,
- compression=None,
- wait_for_ready=None,
- timeout=None,
- metadata=None,
- ):
- return grpc.experimental.unary_unary(
- request,
- target,
- "/google.bigtable.admin.v2.BigtableTableAdmin/RestoreTable",
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_bigtable__table__admin__pb2.RestoreTableRequest.SerializeToString,
- google_dot_longrunning_dot_operations__pb2.Operation.FromString,
- options,
- channel_credentials,
- call_credentials,
- compression,
- wait_for_ready,
- timeout,
- metadata,
- )
-
- @staticmethod
- def GetIamPolicy(
- request,
- target,
- options=(),
- channel_credentials=None,
- call_credentials=None,
- compression=None,
- wait_for_ready=None,
- timeout=None,
- metadata=None,
- ):
- return grpc.experimental.unary_unary(
- request,
- target,
- "/google.bigtable.admin.v2.BigtableTableAdmin/GetIamPolicy",
- google_dot_iam_dot_v1_dot_iam__policy__pb2.GetIamPolicyRequest.SerializeToString,
- google_dot_iam_dot_v1_dot_policy__pb2.Policy.FromString,
- options,
- channel_credentials,
- call_credentials,
- compression,
- wait_for_ready,
- timeout,
- metadata,
- )
-
- @staticmethod
- def SetIamPolicy(
- request,
- target,
- options=(),
- channel_credentials=None,
- call_credentials=None,
- compression=None,
- wait_for_ready=None,
- timeout=None,
- metadata=None,
- ):
- return grpc.experimental.unary_unary(
- request,
- target,
- "/google.bigtable.admin.v2.BigtableTableAdmin/SetIamPolicy",
- google_dot_iam_dot_v1_dot_iam__policy__pb2.SetIamPolicyRequest.SerializeToString,
- google_dot_iam_dot_v1_dot_policy__pb2.Policy.FromString,
- options,
- channel_credentials,
- call_credentials,
- compression,
- wait_for_ready,
- timeout,
- metadata,
- )
-
- @staticmethod
- def TestIamPermissions(
- request,
- target,
- options=(),
- channel_credentials=None,
- call_credentials=None,
- compression=None,
- wait_for_ready=None,
- timeout=None,
- metadata=None,
- ):
- return grpc.experimental.unary_unary(
- request,
- target,
- "/google.bigtable.admin.v2.BigtableTableAdmin/TestIamPermissions",
- google_dot_iam_dot_v1_dot_iam__policy__pb2.TestIamPermissionsRequest.SerializeToString,
- google_dot_iam_dot_v1_dot_iam__policy__pb2.TestIamPermissionsResponse.FromString,
- options,
- channel_credentials,
- call_credentials,
- compression,
- wait_for_ready,
- timeout,
- metadata,
- )
diff --git a/google/cloud/bigtable_admin_v2/proto/bigtable_table_data.proto b/google/cloud/bigtable_admin_v2/proto/bigtable_table_data.proto
deleted file mode 100644
index e4efb74f5..000000000
--- a/google/cloud/bigtable_admin_v2/proto/bigtable_table_data.proto
+++ /dev/null
@@ -1,126 +0,0 @@
-// Copyright 2017 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-syntax = "proto3";
-
-package google.bigtable.admin.table.v1;
-
-import "google/longrunning/operations.proto";
-import "google/protobuf/duration.proto";
-
-option go_package = "google.golang.org/genproto/googleapis/bigtable/admin/table/v1;table";
-option java_multiple_files = true;
-option java_outer_classname = "BigtableTableDataProto";
-option java_package = "com.google.bigtable.admin.table.v1";
-
-
-// A collection of user data indexed by row, column, and timestamp.
-// Each table is served using the resources of its parent cluster.
-message Table {
- enum TimestampGranularity {
- MILLIS = 0;
- }
-
- // A unique identifier of the form
- // /tables/[_a-zA-Z0-9][-_.a-zA-Z0-9]*
- string name = 1;
-
- // If this Table is in the process of being created, the Operation used to
- // track its progress. As long as this operation is present, the Table will
- // not accept any Table Admin or Read/Write requests.
- google.longrunning.Operation current_operation = 2;
-
- // The column families configured for this table, mapped by column family id.
- map column_families = 3;
-
- // The granularity (e.g. MILLIS, MICROS) at which timestamps are stored in
- // this table. Timestamps not matching the granularity will be rejected.
- // Cannot be changed once the table is created.
- TimestampGranularity granularity = 4;
-}
-
-// A set of columns within a table which share a common configuration.
-message ColumnFamily {
- // A unique identifier of the form /columnFamilies/[-_.a-zA-Z0-9]+
- // The last segment is the same as the "name" field in
- // google.bigtable.v1.Family.
- string name = 1;
-
- // Garbage collection expression specified by the following grammar:
- // GC = EXPR
- // | "" ;
- // EXPR = EXPR, "||", EXPR (* lowest precedence *)
- // | EXPR, "&&", EXPR
- // | "(", EXPR, ")" (* highest precedence *)
- // | PROP ;
- // PROP = "version() >", NUM32
- // | "age() >", NUM64, [ UNIT ] ;
- // NUM32 = non-zero-digit { digit } ; (* # NUM32 <= 2^32 - 1 *)
- // NUM64 = non-zero-digit { digit } ; (* # NUM64 <= 2^63 - 1 *)
- // UNIT = "d" | "h" | "m" (* d=days, h=hours, m=minutes, else micros *)
- // GC expressions can be up to 500 characters in length
- //
- // The different types of PROP are defined as follows:
- // version() - cell index, counting from most recent and starting at 1
- // age() - age of the cell (current time minus cell timestamp)
- //
- // Example: "version() > 3 || (age() > 3d && version() > 1)"
- // drop cells beyond the most recent three, and drop cells older than three
- // days unless they're the most recent cell in the row/column
- //
- // Garbage collection executes opportunistically in the background, and so
- // it's possible for reads to return a cell even if it matches the active GC
- // expression for its family.
- string gc_expression = 2;
-
- // Garbage collection rule specified as a protobuf.
- // Supersedes `gc_expression`.
- // Must serialize to at most 500 bytes.
- //
- // NOTE: Garbage collection executes opportunistically in the background, and
- // so it's possible for reads to return a cell even if it matches the active
- // GC expression for its family.
- GcRule gc_rule = 3;
-}
-
-// Rule for determining which cells to delete during garbage collection.
-message GcRule {
- // A GcRule which deletes cells matching all of the given rules.
- message Intersection {
- // Only delete cells which would be deleted by every element of `rules`.
- repeated GcRule rules = 1;
- }
-
- // A GcRule which deletes cells matching any of the given rules.
- message Union {
- // Delete cells which would be deleted by any element of `rules`.
- repeated GcRule rules = 1;
- }
-
- oneof rule {
- // Delete all cells in a column except the most recent N.
- int32 max_num_versions = 1;
-
- // Delete cells in a column older than the given age.
- // Values must be at least one millisecond, and will be truncated to
- // microsecond granularity.
- google.protobuf.Duration max_age = 2;
-
- // Delete cells that would be deleted by every nested rule.
- Intersection intersection = 3;
-
- // Delete cells that would be deleted by any nested rule.
- Union union = 4;
- }
-}
diff --git a/google/cloud/bigtable_admin_v2/proto/bigtable_table_service.proto b/google/cloud/bigtable_admin_v2/proto/bigtable_table_service.proto
deleted file mode 100644
index 6e968fee1..000000000
--- a/google/cloud/bigtable_admin_v2/proto/bigtable_table_service.proto
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright 2017 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-syntax = "proto3";
-
-package google.bigtable.admin.table.v1;
-
-import "google/api/annotations.proto";
-import "google/bigtable/admin/table/v1/bigtable_table_data.proto";
-import "google/bigtable/admin/table/v1/bigtable_table_service_messages.proto";
-import "google/protobuf/empty.proto";
-
-option go_package = "google.golang.org/genproto/googleapis/bigtable/admin/table/v1;table";
-option java_multiple_files = true;
-option java_outer_classname = "BigtableTableServicesProto";
-option java_package = "com.google.bigtable.admin.table.v1";
-
-
-// Service for creating, configuring, and deleting Cloud Bigtable tables.
-// Provides access to the table schemas only, not the data stored within the tables.
-service BigtableTableService {
- // Creates a new table, to be served from a specified cluster.
- // The table can be created with a full set of initial column families,
- // specified in the request.
- rpc CreateTable(CreateTableRequest) returns (Table) {
- option (google.api.http) = { post: "/v1/{name=projects/*/zones/*/clusters/*}/tables" body: "*" };
- }
-
- // Lists the names of all tables served from a specified cluster.
- rpc ListTables(ListTablesRequest) returns (ListTablesResponse) {
- option (google.api.http) = { get: "/v1/{name=projects/*/zones/*/clusters/*}/tables" };
- }
-
- // Gets the schema of the specified table, including its column families.
- rpc GetTable(GetTableRequest) returns (Table) {
- option (google.api.http) = { get: "/v1/{name=projects/*/zones/*/clusters/*/tables/*}" };
- }
-
- // Permanently deletes a specified table and all of its data.
- rpc DeleteTable(DeleteTableRequest) returns (google.protobuf.Empty) {
- option (google.api.http) = { delete: "/v1/{name=projects/*/zones/*/clusters/*/tables/*}" };
- }
-
- // Changes the name of a specified table.
- // Cannot be used to move tables between clusters, zones, or projects.
- rpc RenameTable(RenameTableRequest) returns (google.protobuf.Empty) {
- option (google.api.http) = { post: "/v1/{name=projects/*/zones/*/clusters/*/tables/*}:rename" body: "*" };
- }
-
- // Creates a new column family within a specified table.
- rpc CreateColumnFamily(CreateColumnFamilyRequest) returns (ColumnFamily) {
- option (google.api.http) = { post: "/v1/{name=projects/*/zones/*/clusters/*/tables/*}/columnFamilies" body: "*" };
- }
-
- // Changes the configuration of a specified column family.
- rpc UpdateColumnFamily(ColumnFamily) returns (ColumnFamily) {
- option (google.api.http) = { put: "/v1/{name=projects/*/zones/*/clusters/*/tables/*/columnFamilies/*}" body: "*" };
- }
-
- // Permanently deletes a specified column family and all of its data.
- rpc DeleteColumnFamily(DeleteColumnFamilyRequest) returns (google.protobuf.Empty) {
- option (google.api.http) = { delete: "/v1/{name=projects/*/zones/*/clusters/*/tables/*/columnFamilies/*}" };
- }
-
- // Delete all rows in a table corresponding to a particular prefix
- rpc BulkDeleteRows(BulkDeleteRowsRequest) returns (google.protobuf.Empty) {
- option (google.api.http) = { post: "/v1/{table_name=projects/*/zones/*/clusters/*/tables/*}:bulkDeleteRows" body: "*" };
- }
-}
diff --git a/google/cloud/bigtable_admin_v2/proto/bigtable_table_service_messages.proto b/google/cloud/bigtable_admin_v2/proto/bigtable_table_service_messages.proto
deleted file mode 100644
index 617ede655..000000000
--- a/google/cloud/bigtable_admin_v2/proto/bigtable_table_service_messages.proto
+++ /dev/null
@@ -1,116 +0,0 @@
-// Copyright 2017 Google Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-syntax = "proto3";
-
-package google.bigtable.admin.table.v1;
-
-import "google/bigtable/admin/table/v1/bigtable_table_data.proto";
-
-option go_package = "google.golang.org/genproto/googleapis/bigtable/admin/table/v1;table";
-option java_multiple_files = true;
-option java_outer_classname = "BigtableTableServiceMessagesProto";
-option java_package = "com.google.bigtable.admin.table.v1";
-
-
-message CreateTableRequest {
- // The unique name of the cluster in which to create the new table.
- string name = 1;
-
- // The name by which the new table should be referred to within the cluster,
- // e.g. "foobar" rather than "/tables/foobar".
- string table_id = 2;
-
- // The Table to create. The `name` field of the Table and all of its
- // ColumnFamilies must be left blank, and will be populated in the response.
- Table table = 3;
-
- // The optional list of row keys that will be used to initially split the
- // table into several tablets (Tablets are similar to HBase regions).
- // Given two split keys, "s1" and "s2", three tablets will be created,
- // spanning the key ranges: [, s1), [s1, s2), [s2, ).
- //
- // Example:
- // * Row keys := ["a", "apple", "custom", "customer_1", "customer_2",
- // "other", "zz"]
- // * initial_split_keys := ["apple", "customer_1", "customer_2", "other"]
- // * Key assignment:
- // - Tablet 1 [, apple) => {"a"}.
- // - Tablet 2 [apple, customer_1) => {"apple", "custom"}.
- // - Tablet 3 [customer_1, customer_2) => {"customer_1"}.
- // - Tablet 4 [customer_2, other) => {"customer_2"}.
- // - Tablet 5 [other, ) => {"other", "zz"}.
- repeated string initial_split_keys = 4;
-}
-
-message ListTablesRequest {
- // The unique name of the cluster for which tables should be listed.
- string name = 1;
-}
-
-message ListTablesResponse {
- // The tables present in the requested cluster.
- // At present, only the names of the tables are populated.
- repeated Table tables = 1;
-}
-
-message GetTableRequest {
- // The unique name of the requested table.
- string name = 1;
-}
-
-message DeleteTableRequest {
- // The unique name of the table to be deleted.
- string name = 1;
-}
-
-message RenameTableRequest {
- // The current unique name of the table.
- string name = 1;
-
- // The new name by which the table should be referred to within its containing
- // cluster, e.g. "foobar" rather than "/tables/foobar".
- string new_id = 2;
-}
-
-message CreateColumnFamilyRequest {
- // The unique name of the table in which to create the new column family.
- string name = 1;
-
- // The name by which the new column family should be referred to within the
- // table, e.g. "foobar" rather than "/columnFamilies/foobar".
- string column_family_id = 2;
-
- // The column family to create. The `name` field must be left blank.
- ColumnFamily column_family = 3;
-}
-
-message DeleteColumnFamilyRequest {
- // The unique name of the column family to be deleted.
- string name = 1;
-}
-
-message BulkDeleteRowsRequest {
- // The unique name of the table on which to perform the bulk delete
- string table_name = 1;
-
- oneof target {
- // Delete all rows that start with this row key prefix. Prefix cannot be
- // zero length.
- bytes row_key_prefix = 2;
-
- // Delete all rows in the table. Setting this to false is a no-op.
- bool delete_all_data_from_table = 3;
- }
-}
diff --git a/google/cloud/bigtable_admin_v2/proto/common.proto b/google/cloud/bigtable_admin_v2/proto/common.proto
deleted file mode 100644
index 17c69d469..000000000
--- a/google/cloud/bigtable_admin_v2/proto/common.proto
+++ /dev/null
@@ -1,54 +0,0 @@
-// 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.
-
-syntax = "proto3";
-
-package google.bigtable.admin.v2;
-
-import "google/protobuf/timestamp.proto";
-
-option csharp_namespace = "Google.Cloud.Bigtable.Admin.V2";
-option go_package = "google.golang.org/genproto/googleapis/bigtable/admin/v2;admin";
-option java_multiple_files = true;
-option java_outer_classname = "CommonProto";
-option java_package = "com.google.bigtable.admin.v2";
-option php_namespace = "Google\\Cloud\\Bigtable\\Admin\\V2";
-option ruby_package = "Google::Cloud::Bigtable::Admin::V2";
-
-// Storage media types for persisting Bigtable data.
-enum StorageType {
- // The user did not specify a storage type.
- STORAGE_TYPE_UNSPECIFIED = 0;
-
- // Flash (SSD) storage should be used.
- SSD = 1;
-
- // Magnetic drive (HDD) storage should be used.
- HDD = 2;
-}
-
-// Encapsulates progress related information for a Cloud Bigtable long
-// running operation.
-message OperationProgress {
- // Percent completion of the operation.
- // Values are between 0 and 100 inclusive.
- int32 progress_percent = 1;
-
- // Time the request was received.
- google.protobuf.Timestamp start_time = 2;
-
- // If set, the time at which this operation failed or was completed
- // successfully.
- google.protobuf.Timestamp end_time = 3;
-}
diff --git a/google/cloud/bigtable_admin_v2/proto/common_pb2.py b/google/cloud/bigtable_admin_v2/proto/common_pb2.py
deleted file mode 100644
index 09233cff5..000000000
--- a/google/cloud/bigtable_admin_v2/proto/common_pb2.py
+++ /dev/null
@@ -1,188 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/cloud/bigtable_admin_v2/proto/common.proto
-"""Generated protocol buffer code."""
-from google.protobuf.internal import enum_type_wrapper
-from google.protobuf import descriptor as _descriptor
-from google.protobuf import message as _message
-from google.protobuf import reflection as _reflection
-from google.protobuf import symbol_database as _symbol_database
-
-# @@protoc_insertion_point(imports)
-
-_sym_db = _symbol_database.Default()
-
-
-from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2
-
-
-DESCRIPTOR = _descriptor.FileDescriptor(
- name="google/cloud/bigtable_admin_v2/proto/common.proto",
- package="google.bigtable.admin.v2",
- syntax="proto3",
- serialized_options=b'\n\034com.google.bigtable.admin.v2B\013CommonProtoP\001Z=google.golang.org/genproto/googleapis/bigtable/admin/v2;admin\252\002\036Google.Cloud.Bigtable.Admin.V2\312\002\036Google\\Cloud\\Bigtable\\Admin\\V2\352\002"Google::Cloud::Bigtable::Admin::V2',
- create_key=_descriptor._internal_create_key,
- serialized_pb=b'\n1google/cloud/bigtable_admin_v2/proto/common.proto\x12\x18google.bigtable.admin.v2\x1a\x1fgoogle/protobuf/timestamp.proto"\x8b\x01\n\x11OperationProgress\x12\x18\n\x10progress_percent\x18\x01 \x01(\x05\x12.\n\nstart_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12,\n\x08\x65nd_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp*=\n\x0bStorageType\x12\x1c\n\x18STORAGE_TYPE_UNSPECIFIED\x10\x00\x12\x07\n\x03SSD\x10\x01\x12\x07\n\x03HDD\x10\x02\x42\xd3\x01\n\x1c\x63om.google.bigtable.admin.v2B\x0b\x43ommonProtoP\x01Z=google.golang.org/genproto/googleapis/bigtable/admin/v2;admin\xaa\x02\x1eGoogle.Cloud.Bigtable.Admin.V2\xca\x02\x1eGoogle\\Cloud\\Bigtable\\Admin\\V2\xea\x02"Google::Cloud::Bigtable::Admin::V2b\x06proto3',
- dependencies=[google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR,],
-)
-
-_STORAGETYPE = _descriptor.EnumDescriptor(
- name="StorageType",
- full_name="google.bigtable.admin.v2.StorageType",
- filename=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- values=[
- _descriptor.EnumValueDescriptor(
- name="STORAGE_TYPE_UNSPECIFIED",
- index=0,
- number=0,
- serialized_options=None,
- type=None,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.EnumValueDescriptor(
- name="SSD",
- index=1,
- number=1,
- serialized_options=None,
- type=None,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.EnumValueDescriptor(
- name="HDD",
- index=2,
- number=2,
- serialized_options=None,
- type=None,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- containing_type=None,
- serialized_options=None,
- serialized_start=254,
- serialized_end=315,
-)
-_sym_db.RegisterEnumDescriptor(_STORAGETYPE)
-
-StorageType = enum_type_wrapper.EnumTypeWrapper(_STORAGETYPE)
-STORAGE_TYPE_UNSPECIFIED = 0
-SSD = 1
-HDD = 2
-
-
-_OPERATIONPROGRESS = _descriptor.Descriptor(
- name="OperationProgress",
- full_name="google.bigtable.admin.v2.OperationProgress",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="progress_percent",
- full_name="google.bigtable.admin.v2.OperationProgress.progress_percent",
- index=0,
- number=1,
- type=5,
- cpp_type=1,
- label=1,
- has_default_value=False,
- default_value=0,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="start_time",
- full_name="google.bigtable.admin.v2.OperationProgress.start_time",
- index=1,
- number=2,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="end_time",
- full_name="google.bigtable.admin.v2.OperationProgress.end_time",
- index=2,
- number=3,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=113,
- serialized_end=252,
-)
-
-_OPERATIONPROGRESS.fields_by_name[
- "start_time"
-].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP
-_OPERATIONPROGRESS.fields_by_name[
- "end_time"
-].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP
-DESCRIPTOR.message_types_by_name["OperationProgress"] = _OPERATIONPROGRESS
-DESCRIPTOR.enum_types_by_name["StorageType"] = _STORAGETYPE
-_sym_db.RegisterFileDescriptor(DESCRIPTOR)
-
-OperationProgress = _reflection.GeneratedProtocolMessageType(
- "OperationProgress",
- (_message.Message,),
- {
- "DESCRIPTOR": _OPERATIONPROGRESS,
- "__module__": "google.cloud.bigtable_admin_v2.proto.common_pb2",
- "__doc__": """Encapsulates progress related information for a Cloud Bigtable long
- running operation.
-
- Attributes:
- progress_percent:
- Percent completion of the operation. Values are between 0 and
- 100 inclusive.
- start_time:
- Time the request was received.
- end_time:
- If set, the time at which this operation failed or was
- completed successfully.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.OperationProgress)
- },
-)
-_sym_db.RegisterMessage(OperationProgress)
-
-
-DESCRIPTOR._options = None
-# @@protoc_insertion_point(module_scope)
diff --git a/google/cloud/bigtable_admin_v2/proto/common_pb2_grpc.py b/google/cloud/bigtable_admin_v2/proto/common_pb2_grpc.py
deleted file mode 100644
index 8a9393943..000000000
--- a/google/cloud/bigtable_admin_v2/proto/common_pb2_grpc.py
+++ /dev/null
@@ -1,3 +0,0 @@
-# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
-"""Client and server classes corresponding to protobuf-defined services."""
-import grpc
diff --git a/google/cloud/bigtable_admin_v2/proto/instance.proto b/google/cloud/bigtable_admin_v2/proto/instance.proto
deleted file mode 100644
index 2086f9707..000000000
--- a/google/cloud/bigtable_admin_v2/proto/instance.proto
+++ /dev/null
@@ -1,222 +0,0 @@
-// 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.
-//
-
-syntax = "proto3";
-
-package google.bigtable.admin.v2;
-
-import "google/api/field_behavior.proto";
-import "google/api/resource.proto";
-import "google/bigtable/admin/v2/common.proto";
-
-option csharp_namespace = "Google.Cloud.Bigtable.Admin.V2";
-option go_package = "google.golang.org/genproto/googleapis/bigtable/admin/v2;admin";
-option java_multiple_files = true;
-option java_outer_classname = "InstanceProto";
-option java_package = "com.google.bigtable.admin.v2";
-option php_namespace = "Google\\Cloud\\Bigtable\\Admin\\V2";
-option ruby_package = "Google::Cloud::Bigtable::Admin::V2";
-
-// A collection of Bigtable [Tables][google.bigtable.admin.v2.Table] and
-// the resources that serve them.
-// All tables in an instance are served from all
-// [Clusters][google.bigtable.admin.v2.Cluster] in the instance.
-message Instance {
- option (google.api.resource) = {
- type: "bigtable.googleapis.com/Instance"
- pattern: "projects/{project}/instances/{instance}"
- };
-
- // Possible states of an instance.
- enum State {
- // The state of the instance could not be determined.
- STATE_NOT_KNOWN = 0;
-
- // The instance has been successfully created and can serve requests
- // to its tables.
- READY = 1;
-
- // The instance is currently being created, and may be destroyed
- // if the creation process encounters an error.
- CREATING = 2;
- }
-
- // The type of the instance.
- enum Type {
- // The type of the instance is unspecified. If set when creating an
- // instance, a `PRODUCTION` instance will be created. If set when updating
- // an instance, the type will be left unchanged.
- TYPE_UNSPECIFIED = 0;
-
- // An instance meant for production use. `serve_nodes` must be set
- // on the cluster.
- PRODUCTION = 1;
-
- // The instance is meant for development and testing purposes only; it has
- // no performance or uptime guarantees and is not covered by SLA.
- // After a development instance is created, it can be upgraded by
- // updating the instance to type `PRODUCTION`. An instance created
- // as a production instance cannot be changed to a development instance.
- // When creating a development instance, `serve_nodes` on the cluster must
- // not be set.
- DEVELOPMENT = 2;
- }
-
- // The unique name of the instance. Values are of the form
- // `projects/{project}/instances/[a-z][a-z0-9\\-]+[a-z0-9]`.
- string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
-
- // Required. The descriptive name for this instance as it appears in UIs.
- // Can be changed at any time, but should be kept globally unique
- // to avoid confusion.
- string display_name = 2 [(google.api.field_behavior) = REQUIRED];
-
- // (`OutputOnly`)
- // The current state of the instance.
- State state = 3;
-
- // The type of the instance. Defaults to `PRODUCTION`.
- Type type = 4;
-
- // Labels are a flexible and lightweight mechanism for organizing cloud
- // resources into groups that reflect a customer's organizational needs and
- // deployment strategies. They can be used to filter resources and aggregate
- // metrics.
- //
- // * Label keys must be between 1 and 63 characters long and must conform to
- // the regular expression: `[\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}_-]{0,62}`.
- // * Label values must be between 0 and 63 characters long and must conform to
- // the regular expression: `[\p{Ll}\p{Lo}\p{N}_-]{0,63}`.
- // * No more than 64 labels can be associated with a given resource.
- // * Keys and values must both be under 128 bytes.
- map labels = 5;
-}
-
-// A resizable group of nodes in a particular cloud location, capable
-// of serving all [Tables][google.bigtable.admin.v2.Table] in the parent
-// [Instance][google.bigtable.admin.v2.Instance].
-message Cluster {
- option (google.api.resource) = {
- type: "bigtable.googleapis.com/Cluster"
- pattern: "projects/{project}/instances/{instance}/clusters/{cluster}"
- };
-
- // Possible states of a cluster.
- enum State {
- // The state of the cluster could not be determined.
- STATE_NOT_KNOWN = 0;
-
- // The cluster has been successfully created and is ready to serve requests.
- READY = 1;
-
- // The cluster is currently being created, and may be destroyed
- // if the creation process encounters an error.
- // A cluster may not be able to serve requests while being created.
- CREATING = 2;
-
- // The cluster is currently being resized, and may revert to its previous
- // node count if the process encounters an error.
- // A cluster is still capable of serving requests while being resized,
- // but may exhibit performance as if its number of allocated nodes is
- // between the starting and requested states.
- RESIZING = 3;
-
- // The cluster has no backing nodes. The data (tables) still
- // exist, but no operations can be performed on the cluster.
- DISABLED = 4;
- }
-
- // The unique name of the cluster. Values are of the form
- // `projects/{project}/instances/{instance}/clusters/[a-z][-a-z0-9]*`.
- string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
-
- // (`CreationOnly`)
- // The location where this cluster's nodes and storage reside. For best
- // performance, clients should be located as close as possible to this
- // cluster. Currently only zones are supported, so values should be of the
- // form `projects/{project}/locations/{zone}`.
- string location = 2 [(google.api.resource_reference) = {
- type: "locations.googleapis.com/Location"
- }];
-
- // The current state of the cluster.
- State state = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
-
- // Required. The number of nodes allocated to this cluster. More nodes enable
- // higher throughput and more consistent performance.
- int32 serve_nodes = 4 [(google.api.field_behavior) = REQUIRED];
-
- // (`CreationOnly`)
- // The type of storage used by this cluster to serve its
- // parent instance's tables, unless explicitly overridden.
- StorageType default_storage_type = 5;
-}
-
-// A configuration object describing how Cloud Bigtable should treat traffic
-// from a particular end user application.
-message AppProfile {
- option (google.api.resource) = {
- type: "bigtable.googleapis.com/AppProfile"
- pattern: "projects/{project}/instances/{instance}/appProfiles/{app_profile}"
- };
-
- // Read/write requests are routed to the nearest cluster in the instance, and
- // will fail over to the nearest cluster that is available in the event of
- // transient errors or delays. Clusters in a region are considered
- // equidistant. Choosing this option sacrifices read-your-writes consistency
- // to improve availability.
- message MultiClusterRoutingUseAny {}
-
- // Unconditionally routes all read/write requests to a specific cluster.
- // This option preserves read-your-writes consistency but does not improve
- // availability.
- message SingleClusterRouting {
- // The cluster to which read/write requests should be routed.
- string cluster_id = 1;
-
- // Whether or not `CheckAndMutateRow` and `ReadModifyWriteRow` requests are
- // allowed by this app profile. It is unsafe to send these requests to
- // the same table/row/column in multiple clusters.
- bool allow_transactional_writes = 2;
- }
-
- // (`OutputOnly`)
- // The unique name of the app profile. Values are of the form
- // `projects//instances//appProfiles/[_a-zA-Z0-9][-_.a-zA-Z0-9]*`.
- string name = 1;
-
- // Strongly validated etag for optimistic concurrency control. Preserve the
- // value returned from `GetAppProfile` when calling `UpdateAppProfile` to
- // fail the request if there has been a modification in the mean time. The
- // `update_mask` of the request need not include `etag` for this protection
- // to apply.
- // See [Wikipedia](https://en.wikipedia.org/wiki/HTTP_ETag) and
- // [RFC 7232](https://tools.ietf.org/html/rfc7232#section-2.3) for more
- // details.
- string etag = 2;
-
- // Optional long form description of the use case for this AppProfile.
- string description = 3;
-
- // The routing policy for all read/write requests that use this app profile.
- // A value must be explicitly set.
- oneof routing_policy {
- // Use a multi-cluster routing policy.
- MultiClusterRoutingUseAny multi_cluster_routing_use_any = 5;
-
- // Use a single-cluster routing policy.
- SingleClusterRouting single_cluster_routing = 6;
- }
-}
diff --git a/google/cloud/bigtable_admin_v2/proto/instance_pb2.py b/google/cloud/bigtable_admin_v2/proto/instance_pb2.py
deleted file mode 100644
index e0138e0fb..000000000
--- a/google/cloud/bigtable_admin_v2/proto/instance_pb2.py
+++ /dev/null
@@ -1,886 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/cloud/bigtable_admin_v2/proto/instance.proto
-"""Generated protocol buffer code."""
-from google.protobuf import descriptor as _descriptor
-from google.protobuf import message as _message
-from google.protobuf import reflection as _reflection
-from google.protobuf import symbol_database as _symbol_database
-
-# @@protoc_insertion_point(imports)
-
-_sym_db = _symbol_database.Default()
-
-
-from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2
-from google.api import resource_pb2 as google_dot_api_dot_resource__pb2
-from google.cloud.bigtable_admin_v2.proto import (
- common_pb2 as google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_common__pb2,
-)
-
-
-DESCRIPTOR = _descriptor.FileDescriptor(
- name="google/cloud/bigtable_admin_v2/proto/instance.proto",
- package="google.bigtable.admin.v2",
- syntax="proto3",
- serialized_options=b'\n\034com.google.bigtable.admin.v2B\rInstanceProtoP\001Z=google.golang.org/genproto/googleapis/bigtable/admin/v2;admin\252\002\036Google.Cloud.Bigtable.Admin.V2\312\002\036Google\\Cloud\\Bigtable\\Admin\\V2\352\002"Google::Cloud::Bigtable::Admin::V2',
- create_key=_descriptor._internal_create_key,
- serialized_pb=b'\n3google/cloud/bigtable_admin_v2/proto/instance.proto\x12\x18google.bigtable.admin.v2\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x31google/cloud/bigtable_admin_v2/proto/common.proto"\xdd\x03\n\x08Instance\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x03\x12\x19\n\x0c\x64isplay_name\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\x37\n\x05state\x18\x03 \x01(\x0e\x32(.google.bigtable.admin.v2.Instance.State\x12\x35\n\x04type\x18\x04 \x01(\x0e\x32\'.google.bigtable.admin.v2.Instance.Type\x12>\n\x06labels\x18\x05 \x03(\x0b\x32..google.bigtable.admin.v2.Instance.LabelsEntry\x1a-\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01"5\n\x05State\x12\x13\n\x0fSTATE_NOT_KNOWN\x10\x00\x12\t\n\x05READY\x10\x01\x12\x0c\n\x08\x43REATING\x10\x02"=\n\x04Type\x12\x14\n\x10TYPE_UNSPECIFIED\x10\x00\x12\x0e\n\nPRODUCTION\x10\x01\x12\x0f\n\x0b\x44\x45VELOPMENT\x10\x02:N\xea\x41K\n bigtable.googleapis.com/Instance\x12\'projects/{project}/instances/{instance}"\xa7\x03\n\x07\x43luster\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x03\x12\x38\n\x08location\x18\x02 \x01(\tB&\xfa\x41#\n!locations.googleapis.com/Location\x12;\n\x05state\x18\x03 \x01(\x0e\x32\'.google.bigtable.admin.v2.Cluster.StateB\x03\xe0\x41\x03\x12\x18\n\x0bserve_nodes\x18\x04 \x01(\x05\x42\x03\xe0\x41\x02\x12\x43\n\x14\x64\x65\x66\x61ult_storage_type\x18\x05 \x01(\x0e\x32%.google.bigtable.admin.v2.StorageType"Q\n\x05State\x12\x13\n\x0fSTATE_NOT_KNOWN\x10\x00\x12\t\n\x05READY\x10\x01\x12\x0c\n\x08\x43REATING\x10\x02\x12\x0c\n\x08RESIZING\x10\x03\x12\x0c\n\x08\x44ISABLED\x10\x04:`\xea\x41]\n\x1f\x62igtable.googleapis.com/Cluster\x12:projects/{project}/instances/{instance}/clusters/{cluster}"\xee\x03\n\nAppProfile\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0c\n\x04\x65tag\x18\x02 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x03 \x01(\t\x12g\n\x1dmulti_cluster_routing_use_any\x18\x05 \x01(\x0b\x32>.google.bigtable.admin.v2.AppProfile.MultiClusterRoutingUseAnyH\x00\x12[\n\x16single_cluster_routing\x18\x06 \x01(\x0b\x32\x39.google.bigtable.admin.v2.AppProfile.SingleClusterRoutingH\x00\x1a\x1b\n\x19MultiClusterRoutingUseAny\x1aN\n\x14SingleClusterRouting\x12\x12\n\ncluster_id\x18\x01 \x01(\t\x12"\n\x1a\x61llow_transactional_writes\x18\x02 \x01(\x08:j\xea\x41g\n"bigtable.googleapis.com/AppProfile\x12\x41projects/{project}/instances/{instance}/appProfiles/{app_profile}B\x10\n\x0erouting_policyB\xd5\x01\n\x1c\x63om.google.bigtable.admin.v2B\rInstanceProtoP\x01Z=google.golang.org/genproto/googleapis/bigtable/admin/v2;admin\xaa\x02\x1eGoogle.Cloud.Bigtable.Admin.V2\xca\x02\x1eGoogle\\Cloud\\Bigtable\\Admin\\V2\xea\x02"Google::Cloud::Bigtable::Admin::V2b\x06proto3',
- dependencies=[
- google_dot_api_dot_field__behavior__pb2.DESCRIPTOR,
- google_dot_api_dot_resource__pb2.DESCRIPTOR,
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_common__pb2.DESCRIPTOR,
- ],
-)
-
-
-_INSTANCE_STATE = _descriptor.EnumDescriptor(
- name="State",
- full_name="google.bigtable.admin.v2.Instance.State",
- filename=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- values=[
- _descriptor.EnumValueDescriptor(
- name="STATE_NOT_KNOWN",
- index=0,
- number=0,
- serialized_options=None,
- type=None,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.EnumValueDescriptor(
- name="READY",
- index=1,
- number=1,
- serialized_options=None,
- type=None,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.EnumValueDescriptor(
- name="CREATING",
- index=2,
- number=2,
- serialized_options=None,
- type=None,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- containing_type=None,
- serialized_options=None,
- serialized_start=474,
- serialized_end=527,
-)
-_sym_db.RegisterEnumDescriptor(_INSTANCE_STATE)
-
-_INSTANCE_TYPE = _descriptor.EnumDescriptor(
- name="Type",
- full_name="google.bigtable.admin.v2.Instance.Type",
- filename=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- values=[
- _descriptor.EnumValueDescriptor(
- name="TYPE_UNSPECIFIED",
- index=0,
- number=0,
- serialized_options=None,
- type=None,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.EnumValueDescriptor(
- name="PRODUCTION",
- index=1,
- number=1,
- serialized_options=None,
- type=None,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.EnumValueDescriptor(
- name="DEVELOPMENT",
- index=2,
- number=2,
- serialized_options=None,
- type=None,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- containing_type=None,
- serialized_options=None,
- serialized_start=529,
- serialized_end=590,
-)
-_sym_db.RegisterEnumDescriptor(_INSTANCE_TYPE)
-
-_CLUSTER_STATE = _descriptor.EnumDescriptor(
- name="State",
- full_name="google.bigtable.admin.v2.Cluster.State",
- filename=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- values=[
- _descriptor.EnumValueDescriptor(
- name="STATE_NOT_KNOWN",
- index=0,
- number=0,
- serialized_options=None,
- type=None,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.EnumValueDescriptor(
- name="READY",
- index=1,
- number=1,
- serialized_options=None,
- type=None,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.EnumValueDescriptor(
- name="CREATING",
- index=2,
- number=2,
- serialized_options=None,
- type=None,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.EnumValueDescriptor(
- name="RESIZING",
- index=3,
- number=3,
- serialized_options=None,
- type=None,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.EnumValueDescriptor(
- name="DISABLED",
- index=4,
- number=4,
- serialized_options=None,
- type=None,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- containing_type=None,
- serialized_options=None,
- serialized_start=917,
- serialized_end=998,
-)
-_sym_db.RegisterEnumDescriptor(_CLUSTER_STATE)
-
-
-_INSTANCE_LABELSENTRY = _descriptor.Descriptor(
- name="LabelsEntry",
- full_name="google.bigtable.admin.v2.Instance.LabelsEntry",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="key",
- full_name="google.bigtable.admin.v2.Instance.LabelsEntry.key",
- index=0,
- number=1,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="value",
- full_name="google.bigtable.admin.v2.Instance.LabelsEntry.value",
- index=1,
- number=2,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=b"8\001",
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=427,
- serialized_end=472,
-)
-
-_INSTANCE = _descriptor.Descriptor(
- name="Instance",
- full_name="google.bigtable.admin.v2.Instance",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="name",
- full_name="google.bigtable.admin.v2.Instance.name",
- index=0,
- number=1,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\003",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="display_name",
- full_name="google.bigtable.admin.v2.Instance.display_name",
- index=1,
- number=2,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\002",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="state",
- full_name="google.bigtable.admin.v2.Instance.state",
- index=2,
- number=3,
- type=14,
- cpp_type=8,
- label=1,
- has_default_value=False,
- default_value=0,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="type",
- full_name="google.bigtable.admin.v2.Instance.type",
- index=3,
- number=4,
- type=14,
- cpp_type=8,
- label=1,
- has_default_value=False,
- default_value=0,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="labels",
- full_name="google.bigtable.admin.v2.Instance.labels",
- index=4,
- number=5,
- type=11,
- cpp_type=10,
- label=3,
- has_default_value=False,
- default_value=[],
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[_INSTANCE_LABELSENTRY,],
- enum_types=[_INSTANCE_STATE, _INSTANCE_TYPE,],
- serialized_options=b"\352AK\n bigtable.googleapis.com/Instance\022'projects/{project}/instances/{instance}",
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=193,
- serialized_end=670,
-)
-
-
-_CLUSTER = _descriptor.Descriptor(
- name="Cluster",
- full_name="google.bigtable.admin.v2.Cluster",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="name",
- full_name="google.bigtable.admin.v2.Cluster.name",
- index=0,
- number=1,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\003",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="location",
- full_name="google.bigtable.admin.v2.Cluster.location",
- index=1,
- number=2,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\372A#\n!locations.googleapis.com/Location",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="state",
- full_name="google.bigtable.admin.v2.Cluster.state",
- index=2,
- number=3,
- type=14,
- cpp_type=8,
- label=1,
- has_default_value=False,
- default_value=0,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\003",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="serve_nodes",
- full_name="google.bigtable.admin.v2.Cluster.serve_nodes",
- index=3,
- number=4,
- type=5,
- cpp_type=1,
- label=1,
- has_default_value=False,
- default_value=0,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\002",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="default_storage_type",
- full_name="google.bigtable.admin.v2.Cluster.default_storage_type",
- index=4,
- number=5,
- type=14,
- cpp_type=8,
- label=1,
- has_default_value=False,
- default_value=0,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[_CLUSTER_STATE,],
- serialized_options=b"\352A]\n\037bigtable.googleapis.com/Cluster\022:projects/{project}/instances/{instance}/clusters/{cluster}",
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=673,
- serialized_end=1096,
-)
-
-
-_APPPROFILE_MULTICLUSTERROUTINGUSEANY = _descriptor.Descriptor(
- name="MultiClusterRoutingUseAny",
- full_name="google.bigtable.admin.v2.AppProfile.MultiClusterRoutingUseAny",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=1360,
- serialized_end=1387,
-)
-
-_APPPROFILE_SINGLECLUSTERROUTING = _descriptor.Descriptor(
- name="SingleClusterRouting",
- full_name="google.bigtable.admin.v2.AppProfile.SingleClusterRouting",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="cluster_id",
- full_name="google.bigtable.admin.v2.AppProfile.SingleClusterRouting.cluster_id",
- index=0,
- number=1,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="allow_transactional_writes",
- full_name="google.bigtable.admin.v2.AppProfile.SingleClusterRouting.allow_transactional_writes",
- index=1,
- number=2,
- type=8,
- cpp_type=7,
- label=1,
- has_default_value=False,
- default_value=False,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=1389,
- serialized_end=1467,
-)
-
-_APPPROFILE = _descriptor.Descriptor(
- name="AppProfile",
- full_name="google.bigtable.admin.v2.AppProfile",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="name",
- full_name="google.bigtable.admin.v2.AppProfile.name",
- index=0,
- number=1,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="etag",
- full_name="google.bigtable.admin.v2.AppProfile.etag",
- index=1,
- number=2,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="description",
- full_name="google.bigtable.admin.v2.AppProfile.description",
- index=2,
- number=3,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="multi_cluster_routing_use_any",
- full_name="google.bigtable.admin.v2.AppProfile.multi_cluster_routing_use_any",
- index=3,
- number=5,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="single_cluster_routing",
- full_name="google.bigtable.admin.v2.AppProfile.single_cluster_routing",
- index=4,
- number=6,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[
- _APPPROFILE_MULTICLUSTERROUTINGUSEANY,
- _APPPROFILE_SINGLECLUSTERROUTING,
- ],
- enum_types=[],
- serialized_options=b'\352Ag\n"bigtable.googleapis.com/AppProfile\022Aprojects/{project}/instances/{instance}/appProfiles/{app_profile}',
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[
- _descriptor.OneofDescriptor(
- name="routing_policy",
- full_name="google.bigtable.admin.v2.AppProfile.routing_policy",
- index=0,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[],
- ),
- ],
- serialized_start=1099,
- serialized_end=1593,
-)
-
-_INSTANCE_LABELSENTRY.containing_type = _INSTANCE
-_INSTANCE.fields_by_name["state"].enum_type = _INSTANCE_STATE
-_INSTANCE.fields_by_name["type"].enum_type = _INSTANCE_TYPE
-_INSTANCE.fields_by_name["labels"].message_type = _INSTANCE_LABELSENTRY
-_INSTANCE_STATE.containing_type = _INSTANCE
-_INSTANCE_TYPE.containing_type = _INSTANCE
-_CLUSTER.fields_by_name["state"].enum_type = _CLUSTER_STATE
-_CLUSTER.fields_by_name[
- "default_storage_type"
-].enum_type = (
- google_dot_cloud_dot_bigtable__admin__v2_dot_proto_dot_common__pb2._STORAGETYPE
-)
-_CLUSTER_STATE.containing_type = _CLUSTER
-_APPPROFILE_MULTICLUSTERROUTINGUSEANY.containing_type = _APPPROFILE
-_APPPROFILE_SINGLECLUSTERROUTING.containing_type = _APPPROFILE
-_APPPROFILE.fields_by_name[
- "multi_cluster_routing_use_any"
-].message_type = _APPPROFILE_MULTICLUSTERROUTINGUSEANY
-_APPPROFILE.fields_by_name[
- "single_cluster_routing"
-].message_type = _APPPROFILE_SINGLECLUSTERROUTING
-_APPPROFILE.oneofs_by_name["routing_policy"].fields.append(
- _APPPROFILE.fields_by_name["multi_cluster_routing_use_any"]
-)
-_APPPROFILE.fields_by_name[
- "multi_cluster_routing_use_any"
-].containing_oneof = _APPPROFILE.oneofs_by_name["routing_policy"]
-_APPPROFILE.oneofs_by_name["routing_policy"].fields.append(
- _APPPROFILE.fields_by_name["single_cluster_routing"]
-)
-_APPPROFILE.fields_by_name[
- "single_cluster_routing"
-].containing_oneof = _APPPROFILE.oneofs_by_name["routing_policy"]
-DESCRIPTOR.message_types_by_name["Instance"] = _INSTANCE
-DESCRIPTOR.message_types_by_name["Cluster"] = _CLUSTER
-DESCRIPTOR.message_types_by_name["AppProfile"] = _APPPROFILE
-_sym_db.RegisterFileDescriptor(DESCRIPTOR)
-
-Instance = _reflection.GeneratedProtocolMessageType(
- "Instance",
- (_message.Message,),
- {
- "LabelsEntry": _reflection.GeneratedProtocolMessageType(
- "LabelsEntry",
- (_message.Message,),
- {
- "DESCRIPTOR": _INSTANCE_LABELSENTRY,
- "__module__": "google.cloud.bigtable_admin_v2.proto.instance_pb2"
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.Instance.LabelsEntry)
- },
- ),
- "DESCRIPTOR": _INSTANCE,
- "__module__": "google.cloud.bigtable_admin_v2.proto.instance_pb2",
- "__doc__": """A collection of Bigtable [Tables][google.bigtable.admin.v2.Table] and
- the resources that serve them. All tables in an instance are served
- from all [Clusters][google.bigtable.admin.v2.Cluster] in the instance.
-
- Attributes:
- name:
- The unique name of the instance. Values are of the form
- ``projects/{project}/instances/[a-z][a-z0-9\\-]+[a-z0-9]``.
- display_name:
- Required. The descriptive name for this instance as it appears
- in UIs. Can be changed at any time, but should be kept
- globally unique to avoid confusion.
- state:
- (\ ``OutputOnly``) The current state of the instance.
- type:
- The type of the instance. Defaults to ``PRODUCTION``.
- labels:
- Labels are a flexible and lightweight mechanism for organizing
- cloud resources into groups that reflect a customer’s
- organizational needs and deployment strategies. They can be
- used to filter resources and aggregate metrics. - Label keys
- must be between 1 and 63 characters long and must conform
- to the regular expression:
- ``[\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}_-]{0,62}``. - Label values
- must be between 0 and 63 characters long and must conform
- to the regular expression: ``[\p{Ll}\p{Lo}\p{N}_-]{0,63}``. -
- No more than 64 labels can be associated with a given
- resource. - Keys and values must both be under 128 bytes.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.Instance)
- },
-)
-_sym_db.RegisterMessage(Instance)
-_sym_db.RegisterMessage(Instance.LabelsEntry)
-
-Cluster = _reflection.GeneratedProtocolMessageType(
- "Cluster",
- (_message.Message,),
- {
- "DESCRIPTOR": _CLUSTER,
- "__module__": "google.cloud.bigtable_admin_v2.proto.instance_pb2",
- "__doc__": """A resizable group of nodes in a particular cloud location, capable of
- serving all [Tables][google.bigtable.admin.v2.Table] in the parent
- [Instance][google.bigtable.admin.v2.Instance].
-
- Attributes:
- name:
- The unique name of the cluster. Values are of the form ``proje
- cts/{project}/instances/{instance}/clusters/[a-z][-a-z0-9]*``.
- location:
- (\ ``CreationOnly``) The location where this cluster’s nodes
- and storage reside. For best performance, clients should be
- located as close as possible to this cluster. Currently only
- zones are supported, so values should be of the form
- ``projects/{project}/locations/{zone}``.
- state:
- The current state of the cluster.
- serve_nodes:
- Required. The number of nodes allocated to this cluster. More
- nodes enable higher throughput and more consistent
- performance.
- default_storage_type:
- (\ ``CreationOnly``) The type of storage used by this cluster
- to serve its parent instance’s tables, unless explicitly
- overridden.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.Cluster)
- },
-)
-_sym_db.RegisterMessage(Cluster)
-
-AppProfile = _reflection.GeneratedProtocolMessageType(
- "AppProfile",
- (_message.Message,),
- {
- "MultiClusterRoutingUseAny": _reflection.GeneratedProtocolMessageType(
- "MultiClusterRoutingUseAny",
- (_message.Message,),
- {
- "DESCRIPTOR": _APPPROFILE_MULTICLUSTERROUTINGUSEANY,
- "__module__": "google.cloud.bigtable_admin_v2.proto.instance_pb2",
- "__doc__": """Read/write requests are routed to the nearest cluster in the instance,
- and will fail over to the nearest cluster that is available in the
- event of transient errors or delays. Clusters in a region are
- considered equidistant. Choosing this option sacrifices read-your-
- writes consistency to improve availability.""",
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.AppProfile.MultiClusterRoutingUseAny)
- },
- ),
- "SingleClusterRouting": _reflection.GeneratedProtocolMessageType(
- "SingleClusterRouting",
- (_message.Message,),
- {
- "DESCRIPTOR": _APPPROFILE_SINGLECLUSTERROUTING,
- "__module__": "google.cloud.bigtable_admin_v2.proto.instance_pb2",
- "__doc__": """Unconditionally routes all read/write requests to a specific cluster.
- This option preserves read-your-writes consistency but does not
- improve availability.
-
- Attributes:
- cluster_id:
- The cluster to which read/write requests should be routed.
- allow_transactional_writes:
- Whether or not ``CheckAndMutateRow`` and
- ``ReadModifyWriteRow`` requests are allowed by this app
- profile. It is unsafe to send these requests to the same
- table/row/column in multiple clusters.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.AppProfile.SingleClusterRouting)
- },
- ),
- "DESCRIPTOR": _APPPROFILE,
- "__module__": "google.cloud.bigtable_admin_v2.proto.instance_pb2",
- "__doc__": """A configuration object describing how Cloud Bigtable should treat
- traffic from a particular end user application.
-
- Attributes:
- name:
- (\ ``OutputOnly``) The unique name of the app profile. Values
- are of the form
- ``projects//instances//appProfiles/[_a-
- zA-Z0-9][-_.a-zA-Z0-9]*``.
- etag:
- Strongly validated etag for optimistic concurrency control.
- Preserve the value returned from ``GetAppProfile`` when
- calling ``UpdateAppProfile`` to fail the request if there has
- been a modification in the mean time. The ``update_mask`` of
- the request need not include ``etag`` for this protection to
- apply. See `Wikipedia
- `__ and `RFC 7232
- `__ for more
- details.
- description:
- Optional long form description of the use case for this
- AppProfile.
- routing_policy:
- The routing policy for all read/write requests that use this
- app profile. A value must be explicitly set.
- multi_cluster_routing_use_any:
- Use a multi-cluster routing policy.
- single_cluster_routing:
- Use a single-cluster routing policy.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.AppProfile)
- },
-)
-_sym_db.RegisterMessage(AppProfile)
-_sym_db.RegisterMessage(AppProfile.MultiClusterRoutingUseAny)
-_sym_db.RegisterMessage(AppProfile.SingleClusterRouting)
-
-
-DESCRIPTOR._options = None
-_INSTANCE_LABELSENTRY._options = None
-_INSTANCE.fields_by_name["name"]._options = None
-_INSTANCE.fields_by_name["display_name"]._options = None
-_INSTANCE._options = None
-_CLUSTER.fields_by_name["name"]._options = None
-_CLUSTER.fields_by_name["location"]._options = None
-_CLUSTER.fields_by_name["state"]._options = None
-_CLUSTER.fields_by_name["serve_nodes"]._options = None
-_CLUSTER._options = None
-_APPPROFILE._options = None
-# @@protoc_insertion_point(module_scope)
diff --git a/google/cloud/bigtable_admin_v2/proto/instance_pb2_grpc.py b/google/cloud/bigtable_admin_v2/proto/instance_pb2_grpc.py
deleted file mode 100644
index 8a9393943..000000000
--- a/google/cloud/bigtable_admin_v2/proto/instance_pb2_grpc.py
+++ /dev/null
@@ -1,3 +0,0 @@
-# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
-"""Client and server classes corresponding to protobuf-defined services."""
-import grpc
diff --git a/google/cloud/bigtable_admin_v2/proto/table.proto b/google/cloud/bigtable_admin_v2/proto/table.proto
deleted file mode 100644
index e85ca8ca9..000000000
--- a/google/cloud/bigtable_admin_v2/proto/table.proto
+++ /dev/null
@@ -1,340 +0,0 @@
-// 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.
-
-syntax = "proto3";
-
-package google.bigtable.admin.v2;
-
-import "google/api/field_behavior.proto";
-import "google/api/resource.proto";
-import "google/protobuf/duration.proto";
-import "google/protobuf/timestamp.proto";
-
-option csharp_namespace = "Google.Cloud.Bigtable.Admin.V2";
-option go_package = "google.golang.org/genproto/googleapis/bigtable/admin/v2;admin";
-option java_multiple_files = true;
-option java_outer_classname = "TableProto";
-option java_package = "com.google.bigtable.admin.v2";
-option php_namespace = "Google\\Cloud\\Bigtable\\Admin\\V2";
-option ruby_package = "Google::Cloud::Bigtable::Admin::V2";
-
-// Indicates the type of the restore source.
-enum RestoreSourceType {
- // No restore associated.
- RESTORE_SOURCE_TYPE_UNSPECIFIED = 0;
-
- // A backup was used as the source of the restore.
- BACKUP = 1;
-}
-
-// Information about a table restore.
-message RestoreInfo {
- // The type of the restore source.
- RestoreSourceType source_type = 1;
-
- // Information about the source used to restore the table.
- oneof source_info {
- // Information about the backup used to restore the table. The backup
- // may no longer exist.
- BackupInfo backup_info = 2;
- }
-}
-
-// A collection of user data indexed by row, column, and timestamp.
-// Each table is served using the resources of its parent cluster.
-message Table {
- option (google.api.resource) = {
- type: "bigtable.googleapis.com/Table"
- pattern: "projects/{project}/instances/{instance}/tables/{table}"
- };
-
- // The state of a table's data in a particular cluster.
- message ClusterState {
- // Table replication states.
- enum ReplicationState {
- // The replication state of the table is unknown in this cluster.
- STATE_NOT_KNOWN = 0;
-
- // The cluster was recently created, and the table must finish copying
- // over pre-existing data from other clusters before it can begin
- // receiving live replication updates and serving Data API requests.
- INITIALIZING = 1;
-
- // The table is temporarily unable to serve Data API requests from this
- // cluster due to planned internal maintenance.
- PLANNED_MAINTENANCE = 2;
-
- // The table is temporarily unable to serve Data API requests from this
- // cluster due to unplanned or emergency maintenance.
- UNPLANNED_MAINTENANCE = 3;
-
- // The table can serve Data API requests from this cluster. Depending on
- // replication delay, reads may not immediately reflect the state of the
- // table in other clusters.
- READY = 4;
-
- // The table is fully created and ready for use after a restore, and is
- // being optimized for performance. When optimizations are complete, the
- // table will transition to `READY` state.
- READY_OPTIMIZING = 5;
- }
-
- // Output only. The state of replication for the table in this cluster.
- ReplicationState replication_state = 1;
- }
-
- // Possible timestamp granularities to use when keeping multiple versions
- // of data in a table.
- enum TimestampGranularity {
- // The user did not specify a granularity. Should not be returned.
- // When specified during table creation, MILLIS will be used.
- TIMESTAMP_GRANULARITY_UNSPECIFIED = 0;
-
- // The table keeps data versioned at a granularity of 1ms.
- MILLIS = 1;
- }
-
- // Defines a view over a table's fields.
- enum View {
- // Uses the default view for each method as documented in its request.
- VIEW_UNSPECIFIED = 0;
-
- // Only populates `name`.
- NAME_ONLY = 1;
-
- // Only populates `name` and fields related to the table's schema.
- SCHEMA_VIEW = 2;
-
- // Only populates `name` and fields related to the table's replication
- // state.
- REPLICATION_VIEW = 3;
-
- // Populates all fields.
- FULL = 4;
- }
-
- // Output only. The unique name of the table. Values are of the form
- // `projects//instances//tables/[_a-zA-Z0-9][-_.a-zA-Z0-9]*`.
- // Views: `NAME_ONLY`, `SCHEMA_VIEW`, `REPLICATION_VIEW`, `FULL`
- string name = 1;
-
- // Output only. Map from cluster ID to per-cluster table state.
- // If it could not be determined whether or not the table has data in a
- // particular cluster (for example, if its zone is unavailable), then
- // there will be an entry for the cluster with UNKNOWN `replication_status`.
- // Views: `REPLICATION_VIEW`, `FULL`
- map cluster_states = 2;
-
- // (`CreationOnly`)
- // The column families configured for this table, mapped by column family ID.
- // Views: `SCHEMA_VIEW`, `FULL`
- map column_families = 3;
-
- // (`CreationOnly`)
- // The granularity (i.e. `MILLIS`) at which timestamps are stored in
- // this table. Timestamps not matching the granularity will be rejected.
- // If unspecified at creation time, the value will be set to `MILLIS`.
- // Views: `SCHEMA_VIEW`, `FULL`.
- TimestampGranularity granularity = 4;
-
- // Output only. If this table was restored from another data source (e.g. a
- // backup), this field will be populated with information about the restore.
- RestoreInfo restore_info = 6;
-}
-
-// A set of columns within a table which share a common configuration.
-message ColumnFamily {
- // Garbage collection rule specified as a protobuf.
- // Must serialize to at most 500 bytes.
- //
- // NOTE: Garbage collection executes opportunistically in the background, and
- // so it's possible for reads to return a cell even if it matches the active
- // GC expression for its family.
- GcRule gc_rule = 1;
-}
-
-// Rule for determining which cells to delete during garbage collection.
-message GcRule {
- // A GcRule which deletes cells matching all of the given rules.
- message Intersection {
- // Only delete cells which would be deleted by every element of `rules`.
- repeated GcRule rules = 1;
- }
-
- // A GcRule which deletes cells matching any of the given rules.
- message Union {
- // Delete cells which would be deleted by any element of `rules`.
- repeated GcRule rules = 1;
- }
-
- // Garbage collection rules.
- oneof rule {
- // Delete all cells in a column except the most recent N.
- int32 max_num_versions = 1;
-
- // Delete cells in a column older than the given age.
- // Values must be at least one millisecond, and will be truncated to
- // microsecond granularity.
- google.protobuf.Duration max_age = 2;
-
- // Delete cells that would be deleted by every nested rule.
- Intersection intersection = 3;
-
- // Delete cells that would be deleted by any nested rule.
- Union union = 4;
- }
-}
-
-// A snapshot of a table at a particular time. A snapshot can be used as a
-// checkpoint for data restoration or a data source for a new table.
-//
-// Note: This is a private alpha release of Cloud Bigtable snapshots. This
-// feature is not currently available to most Cloud Bigtable customers. This
-// feature might be changed in backward-incompatible ways and is not recommended
-// for production use. It is not subject to any SLA or deprecation policy.
-message Snapshot {
- option (google.api.resource) = {
- type: "bigtable.googleapis.com/Snapshot"
- pattern: "projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}"
- };
-
- // Possible states of a snapshot.
- enum State {
- // The state of the snapshot could not be determined.
- STATE_NOT_KNOWN = 0;
-
- // The snapshot has been successfully created and can serve all requests.
- READY = 1;
-
- // The snapshot is currently being created, and may be destroyed if the
- // creation process encounters an error. A snapshot may not be restored to a
- // table while it is being created.
- CREATING = 2;
- }
-
- // Output only. The unique name of the snapshot.
- // Values are of the form
- // `projects//instances//clusters//snapshots/`.
- string name = 1;
-
- // Output only. The source table at the time the snapshot was taken.
- Table source_table = 2;
-
- // Output only. The size of the data in the source table at the time the
- // snapshot was taken. In some cases, this value may be computed
- // asynchronously via a background process and a placeholder of 0 will be used
- // in the meantime.
- int64 data_size_bytes = 3;
-
- // Output only. The time when the snapshot is created.
- google.protobuf.Timestamp create_time = 4;
-
- // Output only. The time when the snapshot will be deleted. The maximum amount
- // of time a snapshot can stay active is 365 days. If 'ttl' is not specified,
- // the default maximum of 365 days will be used.
- google.protobuf.Timestamp delete_time = 5;
-
- // Output only. The current state of the snapshot.
- State state = 6;
-
- // Output only. Description of the snapshot.
- string description = 7;
-}
-
-// A backup of a Cloud Bigtable table.
-message Backup {
- option (google.api.resource) = {
- type: "bigtable.googleapis.com/Backup"
- pattern: "projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}"
- };
-
- // Indicates the current state of the backup.
- enum State {
- // Not specified.
- STATE_UNSPECIFIED = 0;
-
- // The pending backup is still being created. Operations on the
- // backup may fail with `FAILED_PRECONDITION` in this state.
- CREATING = 1;
-
- // The backup is complete and ready for use.
- READY = 2;
- }
-
- // Output only. A globally unique identifier for the backup which cannot be
- // changed. Values are of the form
- // `projects/{project}/instances/{instance}/clusters/{cluster}/
- // backups/[_a-zA-Z0-9][-_.a-zA-Z0-9]*`
- // The final segment of the name must be between 1 and 50 characters
- // in length.
- //
- // The backup is stored in the cluster identified by the prefix of the backup
- // name of the form
- // `projects/{project}/instances/{instance}/clusters/{cluster}`.
- string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
-
- // Required. Immutable. Name of the table from which this backup was created.
- // This needs to be in the same instance as the backup. Values are of the form
- // `projects/{project}/instances/{instance}/tables/{source_table}`.
- string source_table = 2 [
- (google.api.field_behavior) = IMMUTABLE,
- (google.api.field_behavior) = REQUIRED
- ];
-
- // Required. The expiration time of the backup, with microseconds
- // granularity that must be at least 6 hours and at most 30 days
- // from the time the request is received. Once the `expire_time`
- // has passed, Cloud Bigtable will delete the backup and free the
- // resources used by the backup.
- google.protobuf.Timestamp expire_time = 3
- [(google.api.field_behavior) = REQUIRED];
-
- // Output only. `start_time` is the time that the backup was started
- // (i.e. approximately the time the
- // [CreateBackup][google.bigtable.admin.v2.BigtableTableAdmin.CreateBackup]
- // request is received). The row data in this backup will be no older than
- // this timestamp.
- google.protobuf.Timestamp start_time = 4
- [(google.api.field_behavior) = OUTPUT_ONLY];
-
- // Output only. `end_time` is the time that the backup was finished. The row
- // data in the backup will be no newer than this timestamp.
- google.protobuf.Timestamp end_time = 5
- [(google.api.field_behavior) = OUTPUT_ONLY];
-
- // Output only. Size of the backup in bytes.
- int64 size_bytes = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
-
- // Output only. The current state of the backup.
- State state = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
-}
-
-// Information about a backup.
-message BackupInfo {
- // Output only. Name of the backup.
- string backup = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
-
- // Output only. The time that the backup was started. Row data in the backup
- // will be no older than this timestamp.
- google.protobuf.Timestamp start_time = 2
- [(google.api.field_behavior) = OUTPUT_ONLY];
-
- // Output only. This time that the backup was finished. Row data in the
- // backup will be no newer than this timestamp.
- google.protobuf.Timestamp end_time = 3
- [(google.api.field_behavior) = OUTPUT_ONLY];
-
- // Output only. Name of the table the backup was created from.
- string source_table = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
-}
diff --git a/google/cloud/bigtable_admin_v2/proto/table_pb2.py b/google/cloud/bigtable_admin_v2/proto/table_pb2.py
deleted file mode 100644
index 67238a81e..000000000
--- a/google/cloud/bigtable_admin_v2/proto/table_pb2.py
+++ /dev/null
@@ -1,1682 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: google/cloud/bigtable_admin_v2/proto/table.proto
-"""Generated protocol buffer code."""
-from google.protobuf.internal import enum_type_wrapper
-from google.protobuf import descriptor as _descriptor
-from google.protobuf import message as _message
-from google.protobuf import reflection as _reflection
-from google.protobuf import symbol_database as _symbol_database
-
-# @@protoc_insertion_point(imports)
-
-_sym_db = _symbol_database.Default()
-
-
-from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2
-from google.api import resource_pb2 as google_dot_api_dot_resource__pb2
-from google.protobuf import duration_pb2 as google_dot_protobuf_dot_duration__pb2
-from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2
-
-
-DESCRIPTOR = _descriptor.FileDescriptor(
- name="google/cloud/bigtable_admin_v2/proto/table.proto",
- package="google.bigtable.admin.v2",
- syntax="proto3",
- serialized_options=b'\n\034com.google.bigtable.admin.v2B\nTableProtoP\001Z=google.golang.org/genproto/googleapis/bigtable/admin/v2;admin\252\002\036Google.Cloud.Bigtable.Admin.V2\312\002\036Google\\Cloud\\Bigtable\\Admin\\V2\352\002"Google::Cloud::Bigtable::Admin::V2',
- create_key=_descriptor._internal_create_key,
- serialized_pb=b'\n0google/cloud/bigtable_admin_v2/proto/table.proto\x12\x18google.bigtable.admin.v2\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1fgoogle/protobuf/timestamp.proto"\x9b\x01\n\x0bRestoreInfo\x12@\n\x0bsource_type\x18\x01 \x01(\x0e\x32+.google.bigtable.admin.v2.RestoreSourceType\x12;\n\x0b\x62\x61\x63kup_info\x18\x02 \x01(\x0b\x32$.google.bigtable.admin.v2.BackupInfoH\x00\x42\r\n\x0bsource_info"\xfb\x07\n\x05Table\x12\x0c\n\x04name\x18\x01 \x01(\t\x12J\n\x0e\x63luster_states\x18\x02 \x03(\x0b\x32\x32.google.bigtable.admin.v2.Table.ClusterStatesEntry\x12L\n\x0f\x63olumn_families\x18\x03 \x03(\x0b\x32\x33.google.bigtable.admin.v2.Table.ColumnFamiliesEntry\x12I\n\x0bgranularity\x18\x04 \x01(\x0e\x32\x34.google.bigtable.admin.v2.Table.TimestampGranularity\x12;\n\x0crestore_info\x18\x06 \x01(\x0b\x32%.google.bigtable.admin.v2.RestoreInfo\x1a\xf9\x01\n\x0c\x43lusterState\x12X\n\x11replication_state\x18\x01 \x01(\x0e\x32=.google.bigtable.admin.v2.Table.ClusterState.ReplicationState"\x8e\x01\n\x10ReplicationState\x12\x13\n\x0fSTATE_NOT_KNOWN\x10\x00\x12\x10\n\x0cINITIALIZING\x10\x01\x12\x17\n\x13PLANNED_MAINTENANCE\x10\x02\x12\x19\n\x15UNPLANNED_MAINTENANCE\x10\x03\x12\t\n\x05READY\x10\x04\x12\x14\n\x10READY_OPTIMIZING\x10\x05\x1a\x62\n\x12\x43lusterStatesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12;\n\x05value\x18\x02 \x01(\x0b\x32,.google.bigtable.admin.v2.Table.ClusterState:\x02\x38\x01\x1a]\n\x13\x43olumnFamiliesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x35\n\x05value\x18\x02 \x01(\x0b\x32&.google.bigtable.admin.v2.ColumnFamily:\x02\x38\x01"I\n\x14TimestampGranularity\x12%\n!TIMESTAMP_GRANULARITY_UNSPECIFIED\x10\x00\x12\n\n\x06MILLIS\x10\x01"\\\n\x04View\x12\x14\n\x10VIEW_UNSPECIFIED\x10\x00\x12\r\n\tNAME_ONLY\x10\x01\x12\x0f\n\x0bSCHEMA_VIEW\x10\x02\x12\x14\n\x10REPLICATION_VIEW\x10\x03\x12\x08\n\x04\x46ULL\x10\x04:Z\xea\x41W\n\x1d\x62igtable.googleapis.com/Table\x12\x36projects/{project}/instances/{instance}/tables/{table}"A\n\x0c\x43olumnFamily\x12\x31\n\x07gc_rule\x18\x01 \x01(\x0b\x32 .google.bigtable.admin.v2.GcRule"\xd5\x02\n\x06GcRule\x12\x1a\n\x10max_num_versions\x18\x01 \x01(\x05H\x00\x12,\n\x07max_age\x18\x02 \x01(\x0b\x32\x19.google.protobuf.DurationH\x00\x12\x45\n\x0cintersection\x18\x03 \x01(\x0b\x32-.google.bigtable.admin.v2.GcRule.IntersectionH\x00\x12\x37\n\x05union\x18\x04 \x01(\x0b\x32&.google.bigtable.admin.v2.GcRule.UnionH\x00\x1a?\n\x0cIntersection\x12/\n\x05rules\x18\x01 \x03(\x0b\x32 .google.bigtable.admin.v2.GcRule\x1a\x38\n\x05Union\x12/\n\x05rules\x18\x01 \x03(\x0b\x32 .google.bigtable.admin.v2.GcRuleB\x06\n\x04rule"\xc7\x03\n\x08Snapshot\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x35\n\x0csource_table\x18\x02 \x01(\x0b\x32\x1f.google.bigtable.admin.v2.Table\x12\x17\n\x0f\x64\x61ta_size_bytes\x18\x03 \x01(\x03\x12/\n\x0b\x63reate_time\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12/\n\x0b\x64\x65lete_time\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x37\n\x05state\x18\x06 \x01(\x0e\x32(.google.bigtable.admin.v2.Snapshot.State\x12\x13\n\x0b\x64\x65scription\x18\x07 \x01(\t"5\n\x05State\x12\x13\n\x0fSTATE_NOT_KNOWN\x10\x00\x12\t\n\x05READY\x10\x01\x12\x0c\n\x08\x43REATING\x10\x02:v\xea\x41s\n bigtable.googleapis.com/Snapshot\x12Oprojects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}"\xd7\x03\n\x06\x42\x61\x63kup\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x03\x12\x1c\n\x0csource_table\x18\x02 \x01(\tB\x06\xe0\x41\x05\xe0\x41\x02\x12\x34\n\x0b\x65xpire_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x02\x12\x33\n\nstart_time\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x31\n\x08\x65nd_time\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x17\n\nsize_bytes\x18\x06 \x01(\x03\x42\x03\xe0\x41\x03\x12:\n\x05state\x18\x07 \x01(\x0e\x32&.google.bigtable.admin.v2.Backup.StateB\x03\xe0\x41\x03"7\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x0c\n\x08\x43REATING\x10\x01\x12\t\n\x05READY\x10\x02:p\xea\x41m\n\x1e\x62igtable.googleapis.com/Backup\x12Kprojects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}"\xa4\x01\n\nBackupInfo\x12\x13\n\x06\x62\x61\x63kup\x18\x01 \x01(\tB\x03\xe0\x41\x03\x12\x33\n\nstart_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x31\n\x08\x65nd_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x19\n\x0csource_table\x18\x04 \x01(\tB\x03\xe0\x41\x03*D\n\x11RestoreSourceType\x12#\n\x1fRESTORE_SOURCE_TYPE_UNSPECIFIED\x10\x00\x12\n\n\x06\x42\x41\x43KUP\x10\x01\x42\xd2\x01\n\x1c\x63om.google.bigtable.admin.v2B\nTableProtoP\x01Z=google.golang.org/genproto/googleapis/bigtable/admin/v2;admin\xaa\x02\x1eGoogle.Cloud.Bigtable.Admin.V2\xca\x02\x1eGoogle\\Cloud\\Bigtable\\Admin\\V2\xea\x02"Google::Cloud::Bigtable::Admin::V2b\x06proto3',
- dependencies=[
- google_dot_api_dot_field__behavior__pb2.DESCRIPTOR,
- google_dot_api_dot_resource__pb2.DESCRIPTOR,
- google_dot_protobuf_dot_duration__pb2.DESCRIPTOR,
- google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR,
- ],
-)
-
-_RESTORESOURCETYPE = _descriptor.EnumDescriptor(
- name="RestoreSourceType",
- full_name="google.bigtable.admin.v2.RestoreSourceType",
- filename=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- values=[
- _descriptor.EnumValueDescriptor(
- name="RESTORE_SOURCE_TYPE_UNSPECIFIED",
- index=0,
- number=0,
- serialized_options=None,
- type=None,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.EnumValueDescriptor(
- name="BACKUP",
- index=1,
- number=1,
- serialized_options=None,
- type=None,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- containing_type=None,
- serialized_options=None,
- serialized_start=2893,
- serialized_end=2961,
-)
-_sym_db.RegisterEnumDescriptor(_RESTORESOURCETYPE)
-
-RestoreSourceType = enum_type_wrapper.EnumTypeWrapper(_RESTORESOURCETYPE)
-RESTORE_SOURCE_TYPE_UNSPECIFIED = 0
-BACKUP = 1
-
-
-_TABLE_CLUSTERSTATE_REPLICATIONSTATE = _descriptor.EnumDescriptor(
- name="ReplicationState",
- full_name="google.bigtable.admin.v2.Table.ClusterState.ReplicationState",
- filename=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- values=[
- _descriptor.EnumValueDescriptor(
- name="STATE_NOT_KNOWN",
- index=0,
- number=0,
- serialized_options=None,
- type=None,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.EnumValueDescriptor(
- name="INITIALIZING",
- index=1,
- number=1,
- serialized_options=None,
- type=None,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.EnumValueDescriptor(
- name="PLANNED_MAINTENANCE",
- index=2,
- number=2,
- serialized_options=None,
- type=None,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.EnumValueDescriptor(
- name="UNPLANNED_MAINTENANCE",
- index=3,
- number=3,
- serialized_options=None,
- type=None,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.EnumValueDescriptor(
- name="READY",
- index=4,
- number=4,
- serialized_options=None,
- type=None,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.EnumValueDescriptor(
- name="READY_OPTIMIZING",
- index=5,
- number=5,
- serialized_options=None,
- type=None,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- containing_type=None,
- serialized_options=None,
- serialized_start=783,
- serialized_end=925,
-)
-_sym_db.RegisterEnumDescriptor(_TABLE_CLUSTERSTATE_REPLICATIONSTATE)
-
-_TABLE_TIMESTAMPGRANULARITY = _descriptor.EnumDescriptor(
- name="TimestampGranularity",
- full_name="google.bigtable.admin.v2.Table.TimestampGranularity",
- filename=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- values=[
- _descriptor.EnumValueDescriptor(
- name="TIMESTAMP_GRANULARITY_UNSPECIFIED",
- index=0,
- number=0,
- serialized_options=None,
- type=None,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.EnumValueDescriptor(
- name="MILLIS",
- index=1,
- number=1,
- serialized_options=None,
- type=None,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- containing_type=None,
- serialized_options=None,
- serialized_start=1122,
- serialized_end=1195,
-)
-_sym_db.RegisterEnumDescriptor(_TABLE_TIMESTAMPGRANULARITY)
-
-_TABLE_VIEW = _descriptor.EnumDescriptor(
- name="View",
- full_name="google.bigtable.admin.v2.Table.View",
- filename=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- values=[
- _descriptor.EnumValueDescriptor(
- name="VIEW_UNSPECIFIED",
- index=0,
- number=0,
- serialized_options=None,
- type=None,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.EnumValueDescriptor(
- name="NAME_ONLY",
- index=1,
- number=1,
- serialized_options=None,
- type=None,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.EnumValueDescriptor(
- name="SCHEMA_VIEW",
- index=2,
- number=2,
- serialized_options=None,
- type=None,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.EnumValueDescriptor(
- name="REPLICATION_VIEW",
- index=3,
- number=3,
- serialized_options=None,
- type=None,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.EnumValueDescriptor(
- name="FULL",
- index=4,
- number=4,
- serialized_options=None,
- type=None,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- containing_type=None,
- serialized_options=None,
- serialized_start=1197,
- serialized_end=1289,
-)
-_sym_db.RegisterEnumDescriptor(_TABLE_VIEW)
-
-_SNAPSHOT_STATE = _descriptor.EnumDescriptor(
- name="State",
- full_name="google.bigtable.admin.v2.Snapshot.State",
- filename=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- values=[
- _descriptor.EnumValueDescriptor(
- name="STATE_NOT_KNOWN",
- index=0,
- number=0,
- serialized_options=None,
- type=None,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.EnumValueDescriptor(
- name="READY",
- index=1,
- number=1,
- serialized_options=None,
- type=None,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.EnumValueDescriptor(
- name="CREATING",
- index=2,
- number=2,
- serialized_options=None,
- type=None,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- containing_type=None,
- serialized_options=None,
- serialized_start=2077,
- serialized_end=2130,
-)
-_sym_db.RegisterEnumDescriptor(_SNAPSHOT_STATE)
-
-_BACKUP_STATE = _descriptor.EnumDescriptor(
- name="State",
- full_name="google.bigtable.admin.v2.Backup.State",
- filename=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- values=[
- _descriptor.EnumValueDescriptor(
- name="STATE_UNSPECIFIED",
- index=0,
- number=0,
- serialized_options=None,
- type=None,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.EnumValueDescriptor(
- name="CREATING",
- index=1,
- number=1,
- serialized_options=None,
- type=None,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.EnumValueDescriptor(
- name="READY",
- index=2,
- number=2,
- serialized_options=None,
- type=None,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- containing_type=None,
- serialized_options=None,
- serialized_start=2555,
- serialized_end=2610,
-)
-_sym_db.RegisterEnumDescriptor(_BACKUP_STATE)
-
-
-_RESTOREINFO = _descriptor.Descriptor(
- name="RestoreInfo",
- full_name="google.bigtable.admin.v2.RestoreInfo",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="source_type",
- full_name="google.bigtable.admin.v2.RestoreInfo.source_type",
- index=0,
- number=1,
- type=14,
- cpp_type=8,
- label=1,
- has_default_value=False,
- default_value=0,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="backup_info",
- full_name="google.bigtable.admin.v2.RestoreInfo.backup_info",
- index=1,
- number=2,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[
- _descriptor.OneofDescriptor(
- name="source_info",
- full_name="google.bigtable.admin.v2.RestoreInfo.source_info",
- index=0,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[],
- ),
- ],
- serialized_start=204,
- serialized_end=359,
-)
-
-
-_TABLE_CLUSTERSTATE = _descriptor.Descriptor(
- name="ClusterState",
- full_name="google.bigtable.admin.v2.Table.ClusterState",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="replication_state",
- full_name="google.bigtable.admin.v2.Table.ClusterState.replication_state",
- index=0,
- number=1,
- type=14,
- cpp_type=8,
- label=1,
- has_default_value=False,
- default_value=0,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[_TABLE_CLUSTERSTATE_REPLICATIONSTATE,],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=676,
- serialized_end=925,
-)
-
-_TABLE_CLUSTERSTATESENTRY = _descriptor.Descriptor(
- name="ClusterStatesEntry",
- full_name="google.bigtable.admin.v2.Table.ClusterStatesEntry",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="key",
- full_name="google.bigtable.admin.v2.Table.ClusterStatesEntry.key",
- index=0,
- number=1,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="value",
- full_name="google.bigtable.admin.v2.Table.ClusterStatesEntry.value",
- index=1,
- number=2,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=b"8\001",
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=927,
- serialized_end=1025,
-)
-
-_TABLE_COLUMNFAMILIESENTRY = _descriptor.Descriptor(
- name="ColumnFamiliesEntry",
- full_name="google.bigtable.admin.v2.Table.ColumnFamiliesEntry",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="key",
- full_name="google.bigtable.admin.v2.Table.ColumnFamiliesEntry.key",
- index=0,
- number=1,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="value",
- full_name="google.bigtable.admin.v2.Table.ColumnFamiliesEntry.value",
- index=1,
- number=2,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=b"8\001",
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=1027,
- serialized_end=1120,
-)
-
-_TABLE = _descriptor.Descriptor(
- name="Table",
- full_name="google.bigtable.admin.v2.Table",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="name",
- full_name="google.bigtable.admin.v2.Table.name",
- index=0,
- number=1,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="cluster_states",
- full_name="google.bigtable.admin.v2.Table.cluster_states",
- index=1,
- number=2,
- type=11,
- cpp_type=10,
- label=3,
- has_default_value=False,
- default_value=[],
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="column_families",
- full_name="google.bigtable.admin.v2.Table.column_families",
- index=2,
- number=3,
- type=11,
- cpp_type=10,
- label=3,
- has_default_value=False,
- default_value=[],
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="granularity",
- full_name="google.bigtable.admin.v2.Table.granularity",
- index=3,
- number=4,
- type=14,
- cpp_type=8,
- label=1,
- has_default_value=False,
- default_value=0,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="restore_info",
- full_name="google.bigtable.admin.v2.Table.restore_info",
- index=4,
- number=6,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[
- _TABLE_CLUSTERSTATE,
- _TABLE_CLUSTERSTATESENTRY,
- _TABLE_COLUMNFAMILIESENTRY,
- ],
- enum_types=[_TABLE_TIMESTAMPGRANULARITY, _TABLE_VIEW,],
- serialized_options=b"\352AW\n\035bigtable.googleapis.com/Table\0226projects/{project}/instances/{instance}/tables/{table}",
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=362,
- serialized_end=1381,
-)
-
-
-_COLUMNFAMILY = _descriptor.Descriptor(
- name="ColumnFamily",
- full_name="google.bigtable.admin.v2.ColumnFamily",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="gc_rule",
- full_name="google.bigtable.admin.v2.ColumnFamily.gc_rule",
- index=0,
- number=1,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=1383,
- serialized_end=1448,
-)
-
-
-_GCRULE_INTERSECTION = _descriptor.Descriptor(
- name="Intersection",
- full_name="google.bigtable.admin.v2.GcRule.Intersection",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="rules",
- full_name="google.bigtable.admin.v2.GcRule.Intersection.rules",
- index=0,
- number=1,
- type=11,
- cpp_type=10,
- label=3,
- has_default_value=False,
- default_value=[],
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=1663,
- serialized_end=1726,
-)
-
-_GCRULE_UNION = _descriptor.Descriptor(
- name="Union",
- full_name="google.bigtable.admin.v2.GcRule.Union",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="rules",
- full_name="google.bigtable.admin.v2.GcRule.Union.rules",
- index=0,
- number=1,
- type=11,
- cpp_type=10,
- label=3,
- has_default_value=False,
- default_value=[],
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=1728,
- serialized_end=1784,
-)
-
-_GCRULE = _descriptor.Descriptor(
- name="GcRule",
- full_name="google.bigtable.admin.v2.GcRule",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="max_num_versions",
- full_name="google.bigtable.admin.v2.GcRule.max_num_versions",
- index=0,
- number=1,
- type=5,
- cpp_type=1,
- label=1,
- has_default_value=False,
- default_value=0,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="max_age",
- full_name="google.bigtable.admin.v2.GcRule.max_age",
- index=1,
- number=2,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="intersection",
- full_name="google.bigtable.admin.v2.GcRule.intersection",
- index=2,
- number=3,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="union",
- full_name="google.bigtable.admin.v2.GcRule.union",
- index=3,
- number=4,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[_GCRULE_INTERSECTION, _GCRULE_UNION,],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[
- _descriptor.OneofDescriptor(
- name="rule",
- full_name="google.bigtable.admin.v2.GcRule.rule",
- index=0,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[],
- ),
- ],
- serialized_start=1451,
- serialized_end=1792,
-)
-
-
-_SNAPSHOT = _descriptor.Descriptor(
- name="Snapshot",
- full_name="google.bigtable.admin.v2.Snapshot",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="name",
- full_name="google.bigtable.admin.v2.Snapshot.name",
- index=0,
- number=1,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="source_table",
- full_name="google.bigtable.admin.v2.Snapshot.source_table",
- index=1,
- number=2,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="data_size_bytes",
- full_name="google.bigtable.admin.v2.Snapshot.data_size_bytes",
- index=2,
- number=3,
- type=3,
- cpp_type=2,
- label=1,
- has_default_value=False,
- default_value=0,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="create_time",
- full_name="google.bigtable.admin.v2.Snapshot.create_time",
- index=3,
- number=4,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="delete_time",
- full_name="google.bigtable.admin.v2.Snapshot.delete_time",
- index=4,
- number=5,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="state",
- full_name="google.bigtable.admin.v2.Snapshot.state",
- index=5,
- number=6,
- type=14,
- cpp_type=8,
- label=1,
- has_default_value=False,
- default_value=0,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="description",
- full_name="google.bigtable.admin.v2.Snapshot.description",
- index=6,
- number=7,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=None,
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[_SNAPSHOT_STATE,],
- serialized_options=b"\352As\n bigtable.googleapis.com/Snapshot\022Oprojects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}",
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=1795,
- serialized_end=2250,
-)
-
-
-_BACKUP = _descriptor.Descriptor(
- name="Backup",
- full_name="google.bigtable.admin.v2.Backup",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="name",
- full_name="google.bigtable.admin.v2.Backup.name",
- index=0,
- number=1,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\003",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="source_table",
- full_name="google.bigtable.admin.v2.Backup.source_table",
- index=1,
- number=2,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\005\340A\002",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="expire_time",
- full_name="google.bigtable.admin.v2.Backup.expire_time",
- index=2,
- number=3,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\002",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="start_time",
- full_name="google.bigtable.admin.v2.Backup.start_time",
- index=3,
- number=4,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\003",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="end_time",
- full_name="google.bigtable.admin.v2.Backup.end_time",
- index=4,
- number=5,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\003",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="size_bytes",
- full_name="google.bigtable.admin.v2.Backup.size_bytes",
- index=5,
- number=6,
- type=3,
- cpp_type=2,
- label=1,
- has_default_value=False,
- default_value=0,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\003",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="state",
- full_name="google.bigtable.admin.v2.Backup.state",
- index=6,
- number=7,
- type=14,
- cpp_type=8,
- label=1,
- has_default_value=False,
- default_value=0,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\003",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[_BACKUP_STATE,],
- serialized_options=b"\352Am\n\036bigtable.googleapis.com/Backup\022Kprojects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}",
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=2253,
- serialized_end=2724,
-)
-
-
-_BACKUPINFO = _descriptor.Descriptor(
- name="BackupInfo",
- full_name="google.bigtable.admin.v2.BackupInfo",
- filename=None,
- file=DESCRIPTOR,
- containing_type=None,
- create_key=_descriptor._internal_create_key,
- fields=[
- _descriptor.FieldDescriptor(
- name="backup",
- full_name="google.bigtable.admin.v2.BackupInfo.backup",
- index=0,
- number=1,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\003",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="start_time",
- full_name="google.bigtable.admin.v2.BackupInfo.start_time",
- index=1,
- number=2,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\003",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="end_time",
- full_name="google.bigtable.admin.v2.BackupInfo.end_time",
- index=2,
- number=3,
- type=11,
- cpp_type=10,
- label=1,
- has_default_value=False,
- default_value=None,
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\003",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- _descriptor.FieldDescriptor(
- name="source_table",
- full_name="google.bigtable.admin.v2.BackupInfo.source_table",
- index=3,
- number=4,
- type=9,
- cpp_type=9,
- label=1,
- has_default_value=False,
- default_value=b"".decode("utf-8"),
- message_type=None,
- enum_type=None,
- containing_type=None,
- is_extension=False,
- extension_scope=None,
- serialized_options=b"\340A\003",
- file=DESCRIPTOR,
- create_key=_descriptor._internal_create_key,
- ),
- ],
- extensions=[],
- nested_types=[],
- enum_types=[],
- serialized_options=None,
- is_extendable=False,
- syntax="proto3",
- extension_ranges=[],
- oneofs=[],
- serialized_start=2727,
- serialized_end=2891,
-)
-
-_RESTOREINFO.fields_by_name["source_type"].enum_type = _RESTORESOURCETYPE
-_RESTOREINFO.fields_by_name["backup_info"].message_type = _BACKUPINFO
-_RESTOREINFO.oneofs_by_name["source_info"].fields.append(
- _RESTOREINFO.fields_by_name["backup_info"]
-)
-_RESTOREINFO.fields_by_name[
- "backup_info"
-].containing_oneof = _RESTOREINFO.oneofs_by_name["source_info"]
-_TABLE_CLUSTERSTATE.fields_by_name[
- "replication_state"
-].enum_type = _TABLE_CLUSTERSTATE_REPLICATIONSTATE
-_TABLE_CLUSTERSTATE.containing_type = _TABLE
-_TABLE_CLUSTERSTATE_REPLICATIONSTATE.containing_type = _TABLE_CLUSTERSTATE
-_TABLE_CLUSTERSTATESENTRY.fields_by_name["value"].message_type = _TABLE_CLUSTERSTATE
-_TABLE_CLUSTERSTATESENTRY.containing_type = _TABLE
-_TABLE_COLUMNFAMILIESENTRY.fields_by_name["value"].message_type = _COLUMNFAMILY
-_TABLE_COLUMNFAMILIESENTRY.containing_type = _TABLE
-_TABLE.fields_by_name["cluster_states"].message_type = _TABLE_CLUSTERSTATESENTRY
-_TABLE.fields_by_name["column_families"].message_type = _TABLE_COLUMNFAMILIESENTRY
-_TABLE.fields_by_name["granularity"].enum_type = _TABLE_TIMESTAMPGRANULARITY
-_TABLE.fields_by_name["restore_info"].message_type = _RESTOREINFO
-_TABLE_TIMESTAMPGRANULARITY.containing_type = _TABLE
-_TABLE_VIEW.containing_type = _TABLE
-_COLUMNFAMILY.fields_by_name["gc_rule"].message_type = _GCRULE
-_GCRULE_INTERSECTION.fields_by_name["rules"].message_type = _GCRULE
-_GCRULE_INTERSECTION.containing_type = _GCRULE
-_GCRULE_UNION.fields_by_name["rules"].message_type = _GCRULE
-_GCRULE_UNION.containing_type = _GCRULE
-_GCRULE.fields_by_name[
- "max_age"
-].message_type = google_dot_protobuf_dot_duration__pb2._DURATION
-_GCRULE.fields_by_name["intersection"].message_type = _GCRULE_INTERSECTION
-_GCRULE.fields_by_name["union"].message_type = _GCRULE_UNION
-_GCRULE.oneofs_by_name["rule"].fields.append(_GCRULE.fields_by_name["max_num_versions"])
-_GCRULE.fields_by_name["max_num_versions"].containing_oneof = _GCRULE.oneofs_by_name[
- "rule"
-]
-_GCRULE.oneofs_by_name["rule"].fields.append(_GCRULE.fields_by_name["max_age"])
-_GCRULE.fields_by_name["max_age"].containing_oneof = _GCRULE.oneofs_by_name["rule"]
-_GCRULE.oneofs_by_name["rule"].fields.append(_GCRULE.fields_by_name["intersection"])
-_GCRULE.fields_by_name["intersection"].containing_oneof = _GCRULE.oneofs_by_name["rule"]
-_GCRULE.oneofs_by_name["rule"].fields.append(_GCRULE.fields_by_name["union"])
-_GCRULE.fields_by_name["union"].containing_oneof = _GCRULE.oneofs_by_name["rule"]
-_SNAPSHOT.fields_by_name["source_table"].message_type = _TABLE
-_SNAPSHOT.fields_by_name[
- "create_time"
-].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP
-_SNAPSHOT.fields_by_name[
- "delete_time"
-].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP
-_SNAPSHOT.fields_by_name["state"].enum_type = _SNAPSHOT_STATE
-_SNAPSHOT_STATE.containing_type = _SNAPSHOT
-_BACKUP.fields_by_name[
- "expire_time"
-].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP
-_BACKUP.fields_by_name[
- "start_time"
-].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP
-_BACKUP.fields_by_name[
- "end_time"
-].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP
-_BACKUP.fields_by_name["state"].enum_type = _BACKUP_STATE
-_BACKUP_STATE.containing_type = _BACKUP
-_BACKUPINFO.fields_by_name[
- "start_time"
-].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP
-_BACKUPINFO.fields_by_name[
- "end_time"
-].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP
-DESCRIPTOR.message_types_by_name["RestoreInfo"] = _RESTOREINFO
-DESCRIPTOR.message_types_by_name["Table"] = _TABLE
-DESCRIPTOR.message_types_by_name["ColumnFamily"] = _COLUMNFAMILY
-DESCRIPTOR.message_types_by_name["GcRule"] = _GCRULE
-DESCRIPTOR.message_types_by_name["Snapshot"] = _SNAPSHOT
-DESCRIPTOR.message_types_by_name["Backup"] = _BACKUP
-DESCRIPTOR.message_types_by_name["BackupInfo"] = _BACKUPINFO
-DESCRIPTOR.enum_types_by_name["RestoreSourceType"] = _RESTORESOURCETYPE
-_sym_db.RegisterFileDescriptor(DESCRIPTOR)
-
-RestoreInfo = _reflection.GeneratedProtocolMessageType(
- "RestoreInfo",
- (_message.Message,),
- {
- "DESCRIPTOR": _RESTOREINFO,
- "__module__": "google.cloud.bigtable_admin_v2.proto.table_pb2",
- "__doc__": """Information about a table restore.
-
- Attributes:
- source_type:
- The type of the restore source.
- source_info:
- Information about the source used to restore the table.
- backup_info:
- Information about the backup used to restore the table. The
- backup may no longer exist.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.RestoreInfo)
- },
-)
-_sym_db.RegisterMessage(RestoreInfo)
-
-Table = _reflection.GeneratedProtocolMessageType(
- "Table",
- (_message.Message,),
- {
- "ClusterState": _reflection.GeneratedProtocolMessageType(
- "ClusterState",
- (_message.Message,),
- {
- "DESCRIPTOR": _TABLE_CLUSTERSTATE,
- "__module__": "google.cloud.bigtable_admin_v2.proto.table_pb2",
- "__doc__": """The state of a table’s data in a particular cluster.
-
- Attributes:
- replication_state:
- Output only. The state of replication for the table in this
- cluster.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.Table.ClusterState)
- },
- ),
- "ClusterStatesEntry": _reflection.GeneratedProtocolMessageType(
- "ClusterStatesEntry",
- (_message.Message,),
- {
- "DESCRIPTOR": _TABLE_CLUSTERSTATESENTRY,
- "__module__": "google.cloud.bigtable_admin_v2.proto.table_pb2"
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.Table.ClusterStatesEntry)
- },
- ),
- "ColumnFamiliesEntry": _reflection.GeneratedProtocolMessageType(
- "ColumnFamiliesEntry",
- (_message.Message,),
- {
- "DESCRIPTOR": _TABLE_COLUMNFAMILIESENTRY,
- "__module__": "google.cloud.bigtable_admin_v2.proto.table_pb2"
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.Table.ColumnFamiliesEntry)
- },
- ),
- "DESCRIPTOR": _TABLE,
- "__module__": "google.cloud.bigtable_admin_v2.proto.table_pb2",
- "__doc__": """A collection of user data indexed by row, column, and timestamp. Each
- table is served using the resources of its parent cluster.
-
- Attributes:
- name:
- Output only. The unique name of the table. Values are of the
- form ``projects//instances//tables/[_a-
- zA-Z0-9][-_.a-zA-Z0-9]*``. Views: ``NAME_ONLY``,
- ``SCHEMA_VIEW``, ``REPLICATION_VIEW``, ``FULL``
- cluster_states:
- Output only. Map from cluster ID to per-cluster table state.
- If it could not be determined whether or not the table has
- data in a particular cluster (for example, if its zone is
- unavailable), then there will be an entry for the cluster with
- UNKNOWN ``replication_status``. Views: ``REPLICATION_VIEW``,
- ``FULL``
- column_families:
- (\ ``CreationOnly``) The column families configured for this
- table, mapped by column family ID. Views: ``SCHEMA_VIEW``,
- ``FULL``
- granularity:
- (\ ``CreationOnly``) The granularity (i.e. ``MILLIS``) at
- which timestamps are stored in this table. Timestamps not
- matching the granularity will be rejected. If unspecified at
- creation time, the value will be set to ``MILLIS``. Views:
- ``SCHEMA_VIEW``, ``FULL``.
- restore_info:
- Output only. If this table was restored from another data
- source (e.g. a backup), this field will be populated with
- information about the restore.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.Table)
- },
-)
-_sym_db.RegisterMessage(Table)
-_sym_db.RegisterMessage(Table.ClusterState)
-_sym_db.RegisterMessage(Table.ClusterStatesEntry)
-_sym_db.RegisterMessage(Table.ColumnFamiliesEntry)
-
-ColumnFamily = _reflection.GeneratedProtocolMessageType(
- "ColumnFamily",
- (_message.Message,),
- {
- "DESCRIPTOR": _COLUMNFAMILY,
- "__module__": "google.cloud.bigtable_admin_v2.proto.table_pb2",
- "__doc__": """A set of columns within a table which share a common configuration.
-
- Attributes:
- gc_rule:
- Garbage collection rule specified as a protobuf. Must
- serialize to at most 500 bytes. NOTE: Garbage collection
- executes opportunistically in the background, and so it’s
- possible for reads to return a cell even if it matches the
- active GC expression for its family.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.ColumnFamily)
- },
-)
-_sym_db.RegisterMessage(ColumnFamily)
-
-GcRule = _reflection.GeneratedProtocolMessageType(
- "GcRule",
- (_message.Message,),
- {
- "Intersection": _reflection.GeneratedProtocolMessageType(
- "Intersection",
- (_message.Message,),
- {
- "DESCRIPTOR": _GCRULE_INTERSECTION,
- "__module__": "google.cloud.bigtable_admin_v2.proto.table_pb2",
- "__doc__": """A GcRule which deletes cells matching all of the given rules.
-
- Attributes:
- rules:
- Only delete cells which would be deleted by every element of
- ``rules``.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.GcRule.Intersection)
- },
- ),
- "Union": _reflection.GeneratedProtocolMessageType(
- "Union",
- (_message.Message,),
- {
- "DESCRIPTOR": _GCRULE_UNION,
- "__module__": "google.cloud.bigtable_admin_v2.proto.table_pb2",
- "__doc__": """A GcRule which deletes cells matching any of the given rules.
-
- Attributes:
- rules:
- Delete cells which would be deleted by any element of
- ``rules``.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.GcRule.Union)
- },
- ),
- "DESCRIPTOR": _GCRULE,
- "__module__": "google.cloud.bigtable_admin_v2.proto.table_pb2",
- "__doc__": """Rule for determining which cells to delete during garbage collection.
-
- Attributes:
- rule:
- Garbage collection rules.
- max_num_versions:
- Delete all cells in a column except the most recent N.
- max_age:
- Delete cells in a column older than the given age. Values must
- be at least one millisecond, and will be truncated to
- microsecond granularity.
- intersection:
- Delete cells that would be deleted by every nested rule.
- union:
- Delete cells that would be deleted by any nested rule.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.GcRule)
- },
-)
-_sym_db.RegisterMessage(GcRule)
-_sym_db.RegisterMessage(GcRule.Intersection)
-_sym_db.RegisterMessage(GcRule.Union)
-
-Snapshot = _reflection.GeneratedProtocolMessageType(
- "Snapshot",
- (_message.Message,),
- {
- "DESCRIPTOR": _SNAPSHOT,
- "__module__": "google.cloud.bigtable_admin_v2.proto.table_pb2",
- "__doc__": """A snapshot of a table at a particular time. A snapshot can be used as
- a checkpoint for data restoration or a data source for a new table.
- Note: This is a private alpha release of Cloud Bigtable snapshots.
- This feature is not currently available to most Cloud Bigtable
- customers. This feature might be changed in backward-incompatible ways
- and is not recommended for production use. It is not subject to any
- SLA or deprecation policy.
-
- Attributes:
- name:
- Output only. The unique name of the snapshot. Values are of
- the form ``projects//instances//clusters//snapshots/``.
- source_table:
- Output only. The source table at the time the snapshot was
- taken.
- data_size_bytes:
- Output only. The size of the data in the source table at the
- time the snapshot was taken. In some cases, this value may be
- computed asynchronously via a background process and a
- placeholder of 0 will be used in the meantime.
- create_time:
- Output only. The time when the snapshot is created.
- delete_time:
- Output only. The time when the snapshot will be deleted. The
- maximum amount of time a snapshot can stay active is 365 days.
- If ‘ttl’ is not specified, the default maximum of 365 days
- will be used.
- state:
- Output only. The current state of the snapshot.
- description:
- Output only. Description of the snapshot.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.Snapshot)
- },
-)
-_sym_db.RegisterMessage(Snapshot)
-
-Backup = _reflection.GeneratedProtocolMessageType(
- "Backup",
- (_message.Message,),
- {
- "DESCRIPTOR": _BACKUP,
- "__module__": "google.cloud.bigtable_admin_v2.proto.table_pb2",
- "__doc__": """A backup of a Cloud Bigtable table.
-
- Attributes:
- name:
- Output only. A globally unique identifier for the backup which
- cannot be changed. Values are of the form
- ``projects/{project}/instances/{instance}/clusters/{cluster}/
- backups/[_a-zA-Z0-9][-_.a-zA-Z0-9]*`` The final segment of the
- name must be between 1 and 50 characters in length. The
- backup is stored in the cluster identified by the prefix of
- the backup name of the form ``projects/{project}/instances/{in
- stance}/clusters/{cluster}``.
- source_table:
- Required. Immutable. Name of the table from which this backup
- was created. This needs to be in the same instance as the
- backup. Values are of the form ``projects/{project}/instances/
- {instance}/tables/{source_table}``.
- expire_time:
- Required. The expiration time of the backup, with microseconds
- granularity that must be at least 6 hours and at most 30 days
- from the time the request is received. Once the
- ``expire_time`` has passed, Cloud Bigtable will delete the
- backup and free the resources used by the backup.
- start_time:
- Output only. ``start_time`` is the time that the backup was
- started (i.e. approximately the time the [CreateBackup][google
- .bigtable.admin.v2.BigtableTableAdmin.CreateBackup] request is
- received). The row data in this backup will be no older than
- this timestamp.
- end_time:
- Output only. ``end_time`` is the time that the backup was
- finished. The row data in the backup will be no newer than
- this timestamp.
- size_bytes:
- Output only. Size of the backup in bytes.
- state:
- Output only. The current state of the backup.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.Backup)
- },
-)
-_sym_db.RegisterMessage(Backup)
-
-BackupInfo = _reflection.GeneratedProtocolMessageType(
- "BackupInfo",
- (_message.Message,),
- {
- "DESCRIPTOR": _BACKUPINFO,
- "__module__": "google.cloud.bigtable_admin_v2.proto.table_pb2",
- "__doc__": """Information about a backup.
-
- Attributes:
- backup:
- Output only. Name of the backup.
- start_time:
- Output only. The time that the backup was started. Row data in
- the backup will be no older than this timestamp.
- end_time:
- Output only. This time that the backup was finished. Row data
- in the backup will be no newer than this timestamp.
- source_table:
- Output only. Name of the table the backup was created from.
- """,
- # @@protoc_insertion_point(class_scope:google.bigtable.admin.v2.BackupInfo)
- },
-)
-_sym_db.RegisterMessage(BackupInfo)
-
-
-DESCRIPTOR._options = None
-_TABLE_CLUSTERSTATESENTRY._options = None
-_TABLE_COLUMNFAMILIESENTRY._options = None
-_TABLE._options = None
-_SNAPSHOT._options = None
-_BACKUP.fields_by_name["name"]._options = None
-_BACKUP.fields_by_name["source_table"]._options = None
-_BACKUP.fields_by_name["expire_time"]._options = None
-_BACKUP.fields_by_name["start_time"]._options = None
-_BACKUP.fields_by_name["end_time"]._options = None
-_BACKUP.fields_by_name["size_bytes"]._options = None
-_BACKUP.fields_by_name["state"]._options = None
-_BACKUP._options = None
-_BACKUPINFO.fields_by_name["backup"]._options = None
-_BACKUPINFO.fields_by_name["start_time"]._options = None
-_BACKUPINFO.fields_by_name["end_time"]._options = None
-_BACKUPINFO.fields_by_name["source_table"]._options = None
-# @@protoc_insertion_point(module_scope)
diff --git a/google/cloud/bigtable_admin_v2/py.typed b/google/cloud/bigtable_admin_v2/py.typed
new file mode 100644
index 000000000..bc26f2069
--- /dev/null
+++ b/google/cloud/bigtable_admin_v2/py.typed
@@ -0,0 +1,2 @@
+# Marker file for PEP 561.
+# The google-cloud-bigtable-admin package uses inline types.
diff --git a/google/cloud/bigtable_admin_v2/services/__init__.py b/google/cloud/bigtable_admin_v2/services/__init__.py
new file mode 100644
index 000000000..cbf94b283
--- /dev/null
+++ b/google/cloud/bigtable_admin_v2/services/__init__.py
@@ -0,0 +1,15 @@
+# -*- coding: utf-8 -*-
+# Copyright 2025 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.
+#
diff --git a/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/__init__.py b/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/__init__.py
new file mode 100644
index 000000000..20ac9e4fc
--- /dev/null
+++ b/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/__init__.py
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+# Copyright 2025 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 .client import BigtableInstanceAdminClient
+from .async_client import BigtableInstanceAdminAsyncClient
+
+__all__ = (
+ "BigtableInstanceAdminClient",
+ "BigtableInstanceAdminAsyncClient",
+)
diff --git a/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/async_client.py b/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/async_client.py
new file mode 100644
index 000000000..632496543
--- /dev/null
+++ b/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/async_client.py
@@ -0,0 +1,4340 @@
+# -*- coding: utf-8 -*-
+# Copyright 2025 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.
+#
+import logging as std_logging
+from collections import OrderedDict
+import re
+from typing import (
+ Dict,
+ Callable,
+ Mapping,
+ MutableMapping,
+ MutableSequence,
+ Optional,
+ Sequence,
+ Tuple,
+ Type,
+ Union,
+)
+
+from google.cloud.bigtable_admin_v2 import gapic_version as package_version
+
+from google.api_core.client_options import ClientOptions
+from google.api_core import exceptions as core_exceptions
+from google.api_core import gapic_v1
+from google.api_core import retry_async as retries
+from google.auth import credentials as ga_credentials # type: ignore
+from google.oauth2 import service_account # type: ignore
+import google.protobuf
+
+
+try:
+ OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None]
+except AttributeError: # pragma: NO COVER
+ OptionalRetry = Union[retries.AsyncRetry, object, None] # type: ignore
+
+from google.api_core import operation # type: ignore
+from google.api_core import operation_async # type: ignore
+from google.cloud.bigtable_admin_v2.services.bigtable_instance_admin import pagers
+from google.cloud.bigtable_admin_v2.types import bigtable_instance_admin
+from google.cloud.bigtable_admin_v2.types import common
+from google.cloud.bigtable_admin_v2.types import instance
+from google.cloud.bigtable_admin_v2.types import instance as gba_instance
+from google.iam.v1 import iam_policy_pb2 # type: ignore
+from google.iam.v1 import policy_pb2 # type: ignore
+from google.protobuf import field_mask_pb2 # type: ignore
+from google.protobuf import timestamp_pb2 # type: ignore
+from .transports.base import BigtableInstanceAdminTransport, DEFAULT_CLIENT_INFO
+from .transports.grpc_asyncio import BigtableInstanceAdminGrpcAsyncIOTransport
+from .client import BigtableInstanceAdminClient
+
+try:
+ from google.api_core import client_logging # type: ignore
+
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
+except ImportError: # pragma: NO COVER
+ CLIENT_LOGGING_SUPPORTED = False
+
+_LOGGER = std_logging.getLogger(__name__)
+
+
+class BigtableInstanceAdminAsyncClient:
+ """Service for creating, configuring, and deleting Cloud
+ Bigtable Instances and Clusters. Provides access to the Instance
+ and Cluster schemas only, not the tables' metadata or data
+ stored in those tables.
+ """
+
+ _client: BigtableInstanceAdminClient
+
+ # Copy defaults from the synchronous client for use here.
+ # Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead.
+ DEFAULT_ENDPOINT = BigtableInstanceAdminClient.DEFAULT_ENDPOINT
+ DEFAULT_MTLS_ENDPOINT = BigtableInstanceAdminClient.DEFAULT_MTLS_ENDPOINT
+ _DEFAULT_ENDPOINT_TEMPLATE = BigtableInstanceAdminClient._DEFAULT_ENDPOINT_TEMPLATE
+ _DEFAULT_UNIVERSE = BigtableInstanceAdminClient._DEFAULT_UNIVERSE
+
+ app_profile_path = staticmethod(BigtableInstanceAdminClient.app_profile_path)
+ parse_app_profile_path = staticmethod(
+ BigtableInstanceAdminClient.parse_app_profile_path
+ )
+ cluster_path = staticmethod(BigtableInstanceAdminClient.cluster_path)
+ parse_cluster_path = staticmethod(BigtableInstanceAdminClient.parse_cluster_path)
+ crypto_key_path = staticmethod(BigtableInstanceAdminClient.crypto_key_path)
+ parse_crypto_key_path = staticmethod(
+ BigtableInstanceAdminClient.parse_crypto_key_path
+ )
+ hot_tablet_path = staticmethod(BigtableInstanceAdminClient.hot_tablet_path)
+ parse_hot_tablet_path = staticmethod(
+ BigtableInstanceAdminClient.parse_hot_tablet_path
+ )
+ instance_path = staticmethod(BigtableInstanceAdminClient.instance_path)
+ parse_instance_path = staticmethod(BigtableInstanceAdminClient.parse_instance_path)
+ logical_view_path = staticmethod(BigtableInstanceAdminClient.logical_view_path)
+ parse_logical_view_path = staticmethod(
+ BigtableInstanceAdminClient.parse_logical_view_path
+ )
+ materialized_view_path = staticmethod(
+ BigtableInstanceAdminClient.materialized_view_path
+ )
+ parse_materialized_view_path = staticmethod(
+ BigtableInstanceAdminClient.parse_materialized_view_path
+ )
+ table_path = staticmethod(BigtableInstanceAdminClient.table_path)
+ parse_table_path = staticmethod(BigtableInstanceAdminClient.parse_table_path)
+ common_billing_account_path = staticmethod(
+ BigtableInstanceAdminClient.common_billing_account_path
+ )
+ parse_common_billing_account_path = staticmethod(
+ BigtableInstanceAdminClient.parse_common_billing_account_path
+ )
+ common_folder_path = staticmethod(BigtableInstanceAdminClient.common_folder_path)
+ parse_common_folder_path = staticmethod(
+ BigtableInstanceAdminClient.parse_common_folder_path
+ )
+ common_organization_path = staticmethod(
+ BigtableInstanceAdminClient.common_organization_path
+ )
+ parse_common_organization_path = staticmethod(
+ BigtableInstanceAdminClient.parse_common_organization_path
+ )
+ common_project_path = staticmethod(BigtableInstanceAdminClient.common_project_path)
+ parse_common_project_path = staticmethod(
+ BigtableInstanceAdminClient.parse_common_project_path
+ )
+ common_location_path = staticmethod(
+ BigtableInstanceAdminClient.common_location_path
+ )
+ parse_common_location_path = staticmethod(
+ BigtableInstanceAdminClient.parse_common_location_path
+ )
+
+ @classmethod
+ def from_service_account_info(cls, info: dict, *args, **kwargs):
+ """Creates an instance of this client using the provided credentials
+ info.
+
+ Args:
+ info (dict): The service account private key info.
+ args: Additional arguments to pass to the constructor.
+ kwargs: Additional arguments to pass to the constructor.
+
+ Returns:
+ BigtableInstanceAdminAsyncClient: The constructed client.
+ """
+ return BigtableInstanceAdminClient.from_service_account_info.__func__(BigtableInstanceAdminAsyncClient, info, *args, **kwargs) # type: ignore
+
+ @classmethod
+ def from_service_account_file(cls, filename: str, *args, **kwargs):
+ """Creates an instance of this client using the provided credentials
+ file.
+
+ Args:
+ filename (str): The path to the service account private key json
+ file.
+ args: Additional arguments to pass to the constructor.
+ kwargs: Additional arguments to pass to the constructor.
+
+ Returns:
+ BigtableInstanceAdminAsyncClient: The constructed client.
+ """
+ return BigtableInstanceAdminClient.from_service_account_file.__func__(BigtableInstanceAdminAsyncClient, filename, *args, **kwargs) # type: ignore
+
+ from_service_account_json = from_service_account_file
+
+ @classmethod
+ def get_mtls_endpoint_and_cert_source(
+ cls, client_options: Optional[ClientOptions] = None
+ ):
+ """Return the API endpoint and client cert source for mutual TLS.
+
+ The client cert source is determined in the following order:
+ (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the
+ client cert source is None.
+ (2) if `client_options.client_cert_source` is provided, use the provided one; if the
+ default client cert source exists, use the default one; otherwise the client cert
+ source is None.
+
+ The API endpoint is determined in the following order:
+ (1) if `client_options.api_endpoint` if provided, use the provided one.
+ (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the
+ default mTLS endpoint; if the environment variable is "never", use the default API
+ endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise
+ use the default API endpoint.
+
+ More details can be found at https://google.aip.dev/auth/4114.
+
+ Args:
+ client_options (google.api_core.client_options.ClientOptions): Custom options for the
+ client. Only the `api_endpoint` and `client_cert_source` properties may be used
+ in this method.
+
+ Returns:
+ Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the
+ client cert source to use.
+
+ Raises:
+ google.auth.exceptions.MutualTLSChannelError: If any errors happen.
+ """
+ return BigtableInstanceAdminClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore
+
+ @property
+ def transport(self) -> BigtableInstanceAdminTransport:
+ """Returns the transport used by the client instance.
+
+ Returns:
+ BigtableInstanceAdminTransport: The transport used by the client instance.
+ """
+ return self._client.transport
+
+ @property
+ def api_endpoint(self):
+ """Return the API endpoint used by the client instance.
+
+ Returns:
+ str: The API endpoint used by the client instance.
+ """
+ return self._client._api_endpoint
+
+ @property
+ def universe_domain(self) -> str:
+ """Return the universe domain used by the client instance.
+
+ Returns:
+ str: The universe domain used
+ by the client instance.
+ """
+ return self._client._universe_domain
+
+ get_transport_class = BigtableInstanceAdminClient.get_transport_class
+
+ def __init__(
+ self,
+ *,
+ credentials: Optional[ga_credentials.Credentials] = None,
+ transport: Optional[
+ Union[
+ str,
+ BigtableInstanceAdminTransport,
+ Callable[..., BigtableInstanceAdminTransport],
+ ]
+ ] = "grpc_asyncio",
+ client_options: Optional[ClientOptions] = None,
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
+ ) -> None:
+ """Instantiates the bigtable instance admin async client.
+
+ Args:
+ credentials (Optional[google.auth.credentials.Credentials]): The
+ authorization credentials to attach to requests. These
+ credentials identify the application to the service; if none
+ are specified, the client will attempt to ascertain the
+ credentials from the environment.
+ transport (Optional[Union[str,BigtableInstanceAdminTransport,Callable[..., BigtableInstanceAdminTransport]]]):
+ The transport to use, or a Callable that constructs and returns a new transport to use.
+ If a Callable is given, it will be called with the same set of initialization
+ arguments as used in the BigtableInstanceAdminTransport constructor.
+ If set to None, a transport is chosen automatically.
+ client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]):
+ Custom options for the client.
+
+ 1. The ``api_endpoint`` property can be used to override the
+ default endpoint provided by the client when ``transport`` is
+ not explicitly provided. Only if this property is not set and
+ ``transport`` was not explicitly provided, the endpoint is
+ determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment
+ variable, which have one of the following values:
+ "always" (always use the default mTLS endpoint), "never" (always
+ use the default regular endpoint) and "auto" (auto-switch to the
+ default mTLS endpoint if client certificate is present; this is
+ the default value).
+
+ 2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable
+ is "true", then the ``client_cert_source`` property can be used
+ to provide a client certificate for mTLS transport. If
+ not provided, the default SSL client certificate will be used if
+ present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not
+ set, no client certificate will be used.
+
+ 3. The ``universe_domain`` property can be used to override the
+ default "googleapis.com" universe. Note that ``api_endpoint``
+ property still takes precedence; and ``universe_domain`` is
+ currently not supported for mTLS.
+
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
+ The client info used to send a user-agent string along with
+ API requests. If ``None``, then default info will be used.
+ Generally, you only need to set this if you're developing
+ your own client library.
+
+ Raises:
+ google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
+ creation failed for any reason.
+ """
+ self._client = BigtableInstanceAdminClient(
+ credentials=credentials,
+ transport=transport,
+ client_options=client_options,
+ client_info=client_info,
+ )
+
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ std_logging.DEBUG
+ ): # pragma: NO COVER
+ _LOGGER.debug(
+ "Created client `google.bigtable.admin_v2.BigtableInstanceAdminAsyncClient`.",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "universeDomain": getattr(
+ self._client._transport._credentials, "universe_domain", ""
+ ),
+ "credentialsType": f"{type(self._client._transport._credentials).__module__}.{type(self._client._transport._credentials).__qualname__}",
+ "credentialsInfo": getattr(
+ self.transport._credentials, "get_cred_info", lambda: None
+ )(),
+ }
+ if hasattr(self._client._transport, "_credentials")
+ else {
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "credentialsType": None,
+ },
+ )
+
+ async def create_instance(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.CreateInstanceRequest, dict]
+ ] = None,
+ *,
+ parent: Optional[str] = None,
+ instance_id: Optional[str] = None,
+ instance: Optional[gba_instance.Instance] = None,
+ clusters: Optional[MutableMapping[str, gba_instance.Cluster]] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operation_async.AsyncOperation:
+ r"""Create an instance within a project.
+
+ Note that exactly one of Cluster.serve_nodes and
+ Cluster.cluster_config.cluster_autoscaling_config can be set. If
+ serve_nodes is set to non-zero, then the cluster is manually
+ scaled. If cluster_config.cluster_autoscaling_config is
+ non-empty, then autoscaling is enabled.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_create_instance():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminAsyncClient()
+
+ # Initialize request argument(s)
+ instance = bigtable_admin_v2.Instance()
+ instance.display_name = "display_name_value"
+
+ request = bigtable_admin_v2.CreateInstanceRequest(
+ parent="parent_value",
+ instance_id="instance_id_value",
+ instance=instance,
+ )
+
+ # Make the request
+ operation = client.create_instance(request=request)
+
+ print("Waiting for operation to complete...")
+
+ response = (await operation).result()
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.CreateInstanceRequest, dict]]):
+ The request object. Request message for
+ BigtableInstanceAdmin.CreateInstance.
+ parent (:class:`str`):
+ Required. The unique name of the project in which to
+ create the new instance. Values are of the form
+ ``projects/{project}``.
+
+ This corresponds to the ``parent`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ instance_id (:class:`str`):
+ Required. The ID to be used when referring to the new
+ instance within its project, e.g., just ``myinstance``
+ rather than ``projects/myproject/instances/myinstance``.
+
+ This corresponds to the ``instance_id`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ instance (:class:`google.cloud.bigtable_admin_v2.types.Instance`):
+ Required. The instance to create. Fields marked
+ ``OutputOnly`` must be left blank.
+
+ This corresponds to the ``instance`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ clusters (:class:`MutableMapping[str, google.cloud.bigtable_admin_v2.types.Cluster]`):
+ Required. The clusters to be created within the
+ instance, mapped by desired cluster ID, e.g., just
+ ``mycluster`` rather than
+ ``projects/myproject/instances/myinstance/clusters/mycluster``.
+ Fields marked ``OutputOnly`` must be left blank.
+
+ This corresponds to the ``clusters`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.api_core.operation_async.AsyncOperation:
+ An object representing a long-running operation.
+
+ The result type for the operation will be :class:`google.cloud.bigtable_admin_v2.types.Instance` A collection of Bigtable [Tables][google.bigtable.admin.v2.Table] and
+ the resources that serve them. All tables in an
+ instance are served from all
+ [Clusters][google.bigtable.admin.v2.Cluster] in the
+ instance.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [parent, instance_id, instance, clusters]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_instance_admin.CreateInstanceRequest):
+ request = bigtable_instance_admin.CreateInstanceRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if parent is not None:
+ request.parent = parent
+ if instance_id is not None:
+ request.instance_id = instance_id
+ if instance is not None:
+ request.instance = instance
+
+ if clusters:
+ request.clusters.update(clusters)
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.create_instance
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Wrap the response in an operation future.
+ response = operation_async.from_gapic(
+ response,
+ self._client._transport.operations_client,
+ gba_instance.Instance,
+ metadata_type=bigtable_instance_admin.CreateInstanceMetadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def get_instance(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.GetInstanceRequest, dict]
+ ] = None,
+ *,
+ name: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> instance.Instance:
+ r"""Gets information about an instance.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_get_instance():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.GetInstanceRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = await client.get_instance(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.GetInstanceRequest, dict]]):
+ The request object. Request message for
+ BigtableInstanceAdmin.GetInstance.
+ name (:class:`str`):
+ Required. The unique name of the requested instance.
+ Values are of the form
+ ``projects/{project}/instances/{instance}``.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.types.Instance:
+ A collection of Bigtable [Tables][google.bigtable.admin.v2.Table] and
+ the resources that serve them. All tables in an
+ instance are served from all
+ [Clusters][google.bigtable.admin.v2.Cluster] in the
+ instance.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_instance_admin.GetInstanceRequest):
+ request = bigtable_instance_admin.GetInstanceRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.get_instance
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def list_instances(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.ListInstancesRequest, dict]
+ ] = None,
+ *,
+ parent: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> bigtable_instance_admin.ListInstancesResponse:
+ r"""Lists information about instances in a project.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_list_instances():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.ListInstancesRequest(
+ parent="parent_value",
+ )
+
+ # Make the request
+ response = await client.list_instances(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.ListInstancesRequest, dict]]):
+ The request object. Request message for
+ BigtableInstanceAdmin.ListInstances.
+ parent (:class:`str`):
+ Required. The unique name of the project for which a
+ list of instances is requested. Values are of the form
+ ``projects/{project}``.
+
+ This corresponds to the ``parent`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.types.ListInstancesResponse:
+ Response message for
+ BigtableInstanceAdmin.ListInstances.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [parent]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_instance_admin.ListInstancesRequest):
+ request = bigtable_instance_admin.ListInstancesRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if parent is not None:
+ request.parent = parent
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.list_instances
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def update_instance(
+ self,
+ request: Optional[Union[instance.Instance, dict]] = None,
+ *,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> instance.Instance:
+ r"""Updates an instance within a project. This method
+ updates only the display name and type for an Instance.
+ To update other Instance properties, such as labels, use
+ PartialUpdateInstance.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_update_instance():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.Instance(
+ display_name="display_name_value",
+ )
+
+ # Make the request
+ response = await client.update_instance(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.Instance, dict]]):
+ The request object. A collection of Bigtable
+ [Tables][google.bigtable.admin.v2.Table] and the
+ resources that serve them. All tables in an instance are
+ served from all
+ [Clusters][google.bigtable.admin.v2.Cluster] in the
+ instance.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.types.Instance:
+ A collection of Bigtable [Tables][google.bigtable.admin.v2.Table] and
+ the resources that serve them. All tables in an
+ instance are served from all
+ [Clusters][google.bigtable.admin.v2.Cluster] in the
+ instance.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, instance.Instance):
+ request = instance.Instance(request)
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.update_instance
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def partial_update_instance(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.PartialUpdateInstanceRequest, dict]
+ ] = None,
+ *,
+ instance: Optional[gba_instance.Instance] = None,
+ update_mask: Optional[field_mask_pb2.FieldMask] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operation_async.AsyncOperation:
+ r"""Partially updates an instance within a project. This
+ method can modify all fields of an Instance and is the
+ preferred way to update an Instance.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_partial_update_instance():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminAsyncClient()
+
+ # Initialize request argument(s)
+ instance = bigtable_admin_v2.Instance()
+ instance.display_name = "display_name_value"
+
+ request = bigtable_admin_v2.PartialUpdateInstanceRequest(
+ instance=instance,
+ )
+
+ # Make the request
+ operation = client.partial_update_instance(request=request)
+
+ print("Waiting for operation to complete...")
+
+ response = (await operation).result()
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.PartialUpdateInstanceRequest, dict]]):
+ The request object. Request message for
+ BigtableInstanceAdmin.PartialUpdateInstance.
+ instance (:class:`google.cloud.bigtable_admin_v2.types.Instance`):
+ Required. The Instance which will
+ (partially) replace the current value.
+
+ This corresponds to the ``instance`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
+ Required. The subset of Instance
+ fields which should be replaced. Must be
+ explicitly set.
+
+ This corresponds to the ``update_mask`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.api_core.operation_async.AsyncOperation:
+ An object representing a long-running operation.
+
+ The result type for the operation will be :class:`google.cloud.bigtable_admin_v2.types.Instance` A collection of Bigtable [Tables][google.bigtable.admin.v2.Table] and
+ the resources that serve them. All tables in an
+ instance are served from all
+ [Clusters][google.bigtable.admin.v2.Cluster] in the
+ instance.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [instance, update_mask]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(
+ request, bigtable_instance_admin.PartialUpdateInstanceRequest
+ ):
+ request = bigtable_instance_admin.PartialUpdateInstanceRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if instance is not None:
+ request.instance = instance
+ if update_mask is not None:
+ request.update_mask = update_mask
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.partial_update_instance
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata(
+ (("instance.name", request.instance.name),)
+ ),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Wrap the response in an operation future.
+ response = operation_async.from_gapic(
+ response,
+ self._client._transport.operations_client,
+ gba_instance.Instance,
+ metadata_type=bigtable_instance_admin.UpdateInstanceMetadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def delete_instance(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.DeleteInstanceRequest, dict]
+ ] = None,
+ *,
+ name: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> None:
+ r"""Delete an instance from a project.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_delete_instance():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.DeleteInstanceRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ await client.delete_instance(request=request)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.DeleteInstanceRequest, dict]]):
+ The request object. Request message for
+ BigtableInstanceAdmin.DeleteInstance.
+ name (:class:`str`):
+ Required. The unique name of the instance to be deleted.
+ Values are of the form
+ ``projects/{project}/instances/{instance}``.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_instance_admin.DeleteInstanceRequest):
+ request = bigtable_instance_admin.DeleteInstanceRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.delete_instance
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ async def create_cluster(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.CreateClusterRequest, dict]
+ ] = None,
+ *,
+ parent: Optional[str] = None,
+ cluster_id: Optional[str] = None,
+ cluster: Optional[instance.Cluster] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operation_async.AsyncOperation:
+ r"""Creates a cluster within an instance.
+
+ Note that exactly one of Cluster.serve_nodes and
+ Cluster.cluster_config.cluster_autoscaling_config can be set. If
+ serve_nodes is set to non-zero, then the cluster is manually
+ scaled. If cluster_config.cluster_autoscaling_config is
+ non-empty, then autoscaling is enabled.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_create_cluster():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.CreateClusterRequest(
+ parent="parent_value",
+ cluster_id="cluster_id_value",
+ )
+
+ # Make the request
+ operation = client.create_cluster(request=request)
+
+ print("Waiting for operation to complete...")
+
+ response = (await operation).result()
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.CreateClusterRequest, dict]]):
+ The request object. Request message for
+ BigtableInstanceAdmin.CreateCluster.
+ parent (:class:`str`):
+ Required. The unique name of the instance in which to
+ create the new cluster. Values are of the form
+ ``projects/{project}/instances/{instance}``.
+
+ This corresponds to the ``parent`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ cluster_id (:class:`str`):
+ Required. The ID to be used when referring to the new
+ cluster within its instance, e.g., just ``mycluster``
+ rather than
+ ``projects/myproject/instances/myinstance/clusters/mycluster``.
+
+ This corresponds to the ``cluster_id`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ cluster (:class:`google.cloud.bigtable_admin_v2.types.Cluster`):
+ Required. The cluster to be created. Fields marked
+ ``OutputOnly`` must be left blank.
+
+ This corresponds to the ``cluster`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.api_core.operation_async.AsyncOperation:
+ An object representing a long-running operation.
+
+ The result type for the operation will be :class:`google.cloud.bigtable_admin_v2.types.Cluster` A resizable group of nodes in a particular cloud location, capable
+ of serving all
+ [Tables][google.bigtable.admin.v2.Table] in the
+ parent [Instance][google.bigtable.admin.v2.Instance].
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [parent, cluster_id, cluster]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_instance_admin.CreateClusterRequest):
+ request = bigtable_instance_admin.CreateClusterRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if parent is not None:
+ request.parent = parent
+ if cluster_id is not None:
+ request.cluster_id = cluster_id
+ if cluster is not None:
+ request.cluster = cluster
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.create_cluster
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Wrap the response in an operation future.
+ response = operation_async.from_gapic(
+ response,
+ self._client._transport.operations_client,
+ instance.Cluster,
+ metadata_type=bigtable_instance_admin.CreateClusterMetadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def get_cluster(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.GetClusterRequest, dict]
+ ] = None,
+ *,
+ name: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> instance.Cluster:
+ r"""Gets information about a cluster.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_get_cluster():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.GetClusterRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = await client.get_cluster(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.GetClusterRequest, dict]]):
+ The request object. Request message for
+ BigtableInstanceAdmin.GetCluster.
+ name (:class:`str`):
+ Required. The unique name of the requested cluster.
+ Values are of the form
+ ``projects/{project}/instances/{instance}/clusters/{cluster}``.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.types.Cluster:
+ A resizable group of nodes in a particular cloud location, capable
+ of serving all
+ [Tables][google.bigtable.admin.v2.Table] in the
+ parent [Instance][google.bigtable.admin.v2.Instance].
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_instance_admin.GetClusterRequest):
+ request = bigtable_instance_admin.GetClusterRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.get_cluster
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def list_clusters(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.ListClustersRequest, dict]
+ ] = None,
+ *,
+ parent: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> bigtable_instance_admin.ListClustersResponse:
+ r"""Lists information about clusters in an instance.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_list_clusters():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.ListClustersRequest(
+ parent="parent_value",
+ )
+
+ # Make the request
+ response = await client.list_clusters(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.ListClustersRequest, dict]]):
+ The request object. Request message for
+ BigtableInstanceAdmin.ListClusters.
+ parent (:class:`str`):
+ Required. The unique name of the instance for which a
+ list of clusters is requested. Values are of the form
+ ``projects/{project}/instances/{instance}``. Use
+ ``{instance} = '-'`` to list Clusters for all Instances
+ in a project, e.g., ``projects/myproject/instances/-``.
+
+ This corresponds to the ``parent`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.types.ListClustersResponse:
+ Response message for
+ BigtableInstanceAdmin.ListClusters.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [parent]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_instance_admin.ListClustersRequest):
+ request = bigtable_instance_admin.ListClustersRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if parent is not None:
+ request.parent = parent
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.list_clusters
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def update_cluster(
+ self,
+ request: Optional[Union[instance.Cluster, dict]] = None,
+ *,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operation_async.AsyncOperation:
+ r"""Updates a cluster within an instance.
+
+ Note that UpdateCluster does not support updating
+ cluster_config.cluster_autoscaling_config. In order to update
+ it, you must use PartialUpdateCluster.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_update_cluster():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.Cluster(
+ )
+
+ # Make the request
+ operation = client.update_cluster(request=request)
+
+ print("Waiting for operation to complete...")
+
+ response = (await operation).result()
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.Cluster, dict]]):
+ The request object. A resizable group of nodes in a particular cloud
+ location, capable of serving all
+ [Tables][google.bigtable.admin.v2.Table] in the parent
+ [Instance][google.bigtable.admin.v2.Instance].
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.api_core.operation_async.AsyncOperation:
+ An object representing a long-running operation.
+
+ The result type for the operation will be :class:`google.cloud.bigtable_admin_v2.types.Cluster` A resizable group of nodes in a particular cloud location, capable
+ of serving all
+ [Tables][google.bigtable.admin.v2.Table] in the
+ parent [Instance][google.bigtable.admin.v2.Instance].
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, instance.Cluster):
+ request = instance.Cluster(request)
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.update_cluster
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Wrap the response in an operation future.
+ response = operation_async.from_gapic(
+ response,
+ self._client._transport.operations_client,
+ instance.Cluster,
+ metadata_type=bigtable_instance_admin.UpdateClusterMetadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def partial_update_cluster(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.PartialUpdateClusterRequest, dict]
+ ] = None,
+ *,
+ cluster: Optional[instance.Cluster] = None,
+ update_mask: Optional[field_mask_pb2.FieldMask] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operation_async.AsyncOperation:
+ r"""Partially updates a cluster within a project. This method is the
+ preferred way to update a Cluster.
+
+ To enable and update autoscaling, set
+ cluster_config.cluster_autoscaling_config. When autoscaling is
+ enabled, serve_nodes is treated as an OUTPUT_ONLY field, meaning
+ that updates to it are ignored. Note that an update cannot
+ simultaneously set serve_nodes to non-zero and
+ cluster_config.cluster_autoscaling_config to non-empty, and also
+ specify both in the update_mask.
+
+ To disable autoscaling, clear
+ cluster_config.cluster_autoscaling_config, and explicitly set a
+ serve_node count via the update_mask.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_partial_update_cluster():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.PartialUpdateClusterRequest(
+ )
+
+ # Make the request
+ operation = client.partial_update_cluster(request=request)
+
+ print("Waiting for operation to complete...")
+
+ response = (await operation).result()
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.PartialUpdateClusterRequest, dict]]):
+ The request object. Request message for
+ BigtableInstanceAdmin.PartialUpdateCluster.
+ cluster (:class:`google.cloud.bigtable_admin_v2.types.Cluster`):
+ Required. The Cluster which contains the partial updates
+ to be applied, subject to the update_mask.
+
+ This corresponds to the ``cluster`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
+ Required. The subset of Cluster
+ fields which should be replaced.
+
+ This corresponds to the ``update_mask`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.api_core.operation_async.AsyncOperation:
+ An object representing a long-running operation.
+
+ The result type for the operation will be :class:`google.cloud.bigtable_admin_v2.types.Cluster` A resizable group of nodes in a particular cloud location, capable
+ of serving all
+ [Tables][google.bigtable.admin.v2.Table] in the
+ parent [Instance][google.bigtable.admin.v2.Instance].
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [cluster, update_mask]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_instance_admin.PartialUpdateClusterRequest):
+ request = bigtable_instance_admin.PartialUpdateClusterRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if cluster is not None:
+ request.cluster = cluster
+ if update_mask is not None:
+ request.update_mask = update_mask
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.partial_update_cluster
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata(
+ (("cluster.name", request.cluster.name),)
+ ),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Wrap the response in an operation future.
+ response = operation_async.from_gapic(
+ response,
+ self._client._transport.operations_client,
+ instance.Cluster,
+ metadata_type=bigtable_instance_admin.PartialUpdateClusterMetadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def delete_cluster(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.DeleteClusterRequest, dict]
+ ] = None,
+ *,
+ name: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> None:
+ r"""Deletes a cluster from an instance.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_delete_cluster():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.DeleteClusterRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ await client.delete_cluster(request=request)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.DeleteClusterRequest, dict]]):
+ The request object. Request message for
+ BigtableInstanceAdmin.DeleteCluster.
+ name (:class:`str`):
+ Required. The unique name of the cluster to be deleted.
+ Values are of the form
+ ``projects/{project}/instances/{instance}/clusters/{cluster}``.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_instance_admin.DeleteClusterRequest):
+ request = bigtable_instance_admin.DeleteClusterRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.delete_cluster
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ async def create_app_profile(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.CreateAppProfileRequest, dict]
+ ] = None,
+ *,
+ parent: Optional[str] = None,
+ app_profile_id: Optional[str] = None,
+ app_profile: Optional[instance.AppProfile] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> instance.AppProfile:
+ r"""Creates an app profile within an instance.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_create_app_profile():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminAsyncClient()
+
+ # Initialize request argument(s)
+ app_profile = bigtable_admin_v2.AppProfile()
+ app_profile.priority = "PRIORITY_HIGH"
+
+ request = bigtable_admin_v2.CreateAppProfileRequest(
+ parent="parent_value",
+ app_profile_id="app_profile_id_value",
+ app_profile=app_profile,
+ )
+
+ # Make the request
+ response = await client.create_app_profile(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.CreateAppProfileRequest, dict]]):
+ The request object. Request message for
+ BigtableInstanceAdmin.CreateAppProfile.
+ parent (:class:`str`):
+ Required. The unique name of the instance in which to
+ create the new app profile. Values are of the form
+ ``projects/{project}/instances/{instance}``.
+
+ This corresponds to the ``parent`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ app_profile_id (:class:`str`):
+ Required. The ID to be used when referring to the new
+ app profile within its instance, e.g., just
+ ``myprofile`` rather than
+ ``projects/myproject/instances/myinstance/appProfiles/myprofile``.
+
+ This corresponds to the ``app_profile_id`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ app_profile (:class:`google.cloud.bigtable_admin_v2.types.AppProfile`):
+ Required. The app profile to be created. Fields marked
+ ``OutputOnly`` will be ignored.
+
+ This corresponds to the ``app_profile`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.types.AppProfile:
+ A configuration object describing how
+ Cloud Bigtable should treat traffic from
+ a particular end user application.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [parent, app_profile_id, app_profile]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_instance_admin.CreateAppProfileRequest):
+ request = bigtable_instance_admin.CreateAppProfileRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if parent is not None:
+ request.parent = parent
+ if app_profile_id is not None:
+ request.app_profile_id = app_profile_id
+ if app_profile is not None:
+ request.app_profile = app_profile
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.create_app_profile
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def get_app_profile(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.GetAppProfileRequest, dict]
+ ] = None,
+ *,
+ name: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> instance.AppProfile:
+ r"""Gets information about an app profile.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_get_app_profile():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.GetAppProfileRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = await client.get_app_profile(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.GetAppProfileRequest, dict]]):
+ The request object. Request message for
+ BigtableInstanceAdmin.GetAppProfile.
+ name (:class:`str`):
+ Required. The unique name of the requested app profile.
+ Values are of the form
+ ``projects/{project}/instances/{instance}/appProfiles/{app_profile}``.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.types.AppProfile:
+ A configuration object describing how
+ Cloud Bigtable should treat traffic from
+ a particular end user application.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_instance_admin.GetAppProfileRequest):
+ request = bigtable_instance_admin.GetAppProfileRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.get_app_profile
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def list_app_profiles(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.ListAppProfilesRequest, dict]
+ ] = None,
+ *,
+ parent: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> pagers.ListAppProfilesAsyncPager:
+ r"""Lists information about app profiles in an instance.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_list_app_profiles():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.ListAppProfilesRequest(
+ parent="parent_value",
+ )
+
+ # Make the request
+ page_result = client.list_app_profiles(request=request)
+
+ # Handle the response
+ async for response in page_result:
+ print(response)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.ListAppProfilesRequest, dict]]):
+ The request object. Request message for
+ BigtableInstanceAdmin.ListAppProfiles.
+ parent (:class:`str`):
+ Required. The unique name of the instance for which a
+ list of app profiles is requested. Values are of the
+ form ``projects/{project}/instances/{instance}``. Use
+ ``{instance} = '-'`` to list AppProfiles for all
+ Instances in a project, e.g.,
+ ``projects/myproject/instances/-``.
+
+ This corresponds to the ``parent`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.services.bigtable_instance_admin.pagers.ListAppProfilesAsyncPager:
+ Response message for
+ BigtableInstanceAdmin.ListAppProfiles.
+ Iterating over this object will yield
+ results and resolve additional pages
+ automatically.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [parent]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_instance_admin.ListAppProfilesRequest):
+ request = bigtable_instance_admin.ListAppProfilesRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if parent is not None:
+ request.parent = parent
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.list_app_profiles
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # This method is paged; wrap the response in a pager, which provides
+ # an `__aiter__` convenience method.
+ response = pagers.ListAppProfilesAsyncPager(
+ method=rpc,
+ request=request,
+ response=response,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def update_app_profile(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.UpdateAppProfileRequest, dict]
+ ] = None,
+ *,
+ app_profile: Optional[instance.AppProfile] = None,
+ update_mask: Optional[field_mask_pb2.FieldMask] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operation_async.AsyncOperation:
+ r"""Updates an app profile within an instance.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_update_app_profile():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminAsyncClient()
+
+ # Initialize request argument(s)
+ app_profile = bigtable_admin_v2.AppProfile()
+ app_profile.priority = "PRIORITY_HIGH"
+
+ request = bigtable_admin_v2.UpdateAppProfileRequest(
+ app_profile=app_profile,
+ )
+
+ # Make the request
+ operation = client.update_app_profile(request=request)
+
+ print("Waiting for operation to complete...")
+
+ response = (await operation).result()
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.UpdateAppProfileRequest, dict]]):
+ The request object. Request message for
+ BigtableInstanceAdmin.UpdateAppProfile.
+ app_profile (:class:`google.cloud.bigtable_admin_v2.types.AppProfile`):
+ Required. The app profile which will
+ (partially) replace the current value.
+
+ This corresponds to the ``app_profile`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
+ Required. The subset of app profile
+ fields which should be replaced. If
+ unset, all fields will be replaced.
+
+ This corresponds to the ``update_mask`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.api_core.operation_async.AsyncOperation:
+ An object representing a long-running operation.
+
+ The result type for the operation will be :class:`google.cloud.bigtable_admin_v2.types.AppProfile` A configuration object describing how Cloud Bigtable should treat traffic
+ from a particular end user application.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [app_profile, update_mask]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_instance_admin.UpdateAppProfileRequest):
+ request = bigtable_instance_admin.UpdateAppProfileRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if app_profile is not None:
+ request.app_profile = app_profile
+ if update_mask is not None:
+ request.update_mask = update_mask
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.update_app_profile
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata(
+ (("app_profile.name", request.app_profile.name),)
+ ),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Wrap the response in an operation future.
+ response = operation_async.from_gapic(
+ response,
+ self._client._transport.operations_client,
+ instance.AppProfile,
+ metadata_type=bigtable_instance_admin.UpdateAppProfileMetadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def delete_app_profile(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.DeleteAppProfileRequest, dict]
+ ] = None,
+ *,
+ name: Optional[str] = None,
+ ignore_warnings: Optional[bool] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> None:
+ r"""Deletes an app profile from an instance.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_delete_app_profile():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.DeleteAppProfileRequest(
+ name="name_value",
+ ignore_warnings=True,
+ )
+
+ # Make the request
+ await client.delete_app_profile(request=request)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.DeleteAppProfileRequest, dict]]):
+ The request object. Request message for
+ BigtableInstanceAdmin.DeleteAppProfile.
+ name (:class:`str`):
+ Required. The unique name of the app profile to be
+ deleted. Values are of the form
+ ``projects/{project}/instances/{instance}/appProfiles/{app_profile}``.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ ignore_warnings (:class:`bool`):
+ Required. If true, ignore safety
+ checks when deleting the app profile.
+
+ This corresponds to the ``ignore_warnings`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name, ignore_warnings]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_instance_admin.DeleteAppProfileRequest):
+ request = bigtable_instance_admin.DeleteAppProfileRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+ if ignore_warnings is not None:
+ request.ignore_warnings = ignore_warnings
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.delete_app_profile
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ async def get_iam_policy(
+ self,
+ request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None,
+ *,
+ resource: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> policy_pb2.Policy:
+ r"""Gets the access control policy for an instance
+ resource. Returns an empty policy if an instance exists
+ but does not have a policy set.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+ from google.iam.v1 import iam_policy_pb2 # type: ignore
+
+ async def sample_get_iam_policy():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = iam_policy_pb2.GetIamPolicyRequest(
+ resource="resource_value",
+ )
+
+ # Make the request
+ response = await client.get_iam_policy(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Optional[Union[google.iam.v1.iam_policy_pb2.GetIamPolicyRequest, dict]]):
+ The request object. Request message for ``GetIamPolicy`` method.
+ resource (:class:`str`):
+ REQUIRED: The resource for which the
+ policy is being requested. See the
+ operation documentation for the
+ appropriate value for this field.
+
+ This corresponds to the ``resource`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.iam.v1.policy_pb2.Policy:
+ An Identity and Access Management (IAM) policy, which specifies access
+ controls for Google Cloud resources.
+
+ A Policy is a collection of bindings. A binding binds
+ one or more members, or principals, to a single role.
+ Principals can be user accounts, service accounts,
+ Google groups, and domains (such as G Suite). A role
+ is a named list of permissions; each role can be an
+ IAM predefined role or a user-created custom role.
+
+ For some types of Google Cloud resources, a binding
+ can also specify a condition, which is a logical
+ expression that allows access to a resource only if
+ the expression evaluates to true. A condition can add
+ constraints based on attributes of the request, the
+ resource, or both. To learn which resources support
+ conditions in their IAM policies, see the [IAM
+ documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
+
+ **JSON example:**
+
+ :literal:`` { "bindings": [ { "role": "roles/resourcemanager.organizationAdmin", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-project-id@appspot.gserviceaccount.com" ] }, { "role": "roles/resourcemanager.organizationViewer", "members": [ "user:eve@example.com" ], "condition": { "title": "expirable access", "description": "Does not grant access after Sep 2020", "expression": "request.time < timestamp('2020-10-01T00:00:00.000Z')", } } ], "etag": "BwWWja0YfJA=", "version": 3 }`\ \`
+
+ **YAML example:**
+
+ :literal:`` bindings: - members: - user:mike@example.com - group:admins@example.com - domain:google.com - serviceAccount:my-project-id@appspot.gserviceaccount.com role: roles/resourcemanager.organizationAdmin - members: - user:eve@example.com role: roles/resourcemanager.organizationViewer condition: title: expirable access description: Does not grant access after Sep 2020 expression: request.time < timestamp('2020-10-01T00:00:00.000Z') etag: BwWWja0YfJA= version: 3`\ \`
+
+ For a description of IAM and its features, see the
+ [IAM
+ documentation](https://cloud.google.com/iam/docs/).
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [resource]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - The request isn't a proto-plus wrapped type,
+ # so it must be constructed via keyword expansion.
+ if isinstance(request, dict):
+ request = iam_policy_pb2.GetIamPolicyRequest(**request)
+ elif not request:
+ request = iam_policy_pb2.GetIamPolicyRequest(resource=resource)
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.get_iam_policy
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def set_iam_policy(
+ self,
+ request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None,
+ *,
+ resource: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> policy_pb2.Policy:
+ r"""Sets the access control policy on an instance
+ resource. Replaces any existing policy.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+ from google.iam.v1 import iam_policy_pb2 # type: ignore
+
+ async def sample_set_iam_policy():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = iam_policy_pb2.SetIamPolicyRequest(
+ resource="resource_value",
+ )
+
+ # Make the request
+ response = await client.set_iam_policy(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Optional[Union[google.iam.v1.iam_policy_pb2.SetIamPolicyRequest, dict]]):
+ The request object. Request message for ``SetIamPolicy`` method.
+ resource (:class:`str`):
+ REQUIRED: The resource for which the
+ policy is being specified. See the
+ operation documentation for the
+ appropriate value for this field.
+
+ This corresponds to the ``resource`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.iam.v1.policy_pb2.Policy:
+ An Identity and Access Management (IAM) policy, which specifies access
+ controls for Google Cloud resources.
+
+ A Policy is a collection of bindings. A binding binds
+ one or more members, or principals, to a single role.
+ Principals can be user accounts, service accounts,
+ Google groups, and domains (such as G Suite). A role
+ is a named list of permissions; each role can be an
+ IAM predefined role or a user-created custom role.
+
+ For some types of Google Cloud resources, a binding
+ can also specify a condition, which is a logical
+ expression that allows access to a resource only if
+ the expression evaluates to true. A condition can add
+ constraints based on attributes of the request, the
+ resource, or both. To learn which resources support
+ conditions in their IAM policies, see the [IAM
+ documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
+
+ **JSON example:**
+
+ :literal:`` { "bindings": [ { "role": "roles/resourcemanager.organizationAdmin", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-project-id@appspot.gserviceaccount.com" ] }, { "role": "roles/resourcemanager.organizationViewer", "members": [ "user:eve@example.com" ], "condition": { "title": "expirable access", "description": "Does not grant access after Sep 2020", "expression": "request.time < timestamp('2020-10-01T00:00:00.000Z')", } } ], "etag": "BwWWja0YfJA=", "version": 3 }`\ \`
+
+ **YAML example:**
+
+ :literal:`` bindings: - members: - user:mike@example.com - group:admins@example.com - domain:google.com - serviceAccount:my-project-id@appspot.gserviceaccount.com role: roles/resourcemanager.organizationAdmin - members: - user:eve@example.com role: roles/resourcemanager.organizationViewer condition: title: expirable access description: Does not grant access after Sep 2020 expression: request.time < timestamp('2020-10-01T00:00:00.000Z') etag: BwWWja0YfJA= version: 3`\ \`
+
+ For a description of IAM and its features, see the
+ [IAM
+ documentation](https://cloud.google.com/iam/docs/).
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [resource]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - The request isn't a proto-plus wrapped type,
+ # so it must be constructed via keyword expansion.
+ if isinstance(request, dict):
+ request = iam_policy_pb2.SetIamPolicyRequest(**request)
+ elif not request:
+ request = iam_policy_pb2.SetIamPolicyRequest(resource=resource)
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.set_iam_policy
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def test_iam_permissions(
+ self,
+ request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None,
+ *,
+ resource: Optional[str] = None,
+ permissions: Optional[MutableSequence[str]] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> iam_policy_pb2.TestIamPermissionsResponse:
+ r"""Returns permissions that the caller has on the
+ specified instance resource.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+ from google.iam.v1 import iam_policy_pb2 # type: ignore
+
+ async def sample_test_iam_permissions():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = iam_policy_pb2.TestIamPermissionsRequest(
+ resource="resource_value",
+ permissions=['permissions_value1', 'permissions_value2'],
+ )
+
+ # Make the request
+ response = await client.test_iam_permissions(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Optional[Union[google.iam.v1.iam_policy_pb2.TestIamPermissionsRequest, dict]]):
+ The request object. Request message for ``TestIamPermissions`` method.
+ resource (:class:`str`):
+ REQUIRED: The resource for which the
+ policy detail is being requested. See
+ the operation documentation for the
+ appropriate value for this field.
+
+ This corresponds to the ``resource`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ permissions (:class:`MutableSequence[str]`):
+ The set of permissions to check for the ``resource``.
+ Permissions with wildcards (such as '*' or 'storage.*')
+ are not allowed. For more information see `IAM
+ Overview `__.
+
+ This corresponds to the ``permissions`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.iam.v1.iam_policy_pb2.TestIamPermissionsResponse:
+ Response message for TestIamPermissions method.
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [resource, permissions]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - The request isn't a proto-plus wrapped type,
+ # so it must be constructed via keyword expansion.
+ if isinstance(request, dict):
+ request = iam_policy_pb2.TestIamPermissionsRequest(**request)
+ elif not request:
+ request = iam_policy_pb2.TestIamPermissionsRequest(
+ resource=resource, permissions=permissions
+ )
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.test_iam_permissions
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def list_hot_tablets(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.ListHotTabletsRequest, dict]
+ ] = None,
+ *,
+ parent: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> pagers.ListHotTabletsAsyncPager:
+ r"""Lists hot tablets in a cluster, within the time range
+ provided. Hot tablets are ordered based on CPU usage.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_list_hot_tablets():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.ListHotTabletsRequest(
+ parent="parent_value",
+ )
+
+ # Make the request
+ page_result = client.list_hot_tablets(request=request)
+
+ # Handle the response
+ async for response in page_result:
+ print(response)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.ListHotTabletsRequest, dict]]):
+ The request object. Request message for
+ BigtableInstanceAdmin.ListHotTablets.
+ parent (:class:`str`):
+ Required. The cluster name to list hot tablets. Value is
+ in the following form:
+ ``projects/{project}/instances/{instance}/clusters/{cluster}``.
+
+ This corresponds to the ``parent`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.services.bigtable_instance_admin.pagers.ListHotTabletsAsyncPager:
+ Response message for
+ BigtableInstanceAdmin.ListHotTablets.
+ Iterating over this object will yield
+ results and resolve additional pages
+ automatically.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [parent]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_instance_admin.ListHotTabletsRequest):
+ request = bigtable_instance_admin.ListHotTabletsRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if parent is not None:
+ request.parent = parent
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.list_hot_tablets
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # This method is paged; wrap the response in a pager, which provides
+ # an `__aiter__` convenience method.
+ response = pagers.ListHotTabletsAsyncPager(
+ method=rpc,
+ request=request,
+ response=response,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def create_logical_view(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.CreateLogicalViewRequest, dict]
+ ] = None,
+ *,
+ parent: Optional[str] = None,
+ logical_view: Optional[instance.LogicalView] = None,
+ logical_view_id: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operation_async.AsyncOperation:
+ r"""Creates a logical view within an instance.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_create_logical_view():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminAsyncClient()
+
+ # Initialize request argument(s)
+ logical_view = bigtable_admin_v2.LogicalView()
+ logical_view.query = "query_value"
+
+ request = bigtable_admin_v2.CreateLogicalViewRequest(
+ parent="parent_value",
+ logical_view_id="logical_view_id_value",
+ logical_view=logical_view,
+ )
+
+ # Make the request
+ operation = client.create_logical_view(request=request)
+
+ print("Waiting for operation to complete...")
+
+ response = (await operation).result()
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.CreateLogicalViewRequest, dict]]):
+ The request object. Request message for
+ BigtableInstanceAdmin.CreateLogicalView.
+ parent (:class:`str`):
+ Required. The parent instance where this logical view
+ will be created. Format:
+ ``projects/{project}/instances/{instance}``.
+
+ This corresponds to the ``parent`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ logical_view (:class:`google.cloud.bigtable_admin_v2.types.LogicalView`):
+ Required. The logical view to create.
+ This corresponds to the ``logical_view`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ logical_view_id (:class:`str`):
+ Required. The ID to use for the
+ logical view, which will become the
+ final component of the logical view's
+ resource name.
+
+ This corresponds to the ``logical_view_id`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.api_core.operation_async.AsyncOperation:
+ An object representing a long-running operation.
+
+ The result type for the operation will be
+ :class:`google.cloud.bigtable_admin_v2.types.LogicalView`
+ A SQL logical view object that can be referenced in SQL
+ queries.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [parent, logical_view, logical_view_id]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_instance_admin.CreateLogicalViewRequest):
+ request = bigtable_instance_admin.CreateLogicalViewRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if parent is not None:
+ request.parent = parent
+ if logical_view is not None:
+ request.logical_view = logical_view
+ if logical_view_id is not None:
+ request.logical_view_id = logical_view_id
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.create_logical_view
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Wrap the response in an operation future.
+ response = operation_async.from_gapic(
+ response,
+ self._client._transport.operations_client,
+ instance.LogicalView,
+ metadata_type=bigtable_instance_admin.CreateLogicalViewMetadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def get_logical_view(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.GetLogicalViewRequest, dict]
+ ] = None,
+ *,
+ name: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> instance.LogicalView:
+ r"""Gets information about a logical view.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_get_logical_view():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.GetLogicalViewRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = await client.get_logical_view(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.GetLogicalViewRequest, dict]]):
+ The request object. Request message for
+ BigtableInstanceAdmin.GetLogicalView.
+ name (:class:`str`):
+ Required. The unique name of the requested logical view.
+ Values are of the form
+ ``projects/{project}/instances/{instance}/logicalViews/{logical_view}``.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.types.LogicalView:
+ A SQL logical view object that can be
+ referenced in SQL queries.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_instance_admin.GetLogicalViewRequest):
+ request = bigtable_instance_admin.GetLogicalViewRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.get_logical_view
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def list_logical_views(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.ListLogicalViewsRequest, dict]
+ ] = None,
+ *,
+ parent: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> pagers.ListLogicalViewsAsyncPager:
+ r"""Lists information about logical views in an instance.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_list_logical_views():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.ListLogicalViewsRequest(
+ parent="parent_value",
+ )
+
+ # Make the request
+ page_result = client.list_logical_views(request=request)
+
+ # Handle the response
+ async for response in page_result:
+ print(response)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.ListLogicalViewsRequest, dict]]):
+ The request object. Request message for
+ BigtableInstanceAdmin.ListLogicalViews.
+ parent (:class:`str`):
+ Required. The unique name of the instance for which the
+ list of logical views is requested. Values are of the
+ form ``projects/{project}/instances/{instance}``.
+
+ This corresponds to the ``parent`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.services.bigtable_instance_admin.pagers.ListLogicalViewsAsyncPager:
+ Response message for
+ BigtableInstanceAdmin.ListLogicalViews.
+ Iterating over this object will yield
+ results and resolve additional pages
+ automatically.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [parent]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_instance_admin.ListLogicalViewsRequest):
+ request = bigtable_instance_admin.ListLogicalViewsRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if parent is not None:
+ request.parent = parent
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.list_logical_views
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # This method is paged; wrap the response in a pager, which provides
+ # an `__aiter__` convenience method.
+ response = pagers.ListLogicalViewsAsyncPager(
+ method=rpc,
+ request=request,
+ response=response,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def update_logical_view(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.UpdateLogicalViewRequest, dict]
+ ] = None,
+ *,
+ logical_view: Optional[instance.LogicalView] = None,
+ update_mask: Optional[field_mask_pb2.FieldMask] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operation_async.AsyncOperation:
+ r"""Updates a logical view within an instance.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_update_logical_view():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminAsyncClient()
+
+ # Initialize request argument(s)
+ logical_view = bigtable_admin_v2.LogicalView()
+ logical_view.query = "query_value"
+
+ request = bigtable_admin_v2.UpdateLogicalViewRequest(
+ logical_view=logical_view,
+ )
+
+ # Make the request
+ operation = client.update_logical_view(request=request)
+
+ print("Waiting for operation to complete...")
+
+ response = (await operation).result()
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.UpdateLogicalViewRequest, dict]]):
+ The request object. Request message for
+ BigtableInstanceAdmin.UpdateLogicalView.
+ logical_view (:class:`google.cloud.bigtable_admin_v2.types.LogicalView`):
+ Required. The logical view to update.
+
+ The logical view's ``name`` field is used to identify
+ the view to update. Format:
+ ``projects/{project}/instances/{instance}/logicalViews/{logical_view}``.
+
+ This corresponds to the ``logical_view`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
+ Optional. The list of fields to
+ update.
+
+ This corresponds to the ``update_mask`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.api_core.operation_async.AsyncOperation:
+ An object representing a long-running operation.
+
+ The result type for the operation will be
+ :class:`google.cloud.bigtable_admin_v2.types.LogicalView`
+ A SQL logical view object that can be referenced in SQL
+ queries.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [logical_view, update_mask]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_instance_admin.UpdateLogicalViewRequest):
+ request = bigtable_instance_admin.UpdateLogicalViewRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if logical_view is not None:
+ request.logical_view = logical_view
+ if update_mask is not None:
+ request.update_mask = update_mask
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.update_logical_view
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata(
+ (("logical_view.name", request.logical_view.name),)
+ ),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Wrap the response in an operation future.
+ response = operation_async.from_gapic(
+ response,
+ self._client._transport.operations_client,
+ instance.LogicalView,
+ metadata_type=bigtable_instance_admin.UpdateLogicalViewMetadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def delete_logical_view(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.DeleteLogicalViewRequest, dict]
+ ] = None,
+ *,
+ name: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> None:
+ r"""Deletes a logical view from an instance.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_delete_logical_view():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.DeleteLogicalViewRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ await client.delete_logical_view(request=request)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.DeleteLogicalViewRequest, dict]]):
+ The request object. Request message for
+ BigtableInstanceAdmin.DeleteLogicalView.
+ name (:class:`str`):
+ Required. The unique name of the logical view to be
+ deleted. Format:
+ ``projects/{project}/instances/{instance}/logicalViews/{logical_view}``.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_instance_admin.DeleteLogicalViewRequest):
+ request = bigtable_instance_admin.DeleteLogicalViewRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.delete_logical_view
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ async def create_materialized_view(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.CreateMaterializedViewRequest, dict]
+ ] = None,
+ *,
+ parent: Optional[str] = None,
+ materialized_view: Optional[instance.MaterializedView] = None,
+ materialized_view_id: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operation_async.AsyncOperation:
+ r"""Creates a materialized view within an instance.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_create_materialized_view():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminAsyncClient()
+
+ # Initialize request argument(s)
+ materialized_view = bigtable_admin_v2.MaterializedView()
+ materialized_view.query = "query_value"
+
+ request = bigtable_admin_v2.CreateMaterializedViewRequest(
+ parent="parent_value",
+ materialized_view_id="materialized_view_id_value",
+ materialized_view=materialized_view,
+ )
+
+ # Make the request
+ operation = client.create_materialized_view(request=request)
+
+ print("Waiting for operation to complete...")
+
+ response = (await operation).result()
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.CreateMaterializedViewRequest, dict]]):
+ The request object. Request message for
+ BigtableInstanceAdmin.CreateMaterializedView.
+ parent (:class:`str`):
+ Required. The parent instance where this materialized
+ view will be created. Format:
+ ``projects/{project}/instances/{instance}``.
+
+ This corresponds to the ``parent`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ materialized_view (:class:`google.cloud.bigtable_admin_v2.types.MaterializedView`):
+ Required. The materialized view to
+ create.
+
+ This corresponds to the ``materialized_view`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ materialized_view_id (:class:`str`):
+ Required. The ID to use for the
+ materialized view, which will become the
+ final component of the materialized
+ view's resource name.
+
+ This corresponds to the ``materialized_view_id`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.api_core.operation_async.AsyncOperation:
+ An object representing a long-running operation.
+
+ The result type for the operation will be
+ :class:`google.cloud.bigtable_admin_v2.types.MaterializedView`
+ A materialized view object that can be referenced in SQL
+ queries.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [parent, materialized_view, materialized_view_id]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(
+ request, bigtable_instance_admin.CreateMaterializedViewRequest
+ ):
+ request = bigtable_instance_admin.CreateMaterializedViewRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if parent is not None:
+ request.parent = parent
+ if materialized_view is not None:
+ request.materialized_view = materialized_view
+ if materialized_view_id is not None:
+ request.materialized_view_id = materialized_view_id
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.create_materialized_view
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Wrap the response in an operation future.
+ response = operation_async.from_gapic(
+ response,
+ self._client._transport.operations_client,
+ instance.MaterializedView,
+ metadata_type=bigtable_instance_admin.CreateMaterializedViewMetadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def get_materialized_view(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.GetMaterializedViewRequest, dict]
+ ] = None,
+ *,
+ name: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> instance.MaterializedView:
+ r"""Gets information about a materialized view.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_get_materialized_view():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.GetMaterializedViewRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = await client.get_materialized_view(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.GetMaterializedViewRequest, dict]]):
+ The request object. Request message for
+ BigtableInstanceAdmin.GetMaterializedView.
+ name (:class:`str`):
+ Required. The unique name of the requested materialized
+ view. Values are of the form
+ ``projects/{project}/instances/{instance}/materializedViews/{materialized_view}``.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.types.MaterializedView:
+ A materialized view object that can
+ be referenced in SQL queries.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_instance_admin.GetMaterializedViewRequest):
+ request = bigtable_instance_admin.GetMaterializedViewRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.get_materialized_view
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def list_materialized_views(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.ListMaterializedViewsRequest, dict]
+ ] = None,
+ *,
+ parent: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> pagers.ListMaterializedViewsAsyncPager:
+ r"""Lists information about materialized views in an
+ instance.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_list_materialized_views():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.ListMaterializedViewsRequest(
+ parent="parent_value",
+ )
+
+ # Make the request
+ page_result = client.list_materialized_views(request=request)
+
+ # Handle the response
+ async for response in page_result:
+ print(response)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.ListMaterializedViewsRequest, dict]]):
+ The request object. Request message for
+ BigtableInstanceAdmin.ListMaterializedViews.
+ parent (:class:`str`):
+ Required. The unique name of the instance for which the
+ list of materialized views is requested. Values are of
+ the form ``projects/{project}/instances/{instance}``.
+
+ This corresponds to the ``parent`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.services.bigtable_instance_admin.pagers.ListMaterializedViewsAsyncPager:
+ Response message for
+ BigtableInstanceAdmin.ListMaterializedViews.
+ Iterating over this object will yield
+ results and resolve additional pages
+ automatically.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [parent]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(
+ request, bigtable_instance_admin.ListMaterializedViewsRequest
+ ):
+ request = bigtable_instance_admin.ListMaterializedViewsRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if parent is not None:
+ request.parent = parent
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.list_materialized_views
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # This method is paged; wrap the response in a pager, which provides
+ # an `__aiter__` convenience method.
+ response = pagers.ListMaterializedViewsAsyncPager(
+ method=rpc,
+ request=request,
+ response=response,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def update_materialized_view(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.UpdateMaterializedViewRequest, dict]
+ ] = None,
+ *,
+ materialized_view: Optional[instance.MaterializedView] = None,
+ update_mask: Optional[field_mask_pb2.FieldMask] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operation_async.AsyncOperation:
+ r"""Updates a materialized view within an instance.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_update_materialized_view():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminAsyncClient()
+
+ # Initialize request argument(s)
+ materialized_view = bigtable_admin_v2.MaterializedView()
+ materialized_view.query = "query_value"
+
+ request = bigtable_admin_v2.UpdateMaterializedViewRequest(
+ materialized_view=materialized_view,
+ )
+
+ # Make the request
+ operation = client.update_materialized_view(request=request)
+
+ print("Waiting for operation to complete...")
+
+ response = (await operation).result()
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.UpdateMaterializedViewRequest, dict]]):
+ The request object. Request message for
+ BigtableInstanceAdmin.UpdateMaterializedView.
+ materialized_view (:class:`google.cloud.bigtable_admin_v2.types.MaterializedView`):
+ Required. The materialized view to update.
+
+ The materialized view's ``name`` field is used to
+ identify the view to update. Format:
+ ``projects/{project}/instances/{instance}/materializedViews/{materialized_view}``.
+
+ This corresponds to the ``materialized_view`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
+ Optional. The list of fields to
+ update.
+
+ This corresponds to the ``update_mask`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.api_core.operation_async.AsyncOperation:
+ An object representing a long-running operation.
+
+ The result type for the operation will be
+ :class:`google.cloud.bigtable_admin_v2.types.MaterializedView`
+ A materialized view object that can be referenced in SQL
+ queries.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [materialized_view, update_mask]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(
+ request, bigtable_instance_admin.UpdateMaterializedViewRequest
+ ):
+ request = bigtable_instance_admin.UpdateMaterializedViewRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if materialized_view is not None:
+ request.materialized_view = materialized_view
+ if update_mask is not None:
+ request.update_mask = update_mask
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.update_materialized_view
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata(
+ (("materialized_view.name", request.materialized_view.name),)
+ ),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Wrap the response in an operation future.
+ response = operation_async.from_gapic(
+ response,
+ self._client._transport.operations_client,
+ instance.MaterializedView,
+ metadata_type=bigtable_instance_admin.UpdateMaterializedViewMetadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def delete_materialized_view(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.DeleteMaterializedViewRequest, dict]
+ ] = None,
+ *,
+ name: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> None:
+ r"""Deletes a materialized view from an instance.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_delete_materialized_view():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.DeleteMaterializedViewRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ await client.delete_materialized_view(request=request)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.DeleteMaterializedViewRequest, dict]]):
+ The request object. Request message for
+ BigtableInstanceAdmin.DeleteMaterializedView.
+ name (:class:`str`):
+ Required. The unique name of the materialized view to be
+ deleted. Format:
+ ``projects/{project}/instances/{instance}/materializedViews/{materialized_view}``.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(
+ request, bigtable_instance_admin.DeleteMaterializedViewRequest
+ ):
+ request = bigtable_instance_admin.DeleteMaterializedViewRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.delete_materialized_view
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ async def __aenter__(self) -> "BigtableInstanceAdminAsyncClient":
+ return self
+
+ async def __aexit__(self, exc_type, exc, tb):
+ await self.transport.close()
+
+
+DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
+ gapic_version=package_version.__version__
+)
+
+if hasattr(DEFAULT_CLIENT_INFO, "protobuf_runtime_version"): # pragma: NO COVER
+ DEFAULT_CLIENT_INFO.protobuf_runtime_version = google.protobuf.__version__
+
+
+__all__ = ("BigtableInstanceAdminAsyncClient",)
diff --git a/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/client.py b/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/client.py
new file mode 100644
index 000000000..9d64108bb
--- /dev/null
+++ b/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/client.py
@@ -0,0 +1,4836 @@
+# -*- coding: utf-8 -*-
+# Copyright 2025 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+from collections import OrderedDict
+from http import HTTPStatus
+import json
+import logging as std_logging
+import os
+import re
+from typing import (
+ Dict,
+ Callable,
+ Mapping,
+ MutableMapping,
+ MutableSequence,
+ Optional,
+ Sequence,
+ Tuple,
+ Type,
+ Union,
+ cast,
+)
+import warnings
+
+from google.cloud.bigtable_admin_v2 import gapic_version as package_version
+
+from google.api_core import client_options as client_options_lib
+from google.api_core import exceptions as core_exceptions
+from google.api_core import gapic_v1
+from google.api_core import retry as retries
+from google.auth import credentials as ga_credentials # type: ignore
+from google.auth.transport import mtls # type: ignore
+from google.auth.transport.grpc import SslCredentials # type: ignore
+from google.auth.exceptions import MutualTLSChannelError # type: ignore
+from google.oauth2 import service_account # type: ignore
+import google.protobuf
+
+try:
+ OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault, None]
+except AttributeError: # pragma: NO COVER
+ OptionalRetry = Union[retries.Retry, object, None] # type: ignore
+
+try:
+ from google.api_core import client_logging # type: ignore
+
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
+except ImportError: # pragma: NO COVER
+ CLIENT_LOGGING_SUPPORTED = False
+
+_LOGGER = std_logging.getLogger(__name__)
+
+from google.api_core import operation # type: ignore
+from google.api_core import operation_async # type: ignore
+from google.cloud.bigtable_admin_v2.services.bigtable_instance_admin import pagers
+from google.cloud.bigtable_admin_v2.types import bigtable_instance_admin
+from google.cloud.bigtable_admin_v2.types import common
+from google.cloud.bigtable_admin_v2.types import instance
+from google.cloud.bigtable_admin_v2.types import instance as gba_instance
+from google.iam.v1 import iam_policy_pb2 # type: ignore
+from google.iam.v1 import policy_pb2 # type: ignore
+from google.protobuf import field_mask_pb2 # type: ignore
+from google.protobuf import timestamp_pb2 # type: ignore
+from .transports.base import BigtableInstanceAdminTransport, DEFAULT_CLIENT_INFO
+from .transports.grpc import BigtableInstanceAdminGrpcTransport
+from .transports.grpc_asyncio import BigtableInstanceAdminGrpcAsyncIOTransport
+from .transports.rest import BigtableInstanceAdminRestTransport
+
+
+class BigtableInstanceAdminClientMeta(type):
+ """Metaclass for the BigtableInstanceAdmin client.
+
+ This provides class-level methods for building and retrieving
+ support objects (e.g. transport) without polluting the client instance
+ objects.
+ """
+
+ _transport_registry = (
+ OrderedDict()
+ ) # type: Dict[str, Type[BigtableInstanceAdminTransport]]
+ _transport_registry["grpc"] = BigtableInstanceAdminGrpcTransport
+ _transport_registry["grpc_asyncio"] = BigtableInstanceAdminGrpcAsyncIOTransport
+ _transport_registry["rest"] = BigtableInstanceAdminRestTransport
+
+ def get_transport_class(
+ cls,
+ label: Optional[str] = None,
+ ) -> Type[BigtableInstanceAdminTransport]:
+ """Returns an appropriate transport class.
+
+ Args:
+ label: The name of the desired transport. If none is
+ provided, then the first transport in the registry is used.
+
+ Returns:
+ The transport class to use.
+ """
+ # If a specific transport is requested, return that one.
+ if label:
+ return cls._transport_registry[label]
+
+ # No transport is requested; return the default (that is, the first one
+ # in the dictionary).
+ return next(iter(cls._transport_registry.values()))
+
+
+class BigtableInstanceAdminClient(metaclass=BigtableInstanceAdminClientMeta):
+ """Service for creating, configuring, and deleting Cloud
+ Bigtable Instances and Clusters. Provides access to the Instance
+ and Cluster schemas only, not the tables' metadata or data
+ stored in those tables.
+ """
+
+ @staticmethod
+ def _get_default_mtls_endpoint(api_endpoint):
+ """Converts api endpoint to mTLS endpoint.
+
+ Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to
+ "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively.
+ Args:
+ api_endpoint (Optional[str]): the api endpoint to convert.
+ Returns:
+ str: converted mTLS api endpoint.
+ """
+ if not api_endpoint:
+ return api_endpoint
+
+ mtls_endpoint_re = re.compile(
+ r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?"
+ )
+
+ m = mtls_endpoint_re.match(api_endpoint)
+ name, mtls, sandbox, googledomain = m.groups()
+ if mtls or not googledomain:
+ return api_endpoint
+
+ if sandbox:
+ return api_endpoint.replace(
+ "sandbox.googleapis.com", "mtls.sandbox.googleapis.com"
+ )
+
+ return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com")
+
+ # Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead.
+ DEFAULT_ENDPOINT = "bigtableadmin.googleapis.com"
+ DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore
+ DEFAULT_ENDPOINT
+ )
+
+ _DEFAULT_ENDPOINT_TEMPLATE = "bigtableadmin.{UNIVERSE_DOMAIN}"
+ _DEFAULT_UNIVERSE = "googleapis.com"
+
+ @staticmethod
+ def _use_client_cert_effective():
+ """Returns whether client certificate should be used for mTLS if the
+ google-auth version supports should_use_client_cert automatic mTLS enablement.
+
+ Alternatively, read from the GOOGLE_API_USE_CLIENT_CERTIFICATE env var.
+
+ Returns:
+ bool: whether client certificate should be used for mTLS
+ Raises:
+ ValueError: (If using a version of google-auth without should_use_client_cert and
+ GOOGLE_API_USE_CLIENT_CERTIFICATE is set to an unexpected value.)
+ """
+ # check if google-auth version supports should_use_client_cert for automatic mTLS enablement
+ if hasattr(mtls, "should_use_client_cert"): # pragma: NO COVER
+ return mtls.should_use_client_cert()
+ else: # pragma: NO COVER
+ # if unsupported, fallback to reading from env var
+ use_client_cert_str = os.getenv(
+ "GOOGLE_API_USE_CLIENT_CERTIFICATE", "false"
+ ).lower()
+ if use_client_cert_str not in ("true", "false"):
+ raise ValueError(
+ "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be"
+ " either `true` or `false`"
+ )
+ return use_client_cert_str == "true"
+
+ @classmethod
+ def from_service_account_info(cls, info: dict, *args, **kwargs):
+ """Creates an instance of this client using the provided credentials
+ info.
+
+ Args:
+ info (dict): The service account private key info.
+ args: Additional arguments to pass to the constructor.
+ kwargs: Additional arguments to pass to the constructor.
+
+ Returns:
+ BigtableInstanceAdminClient: The constructed client.
+ """
+ credentials = service_account.Credentials.from_service_account_info(info)
+ kwargs["credentials"] = credentials
+ return cls(*args, **kwargs)
+
+ @classmethod
+ def from_service_account_file(cls, filename: str, *args, **kwargs):
+ """Creates an instance of this client using the provided credentials
+ file.
+
+ Args:
+ filename (str): The path to the service account private key json
+ file.
+ args: Additional arguments to pass to the constructor.
+ kwargs: Additional arguments to pass to the constructor.
+
+ Returns:
+ BigtableInstanceAdminClient: The constructed client.
+ """
+ credentials = service_account.Credentials.from_service_account_file(filename)
+ kwargs["credentials"] = credentials
+ return cls(*args, **kwargs)
+
+ from_service_account_json = from_service_account_file
+
+ @property
+ def transport(self) -> BigtableInstanceAdminTransport:
+ """Returns the transport used by the client instance.
+
+ Returns:
+ BigtableInstanceAdminTransport: The transport used by the client
+ instance.
+ """
+ return self._transport
+
+ @staticmethod
+ def app_profile_path(
+ project: str,
+ instance: str,
+ app_profile: str,
+ ) -> str:
+ """Returns a fully-qualified app_profile string."""
+ return (
+ "projects/{project}/instances/{instance}/appProfiles/{app_profile}".format(
+ project=project,
+ instance=instance,
+ app_profile=app_profile,
+ )
+ )
+
+ @staticmethod
+ def parse_app_profile_path(path: str) -> Dict[str, str]:
+ """Parses a app_profile path into its component segments."""
+ m = re.match(
+ r"^projects/(?P.+?)/instances/(?P.+?)/appProfiles/(?P.+?)$",
+ path,
+ )
+ return m.groupdict() if m else {}
+
+ @staticmethod
+ def cluster_path(
+ project: str,
+ instance: str,
+ cluster: str,
+ ) -> str:
+ """Returns a fully-qualified cluster string."""
+ return "projects/{project}/instances/{instance}/clusters/{cluster}".format(
+ project=project,
+ instance=instance,
+ cluster=cluster,
+ )
+
+ @staticmethod
+ def parse_cluster_path(path: str) -> Dict[str, str]:
+ """Parses a cluster path into its component segments."""
+ m = re.match(
+ r"^projects/(?P.+?)/instances/(?P.+?)/clusters/(?P.+?)$",
+ path,
+ )
+ return m.groupdict() if m else {}
+
+ @staticmethod
+ def crypto_key_path(
+ project: str,
+ location: str,
+ key_ring: str,
+ crypto_key: str,
+ ) -> str:
+ """Returns a fully-qualified crypto_key string."""
+ return "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}".format(
+ project=project,
+ location=location,
+ key_ring=key_ring,
+ crypto_key=crypto_key,
+ )
+
+ @staticmethod
+ def parse_crypto_key_path(path: str) -> Dict[str, str]:
+ """Parses a crypto_key path into its component segments."""
+ m = re.match(
+ r"^projects/(?P.+?)/locations/(?P.+?)/keyRings/(?P.+?)/cryptoKeys/(?P.+?)$",
+ path,
+ )
+ return m.groupdict() if m else {}
+
+ @staticmethod
+ def hot_tablet_path(
+ project: str,
+ instance: str,
+ cluster: str,
+ hot_tablet: str,
+ ) -> str:
+ """Returns a fully-qualified hot_tablet string."""
+ return "projects/{project}/instances/{instance}/clusters/{cluster}/hotTablets/{hot_tablet}".format(
+ project=project,
+ instance=instance,
+ cluster=cluster,
+ hot_tablet=hot_tablet,
+ )
+
+ @staticmethod
+ def parse_hot_tablet_path(path: str) -> Dict[str, str]:
+ """Parses a hot_tablet path into its component segments."""
+ m = re.match(
+ r"^projects/(?P.+?)/instances/(?P.+?)/clusters/(?P.+?)/hotTablets/(?P.+?)$",
+ path,
+ )
+ return m.groupdict() if m else {}
+
+ @staticmethod
+ def instance_path(
+ project: str,
+ instance: str,
+ ) -> str:
+ """Returns a fully-qualified instance string."""
+ return "projects/{project}/instances/{instance}".format(
+ project=project,
+ instance=instance,
+ )
+
+ @staticmethod
+ def parse_instance_path(path: str) -> Dict[str, str]:
+ """Parses a instance path into its component segments."""
+ m = re.match(r"^projects/(?P.+?)/instances/(?P.+?)$", path)
+ return m.groupdict() if m else {}
+
+ @staticmethod
+ def logical_view_path(
+ project: str,
+ instance: str,
+ logical_view: str,
+ ) -> str:
+ """Returns a fully-qualified logical_view string."""
+ return "projects/{project}/instances/{instance}/logicalViews/{logical_view}".format(
+ project=project,
+ instance=instance,
+ logical_view=logical_view,
+ )
+
+ @staticmethod
+ def parse_logical_view_path(path: str) -> Dict[str, str]:
+ """Parses a logical_view path into its component segments."""
+ m = re.match(
+ r"^projects/(?P.+?)/instances/(?P.+?)/logicalViews/(?P.+?)$",
+ path,
+ )
+ return m.groupdict() if m else {}
+
+ @staticmethod
+ def materialized_view_path(
+ project: str,
+ instance: str,
+ materialized_view: str,
+ ) -> str:
+ """Returns a fully-qualified materialized_view string."""
+ return "projects/{project}/instances/{instance}/materializedViews/{materialized_view}".format(
+ project=project,
+ instance=instance,
+ materialized_view=materialized_view,
+ )
+
+ @staticmethod
+ def parse_materialized_view_path(path: str) -> Dict[str, str]:
+ """Parses a materialized_view path into its component segments."""
+ m = re.match(
+ r"^projects/(?P.+?)/instances/(?P.+?)/materializedViews/(?P.+?)$",
+ path,
+ )
+ return m.groupdict() if m else {}
+
+ @staticmethod
+ def table_path(
+ project: str,
+ instance: str,
+ table: str,
+ ) -> str:
+ """Returns a fully-qualified table string."""
+ return "projects/{project}/instances/{instance}/tables/{table}".format(
+ project=project,
+ instance=instance,
+ table=table,
+ )
+
+ @staticmethod
+ def parse_table_path(path: str) -> Dict[str, str]:
+ """Parses a table path into its component segments."""
+ m = re.match(
+ r"^projects/(?P.+?)/instances/(?P.+?)/tables/(?P.+?)$",
+ path,
+ )
+ return m.groupdict() if m else {}
+
+ @staticmethod
+ def common_billing_account_path(
+ billing_account: str,
+ ) -> str:
+ """Returns a fully-qualified billing_account string."""
+ return "billingAccounts/{billing_account}".format(
+ billing_account=billing_account,
+ )
+
+ @staticmethod
+ def parse_common_billing_account_path(path: str) -> Dict[str, str]:
+ """Parse a billing_account path into its component segments."""
+ m = re.match(r"^billingAccounts/(?P.+?)$", path)
+ return m.groupdict() if m else {}
+
+ @staticmethod
+ def common_folder_path(
+ folder: str,
+ ) -> str:
+ """Returns a fully-qualified folder string."""
+ return "folders/{folder}".format(
+ folder=folder,
+ )
+
+ @staticmethod
+ def parse_common_folder_path(path: str) -> Dict[str, str]:
+ """Parse a folder path into its component segments."""
+ m = re.match(r"^folders/(?P.+?)$", path)
+ return m.groupdict() if m else {}
+
+ @staticmethod
+ def common_organization_path(
+ organization: str,
+ ) -> str:
+ """Returns a fully-qualified organization string."""
+ return "organizations/{organization}".format(
+ organization=organization,
+ )
+
+ @staticmethod
+ def parse_common_organization_path(path: str) -> Dict[str, str]:
+ """Parse a organization path into its component segments."""
+ m = re.match(r"^organizations/(?P.+?)$", path)
+ return m.groupdict() if m else {}
+
+ @staticmethod
+ def common_project_path(
+ project: str,
+ ) -> str:
+ """Returns a fully-qualified project string."""
+ return "projects/{project}".format(
+ project=project,
+ )
+
+ @staticmethod
+ def parse_common_project_path(path: str) -> Dict[str, str]:
+ """Parse a project path into its component segments."""
+ m = re.match(r"^projects/(?P.+?)$", path)
+ return m.groupdict() if m else {}
+
+ @staticmethod
+ def common_location_path(
+ project: str,
+ location: str,
+ ) -> str:
+ """Returns a fully-qualified location string."""
+ return "projects/{project}/locations/{location}".format(
+ project=project,
+ location=location,
+ )
+
+ @staticmethod
+ def parse_common_location_path(path: str) -> Dict[str, str]:
+ """Parse a location path into its component segments."""
+ m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path)
+ return m.groupdict() if m else {}
+
+ @classmethod
+ def get_mtls_endpoint_and_cert_source(
+ cls, client_options: Optional[client_options_lib.ClientOptions] = None
+ ):
+ """Deprecated. Return the API endpoint and client cert source for mutual TLS.
+
+ The client cert source is determined in the following order:
+ (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the
+ client cert source is None.
+ (2) if `client_options.client_cert_source` is provided, use the provided one; if the
+ default client cert source exists, use the default one; otherwise the client cert
+ source is None.
+
+ The API endpoint is determined in the following order:
+ (1) if `client_options.api_endpoint` if provided, use the provided one.
+ (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the
+ default mTLS endpoint; if the environment variable is "never", use the default API
+ endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise
+ use the default API endpoint.
+
+ More details can be found at https://google.aip.dev/auth/4114.
+
+ Args:
+ client_options (google.api_core.client_options.ClientOptions): Custom options for the
+ client. Only the `api_endpoint` and `client_cert_source` properties may be used
+ in this method.
+
+ Returns:
+ Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the
+ client cert source to use.
+
+ Raises:
+ google.auth.exceptions.MutualTLSChannelError: If any errors happen.
+ """
+
+ warnings.warn(
+ "get_mtls_endpoint_and_cert_source is deprecated. Use the api_endpoint property instead.",
+ DeprecationWarning,
+ )
+ if client_options is None:
+ client_options = client_options_lib.ClientOptions()
+ use_client_cert = BigtableInstanceAdminClient._use_client_cert_effective()
+ use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto")
+ if use_mtls_endpoint not in ("auto", "never", "always"):
+ raise MutualTLSChannelError(
+ "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`"
+ )
+
+ # Figure out the client cert source to use.
+ client_cert_source = None
+ if use_client_cert:
+ if client_options.client_cert_source:
+ client_cert_source = client_options.client_cert_source
+ elif mtls.has_default_client_cert_source():
+ client_cert_source = mtls.default_client_cert_source()
+
+ # Figure out which api endpoint to use.
+ if client_options.api_endpoint is not None:
+ api_endpoint = client_options.api_endpoint
+ elif use_mtls_endpoint == "always" or (
+ use_mtls_endpoint == "auto" and client_cert_source
+ ):
+ api_endpoint = cls.DEFAULT_MTLS_ENDPOINT
+ else:
+ api_endpoint = cls.DEFAULT_ENDPOINT
+
+ return api_endpoint, client_cert_source
+
+ @staticmethod
+ def _read_environment_variables():
+ """Returns the environment variables used by the client.
+
+ Returns:
+ Tuple[bool, str, str]: returns the GOOGLE_API_USE_CLIENT_CERTIFICATE,
+ GOOGLE_API_USE_MTLS_ENDPOINT, and GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variables.
+
+ Raises:
+ ValueError: If GOOGLE_API_USE_CLIENT_CERTIFICATE is not
+ any of ["true", "false"].
+ google.auth.exceptions.MutualTLSChannelError: If GOOGLE_API_USE_MTLS_ENDPOINT
+ is not any of ["auto", "never", "always"].
+ """
+ use_client_cert = BigtableInstanceAdminClient._use_client_cert_effective()
+ use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto").lower()
+ universe_domain_env = os.getenv("GOOGLE_CLOUD_UNIVERSE_DOMAIN")
+ if use_mtls_endpoint not in ("auto", "never", "always"):
+ raise MutualTLSChannelError(
+ "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`"
+ )
+ return use_client_cert, use_mtls_endpoint, universe_domain_env
+
+ @staticmethod
+ def _get_client_cert_source(provided_cert_source, use_cert_flag):
+ """Return the client cert source to be used by the client.
+
+ Args:
+ provided_cert_source (bytes): The client certificate source provided.
+ use_cert_flag (bool): A flag indicating whether to use the client certificate.
+
+ Returns:
+ bytes or None: The client cert source to be used by the client.
+ """
+ client_cert_source = None
+ if use_cert_flag:
+ if provided_cert_source:
+ client_cert_source = provided_cert_source
+ elif mtls.has_default_client_cert_source():
+ client_cert_source = mtls.default_client_cert_source()
+ return client_cert_source
+
+ @staticmethod
+ def _get_api_endpoint(
+ api_override, client_cert_source, universe_domain, use_mtls_endpoint
+ ):
+ """Return the API endpoint used by the client.
+
+ Args:
+ api_override (str): The API endpoint override. If specified, this is always
+ the return value of this function and the other arguments are not used.
+ client_cert_source (bytes): The client certificate source used by the client.
+ universe_domain (str): The universe domain used by the client.
+ use_mtls_endpoint (str): How to use the mTLS endpoint, which depends also on the other parameters.
+ Possible values are "always", "auto", or "never".
+
+ Returns:
+ str: The API endpoint to be used by the client.
+ """
+ if api_override is not None:
+ api_endpoint = api_override
+ elif use_mtls_endpoint == "always" or (
+ use_mtls_endpoint == "auto" and client_cert_source
+ ):
+ _default_universe = BigtableInstanceAdminClient._DEFAULT_UNIVERSE
+ if universe_domain != _default_universe:
+ raise MutualTLSChannelError(
+ f"mTLS is not supported in any universe other than {_default_universe}."
+ )
+ api_endpoint = BigtableInstanceAdminClient.DEFAULT_MTLS_ENDPOINT
+ else:
+ api_endpoint = (
+ BigtableInstanceAdminClient._DEFAULT_ENDPOINT_TEMPLATE.format(
+ UNIVERSE_DOMAIN=universe_domain
+ )
+ )
+ return api_endpoint
+
+ @staticmethod
+ def _get_universe_domain(
+ client_universe_domain: Optional[str], universe_domain_env: Optional[str]
+ ) -> str:
+ """Return the universe domain used by the client.
+
+ Args:
+ client_universe_domain (Optional[str]): The universe domain configured via the client options.
+ universe_domain_env (Optional[str]): The universe domain configured via the "GOOGLE_CLOUD_UNIVERSE_DOMAIN" environment variable.
+
+ Returns:
+ str: The universe domain to be used by the client.
+
+ Raises:
+ ValueError: If the universe domain is an empty string.
+ """
+ universe_domain = BigtableInstanceAdminClient._DEFAULT_UNIVERSE
+ if client_universe_domain is not None:
+ universe_domain = client_universe_domain
+ elif universe_domain_env is not None:
+ universe_domain = universe_domain_env
+ if len(universe_domain.strip()) == 0:
+ raise ValueError("Universe Domain cannot be an empty string.")
+ return universe_domain
+
+ def _validate_universe_domain(self):
+ """Validates client's and credentials' universe domains are consistent.
+
+ Returns:
+ bool: True iff the configured universe domain is valid.
+
+ Raises:
+ ValueError: If the configured universe domain is not valid.
+ """
+
+ # NOTE (b/349488459): universe validation is disabled until further notice.
+ return True
+
+ def _add_cred_info_for_auth_errors(
+ self, error: core_exceptions.GoogleAPICallError
+ ) -> None:
+ """Adds credential info string to error details for 401/403/404 errors.
+
+ Args:
+ error (google.api_core.exceptions.GoogleAPICallError): The error to add the cred info.
+ """
+ if error.code not in [
+ HTTPStatus.UNAUTHORIZED,
+ HTTPStatus.FORBIDDEN,
+ HTTPStatus.NOT_FOUND,
+ ]:
+ return
+
+ cred = self._transport._credentials
+
+ # get_cred_info is only available in google-auth>=2.35.0
+ if not hasattr(cred, "get_cred_info"):
+ return
+
+ # ignore the type check since pypy test fails when get_cred_info
+ # is not available
+ cred_info = cred.get_cred_info() # type: ignore
+ if cred_info and hasattr(error._details, "append"):
+ error._details.append(json.dumps(cred_info))
+
+ @property
+ def api_endpoint(self):
+ """Return the API endpoint used by the client instance.
+
+ Returns:
+ str: The API endpoint used by the client instance.
+ """
+ return self._api_endpoint
+
+ @property
+ def universe_domain(self) -> str:
+ """Return the universe domain used by the client instance.
+
+ Returns:
+ str: The universe domain used by the client instance.
+ """
+ return self._universe_domain
+
+ def __init__(
+ self,
+ *,
+ credentials: Optional[ga_credentials.Credentials] = None,
+ transport: Optional[
+ Union[
+ str,
+ BigtableInstanceAdminTransport,
+ Callable[..., BigtableInstanceAdminTransport],
+ ]
+ ] = None,
+ client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None,
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
+ ) -> None:
+ """Instantiates the bigtable instance admin client.
+
+ Args:
+ credentials (Optional[google.auth.credentials.Credentials]): The
+ authorization credentials to attach to requests. These
+ credentials identify the application to the service; if none
+ are specified, the client will attempt to ascertain the
+ credentials from the environment.
+ transport (Optional[Union[str,BigtableInstanceAdminTransport,Callable[..., BigtableInstanceAdminTransport]]]):
+ The transport to use, or a Callable that constructs and returns a new transport.
+ If a Callable is given, it will be called with the same set of initialization
+ arguments as used in the BigtableInstanceAdminTransport constructor.
+ If set to None, a transport is chosen automatically.
+ client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]):
+ Custom options for the client.
+
+ 1. The ``api_endpoint`` property can be used to override the
+ default endpoint provided by the client when ``transport`` is
+ not explicitly provided. Only if this property is not set and
+ ``transport`` was not explicitly provided, the endpoint is
+ determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment
+ variable, which have one of the following values:
+ "always" (always use the default mTLS endpoint), "never" (always
+ use the default regular endpoint) and "auto" (auto-switch to the
+ default mTLS endpoint if client certificate is present; this is
+ the default value).
+
+ 2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable
+ is "true", then the ``client_cert_source`` property can be used
+ to provide a client certificate for mTLS transport. If
+ not provided, the default SSL client certificate will be used if
+ present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not
+ set, no client certificate will be used.
+
+ 3. The ``universe_domain`` property can be used to override the
+ default "googleapis.com" universe. Note that the ``api_endpoint``
+ property still takes precedence; and ``universe_domain`` is
+ currently not supported for mTLS.
+
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
+ The client info used to send a user-agent string along with
+ API requests. If ``None``, then default info will be used.
+ Generally, you only need to set this if you're developing
+ your own client library.
+
+ Raises:
+ google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport
+ creation failed for any reason.
+ """
+ self._client_options = client_options
+ if isinstance(self._client_options, dict):
+ self._client_options = client_options_lib.from_dict(self._client_options)
+ if self._client_options is None:
+ self._client_options = client_options_lib.ClientOptions()
+ self._client_options = cast(
+ client_options_lib.ClientOptions, self._client_options
+ )
+
+ universe_domain_opt = getattr(self._client_options, "universe_domain", None)
+
+ (
+ self._use_client_cert,
+ self._use_mtls_endpoint,
+ self._universe_domain_env,
+ ) = BigtableInstanceAdminClient._read_environment_variables()
+ self._client_cert_source = BigtableInstanceAdminClient._get_client_cert_source(
+ self._client_options.client_cert_source, self._use_client_cert
+ )
+ self._universe_domain = BigtableInstanceAdminClient._get_universe_domain(
+ universe_domain_opt, self._universe_domain_env
+ )
+ self._api_endpoint = None # updated below, depending on `transport`
+
+ # Initialize the universe domain validation.
+ self._is_universe_domain_valid = False
+
+ if CLIENT_LOGGING_SUPPORTED: # pragma: NO COVER
+ # Setup logging.
+ client_logging.initialize_logging()
+
+ api_key_value = getattr(self._client_options, "api_key", None)
+ if api_key_value and credentials:
+ raise ValueError(
+ "client_options.api_key and credentials are mutually exclusive"
+ )
+
+ # Save or instantiate the transport.
+ # Ordinarily, we provide the transport, but allowing a custom transport
+ # instance provides an extensibility point for unusual situations.
+ transport_provided = isinstance(transport, BigtableInstanceAdminTransport)
+ if transport_provided:
+ # transport is a BigtableInstanceAdminTransport instance.
+ if credentials or self._client_options.credentials_file or api_key_value:
+ raise ValueError(
+ "When providing a transport instance, "
+ "provide its credentials directly."
+ )
+ if self._client_options.scopes:
+ raise ValueError(
+ "When providing a transport instance, provide its scopes "
+ "directly."
+ )
+ self._transport = cast(BigtableInstanceAdminTransport, transport)
+ self._api_endpoint = self._transport.host
+
+ self._api_endpoint = (
+ self._api_endpoint
+ or BigtableInstanceAdminClient._get_api_endpoint(
+ self._client_options.api_endpoint,
+ self._client_cert_source,
+ self._universe_domain,
+ self._use_mtls_endpoint,
+ )
+ )
+
+ if not transport_provided:
+ import google.auth._default # type: ignore
+
+ if api_key_value and hasattr(
+ google.auth._default, "get_api_key_credentials"
+ ):
+ credentials = google.auth._default.get_api_key_credentials(
+ api_key_value
+ )
+
+ transport_init: Union[
+ Type[BigtableInstanceAdminTransport],
+ Callable[..., BigtableInstanceAdminTransport],
+ ] = (
+ BigtableInstanceAdminClient.get_transport_class(transport)
+ if isinstance(transport, str) or transport is None
+ else cast(Callable[..., BigtableInstanceAdminTransport], transport)
+ )
+ # initialize with the provided callable or the passed in class
+ self._transport = transport_init(
+ credentials=credentials,
+ credentials_file=self._client_options.credentials_file,
+ host=self._api_endpoint,
+ scopes=self._client_options.scopes,
+ client_cert_source_for_mtls=self._client_cert_source,
+ quota_project_id=self._client_options.quota_project_id,
+ client_info=client_info,
+ always_use_jwt_access=True,
+ api_audience=self._client_options.api_audience,
+ )
+
+ if "async" not in str(self._transport):
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ std_logging.DEBUG
+ ): # pragma: NO COVER
+ _LOGGER.debug(
+ "Created client `google.bigtable.admin_v2.BigtableInstanceAdminClient`.",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "universeDomain": getattr(
+ self._transport._credentials, "universe_domain", ""
+ ),
+ "credentialsType": f"{type(self._transport._credentials).__module__}.{type(self._transport._credentials).__qualname__}",
+ "credentialsInfo": getattr(
+ self.transport._credentials, "get_cred_info", lambda: None
+ )(),
+ }
+ if hasattr(self._transport, "_credentials")
+ else {
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "credentialsType": None,
+ },
+ )
+
+ def create_instance(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.CreateInstanceRequest, dict]
+ ] = None,
+ *,
+ parent: Optional[str] = None,
+ instance_id: Optional[str] = None,
+ instance: Optional[gba_instance.Instance] = None,
+ clusters: Optional[MutableMapping[str, gba_instance.Cluster]] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operation.Operation:
+ r"""Create an instance within a project.
+
+ Note that exactly one of Cluster.serve_nodes and
+ Cluster.cluster_config.cluster_autoscaling_config can be set. If
+ serve_nodes is set to non-zero, then the cluster is manually
+ scaled. If cluster_config.cluster_autoscaling_config is
+ non-empty, then autoscaling is enabled.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_create_instance():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminClient()
+
+ # Initialize request argument(s)
+ instance = bigtable_admin_v2.Instance()
+ instance.display_name = "display_name_value"
+
+ request = bigtable_admin_v2.CreateInstanceRequest(
+ parent="parent_value",
+ instance_id="instance_id_value",
+ instance=instance,
+ )
+
+ # Make the request
+ operation = client.create_instance(request=request)
+
+ print("Waiting for operation to complete...")
+
+ response = operation.result()
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.CreateInstanceRequest, dict]):
+ The request object. Request message for
+ BigtableInstanceAdmin.CreateInstance.
+ parent (str):
+ Required. The unique name of the project in which to
+ create the new instance. Values are of the form
+ ``projects/{project}``.
+
+ This corresponds to the ``parent`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ instance_id (str):
+ Required. The ID to be used when referring to the new
+ instance within its project, e.g., just ``myinstance``
+ rather than ``projects/myproject/instances/myinstance``.
+
+ This corresponds to the ``instance_id`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ instance (google.cloud.bigtable_admin_v2.types.Instance):
+ Required. The instance to create. Fields marked
+ ``OutputOnly`` must be left blank.
+
+ This corresponds to the ``instance`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ clusters (MutableMapping[str, google.cloud.bigtable_admin_v2.types.Cluster]):
+ Required. The clusters to be created within the
+ instance, mapped by desired cluster ID, e.g., just
+ ``mycluster`` rather than
+ ``projects/myproject/instances/myinstance/clusters/mycluster``.
+ Fields marked ``OutputOnly`` must be left blank.
+
+ This corresponds to the ``clusters`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.api_core.operation.Operation:
+ An object representing a long-running operation.
+
+ The result type for the operation will be :class:`google.cloud.bigtable_admin_v2.types.Instance` A collection of Bigtable [Tables][google.bigtable.admin.v2.Table] and
+ the resources that serve them. All tables in an
+ instance are served from all
+ [Clusters][google.bigtable.admin.v2.Cluster] in the
+ instance.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [parent, instance_id, instance, clusters]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_instance_admin.CreateInstanceRequest):
+ request = bigtable_instance_admin.CreateInstanceRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if parent is not None:
+ request.parent = parent
+ if instance_id is not None:
+ request.instance_id = instance_id
+ if instance is not None:
+ request.instance = instance
+ if clusters is not None:
+ request.clusters = clusters
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.create_instance]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Wrap the response in an operation future.
+ response = operation.from_gapic(
+ response,
+ self._transport.operations_client,
+ gba_instance.Instance,
+ metadata_type=bigtable_instance_admin.CreateInstanceMetadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def get_instance(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.GetInstanceRequest, dict]
+ ] = None,
+ *,
+ name: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> instance.Instance:
+ r"""Gets information about an instance.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_get_instance():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.GetInstanceRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = client.get_instance(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.GetInstanceRequest, dict]):
+ The request object. Request message for
+ BigtableInstanceAdmin.GetInstance.
+ name (str):
+ Required. The unique name of the requested instance.
+ Values are of the form
+ ``projects/{project}/instances/{instance}``.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.types.Instance:
+ A collection of Bigtable [Tables][google.bigtable.admin.v2.Table] and
+ the resources that serve them. All tables in an
+ instance are served from all
+ [Clusters][google.bigtable.admin.v2.Cluster] in the
+ instance.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_instance_admin.GetInstanceRequest):
+ request = bigtable_instance_admin.GetInstanceRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.get_instance]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def list_instances(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.ListInstancesRequest, dict]
+ ] = None,
+ *,
+ parent: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> bigtable_instance_admin.ListInstancesResponse:
+ r"""Lists information about instances in a project.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_list_instances():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.ListInstancesRequest(
+ parent="parent_value",
+ )
+
+ # Make the request
+ response = client.list_instances(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.ListInstancesRequest, dict]):
+ The request object. Request message for
+ BigtableInstanceAdmin.ListInstances.
+ parent (str):
+ Required. The unique name of the project for which a
+ list of instances is requested. Values are of the form
+ ``projects/{project}``.
+
+ This corresponds to the ``parent`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.types.ListInstancesResponse:
+ Response message for
+ BigtableInstanceAdmin.ListInstances.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [parent]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_instance_admin.ListInstancesRequest):
+ request = bigtable_instance_admin.ListInstancesRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if parent is not None:
+ request.parent = parent
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.list_instances]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def update_instance(
+ self,
+ request: Optional[Union[instance.Instance, dict]] = None,
+ *,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> instance.Instance:
+ r"""Updates an instance within a project. This method
+ updates only the display name and type for an Instance.
+ To update other Instance properties, such as labels, use
+ PartialUpdateInstance.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_update_instance():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.Instance(
+ display_name="display_name_value",
+ )
+
+ # Make the request
+ response = client.update_instance(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.Instance, dict]):
+ The request object. A collection of Bigtable
+ [Tables][google.bigtable.admin.v2.Table] and the
+ resources that serve them. All tables in an instance are
+ served from all
+ [Clusters][google.bigtable.admin.v2.Cluster] in the
+ instance.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.types.Instance:
+ A collection of Bigtable [Tables][google.bigtable.admin.v2.Table] and
+ the resources that serve them. All tables in an
+ instance are served from all
+ [Clusters][google.bigtable.admin.v2.Cluster] in the
+ instance.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, instance.Instance):
+ request = instance.Instance(request)
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.update_instance]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def partial_update_instance(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.PartialUpdateInstanceRequest, dict]
+ ] = None,
+ *,
+ instance: Optional[gba_instance.Instance] = None,
+ update_mask: Optional[field_mask_pb2.FieldMask] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operation.Operation:
+ r"""Partially updates an instance within a project. This
+ method can modify all fields of an Instance and is the
+ preferred way to update an Instance.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_partial_update_instance():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminClient()
+
+ # Initialize request argument(s)
+ instance = bigtable_admin_v2.Instance()
+ instance.display_name = "display_name_value"
+
+ request = bigtable_admin_v2.PartialUpdateInstanceRequest(
+ instance=instance,
+ )
+
+ # Make the request
+ operation = client.partial_update_instance(request=request)
+
+ print("Waiting for operation to complete...")
+
+ response = operation.result()
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.PartialUpdateInstanceRequest, dict]):
+ The request object. Request message for
+ BigtableInstanceAdmin.PartialUpdateInstance.
+ instance (google.cloud.bigtable_admin_v2.types.Instance):
+ Required. The Instance which will
+ (partially) replace the current value.
+
+ This corresponds to the ``instance`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ update_mask (google.protobuf.field_mask_pb2.FieldMask):
+ Required. The subset of Instance
+ fields which should be replaced. Must be
+ explicitly set.
+
+ This corresponds to the ``update_mask`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.api_core.operation.Operation:
+ An object representing a long-running operation.
+
+ The result type for the operation will be :class:`google.cloud.bigtable_admin_v2.types.Instance` A collection of Bigtable [Tables][google.bigtable.admin.v2.Table] and
+ the resources that serve them. All tables in an
+ instance are served from all
+ [Clusters][google.bigtable.admin.v2.Cluster] in the
+ instance.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [instance, update_mask]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(
+ request, bigtable_instance_admin.PartialUpdateInstanceRequest
+ ):
+ request = bigtable_instance_admin.PartialUpdateInstanceRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if instance is not None:
+ request.instance = instance
+ if update_mask is not None:
+ request.update_mask = update_mask
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.partial_update_instance]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata(
+ (("instance.name", request.instance.name),)
+ ),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Wrap the response in an operation future.
+ response = operation.from_gapic(
+ response,
+ self._transport.operations_client,
+ gba_instance.Instance,
+ metadata_type=bigtable_instance_admin.UpdateInstanceMetadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def delete_instance(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.DeleteInstanceRequest, dict]
+ ] = None,
+ *,
+ name: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> None:
+ r"""Delete an instance from a project.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_delete_instance():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.DeleteInstanceRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ client.delete_instance(request=request)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.DeleteInstanceRequest, dict]):
+ The request object. Request message for
+ BigtableInstanceAdmin.DeleteInstance.
+ name (str):
+ Required. The unique name of the instance to be deleted.
+ Values are of the form
+ ``projects/{project}/instances/{instance}``.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_instance_admin.DeleteInstanceRequest):
+ request = bigtable_instance_admin.DeleteInstanceRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.delete_instance]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ def create_cluster(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.CreateClusterRequest, dict]
+ ] = None,
+ *,
+ parent: Optional[str] = None,
+ cluster_id: Optional[str] = None,
+ cluster: Optional[instance.Cluster] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operation.Operation:
+ r"""Creates a cluster within an instance.
+
+ Note that exactly one of Cluster.serve_nodes and
+ Cluster.cluster_config.cluster_autoscaling_config can be set. If
+ serve_nodes is set to non-zero, then the cluster is manually
+ scaled. If cluster_config.cluster_autoscaling_config is
+ non-empty, then autoscaling is enabled.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_create_cluster():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.CreateClusterRequest(
+ parent="parent_value",
+ cluster_id="cluster_id_value",
+ )
+
+ # Make the request
+ operation = client.create_cluster(request=request)
+
+ print("Waiting for operation to complete...")
+
+ response = operation.result()
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.CreateClusterRequest, dict]):
+ The request object. Request message for
+ BigtableInstanceAdmin.CreateCluster.
+ parent (str):
+ Required. The unique name of the instance in which to
+ create the new cluster. Values are of the form
+ ``projects/{project}/instances/{instance}``.
+
+ This corresponds to the ``parent`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ cluster_id (str):
+ Required. The ID to be used when referring to the new
+ cluster within its instance, e.g., just ``mycluster``
+ rather than
+ ``projects/myproject/instances/myinstance/clusters/mycluster``.
+
+ This corresponds to the ``cluster_id`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ cluster (google.cloud.bigtable_admin_v2.types.Cluster):
+ Required. The cluster to be created. Fields marked
+ ``OutputOnly`` must be left blank.
+
+ This corresponds to the ``cluster`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.api_core.operation.Operation:
+ An object representing a long-running operation.
+
+ The result type for the operation will be :class:`google.cloud.bigtable_admin_v2.types.Cluster` A resizable group of nodes in a particular cloud location, capable
+ of serving all
+ [Tables][google.bigtable.admin.v2.Table] in the
+ parent [Instance][google.bigtable.admin.v2.Instance].
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [parent, cluster_id, cluster]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_instance_admin.CreateClusterRequest):
+ request = bigtable_instance_admin.CreateClusterRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if parent is not None:
+ request.parent = parent
+ if cluster_id is not None:
+ request.cluster_id = cluster_id
+ if cluster is not None:
+ request.cluster = cluster
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.create_cluster]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Wrap the response in an operation future.
+ response = operation.from_gapic(
+ response,
+ self._transport.operations_client,
+ instance.Cluster,
+ metadata_type=bigtable_instance_admin.CreateClusterMetadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def get_cluster(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.GetClusterRequest, dict]
+ ] = None,
+ *,
+ name: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> instance.Cluster:
+ r"""Gets information about a cluster.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_get_cluster():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.GetClusterRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = client.get_cluster(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.GetClusterRequest, dict]):
+ The request object. Request message for
+ BigtableInstanceAdmin.GetCluster.
+ name (str):
+ Required. The unique name of the requested cluster.
+ Values are of the form
+ ``projects/{project}/instances/{instance}/clusters/{cluster}``.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.types.Cluster:
+ A resizable group of nodes in a particular cloud location, capable
+ of serving all
+ [Tables][google.bigtable.admin.v2.Table] in the
+ parent [Instance][google.bigtable.admin.v2.Instance].
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_instance_admin.GetClusterRequest):
+ request = bigtable_instance_admin.GetClusterRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.get_cluster]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def list_clusters(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.ListClustersRequest, dict]
+ ] = None,
+ *,
+ parent: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> bigtable_instance_admin.ListClustersResponse:
+ r"""Lists information about clusters in an instance.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_list_clusters():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.ListClustersRequest(
+ parent="parent_value",
+ )
+
+ # Make the request
+ response = client.list_clusters(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.ListClustersRequest, dict]):
+ The request object. Request message for
+ BigtableInstanceAdmin.ListClusters.
+ parent (str):
+ Required. The unique name of the instance for which a
+ list of clusters is requested. Values are of the form
+ ``projects/{project}/instances/{instance}``. Use
+ ``{instance} = '-'`` to list Clusters for all Instances
+ in a project, e.g., ``projects/myproject/instances/-``.
+
+ This corresponds to the ``parent`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.types.ListClustersResponse:
+ Response message for
+ BigtableInstanceAdmin.ListClusters.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [parent]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_instance_admin.ListClustersRequest):
+ request = bigtable_instance_admin.ListClustersRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if parent is not None:
+ request.parent = parent
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.list_clusters]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def update_cluster(
+ self,
+ request: Optional[Union[instance.Cluster, dict]] = None,
+ *,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operation.Operation:
+ r"""Updates a cluster within an instance.
+
+ Note that UpdateCluster does not support updating
+ cluster_config.cluster_autoscaling_config. In order to update
+ it, you must use PartialUpdateCluster.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_update_cluster():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.Cluster(
+ )
+
+ # Make the request
+ operation = client.update_cluster(request=request)
+
+ print("Waiting for operation to complete...")
+
+ response = operation.result()
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.Cluster, dict]):
+ The request object. A resizable group of nodes in a particular cloud
+ location, capable of serving all
+ [Tables][google.bigtable.admin.v2.Table] in the parent
+ [Instance][google.bigtable.admin.v2.Instance].
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.api_core.operation.Operation:
+ An object representing a long-running operation.
+
+ The result type for the operation will be :class:`google.cloud.bigtable_admin_v2.types.Cluster` A resizable group of nodes in a particular cloud location, capable
+ of serving all
+ [Tables][google.bigtable.admin.v2.Table] in the
+ parent [Instance][google.bigtable.admin.v2.Instance].
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, instance.Cluster):
+ request = instance.Cluster(request)
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.update_cluster]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Wrap the response in an operation future.
+ response = operation.from_gapic(
+ response,
+ self._transport.operations_client,
+ instance.Cluster,
+ metadata_type=bigtable_instance_admin.UpdateClusterMetadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def partial_update_cluster(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.PartialUpdateClusterRequest, dict]
+ ] = None,
+ *,
+ cluster: Optional[instance.Cluster] = None,
+ update_mask: Optional[field_mask_pb2.FieldMask] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operation.Operation:
+ r"""Partially updates a cluster within a project. This method is the
+ preferred way to update a Cluster.
+
+ To enable and update autoscaling, set
+ cluster_config.cluster_autoscaling_config. When autoscaling is
+ enabled, serve_nodes is treated as an OUTPUT_ONLY field, meaning
+ that updates to it are ignored. Note that an update cannot
+ simultaneously set serve_nodes to non-zero and
+ cluster_config.cluster_autoscaling_config to non-empty, and also
+ specify both in the update_mask.
+
+ To disable autoscaling, clear
+ cluster_config.cluster_autoscaling_config, and explicitly set a
+ serve_node count via the update_mask.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_partial_update_cluster():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.PartialUpdateClusterRequest(
+ )
+
+ # Make the request
+ operation = client.partial_update_cluster(request=request)
+
+ print("Waiting for operation to complete...")
+
+ response = operation.result()
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.PartialUpdateClusterRequest, dict]):
+ The request object. Request message for
+ BigtableInstanceAdmin.PartialUpdateCluster.
+ cluster (google.cloud.bigtable_admin_v2.types.Cluster):
+ Required. The Cluster which contains the partial updates
+ to be applied, subject to the update_mask.
+
+ This corresponds to the ``cluster`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ update_mask (google.protobuf.field_mask_pb2.FieldMask):
+ Required. The subset of Cluster
+ fields which should be replaced.
+
+ This corresponds to the ``update_mask`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.api_core.operation.Operation:
+ An object representing a long-running operation.
+
+ The result type for the operation will be :class:`google.cloud.bigtable_admin_v2.types.Cluster` A resizable group of nodes in a particular cloud location, capable
+ of serving all
+ [Tables][google.bigtable.admin.v2.Table] in the
+ parent [Instance][google.bigtable.admin.v2.Instance].
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [cluster, update_mask]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_instance_admin.PartialUpdateClusterRequest):
+ request = bigtable_instance_admin.PartialUpdateClusterRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if cluster is not None:
+ request.cluster = cluster
+ if update_mask is not None:
+ request.update_mask = update_mask
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.partial_update_cluster]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata(
+ (("cluster.name", request.cluster.name),)
+ ),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Wrap the response in an operation future.
+ response = operation.from_gapic(
+ response,
+ self._transport.operations_client,
+ instance.Cluster,
+ metadata_type=bigtable_instance_admin.PartialUpdateClusterMetadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def delete_cluster(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.DeleteClusterRequest, dict]
+ ] = None,
+ *,
+ name: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> None:
+ r"""Deletes a cluster from an instance.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_delete_cluster():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.DeleteClusterRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ client.delete_cluster(request=request)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.DeleteClusterRequest, dict]):
+ The request object. Request message for
+ BigtableInstanceAdmin.DeleteCluster.
+ name (str):
+ Required. The unique name of the cluster to be deleted.
+ Values are of the form
+ ``projects/{project}/instances/{instance}/clusters/{cluster}``.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_instance_admin.DeleteClusterRequest):
+ request = bigtable_instance_admin.DeleteClusterRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.delete_cluster]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ def create_app_profile(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.CreateAppProfileRequest, dict]
+ ] = None,
+ *,
+ parent: Optional[str] = None,
+ app_profile_id: Optional[str] = None,
+ app_profile: Optional[instance.AppProfile] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> instance.AppProfile:
+ r"""Creates an app profile within an instance.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_create_app_profile():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminClient()
+
+ # Initialize request argument(s)
+ app_profile = bigtable_admin_v2.AppProfile()
+ app_profile.priority = "PRIORITY_HIGH"
+
+ request = bigtable_admin_v2.CreateAppProfileRequest(
+ parent="parent_value",
+ app_profile_id="app_profile_id_value",
+ app_profile=app_profile,
+ )
+
+ # Make the request
+ response = client.create_app_profile(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.CreateAppProfileRequest, dict]):
+ The request object. Request message for
+ BigtableInstanceAdmin.CreateAppProfile.
+ parent (str):
+ Required. The unique name of the instance in which to
+ create the new app profile. Values are of the form
+ ``projects/{project}/instances/{instance}``.
+
+ This corresponds to the ``parent`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ app_profile_id (str):
+ Required. The ID to be used when referring to the new
+ app profile within its instance, e.g., just
+ ``myprofile`` rather than
+ ``projects/myproject/instances/myinstance/appProfiles/myprofile``.
+
+ This corresponds to the ``app_profile_id`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ app_profile (google.cloud.bigtable_admin_v2.types.AppProfile):
+ Required. The app profile to be created. Fields marked
+ ``OutputOnly`` will be ignored.
+
+ This corresponds to the ``app_profile`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.types.AppProfile:
+ A configuration object describing how
+ Cloud Bigtable should treat traffic from
+ a particular end user application.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [parent, app_profile_id, app_profile]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_instance_admin.CreateAppProfileRequest):
+ request = bigtable_instance_admin.CreateAppProfileRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if parent is not None:
+ request.parent = parent
+ if app_profile_id is not None:
+ request.app_profile_id = app_profile_id
+ if app_profile is not None:
+ request.app_profile = app_profile
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.create_app_profile]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def get_app_profile(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.GetAppProfileRequest, dict]
+ ] = None,
+ *,
+ name: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> instance.AppProfile:
+ r"""Gets information about an app profile.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_get_app_profile():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.GetAppProfileRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = client.get_app_profile(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.GetAppProfileRequest, dict]):
+ The request object. Request message for
+ BigtableInstanceAdmin.GetAppProfile.
+ name (str):
+ Required. The unique name of the requested app profile.
+ Values are of the form
+ ``projects/{project}/instances/{instance}/appProfiles/{app_profile}``.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.types.AppProfile:
+ A configuration object describing how
+ Cloud Bigtable should treat traffic from
+ a particular end user application.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_instance_admin.GetAppProfileRequest):
+ request = bigtable_instance_admin.GetAppProfileRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.get_app_profile]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def list_app_profiles(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.ListAppProfilesRequest, dict]
+ ] = None,
+ *,
+ parent: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> pagers.ListAppProfilesPager:
+ r"""Lists information about app profiles in an instance.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_list_app_profiles():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.ListAppProfilesRequest(
+ parent="parent_value",
+ )
+
+ # Make the request
+ page_result = client.list_app_profiles(request=request)
+
+ # Handle the response
+ for response in page_result:
+ print(response)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.ListAppProfilesRequest, dict]):
+ The request object. Request message for
+ BigtableInstanceAdmin.ListAppProfiles.
+ parent (str):
+ Required. The unique name of the instance for which a
+ list of app profiles is requested. Values are of the
+ form ``projects/{project}/instances/{instance}``. Use
+ ``{instance} = '-'`` to list AppProfiles for all
+ Instances in a project, e.g.,
+ ``projects/myproject/instances/-``.
+
+ This corresponds to the ``parent`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.services.bigtable_instance_admin.pagers.ListAppProfilesPager:
+ Response message for
+ BigtableInstanceAdmin.ListAppProfiles.
+ Iterating over this object will yield
+ results and resolve additional pages
+ automatically.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [parent]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_instance_admin.ListAppProfilesRequest):
+ request = bigtable_instance_admin.ListAppProfilesRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if parent is not None:
+ request.parent = parent
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.list_app_profiles]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # This method is paged; wrap the response in a pager, which provides
+ # an `__iter__` convenience method.
+ response = pagers.ListAppProfilesPager(
+ method=rpc,
+ request=request,
+ response=response,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def update_app_profile(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.UpdateAppProfileRequest, dict]
+ ] = None,
+ *,
+ app_profile: Optional[instance.AppProfile] = None,
+ update_mask: Optional[field_mask_pb2.FieldMask] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operation.Operation:
+ r"""Updates an app profile within an instance.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_update_app_profile():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminClient()
+
+ # Initialize request argument(s)
+ app_profile = bigtable_admin_v2.AppProfile()
+ app_profile.priority = "PRIORITY_HIGH"
+
+ request = bigtable_admin_v2.UpdateAppProfileRequest(
+ app_profile=app_profile,
+ )
+
+ # Make the request
+ operation = client.update_app_profile(request=request)
+
+ print("Waiting for operation to complete...")
+
+ response = operation.result()
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.UpdateAppProfileRequest, dict]):
+ The request object. Request message for
+ BigtableInstanceAdmin.UpdateAppProfile.
+ app_profile (google.cloud.bigtable_admin_v2.types.AppProfile):
+ Required. The app profile which will
+ (partially) replace the current value.
+
+ This corresponds to the ``app_profile`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ update_mask (google.protobuf.field_mask_pb2.FieldMask):
+ Required. The subset of app profile
+ fields which should be replaced. If
+ unset, all fields will be replaced.
+
+ This corresponds to the ``update_mask`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.api_core.operation.Operation:
+ An object representing a long-running operation.
+
+ The result type for the operation will be :class:`google.cloud.bigtable_admin_v2.types.AppProfile` A configuration object describing how Cloud Bigtable should treat traffic
+ from a particular end user application.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [app_profile, update_mask]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_instance_admin.UpdateAppProfileRequest):
+ request = bigtable_instance_admin.UpdateAppProfileRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if app_profile is not None:
+ request.app_profile = app_profile
+ if update_mask is not None:
+ request.update_mask = update_mask
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.update_app_profile]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata(
+ (("app_profile.name", request.app_profile.name),)
+ ),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Wrap the response in an operation future.
+ response = operation.from_gapic(
+ response,
+ self._transport.operations_client,
+ instance.AppProfile,
+ metadata_type=bigtable_instance_admin.UpdateAppProfileMetadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def delete_app_profile(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.DeleteAppProfileRequest, dict]
+ ] = None,
+ *,
+ name: Optional[str] = None,
+ ignore_warnings: Optional[bool] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> None:
+ r"""Deletes an app profile from an instance.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_delete_app_profile():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.DeleteAppProfileRequest(
+ name="name_value",
+ ignore_warnings=True,
+ )
+
+ # Make the request
+ client.delete_app_profile(request=request)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.DeleteAppProfileRequest, dict]):
+ The request object. Request message for
+ BigtableInstanceAdmin.DeleteAppProfile.
+ name (str):
+ Required. The unique name of the app profile to be
+ deleted. Values are of the form
+ ``projects/{project}/instances/{instance}/appProfiles/{app_profile}``.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ ignore_warnings (bool):
+ Required. If true, ignore safety
+ checks when deleting the app profile.
+
+ This corresponds to the ``ignore_warnings`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name, ignore_warnings]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_instance_admin.DeleteAppProfileRequest):
+ request = bigtable_instance_admin.DeleteAppProfileRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+ if ignore_warnings is not None:
+ request.ignore_warnings = ignore_warnings
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.delete_app_profile]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ def get_iam_policy(
+ self,
+ request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None,
+ *,
+ resource: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> policy_pb2.Policy:
+ r"""Gets the access control policy for an instance
+ resource. Returns an empty policy if an instance exists
+ but does not have a policy set.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+ from google.iam.v1 import iam_policy_pb2 # type: ignore
+
+ def sample_get_iam_policy():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminClient()
+
+ # Initialize request argument(s)
+ request = iam_policy_pb2.GetIamPolicyRequest(
+ resource="resource_value",
+ )
+
+ # Make the request
+ response = client.get_iam_policy(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Union[google.iam.v1.iam_policy_pb2.GetIamPolicyRequest, dict]):
+ The request object. Request message for ``GetIamPolicy`` method.
+ resource (str):
+ REQUIRED: The resource for which the
+ policy is being requested. See the
+ operation documentation for the
+ appropriate value for this field.
+
+ This corresponds to the ``resource`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.iam.v1.policy_pb2.Policy:
+ An Identity and Access Management (IAM) policy, which specifies access
+ controls for Google Cloud resources.
+
+ A Policy is a collection of bindings. A binding binds
+ one or more members, or principals, to a single role.
+ Principals can be user accounts, service accounts,
+ Google groups, and domains (such as G Suite). A role
+ is a named list of permissions; each role can be an
+ IAM predefined role or a user-created custom role.
+
+ For some types of Google Cloud resources, a binding
+ can also specify a condition, which is a logical
+ expression that allows access to a resource only if
+ the expression evaluates to true. A condition can add
+ constraints based on attributes of the request, the
+ resource, or both. To learn which resources support
+ conditions in their IAM policies, see the [IAM
+ documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
+
+ **JSON example:**
+
+ :literal:`` { "bindings": [ { "role": "roles/resourcemanager.organizationAdmin", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-project-id@appspot.gserviceaccount.com" ] }, { "role": "roles/resourcemanager.organizationViewer", "members": [ "user:eve@example.com" ], "condition": { "title": "expirable access", "description": "Does not grant access after Sep 2020", "expression": "request.time < timestamp('2020-10-01T00:00:00.000Z')", } } ], "etag": "BwWWja0YfJA=", "version": 3 }`\ \`
+
+ **YAML example:**
+
+ :literal:`` bindings: - members: - user:mike@example.com - group:admins@example.com - domain:google.com - serviceAccount:my-project-id@appspot.gserviceaccount.com role: roles/resourcemanager.organizationAdmin - members: - user:eve@example.com role: roles/resourcemanager.organizationViewer condition: title: expirable access description: Does not grant access after Sep 2020 expression: request.time < timestamp('2020-10-01T00:00:00.000Z') etag: BwWWja0YfJA= version: 3`\ \`
+
+ For a description of IAM and its features, see the
+ [IAM
+ documentation](https://cloud.google.com/iam/docs/).
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [resource]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ if isinstance(request, dict):
+ # - The request isn't a proto-plus wrapped type,
+ # so it must be constructed via keyword expansion.
+ request = iam_policy_pb2.GetIamPolicyRequest(**request)
+ elif not request:
+ # Null request, just make one.
+ request = iam_policy_pb2.GetIamPolicyRequest()
+ if resource is not None:
+ request.resource = resource
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.get_iam_policy]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def set_iam_policy(
+ self,
+ request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None,
+ *,
+ resource: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> policy_pb2.Policy:
+ r"""Sets the access control policy on an instance
+ resource. Replaces any existing policy.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+ from google.iam.v1 import iam_policy_pb2 # type: ignore
+
+ def sample_set_iam_policy():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminClient()
+
+ # Initialize request argument(s)
+ request = iam_policy_pb2.SetIamPolicyRequest(
+ resource="resource_value",
+ )
+
+ # Make the request
+ response = client.set_iam_policy(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Union[google.iam.v1.iam_policy_pb2.SetIamPolicyRequest, dict]):
+ The request object. Request message for ``SetIamPolicy`` method.
+ resource (str):
+ REQUIRED: The resource for which the
+ policy is being specified. See the
+ operation documentation for the
+ appropriate value for this field.
+
+ This corresponds to the ``resource`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.iam.v1.policy_pb2.Policy:
+ An Identity and Access Management (IAM) policy, which specifies access
+ controls for Google Cloud resources.
+
+ A Policy is a collection of bindings. A binding binds
+ one or more members, or principals, to a single role.
+ Principals can be user accounts, service accounts,
+ Google groups, and domains (such as G Suite). A role
+ is a named list of permissions; each role can be an
+ IAM predefined role or a user-created custom role.
+
+ For some types of Google Cloud resources, a binding
+ can also specify a condition, which is a logical
+ expression that allows access to a resource only if
+ the expression evaluates to true. A condition can add
+ constraints based on attributes of the request, the
+ resource, or both. To learn which resources support
+ conditions in their IAM policies, see the [IAM
+ documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
+
+ **JSON example:**
+
+ :literal:`` { "bindings": [ { "role": "roles/resourcemanager.organizationAdmin", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-project-id@appspot.gserviceaccount.com" ] }, { "role": "roles/resourcemanager.organizationViewer", "members": [ "user:eve@example.com" ], "condition": { "title": "expirable access", "description": "Does not grant access after Sep 2020", "expression": "request.time < timestamp('2020-10-01T00:00:00.000Z')", } } ], "etag": "BwWWja0YfJA=", "version": 3 }`\ \`
+
+ **YAML example:**
+
+ :literal:`` bindings: - members: - user:mike@example.com - group:admins@example.com - domain:google.com - serviceAccount:my-project-id@appspot.gserviceaccount.com role: roles/resourcemanager.organizationAdmin - members: - user:eve@example.com role: roles/resourcemanager.organizationViewer condition: title: expirable access description: Does not grant access after Sep 2020 expression: request.time < timestamp('2020-10-01T00:00:00.000Z') etag: BwWWja0YfJA= version: 3`\ \`
+
+ For a description of IAM and its features, see the
+ [IAM
+ documentation](https://cloud.google.com/iam/docs/).
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [resource]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ if isinstance(request, dict):
+ # - The request isn't a proto-plus wrapped type,
+ # so it must be constructed via keyword expansion.
+ request = iam_policy_pb2.SetIamPolicyRequest(**request)
+ elif not request:
+ # Null request, just make one.
+ request = iam_policy_pb2.SetIamPolicyRequest()
+ if resource is not None:
+ request.resource = resource
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.set_iam_policy]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def test_iam_permissions(
+ self,
+ request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None,
+ *,
+ resource: Optional[str] = None,
+ permissions: Optional[MutableSequence[str]] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> iam_policy_pb2.TestIamPermissionsResponse:
+ r"""Returns permissions that the caller has on the
+ specified instance resource.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+ from google.iam.v1 import iam_policy_pb2 # type: ignore
+
+ def sample_test_iam_permissions():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminClient()
+
+ # Initialize request argument(s)
+ request = iam_policy_pb2.TestIamPermissionsRequest(
+ resource="resource_value",
+ permissions=['permissions_value1', 'permissions_value2'],
+ )
+
+ # Make the request
+ response = client.test_iam_permissions(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Union[google.iam.v1.iam_policy_pb2.TestIamPermissionsRequest, dict]):
+ The request object. Request message for ``TestIamPermissions`` method.
+ resource (str):
+ REQUIRED: The resource for which the
+ policy detail is being requested. See
+ the operation documentation for the
+ appropriate value for this field.
+
+ This corresponds to the ``resource`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ permissions (MutableSequence[str]):
+ The set of permissions to check for the ``resource``.
+ Permissions with wildcards (such as '*' or 'storage.*')
+ are not allowed. For more information see `IAM
+ Overview `__.
+
+ This corresponds to the ``permissions`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.iam.v1.iam_policy_pb2.TestIamPermissionsResponse:
+ Response message for TestIamPermissions method.
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [resource, permissions]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ if isinstance(request, dict):
+ # - The request isn't a proto-plus wrapped type,
+ # so it must be constructed via keyword expansion.
+ request = iam_policy_pb2.TestIamPermissionsRequest(**request)
+ elif not request:
+ # Null request, just make one.
+ request = iam_policy_pb2.TestIamPermissionsRequest()
+ if resource is not None:
+ request.resource = resource
+ if permissions:
+ request.permissions.extend(permissions)
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.test_iam_permissions]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def list_hot_tablets(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.ListHotTabletsRequest, dict]
+ ] = None,
+ *,
+ parent: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> pagers.ListHotTabletsPager:
+ r"""Lists hot tablets in a cluster, within the time range
+ provided. Hot tablets are ordered based on CPU usage.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_list_hot_tablets():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.ListHotTabletsRequest(
+ parent="parent_value",
+ )
+
+ # Make the request
+ page_result = client.list_hot_tablets(request=request)
+
+ # Handle the response
+ for response in page_result:
+ print(response)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.ListHotTabletsRequest, dict]):
+ The request object. Request message for
+ BigtableInstanceAdmin.ListHotTablets.
+ parent (str):
+ Required. The cluster name to list hot tablets. Value is
+ in the following form:
+ ``projects/{project}/instances/{instance}/clusters/{cluster}``.
+
+ This corresponds to the ``parent`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.services.bigtable_instance_admin.pagers.ListHotTabletsPager:
+ Response message for
+ BigtableInstanceAdmin.ListHotTablets.
+ Iterating over this object will yield
+ results and resolve additional pages
+ automatically.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [parent]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_instance_admin.ListHotTabletsRequest):
+ request = bigtable_instance_admin.ListHotTabletsRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if parent is not None:
+ request.parent = parent
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.list_hot_tablets]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # This method is paged; wrap the response in a pager, which provides
+ # an `__iter__` convenience method.
+ response = pagers.ListHotTabletsPager(
+ method=rpc,
+ request=request,
+ response=response,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def create_logical_view(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.CreateLogicalViewRequest, dict]
+ ] = None,
+ *,
+ parent: Optional[str] = None,
+ logical_view: Optional[instance.LogicalView] = None,
+ logical_view_id: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operation.Operation:
+ r"""Creates a logical view within an instance.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_create_logical_view():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminClient()
+
+ # Initialize request argument(s)
+ logical_view = bigtable_admin_v2.LogicalView()
+ logical_view.query = "query_value"
+
+ request = bigtable_admin_v2.CreateLogicalViewRequest(
+ parent="parent_value",
+ logical_view_id="logical_view_id_value",
+ logical_view=logical_view,
+ )
+
+ # Make the request
+ operation = client.create_logical_view(request=request)
+
+ print("Waiting for operation to complete...")
+
+ response = operation.result()
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.CreateLogicalViewRequest, dict]):
+ The request object. Request message for
+ BigtableInstanceAdmin.CreateLogicalView.
+ parent (str):
+ Required. The parent instance where this logical view
+ will be created. Format:
+ ``projects/{project}/instances/{instance}``.
+
+ This corresponds to the ``parent`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ logical_view (google.cloud.bigtable_admin_v2.types.LogicalView):
+ Required. The logical view to create.
+ This corresponds to the ``logical_view`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ logical_view_id (str):
+ Required. The ID to use for the
+ logical view, which will become the
+ final component of the logical view's
+ resource name.
+
+ This corresponds to the ``logical_view_id`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.api_core.operation.Operation:
+ An object representing a long-running operation.
+
+ The result type for the operation will be
+ :class:`google.cloud.bigtable_admin_v2.types.LogicalView`
+ A SQL logical view object that can be referenced in SQL
+ queries.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [parent, logical_view, logical_view_id]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_instance_admin.CreateLogicalViewRequest):
+ request = bigtable_instance_admin.CreateLogicalViewRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if parent is not None:
+ request.parent = parent
+ if logical_view is not None:
+ request.logical_view = logical_view
+ if logical_view_id is not None:
+ request.logical_view_id = logical_view_id
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.create_logical_view]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Wrap the response in an operation future.
+ response = operation.from_gapic(
+ response,
+ self._transport.operations_client,
+ instance.LogicalView,
+ metadata_type=bigtable_instance_admin.CreateLogicalViewMetadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def get_logical_view(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.GetLogicalViewRequest, dict]
+ ] = None,
+ *,
+ name: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> instance.LogicalView:
+ r"""Gets information about a logical view.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_get_logical_view():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.GetLogicalViewRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = client.get_logical_view(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.GetLogicalViewRequest, dict]):
+ The request object. Request message for
+ BigtableInstanceAdmin.GetLogicalView.
+ name (str):
+ Required. The unique name of the requested logical view.
+ Values are of the form
+ ``projects/{project}/instances/{instance}/logicalViews/{logical_view}``.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.types.LogicalView:
+ A SQL logical view object that can be
+ referenced in SQL queries.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_instance_admin.GetLogicalViewRequest):
+ request = bigtable_instance_admin.GetLogicalViewRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.get_logical_view]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def list_logical_views(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.ListLogicalViewsRequest, dict]
+ ] = None,
+ *,
+ parent: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> pagers.ListLogicalViewsPager:
+ r"""Lists information about logical views in an instance.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_list_logical_views():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.ListLogicalViewsRequest(
+ parent="parent_value",
+ )
+
+ # Make the request
+ page_result = client.list_logical_views(request=request)
+
+ # Handle the response
+ for response in page_result:
+ print(response)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.ListLogicalViewsRequest, dict]):
+ The request object. Request message for
+ BigtableInstanceAdmin.ListLogicalViews.
+ parent (str):
+ Required. The unique name of the instance for which the
+ list of logical views is requested. Values are of the
+ form ``projects/{project}/instances/{instance}``.
+
+ This corresponds to the ``parent`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.services.bigtable_instance_admin.pagers.ListLogicalViewsPager:
+ Response message for
+ BigtableInstanceAdmin.ListLogicalViews.
+ Iterating over this object will yield
+ results and resolve additional pages
+ automatically.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [parent]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_instance_admin.ListLogicalViewsRequest):
+ request = bigtable_instance_admin.ListLogicalViewsRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if parent is not None:
+ request.parent = parent
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.list_logical_views]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # This method is paged; wrap the response in a pager, which provides
+ # an `__iter__` convenience method.
+ response = pagers.ListLogicalViewsPager(
+ method=rpc,
+ request=request,
+ response=response,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def update_logical_view(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.UpdateLogicalViewRequest, dict]
+ ] = None,
+ *,
+ logical_view: Optional[instance.LogicalView] = None,
+ update_mask: Optional[field_mask_pb2.FieldMask] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operation.Operation:
+ r"""Updates a logical view within an instance.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_update_logical_view():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminClient()
+
+ # Initialize request argument(s)
+ logical_view = bigtable_admin_v2.LogicalView()
+ logical_view.query = "query_value"
+
+ request = bigtable_admin_v2.UpdateLogicalViewRequest(
+ logical_view=logical_view,
+ )
+
+ # Make the request
+ operation = client.update_logical_view(request=request)
+
+ print("Waiting for operation to complete...")
+
+ response = operation.result()
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.UpdateLogicalViewRequest, dict]):
+ The request object. Request message for
+ BigtableInstanceAdmin.UpdateLogicalView.
+ logical_view (google.cloud.bigtable_admin_v2.types.LogicalView):
+ Required. The logical view to update.
+
+ The logical view's ``name`` field is used to identify
+ the view to update. Format:
+ ``projects/{project}/instances/{instance}/logicalViews/{logical_view}``.
+
+ This corresponds to the ``logical_view`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ update_mask (google.protobuf.field_mask_pb2.FieldMask):
+ Optional. The list of fields to
+ update.
+
+ This corresponds to the ``update_mask`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.api_core.operation.Operation:
+ An object representing a long-running operation.
+
+ The result type for the operation will be
+ :class:`google.cloud.bigtable_admin_v2.types.LogicalView`
+ A SQL logical view object that can be referenced in SQL
+ queries.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [logical_view, update_mask]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_instance_admin.UpdateLogicalViewRequest):
+ request = bigtable_instance_admin.UpdateLogicalViewRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if logical_view is not None:
+ request.logical_view = logical_view
+ if update_mask is not None:
+ request.update_mask = update_mask
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.update_logical_view]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata(
+ (("logical_view.name", request.logical_view.name),)
+ ),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Wrap the response in an operation future.
+ response = operation.from_gapic(
+ response,
+ self._transport.operations_client,
+ instance.LogicalView,
+ metadata_type=bigtable_instance_admin.UpdateLogicalViewMetadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def delete_logical_view(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.DeleteLogicalViewRequest, dict]
+ ] = None,
+ *,
+ name: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> None:
+ r"""Deletes a logical view from an instance.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_delete_logical_view():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.DeleteLogicalViewRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ client.delete_logical_view(request=request)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.DeleteLogicalViewRequest, dict]):
+ The request object. Request message for
+ BigtableInstanceAdmin.DeleteLogicalView.
+ name (str):
+ Required. The unique name of the logical view to be
+ deleted. Format:
+ ``projects/{project}/instances/{instance}/logicalViews/{logical_view}``.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_instance_admin.DeleteLogicalViewRequest):
+ request = bigtable_instance_admin.DeleteLogicalViewRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.delete_logical_view]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ def create_materialized_view(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.CreateMaterializedViewRequest, dict]
+ ] = None,
+ *,
+ parent: Optional[str] = None,
+ materialized_view: Optional[instance.MaterializedView] = None,
+ materialized_view_id: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operation.Operation:
+ r"""Creates a materialized view within an instance.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_create_materialized_view():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminClient()
+
+ # Initialize request argument(s)
+ materialized_view = bigtable_admin_v2.MaterializedView()
+ materialized_view.query = "query_value"
+
+ request = bigtable_admin_v2.CreateMaterializedViewRequest(
+ parent="parent_value",
+ materialized_view_id="materialized_view_id_value",
+ materialized_view=materialized_view,
+ )
+
+ # Make the request
+ operation = client.create_materialized_view(request=request)
+
+ print("Waiting for operation to complete...")
+
+ response = operation.result()
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.CreateMaterializedViewRequest, dict]):
+ The request object. Request message for
+ BigtableInstanceAdmin.CreateMaterializedView.
+ parent (str):
+ Required. The parent instance where this materialized
+ view will be created. Format:
+ ``projects/{project}/instances/{instance}``.
+
+ This corresponds to the ``parent`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ materialized_view (google.cloud.bigtable_admin_v2.types.MaterializedView):
+ Required. The materialized view to
+ create.
+
+ This corresponds to the ``materialized_view`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ materialized_view_id (str):
+ Required. The ID to use for the
+ materialized view, which will become the
+ final component of the materialized
+ view's resource name.
+
+ This corresponds to the ``materialized_view_id`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.api_core.operation.Operation:
+ An object representing a long-running operation.
+
+ The result type for the operation will be
+ :class:`google.cloud.bigtable_admin_v2.types.MaterializedView`
+ A materialized view object that can be referenced in SQL
+ queries.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [parent, materialized_view, materialized_view_id]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(
+ request, bigtable_instance_admin.CreateMaterializedViewRequest
+ ):
+ request = bigtable_instance_admin.CreateMaterializedViewRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if parent is not None:
+ request.parent = parent
+ if materialized_view is not None:
+ request.materialized_view = materialized_view
+ if materialized_view_id is not None:
+ request.materialized_view_id = materialized_view_id
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.create_materialized_view]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Wrap the response in an operation future.
+ response = operation.from_gapic(
+ response,
+ self._transport.operations_client,
+ instance.MaterializedView,
+ metadata_type=bigtable_instance_admin.CreateMaterializedViewMetadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def get_materialized_view(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.GetMaterializedViewRequest, dict]
+ ] = None,
+ *,
+ name: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> instance.MaterializedView:
+ r"""Gets information about a materialized view.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_get_materialized_view():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.GetMaterializedViewRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = client.get_materialized_view(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.GetMaterializedViewRequest, dict]):
+ The request object. Request message for
+ BigtableInstanceAdmin.GetMaterializedView.
+ name (str):
+ Required. The unique name of the requested materialized
+ view. Values are of the form
+ ``projects/{project}/instances/{instance}/materializedViews/{materialized_view}``.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.types.MaterializedView:
+ A materialized view object that can
+ be referenced in SQL queries.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_instance_admin.GetMaterializedViewRequest):
+ request = bigtable_instance_admin.GetMaterializedViewRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.get_materialized_view]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def list_materialized_views(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.ListMaterializedViewsRequest, dict]
+ ] = None,
+ *,
+ parent: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> pagers.ListMaterializedViewsPager:
+ r"""Lists information about materialized views in an
+ instance.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_list_materialized_views():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.ListMaterializedViewsRequest(
+ parent="parent_value",
+ )
+
+ # Make the request
+ page_result = client.list_materialized_views(request=request)
+
+ # Handle the response
+ for response in page_result:
+ print(response)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.ListMaterializedViewsRequest, dict]):
+ The request object. Request message for
+ BigtableInstanceAdmin.ListMaterializedViews.
+ parent (str):
+ Required. The unique name of the instance for which the
+ list of materialized views is requested. Values are of
+ the form ``projects/{project}/instances/{instance}``.
+
+ This corresponds to the ``parent`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.services.bigtable_instance_admin.pagers.ListMaterializedViewsPager:
+ Response message for
+ BigtableInstanceAdmin.ListMaterializedViews.
+ Iterating over this object will yield
+ results and resolve additional pages
+ automatically.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [parent]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(
+ request, bigtable_instance_admin.ListMaterializedViewsRequest
+ ):
+ request = bigtable_instance_admin.ListMaterializedViewsRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if parent is not None:
+ request.parent = parent
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.list_materialized_views]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # This method is paged; wrap the response in a pager, which provides
+ # an `__iter__` convenience method.
+ response = pagers.ListMaterializedViewsPager(
+ method=rpc,
+ request=request,
+ response=response,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def update_materialized_view(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.UpdateMaterializedViewRequest, dict]
+ ] = None,
+ *,
+ materialized_view: Optional[instance.MaterializedView] = None,
+ update_mask: Optional[field_mask_pb2.FieldMask] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operation.Operation:
+ r"""Updates a materialized view within an instance.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_update_materialized_view():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminClient()
+
+ # Initialize request argument(s)
+ materialized_view = bigtable_admin_v2.MaterializedView()
+ materialized_view.query = "query_value"
+
+ request = bigtable_admin_v2.UpdateMaterializedViewRequest(
+ materialized_view=materialized_view,
+ )
+
+ # Make the request
+ operation = client.update_materialized_view(request=request)
+
+ print("Waiting for operation to complete...")
+
+ response = operation.result()
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.UpdateMaterializedViewRequest, dict]):
+ The request object. Request message for
+ BigtableInstanceAdmin.UpdateMaterializedView.
+ materialized_view (google.cloud.bigtable_admin_v2.types.MaterializedView):
+ Required. The materialized view to update.
+
+ The materialized view's ``name`` field is used to
+ identify the view to update. Format:
+ ``projects/{project}/instances/{instance}/materializedViews/{materialized_view}``.
+
+ This corresponds to the ``materialized_view`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ update_mask (google.protobuf.field_mask_pb2.FieldMask):
+ Optional. The list of fields to
+ update.
+
+ This corresponds to the ``update_mask`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.api_core.operation.Operation:
+ An object representing a long-running operation.
+
+ The result type for the operation will be
+ :class:`google.cloud.bigtable_admin_v2.types.MaterializedView`
+ A materialized view object that can be referenced in SQL
+ queries.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [materialized_view, update_mask]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(
+ request, bigtable_instance_admin.UpdateMaterializedViewRequest
+ ):
+ request = bigtable_instance_admin.UpdateMaterializedViewRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if materialized_view is not None:
+ request.materialized_view = materialized_view
+ if update_mask is not None:
+ request.update_mask = update_mask
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.update_materialized_view]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata(
+ (("materialized_view.name", request.materialized_view.name),)
+ ),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Wrap the response in an operation future.
+ response = operation.from_gapic(
+ response,
+ self._transport.operations_client,
+ instance.MaterializedView,
+ metadata_type=bigtable_instance_admin.UpdateMaterializedViewMetadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def delete_materialized_view(
+ self,
+ request: Optional[
+ Union[bigtable_instance_admin.DeleteMaterializedViewRequest, dict]
+ ] = None,
+ *,
+ name: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> None:
+ r"""Deletes a materialized view from an instance.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_delete_materialized_view():
+ # Create a client
+ client = bigtable_admin_v2.BigtableInstanceAdminClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.DeleteMaterializedViewRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ client.delete_materialized_view(request=request)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.DeleteMaterializedViewRequest, dict]):
+ The request object. Request message for
+ BigtableInstanceAdmin.DeleteMaterializedView.
+ name (str):
+ Required. The unique name of the materialized view to be
+ deleted. Format:
+ ``projects/{project}/instances/{instance}/materializedViews/{materialized_view}``.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(
+ request, bigtable_instance_admin.DeleteMaterializedViewRequest
+ ):
+ request = bigtable_instance_admin.DeleteMaterializedViewRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.delete_materialized_view]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ def __enter__(self) -> "BigtableInstanceAdminClient":
+ return self
+
+ def __exit__(self, type, value, traceback):
+ """Releases underlying transport's resources.
+
+ .. warning::
+ ONLY use as a context manager if the transport is NOT shared
+ with other clients! Exiting the with block will CLOSE the transport
+ and may cause errors in other clients!
+ """
+ self.transport.close()
+
+
+DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
+ gapic_version=package_version.__version__
+)
+
+if hasattr(DEFAULT_CLIENT_INFO, "protobuf_runtime_version"): # pragma: NO COVER
+ DEFAULT_CLIENT_INFO.protobuf_runtime_version = google.protobuf.__version__
+
+__all__ = ("BigtableInstanceAdminClient",)
diff --git a/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/pagers.py b/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/pagers.py
new file mode 100644
index 000000000..ce5b67b27
--- /dev/null
+++ b/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/pagers.py
@@ -0,0 +1,681 @@
+# -*- coding: utf-8 -*-
+# Copyright 2025 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 google.api_core import gapic_v1
+from google.api_core import retry as retries
+from google.api_core import retry_async as retries_async
+from typing import (
+ Any,
+ AsyncIterator,
+ Awaitable,
+ Callable,
+ Sequence,
+ Tuple,
+ Optional,
+ Iterator,
+ Union,
+)
+
+try:
+ OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault, None]
+ OptionalAsyncRetry = Union[
+ retries_async.AsyncRetry, gapic_v1.method._MethodDefault, None
+ ]
+except AttributeError: # pragma: NO COVER
+ OptionalRetry = Union[retries.Retry, object, None] # type: ignore
+ OptionalAsyncRetry = Union[retries_async.AsyncRetry, object, None] # type: ignore
+
+from google.cloud.bigtable_admin_v2.types import bigtable_instance_admin
+from google.cloud.bigtable_admin_v2.types import instance
+
+
+class ListAppProfilesPager:
+ """A pager for iterating through ``list_app_profiles`` requests.
+
+ This class thinly wraps an initial
+ :class:`google.cloud.bigtable_admin_v2.types.ListAppProfilesResponse` object, and
+ provides an ``__iter__`` method to iterate through its
+ ``app_profiles`` field.
+
+ If there are more pages, the ``__iter__`` method will make additional
+ ``ListAppProfiles`` requests and continue to iterate
+ through the ``app_profiles`` field on the
+ corresponding responses.
+
+ All the usual :class:`google.cloud.bigtable_admin_v2.types.ListAppProfilesResponse`
+ attributes are available on the pager. If multiple requests are made, only
+ the most recent response is retained, and thus used for attribute lookup.
+ """
+
+ def __init__(
+ self,
+ method: Callable[..., bigtable_instance_admin.ListAppProfilesResponse],
+ request: bigtable_instance_admin.ListAppProfilesRequest,
+ response: bigtable_instance_admin.ListAppProfilesResponse,
+ *,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
+ ):
+ """Instantiate the pager.
+
+ Args:
+ method (Callable): The method that was originally called, and
+ which instantiated this pager.
+ request (google.cloud.bigtable_admin_v2.types.ListAppProfilesRequest):
+ The initial request object.
+ response (google.cloud.bigtable_admin_v2.types.ListAppProfilesResponse):
+ The initial response object.
+ retry (google.api_core.retry.Retry): Designation of what errors,
+ if any, should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+ """
+ self._method = method
+ self._request = bigtable_instance_admin.ListAppProfilesRequest(request)
+ self._response = response
+ self._retry = retry
+ self._timeout = timeout
+ self._metadata = metadata
+
+ def __getattr__(self, name: str) -> Any:
+ return getattr(self._response, name)
+
+ @property
+ def pages(self) -> Iterator[bigtable_instance_admin.ListAppProfilesResponse]:
+ yield self._response
+ while self._response.next_page_token:
+ self._request.page_token = self._response.next_page_token
+ self._response = self._method(
+ self._request,
+ retry=self._retry,
+ timeout=self._timeout,
+ metadata=self._metadata,
+ )
+ yield self._response
+
+ def __iter__(self) -> Iterator[instance.AppProfile]:
+ for page in self.pages:
+ yield from page.app_profiles
+
+ def __repr__(self) -> str:
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
+
+
+class ListAppProfilesAsyncPager:
+ """A pager for iterating through ``list_app_profiles`` requests.
+
+ This class thinly wraps an initial
+ :class:`google.cloud.bigtable_admin_v2.types.ListAppProfilesResponse` object, and
+ provides an ``__aiter__`` method to iterate through its
+ ``app_profiles`` field.
+
+ If there are more pages, the ``__aiter__`` method will make additional
+ ``ListAppProfiles`` requests and continue to iterate
+ through the ``app_profiles`` field on the
+ corresponding responses.
+
+ All the usual :class:`google.cloud.bigtable_admin_v2.types.ListAppProfilesResponse`
+ attributes are available on the pager. If multiple requests are made, only
+ the most recent response is retained, and thus used for attribute lookup.
+ """
+
+ def __init__(
+ self,
+ method: Callable[
+ ..., Awaitable[bigtable_instance_admin.ListAppProfilesResponse]
+ ],
+ request: bigtable_instance_admin.ListAppProfilesRequest,
+ response: bigtable_instance_admin.ListAppProfilesResponse,
+ *,
+ retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
+ ):
+ """Instantiates the pager.
+
+ Args:
+ method (Callable): The method that was originally called, and
+ which instantiated this pager.
+ request (google.cloud.bigtable_admin_v2.types.ListAppProfilesRequest):
+ The initial request object.
+ response (google.cloud.bigtable_admin_v2.types.ListAppProfilesResponse):
+ The initial response object.
+ retry (google.api_core.retry.AsyncRetry): Designation of what errors,
+ if any, should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+ """
+ self._method = method
+ self._request = bigtable_instance_admin.ListAppProfilesRequest(request)
+ self._response = response
+ self._retry = retry
+ self._timeout = timeout
+ self._metadata = metadata
+
+ def __getattr__(self, name: str) -> Any:
+ return getattr(self._response, name)
+
+ @property
+ async def pages(
+ self,
+ ) -> AsyncIterator[bigtable_instance_admin.ListAppProfilesResponse]:
+ yield self._response
+ while self._response.next_page_token:
+ self._request.page_token = self._response.next_page_token
+ self._response = await self._method(
+ self._request,
+ retry=self._retry,
+ timeout=self._timeout,
+ metadata=self._metadata,
+ )
+ yield self._response
+
+ def __aiter__(self) -> AsyncIterator[instance.AppProfile]:
+ async def async_generator():
+ async for page in self.pages:
+ for response in page.app_profiles:
+ yield response
+
+ return async_generator()
+
+ def __repr__(self) -> str:
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
+
+
+class ListHotTabletsPager:
+ """A pager for iterating through ``list_hot_tablets`` requests.
+
+ This class thinly wraps an initial
+ :class:`google.cloud.bigtable_admin_v2.types.ListHotTabletsResponse` object, and
+ provides an ``__iter__`` method to iterate through its
+ ``hot_tablets`` field.
+
+ If there are more pages, the ``__iter__`` method will make additional
+ ``ListHotTablets`` requests and continue to iterate
+ through the ``hot_tablets`` field on the
+ corresponding responses.
+
+ All the usual :class:`google.cloud.bigtable_admin_v2.types.ListHotTabletsResponse`
+ attributes are available on the pager. If multiple requests are made, only
+ the most recent response is retained, and thus used for attribute lookup.
+ """
+
+ def __init__(
+ self,
+ method: Callable[..., bigtable_instance_admin.ListHotTabletsResponse],
+ request: bigtable_instance_admin.ListHotTabletsRequest,
+ response: bigtable_instance_admin.ListHotTabletsResponse,
+ *,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
+ ):
+ """Instantiate the pager.
+
+ Args:
+ method (Callable): The method that was originally called, and
+ which instantiated this pager.
+ request (google.cloud.bigtable_admin_v2.types.ListHotTabletsRequest):
+ The initial request object.
+ response (google.cloud.bigtable_admin_v2.types.ListHotTabletsResponse):
+ The initial response object.
+ retry (google.api_core.retry.Retry): Designation of what errors,
+ if any, should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+ """
+ self._method = method
+ self._request = bigtable_instance_admin.ListHotTabletsRequest(request)
+ self._response = response
+ self._retry = retry
+ self._timeout = timeout
+ self._metadata = metadata
+
+ def __getattr__(self, name: str) -> Any:
+ return getattr(self._response, name)
+
+ @property
+ def pages(self) -> Iterator[bigtable_instance_admin.ListHotTabletsResponse]:
+ yield self._response
+ while self._response.next_page_token:
+ self._request.page_token = self._response.next_page_token
+ self._response = self._method(
+ self._request,
+ retry=self._retry,
+ timeout=self._timeout,
+ metadata=self._metadata,
+ )
+ yield self._response
+
+ def __iter__(self) -> Iterator[instance.HotTablet]:
+ for page in self.pages:
+ yield from page.hot_tablets
+
+ def __repr__(self) -> str:
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
+
+
+class ListHotTabletsAsyncPager:
+ """A pager for iterating through ``list_hot_tablets`` requests.
+
+ This class thinly wraps an initial
+ :class:`google.cloud.bigtable_admin_v2.types.ListHotTabletsResponse` object, and
+ provides an ``__aiter__`` method to iterate through its
+ ``hot_tablets`` field.
+
+ If there are more pages, the ``__aiter__`` method will make additional
+ ``ListHotTablets`` requests and continue to iterate
+ through the ``hot_tablets`` field on the
+ corresponding responses.
+
+ All the usual :class:`google.cloud.bigtable_admin_v2.types.ListHotTabletsResponse`
+ attributes are available on the pager. If multiple requests are made, only
+ the most recent response is retained, and thus used for attribute lookup.
+ """
+
+ def __init__(
+ self,
+ method: Callable[
+ ..., Awaitable[bigtable_instance_admin.ListHotTabletsResponse]
+ ],
+ request: bigtable_instance_admin.ListHotTabletsRequest,
+ response: bigtable_instance_admin.ListHotTabletsResponse,
+ *,
+ retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
+ ):
+ """Instantiates the pager.
+
+ Args:
+ method (Callable): The method that was originally called, and
+ which instantiated this pager.
+ request (google.cloud.bigtable_admin_v2.types.ListHotTabletsRequest):
+ The initial request object.
+ response (google.cloud.bigtable_admin_v2.types.ListHotTabletsResponse):
+ The initial response object.
+ retry (google.api_core.retry.AsyncRetry): Designation of what errors,
+ if any, should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+ """
+ self._method = method
+ self._request = bigtable_instance_admin.ListHotTabletsRequest(request)
+ self._response = response
+ self._retry = retry
+ self._timeout = timeout
+ self._metadata = metadata
+
+ def __getattr__(self, name: str) -> Any:
+ return getattr(self._response, name)
+
+ @property
+ async def pages(
+ self,
+ ) -> AsyncIterator[bigtable_instance_admin.ListHotTabletsResponse]:
+ yield self._response
+ while self._response.next_page_token:
+ self._request.page_token = self._response.next_page_token
+ self._response = await self._method(
+ self._request,
+ retry=self._retry,
+ timeout=self._timeout,
+ metadata=self._metadata,
+ )
+ yield self._response
+
+ def __aiter__(self) -> AsyncIterator[instance.HotTablet]:
+ async def async_generator():
+ async for page in self.pages:
+ for response in page.hot_tablets:
+ yield response
+
+ return async_generator()
+
+ def __repr__(self) -> str:
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
+
+
+class ListLogicalViewsPager:
+ """A pager for iterating through ``list_logical_views`` requests.
+
+ This class thinly wraps an initial
+ :class:`google.cloud.bigtable_admin_v2.types.ListLogicalViewsResponse` object, and
+ provides an ``__iter__`` method to iterate through its
+ ``logical_views`` field.
+
+ If there are more pages, the ``__iter__`` method will make additional
+ ``ListLogicalViews`` requests and continue to iterate
+ through the ``logical_views`` field on the
+ corresponding responses.
+
+ All the usual :class:`google.cloud.bigtable_admin_v2.types.ListLogicalViewsResponse`
+ attributes are available on the pager. If multiple requests are made, only
+ the most recent response is retained, and thus used for attribute lookup.
+ """
+
+ def __init__(
+ self,
+ method: Callable[..., bigtable_instance_admin.ListLogicalViewsResponse],
+ request: bigtable_instance_admin.ListLogicalViewsRequest,
+ response: bigtable_instance_admin.ListLogicalViewsResponse,
+ *,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
+ ):
+ """Instantiate the pager.
+
+ Args:
+ method (Callable): The method that was originally called, and
+ which instantiated this pager.
+ request (google.cloud.bigtable_admin_v2.types.ListLogicalViewsRequest):
+ The initial request object.
+ response (google.cloud.bigtable_admin_v2.types.ListLogicalViewsResponse):
+ The initial response object.
+ retry (google.api_core.retry.Retry): Designation of what errors,
+ if any, should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+ """
+ self._method = method
+ self._request = bigtable_instance_admin.ListLogicalViewsRequest(request)
+ self._response = response
+ self._retry = retry
+ self._timeout = timeout
+ self._metadata = metadata
+
+ def __getattr__(self, name: str) -> Any:
+ return getattr(self._response, name)
+
+ @property
+ def pages(self) -> Iterator[bigtable_instance_admin.ListLogicalViewsResponse]:
+ yield self._response
+ while self._response.next_page_token:
+ self._request.page_token = self._response.next_page_token
+ self._response = self._method(
+ self._request,
+ retry=self._retry,
+ timeout=self._timeout,
+ metadata=self._metadata,
+ )
+ yield self._response
+
+ def __iter__(self) -> Iterator[instance.LogicalView]:
+ for page in self.pages:
+ yield from page.logical_views
+
+ def __repr__(self) -> str:
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
+
+
+class ListLogicalViewsAsyncPager:
+ """A pager for iterating through ``list_logical_views`` requests.
+
+ This class thinly wraps an initial
+ :class:`google.cloud.bigtable_admin_v2.types.ListLogicalViewsResponse` object, and
+ provides an ``__aiter__`` method to iterate through its
+ ``logical_views`` field.
+
+ If there are more pages, the ``__aiter__`` method will make additional
+ ``ListLogicalViews`` requests and continue to iterate
+ through the ``logical_views`` field on the
+ corresponding responses.
+
+ All the usual :class:`google.cloud.bigtable_admin_v2.types.ListLogicalViewsResponse`
+ attributes are available on the pager. If multiple requests are made, only
+ the most recent response is retained, and thus used for attribute lookup.
+ """
+
+ def __init__(
+ self,
+ method: Callable[
+ ..., Awaitable[bigtable_instance_admin.ListLogicalViewsResponse]
+ ],
+ request: bigtable_instance_admin.ListLogicalViewsRequest,
+ response: bigtable_instance_admin.ListLogicalViewsResponse,
+ *,
+ retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
+ ):
+ """Instantiates the pager.
+
+ Args:
+ method (Callable): The method that was originally called, and
+ which instantiated this pager.
+ request (google.cloud.bigtable_admin_v2.types.ListLogicalViewsRequest):
+ The initial request object.
+ response (google.cloud.bigtable_admin_v2.types.ListLogicalViewsResponse):
+ The initial response object.
+ retry (google.api_core.retry.AsyncRetry): Designation of what errors,
+ if any, should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+ """
+ self._method = method
+ self._request = bigtable_instance_admin.ListLogicalViewsRequest(request)
+ self._response = response
+ self._retry = retry
+ self._timeout = timeout
+ self._metadata = metadata
+
+ def __getattr__(self, name: str) -> Any:
+ return getattr(self._response, name)
+
+ @property
+ async def pages(
+ self,
+ ) -> AsyncIterator[bigtable_instance_admin.ListLogicalViewsResponse]:
+ yield self._response
+ while self._response.next_page_token:
+ self._request.page_token = self._response.next_page_token
+ self._response = await self._method(
+ self._request,
+ retry=self._retry,
+ timeout=self._timeout,
+ metadata=self._metadata,
+ )
+ yield self._response
+
+ def __aiter__(self) -> AsyncIterator[instance.LogicalView]:
+ async def async_generator():
+ async for page in self.pages:
+ for response in page.logical_views:
+ yield response
+
+ return async_generator()
+
+ def __repr__(self) -> str:
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
+
+
+class ListMaterializedViewsPager:
+ """A pager for iterating through ``list_materialized_views`` requests.
+
+ This class thinly wraps an initial
+ :class:`google.cloud.bigtable_admin_v2.types.ListMaterializedViewsResponse` object, and
+ provides an ``__iter__`` method to iterate through its
+ ``materialized_views`` field.
+
+ If there are more pages, the ``__iter__`` method will make additional
+ ``ListMaterializedViews`` requests and continue to iterate
+ through the ``materialized_views`` field on the
+ corresponding responses.
+
+ All the usual :class:`google.cloud.bigtable_admin_v2.types.ListMaterializedViewsResponse`
+ attributes are available on the pager. If multiple requests are made, only
+ the most recent response is retained, and thus used for attribute lookup.
+ """
+
+ def __init__(
+ self,
+ method: Callable[..., bigtable_instance_admin.ListMaterializedViewsResponse],
+ request: bigtable_instance_admin.ListMaterializedViewsRequest,
+ response: bigtable_instance_admin.ListMaterializedViewsResponse,
+ *,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
+ ):
+ """Instantiate the pager.
+
+ Args:
+ method (Callable): The method that was originally called, and
+ which instantiated this pager.
+ request (google.cloud.bigtable_admin_v2.types.ListMaterializedViewsRequest):
+ The initial request object.
+ response (google.cloud.bigtable_admin_v2.types.ListMaterializedViewsResponse):
+ The initial response object.
+ retry (google.api_core.retry.Retry): Designation of what errors,
+ if any, should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+ """
+ self._method = method
+ self._request = bigtable_instance_admin.ListMaterializedViewsRequest(request)
+ self._response = response
+ self._retry = retry
+ self._timeout = timeout
+ self._metadata = metadata
+
+ def __getattr__(self, name: str) -> Any:
+ return getattr(self._response, name)
+
+ @property
+ def pages(self) -> Iterator[bigtable_instance_admin.ListMaterializedViewsResponse]:
+ yield self._response
+ while self._response.next_page_token:
+ self._request.page_token = self._response.next_page_token
+ self._response = self._method(
+ self._request,
+ retry=self._retry,
+ timeout=self._timeout,
+ metadata=self._metadata,
+ )
+ yield self._response
+
+ def __iter__(self) -> Iterator[instance.MaterializedView]:
+ for page in self.pages:
+ yield from page.materialized_views
+
+ def __repr__(self) -> str:
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
+
+
+class ListMaterializedViewsAsyncPager:
+ """A pager for iterating through ``list_materialized_views`` requests.
+
+ This class thinly wraps an initial
+ :class:`google.cloud.bigtable_admin_v2.types.ListMaterializedViewsResponse` object, and
+ provides an ``__aiter__`` method to iterate through its
+ ``materialized_views`` field.
+
+ If there are more pages, the ``__aiter__`` method will make additional
+ ``ListMaterializedViews`` requests and continue to iterate
+ through the ``materialized_views`` field on the
+ corresponding responses.
+
+ All the usual :class:`google.cloud.bigtable_admin_v2.types.ListMaterializedViewsResponse`
+ attributes are available on the pager. If multiple requests are made, only
+ the most recent response is retained, and thus used for attribute lookup.
+ """
+
+ def __init__(
+ self,
+ method: Callable[
+ ..., Awaitable[bigtable_instance_admin.ListMaterializedViewsResponse]
+ ],
+ request: bigtable_instance_admin.ListMaterializedViewsRequest,
+ response: bigtable_instance_admin.ListMaterializedViewsResponse,
+ *,
+ retry: OptionalAsyncRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = ()
+ ):
+ """Instantiates the pager.
+
+ Args:
+ method (Callable): The method that was originally called, and
+ which instantiated this pager.
+ request (google.cloud.bigtable_admin_v2.types.ListMaterializedViewsRequest):
+ The initial request object.
+ response (google.cloud.bigtable_admin_v2.types.ListMaterializedViewsResponse):
+ The initial response object.
+ retry (google.api_core.retry.AsyncRetry): Designation of what errors,
+ if any, should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+ """
+ self._method = method
+ self._request = bigtable_instance_admin.ListMaterializedViewsRequest(request)
+ self._response = response
+ self._retry = retry
+ self._timeout = timeout
+ self._metadata = metadata
+
+ def __getattr__(self, name: str) -> Any:
+ return getattr(self._response, name)
+
+ @property
+ async def pages(
+ self,
+ ) -> AsyncIterator[bigtable_instance_admin.ListMaterializedViewsResponse]:
+ yield self._response
+ while self._response.next_page_token:
+ self._request.page_token = self._response.next_page_token
+ self._response = await self._method(
+ self._request,
+ retry=self._retry,
+ timeout=self._timeout,
+ metadata=self._metadata,
+ )
+ yield self._response
+
+ def __aiter__(self) -> AsyncIterator[instance.MaterializedView]:
+ async def async_generator():
+ async for page in self.pages:
+ for response in page.materialized_views:
+ yield response
+
+ return async_generator()
+
+ def __repr__(self) -> str:
+ return "{0}<{1!r}>".format(self.__class__.__name__, self._response)
diff --git a/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/README.rst b/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/README.rst
new file mode 100644
index 000000000..9a01ee7c3
--- /dev/null
+++ b/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/README.rst
@@ -0,0 +1,9 @@
+
+transport inheritance structure
+_______________________________
+
+`BigtableInstanceAdminTransport` is the ABC for all transports.
+- public child `BigtableInstanceAdminGrpcTransport` for sync gRPC transport (defined in `grpc.py`).
+- public child `BigtableInstanceAdminGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`).
+- private child `_BaseBigtableInstanceAdminRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`).
+- public child `BigtableInstanceAdminRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`).
diff --git a/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/__init__.py b/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/__init__.py
new file mode 100644
index 000000000..021458f35
--- /dev/null
+++ b/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/__init__.py
@@ -0,0 +1,40 @@
+# -*- coding: utf-8 -*-
+# Copyright 2025 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+from collections import OrderedDict
+from typing import Dict, Type
+
+from .base import BigtableInstanceAdminTransport
+from .grpc import BigtableInstanceAdminGrpcTransport
+from .grpc_asyncio import BigtableInstanceAdminGrpcAsyncIOTransport
+from .rest import BigtableInstanceAdminRestTransport
+from .rest import BigtableInstanceAdminRestInterceptor
+
+
+# Compile a registry of transports.
+_transport_registry = (
+ OrderedDict()
+) # type: Dict[str, Type[BigtableInstanceAdminTransport]]
+_transport_registry["grpc"] = BigtableInstanceAdminGrpcTransport
+_transport_registry["grpc_asyncio"] = BigtableInstanceAdminGrpcAsyncIOTransport
+_transport_registry["rest"] = BigtableInstanceAdminRestTransport
+
+__all__ = (
+ "BigtableInstanceAdminTransport",
+ "BigtableInstanceAdminGrpcTransport",
+ "BigtableInstanceAdminGrpcAsyncIOTransport",
+ "BigtableInstanceAdminRestTransport",
+ "BigtableInstanceAdminRestInterceptor",
+)
diff --git a/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/base.py b/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/base.py
new file mode 100644
index 000000000..3a05dd663
--- /dev/null
+++ b/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/base.py
@@ -0,0 +1,756 @@
+# -*- coding: utf-8 -*-
+# Copyright 2025 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.
+#
+import abc
+from typing import Awaitable, Callable, Dict, Optional, Sequence, Union
+
+from google.cloud.bigtable_admin_v2 import gapic_version as package_version
+
+import google.auth # type: ignore
+import google.api_core
+from google.api_core import exceptions as core_exceptions
+from google.api_core import gapic_v1
+from google.api_core import retry as retries
+from google.api_core import operations_v1
+from google.auth import credentials as ga_credentials # type: ignore
+from google.oauth2 import service_account # type: ignore
+import google.protobuf
+
+from google.cloud.bigtable_admin_v2.types import bigtable_instance_admin
+from google.cloud.bigtable_admin_v2.types import instance
+from google.iam.v1 import iam_policy_pb2 # type: ignore
+from google.iam.v1 import policy_pb2 # type: ignore
+from google.longrunning import operations_pb2 # type: ignore
+from google.protobuf import empty_pb2 # type: ignore
+
+DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
+ gapic_version=package_version.__version__
+)
+
+if hasattr(DEFAULT_CLIENT_INFO, "protobuf_runtime_version"): # pragma: NO COVER
+ DEFAULT_CLIENT_INFO.protobuf_runtime_version = google.protobuf.__version__
+
+
+class BigtableInstanceAdminTransport(abc.ABC):
+ """Abstract transport class for BigtableInstanceAdmin."""
+
+ AUTH_SCOPES = (
+ "https://www.googleapis.com/auth/bigtable.admin",
+ "https://www.googleapis.com/auth/bigtable.admin.cluster",
+ "https://www.googleapis.com/auth/bigtable.admin.instance",
+ "https://www.googleapis.com/auth/cloud-bigtable.admin",
+ "https://www.googleapis.com/auth/cloud-bigtable.admin.cluster",
+ "https://www.googleapis.com/auth/cloud-platform",
+ "https://www.googleapis.com/auth/cloud-platform.read-only",
+ )
+
+ DEFAULT_HOST: str = "bigtableadmin.googleapis.com"
+
+ def __init__(
+ self,
+ *,
+ host: str = DEFAULT_HOST,
+ credentials: Optional[ga_credentials.Credentials] = None,
+ credentials_file: Optional[str] = None,
+ scopes: Optional[Sequence[str]] = None,
+ quota_project_id: Optional[str] = None,
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
+ always_use_jwt_access: Optional[bool] = False,
+ api_audience: Optional[str] = None,
+ **kwargs,
+ ) -> None:
+ """Instantiate the transport.
+
+ Args:
+ host (Optional[str]):
+ The hostname to connect to (default: 'bigtableadmin.googleapis.com').
+ credentials (Optional[google.auth.credentials.Credentials]): The
+ authorization credentials to attach to requests. These
+ credentials identify the application to the service; if none
+ are specified, the client will attempt to ascertain the
+ credentials from the environment.
+ credentials_file (Optional[str]): Deprecated. A file with credentials that can
+ be loaded with :func:`google.auth.load_credentials_from_file`.
+ This argument is mutually exclusive with credentials. This argument will be
+ removed in the next major version of this library.
+ scopes (Optional[Sequence[str]]): A list of scopes.
+ quota_project_id (Optional[str]): An optional project to use for billing
+ and quota.
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
+ The client info used to send a user-agent string along with
+ API requests. If ``None``, then default info will be used.
+ Generally, you only need to set this if you're developing
+ your own client library.
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
+ be used for service account credentials.
+ """
+
+ scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES}
+
+ # Save the scopes.
+ self._scopes = scopes
+ if not hasattr(self, "_ignore_credentials"):
+ self._ignore_credentials: bool = False
+
+ # If no credentials are provided, then determine the appropriate
+ # defaults.
+ if credentials and credentials_file:
+ raise core_exceptions.DuplicateCredentialArgs(
+ "'credentials_file' and 'credentials' are mutually exclusive"
+ )
+
+ if credentials_file is not None:
+ credentials, _ = google.auth.load_credentials_from_file(
+ credentials_file, **scopes_kwargs, quota_project_id=quota_project_id
+ )
+ elif credentials is None and not self._ignore_credentials:
+ credentials, _ = google.auth.default(
+ **scopes_kwargs, quota_project_id=quota_project_id
+ )
+ # Don't apply audience if the credentials file passed from user.
+ if hasattr(credentials, "with_gdch_audience"):
+ credentials = credentials.with_gdch_audience(
+ api_audience if api_audience else host
+ )
+
+ # If the credentials are service account credentials, then always try to use self signed JWT.
+ if (
+ always_use_jwt_access
+ and isinstance(credentials, service_account.Credentials)
+ and hasattr(service_account.Credentials, "with_always_use_jwt_access")
+ ):
+ credentials = credentials.with_always_use_jwt_access(True)
+
+ # Save the credentials.
+ self._credentials = credentials
+
+ # Save the hostname. Default to port 443 (HTTPS) if none is specified.
+ if ":" not in host:
+ host += ":443"
+ self._host = host
+
+ @property
+ def host(self):
+ return self._host
+
+ def _prep_wrapped_messages(self, client_info):
+ # Precompute the wrapped methods.
+ self._wrapped_methods = {
+ self.create_instance: gapic_v1.method.wrap_method(
+ self.create_instance,
+ default_timeout=300.0,
+ client_info=client_info,
+ ),
+ self.get_instance: gapic_v1.method.wrap_method(
+ self.get_instance,
+ default_retry=retries.Retry(
+ initial=1.0,
+ maximum=60.0,
+ multiplier=2,
+ predicate=retries.if_exception_type(
+ core_exceptions.DeadlineExceeded,
+ core_exceptions.ServiceUnavailable,
+ ),
+ deadline=60.0,
+ ),
+ default_timeout=60.0,
+ client_info=client_info,
+ ),
+ self.list_instances: gapic_v1.method.wrap_method(
+ self.list_instances,
+ default_retry=retries.Retry(
+ initial=1.0,
+ maximum=60.0,
+ multiplier=2,
+ predicate=retries.if_exception_type(
+ core_exceptions.DeadlineExceeded,
+ core_exceptions.ServiceUnavailable,
+ ),
+ deadline=60.0,
+ ),
+ default_timeout=60.0,
+ client_info=client_info,
+ ),
+ self.update_instance: gapic_v1.method.wrap_method(
+ self.update_instance,
+ default_retry=retries.Retry(
+ initial=1.0,
+ maximum=60.0,
+ multiplier=2,
+ predicate=retries.if_exception_type(
+ core_exceptions.DeadlineExceeded,
+ core_exceptions.ServiceUnavailable,
+ ),
+ deadline=60.0,
+ ),
+ default_timeout=60.0,
+ client_info=client_info,
+ ),
+ self.partial_update_instance: gapic_v1.method.wrap_method(
+ self.partial_update_instance,
+ default_retry=retries.Retry(
+ initial=1.0,
+ maximum=60.0,
+ multiplier=2,
+ predicate=retries.if_exception_type(
+ core_exceptions.DeadlineExceeded,
+ core_exceptions.ServiceUnavailable,
+ ),
+ deadline=60.0,
+ ),
+ default_timeout=60.0,
+ client_info=client_info,
+ ),
+ self.delete_instance: gapic_v1.method.wrap_method(
+ self.delete_instance,
+ default_timeout=60.0,
+ client_info=client_info,
+ ),
+ self.create_cluster: gapic_v1.method.wrap_method(
+ self.create_cluster,
+ default_timeout=60.0,
+ client_info=client_info,
+ ),
+ self.get_cluster: gapic_v1.method.wrap_method(
+ self.get_cluster,
+ default_retry=retries.Retry(
+ initial=1.0,
+ maximum=60.0,
+ multiplier=2,
+ predicate=retries.if_exception_type(
+ core_exceptions.DeadlineExceeded,
+ core_exceptions.ServiceUnavailable,
+ ),
+ deadline=60.0,
+ ),
+ default_timeout=60.0,
+ client_info=client_info,
+ ),
+ self.list_clusters: gapic_v1.method.wrap_method(
+ self.list_clusters,
+ default_retry=retries.Retry(
+ initial=1.0,
+ maximum=60.0,
+ multiplier=2,
+ predicate=retries.if_exception_type(
+ core_exceptions.DeadlineExceeded,
+ core_exceptions.ServiceUnavailable,
+ ),
+ deadline=60.0,
+ ),
+ default_timeout=60.0,
+ client_info=client_info,
+ ),
+ self.update_cluster: gapic_v1.method.wrap_method(
+ self.update_cluster,
+ default_retry=retries.Retry(
+ initial=1.0,
+ maximum=60.0,
+ multiplier=2,
+ predicate=retries.if_exception_type(
+ core_exceptions.DeadlineExceeded,
+ core_exceptions.ServiceUnavailable,
+ ),
+ deadline=60.0,
+ ),
+ default_timeout=60.0,
+ client_info=client_info,
+ ),
+ self.partial_update_cluster: gapic_v1.method.wrap_method(
+ self.partial_update_cluster,
+ default_timeout=None,
+ client_info=client_info,
+ ),
+ self.delete_cluster: gapic_v1.method.wrap_method(
+ self.delete_cluster,
+ default_timeout=60.0,
+ client_info=client_info,
+ ),
+ self.create_app_profile: gapic_v1.method.wrap_method(
+ self.create_app_profile,
+ default_timeout=60.0,
+ client_info=client_info,
+ ),
+ self.get_app_profile: gapic_v1.method.wrap_method(
+ self.get_app_profile,
+ default_retry=retries.Retry(
+ initial=1.0,
+ maximum=60.0,
+ multiplier=2,
+ predicate=retries.if_exception_type(
+ core_exceptions.DeadlineExceeded,
+ core_exceptions.ServiceUnavailable,
+ ),
+ deadline=60.0,
+ ),
+ default_timeout=60.0,
+ client_info=client_info,
+ ),
+ self.list_app_profiles: gapic_v1.method.wrap_method(
+ self.list_app_profiles,
+ default_retry=retries.Retry(
+ initial=1.0,
+ maximum=60.0,
+ multiplier=2,
+ predicate=retries.if_exception_type(
+ core_exceptions.DeadlineExceeded,
+ core_exceptions.ServiceUnavailable,
+ ),
+ deadline=60.0,
+ ),
+ default_timeout=60.0,
+ client_info=client_info,
+ ),
+ self.update_app_profile: gapic_v1.method.wrap_method(
+ self.update_app_profile,
+ default_retry=retries.Retry(
+ initial=1.0,
+ maximum=60.0,
+ multiplier=2,
+ predicate=retries.if_exception_type(
+ core_exceptions.DeadlineExceeded,
+ core_exceptions.ServiceUnavailable,
+ ),
+ deadline=60.0,
+ ),
+ default_timeout=60.0,
+ client_info=client_info,
+ ),
+ self.delete_app_profile: gapic_v1.method.wrap_method(
+ self.delete_app_profile,
+ default_timeout=60.0,
+ client_info=client_info,
+ ),
+ self.get_iam_policy: gapic_v1.method.wrap_method(
+ self.get_iam_policy,
+ default_retry=retries.Retry(
+ initial=1.0,
+ maximum=60.0,
+ multiplier=2,
+ predicate=retries.if_exception_type(
+ core_exceptions.DeadlineExceeded,
+ core_exceptions.ServiceUnavailable,
+ ),
+ deadline=60.0,
+ ),
+ default_timeout=60.0,
+ client_info=client_info,
+ ),
+ self.set_iam_policy: gapic_v1.method.wrap_method(
+ self.set_iam_policy,
+ default_timeout=60.0,
+ client_info=client_info,
+ ),
+ self.test_iam_permissions: gapic_v1.method.wrap_method(
+ self.test_iam_permissions,
+ default_retry=retries.Retry(
+ initial=1.0,
+ maximum=60.0,
+ multiplier=2,
+ predicate=retries.if_exception_type(
+ core_exceptions.DeadlineExceeded,
+ core_exceptions.ServiceUnavailable,
+ ),
+ deadline=60.0,
+ ),
+ default_timeout=60.0,
+ client_info=client_info,
+ ),
+ self.list_hot_tablets: gapic_v1.method.wrap_method(
+ self.list_hot_tablets,
+ default_retry=retries.Retry(
+ initial=1.0,
+ maximum=60.0,
+ multiplier=2,
+ predicate=retries.if_exception_type(
+ core_exceptions.DeadlineExceeded,
+ core_exceptions.ServiceUnavailable,
+ ),
+ deadline=60.0,
+ ),
+ default_timeout=60.0,
+ client_info=client_info,
+ ),
+ self.create_logical_view: gapic_v1.method.wrap_method(
+ self.create_logical_view,
+ default_timeout=None,
+ client_info=client_info,
+ ),
+ self.get_logical_view: gapic_v1.method.wrap_method(
+ self.get_logical_view,
+ default_timeout=None,
+ client_info=client_info,
+ ),
+ self.list_logical_views: gapic_v1.method.wrap_method(
+ self.list_logical_views,
+ default_timeout=None,
+ client_info=client_info,
+ ),
+ self.update_logical_view: gapic_v1.method.wrap_method(
+ self.update_logical_view,
+ default_timeout=None,
+ client_info=client_info,
+ ),
+ self.delete_logical_view: gapic_v1.method.wrap_method(
+ self.delete_logical_view,
+ default_timeout=None,
+ client_info=client_info,
+ ),
+ self.create_materialized_view: gapic_v1.method.wrap_method(
+ self.create_materialized_view,
+ default_timeout=None,
+ client_info=client_info,
+ ),
+ self.get_materialized_view: gapic_v1.method.wrap_method(
+ self.get_materialized_view,
+ default_timeout=None,
+ client_info=client_info,
+ ),
+ self.list_materialized_views: gapic_v1.method.wrap_method(
+ self.list_materialized_views,
+ default_timeout=None,
+ client_info=client_info,
+ ),
+ self.update_materialized_view: gapic_v1.method.wrap_method(
+ self.update_materialized_view,
+ default_timeout=None,
+ client_info=client_info,
+ ),
+ self.delete_materialized_view: gapic_v1.method.wrap_method(
+ self.delete_materialized_view,
+ default_timeout=None,
+ client_info=client_info,
+ ),
+ }
+
+ def close(self):
+ """Closes resources associated with the transport.
+
+ .. warning::
+ Only call this method if the transport is NOT shared
+ with other clients - this may cause errors in other clients!
+ """
+ raise NotImplementedError()
+
+ @property
+ def operations_client(self):
+ """Return the client designed to process long-running operations."""
+ raise NotImplementedError()
+
+ @property
+ def create_instance(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.CreateInstanceRequest],
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
+ ]:
+ raise NotImplementedError()
+
+ @property
+ def get_instance(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.GetInstanceRequest],
+ Union[instance.Instance, Awaitable[instance.Instance]],
+ ]:
+ raise NotImplementedError()
+
+ @property
+ def list_instances(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.ListInstancesRequest],
+ Union[
+ bigtable_instance_admin.ListInstancesResponse,
+ Awaitable[bigtable_instance_admin.ListInstancesResponse],
+ ],
+ ]:
+ raise NotImplementedError()
+
+ @property
+ def update_instance(
+ self,
+ ) -> Callable[
+ [instance.Instance], Union[instance.Instance, Awaitable[instance.Instance]]
+ ]:
+ raise NotImplementedError()
+
+ @property
+ def partial_update_instance(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.PartialUpdateInstanceRequest],
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
+ ]:
+ raise NotImplementedError()
+
+ @property
+ def delete_instance(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.DeleteInstanceRequest],
+ Union[empty_pb2.Empty, Awaitable[empty_pb2.Empty]],
+ ]:
+ raise NotImplementedError()
+
+ @property
+ def create_cluster(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.CreateClusterRequest],
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
+ ]:
+ raise NotImplementedError()
+
+ @property
+ def get_cluster(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.GetClusterRequest],
+ Union[instance.Cluster, Awaitable[instance.Cluster]],
+ ]:
+ raise NotImplementedError()
+
+ @property
+ def list_clusters(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.ListClustersRequest],
+ Union[
+ bigtable_instance_admin.ListClustersResponse,
+ Awaitable[bigtable_instance_admin.ListClustersResponse],
+ ],
+ ]:
+ raise NotImplementedError()
+
+ @property
+ def update_cluster(
+ self,
+ ) -> Callable[
+ [instance.Cluster],
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
+ ]:
+ raise NotImplementedError()
+
+ @property
+ def partial_update_cluster(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.PartialUpdateClusterRequest],
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
+ ]:
+ raise NotImplementedError()
+
+ @property
+ def delete_cluster(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.DeleteClusterRequest],
+ Union[empty_pb2.Empty, Awaitable[empty_pb2.Empty]],
+ ]:
+ raise NotImplementedError()
+
+ @property
+ def create_app_profile(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.CreateAppProfileRequest],
+ Union[instance.AppProfile, Awaitable[instance.AppProfile]],
+ ]:
+ raise NotImplementedError()
+
+ @property
+ def get_app_profile(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.GetAppProfileRequest],
+ Union[instance.AppProfile, Awaitable[instance.AppProfile]],
+ ]:
+ raise NotImplementedError()
+
+ @property
+ def list_app_profiles(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.ListAppProfilesRequest],
+ Union[
+ bigtable_instance_admin.ListAppProfilesResponse,
+ Awaitable[bigtable_instance_admin.ListAppProfilesResponse],
+ ],
+ ]:
+ raise NotImplementedError()
+
+ @property
+ def update_app_profile(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.UpdateAppProfileRequest],
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
+ ]:
+ raise NotImplementedError()
+
+ @property
+ def delete_app_profile(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.DeleteAppProfileRequest],
+ Union[empty_pb2.Empty, Awaitable[empty_pb2.Empty]],
+ ]:
+ raise NotImplementedError()
+
+ @property
+ def get_iam_policy(
+ self,
+ ) -> Callable[
+ [iam_policy_pb2.GetIamPolicyRequest],
+ Union[policy_pb2.Policy, Awaitable[policy_pb2.Policy]],
+ ]:
+ raise NotImplementedError()
+
+ @property
+ def set_iam_policy(
+ self,
+ ) -> Callable[
+ [iam_policy_pb2.SetIamPolicyRequest],
+ Union[policy_pb2.Policy, Awaitable[policy_pb2.Policy]],
+ ]:
+ raise NotImplementedError()
+
+ @property
+ def test_iam_permissions(
+ self,
+ ) -> Callable[
+ [iam_policy_pb2.TestIamPermissionsRequest],
+ Union[
+ iam_policy_pb2.TestIamPermissionsResponse,
+ Awaitable[iam_policy_pb2.TestIamPermissionsResponse],
+ ],
+ ]:
+ raise NotImplementedError()
+
+ @property
+ def list_hot_tablets(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.ListHotTabletsRequest],
+ Union[
+ bigtable_instance_admin.ListHotTabletsResponse,
+ Awaitable[bigtable_instance_admin.ListHotTabletsResponse],
+ ],
+ ]:
+ raise NotImplementedError()
+
+ @property
+ def create_logical_view(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.CreateLogicalViewRequest],
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
+ ]:
+ raise NotImplementedError()
+
+ @property
+ def get_logical_view(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.GetLogicalViewRequest],
+ Union[instance.LogicalView, Awaitable[instance.LogicalView]],
+ ]:
+ raise NotImplementedError()
+
+ @property
+ def list_logical_views(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.ListLogicalViewsRequest],
+ Union[
+ bigtable_instance_admin.ListLogicalViewsResponse,
+ Awaitable[bigtable_instance_admin.ListLogicalViewsResponse],
+ ],
+ ]:
+ raise NotImplementedError()
+
+ @property
+ def update_logical_view(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.UpdateLogicalViewRequest],
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
+ ]:
+ raise NotImplementedError()
+
+ @property
+ def delete_logical_view(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.DeleteLogicalViewRequest],
+ Union[empty_pb2.Empty, Awaitable[empty_pb2.Empty]],
+ ]:
+ raise NotImplementedError()
+
+ @property
+ def create_materialized_view(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.CreateMaterializedViewRequest],
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
+ ]:
+ raise NotImplementedError()
+
+ @property
+ def get_materialized_view(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.GetMaterializedViewRequest],
+ Union[instance.MaterializedView, Awaitable[instance.MaterializedView]],
+ ]:
+ raise NotImplementedError()
+
+ @property
+ def list_materialized_views(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.ListMaterializedViewsRequest],
+ Union[
+ bigtable_instance_admin.ListMaterializedViewsResponse,
+ Awaitable[bigtable_instance_admin.ListMaterializedViewsResponse],
+ ],
+ ]:
+ raise NotImplementedError()
+
+ @property
+ def update_materialized_view(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.UpdateMaterializedViewRequest],
+ Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
+ ]:
+ raise NotImplementedError()
+
+ @property
+ def delete_materialized_view(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.DeleteMaterializedViewRequest],
+ Union[empty_pb2.Empty, Awaitable[empty_pb2.Empty]],
+ ]:
+ raise NotImplementedError()
+
+ @property
+ def kind(self) -> str:
+ raise NotImplementedError()
+
+
+__all__ = ("BigtableInstanceAdminTransport",)
diff --git a/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/grpc.py b/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/grpc.py
new file mode 100644
index 000000000..d5d5cf1e5
--- /dev/null
+++ b/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/grpc.py
@@ -0,0 +1,1250 @@
+# -*- coding: utf-8 -*-
+# Copyright 2025 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.
+#
+import json
+import logging as std_logging
+import pickle
+import warnings
+from typing import Callable, Dict, Optional, Sequence, Tuple, Union
+
+from google.api_core import grpc_helpers
+from google.api_core import operations_v1
+from google.api_core import gapic_v1
+import google.auth # type: ignore
+from google.auth import credentials as ga_credentials # type: ignore
+from google.auth.transport.grpc import SslCredentials # type: ignore
+from google.protobuf.json_format import MessageToJson
+import google.protobuf.message
+
+import grpc # type: ignore
+import proto # type: ignore
+
+from google.cloud.bigtable_admin_v2.types import bigtable_instance_admin
+from google.cloud.bigtable_admin_v2.types import instance
+from google.iam.v1 import iam_policy_pb2 # type: ignore
+from google.iam.v1 import policy_pb2 # type: ignore
+from google.longrunning import operations_pb2 # type: ignore
+from google.protobuf import empty_pb2 # type: ignore
+from .base import BigtableInstanceAdminTransport, DEFAULT_CLIENT_INFO
+
+try:
+ from google.api_core import client_logging # type: ignore
+
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
+except ImportError: # pragma: NO COVER
+ CLIENT_LOGGING_SUPPORTED = False
+
+_LOGGER = std_logging.getLogger(__name__)
+
+
+class _LoggingClientInterceptor(grpc.UnaryUnaryClientInterceptor): # pragma: NO COVER
+ def intercept_unary_unary(self, continuation, client_call_details, request):
+ logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ std_logging.DEBUG
+ )
+ if logging_enabled: # pragma: NO COVER
+ request_metadata = client_call_details.metadata
+ if isinstance(request, proto.Message):
+ request_payload = type(request).to_json(request)
+ elif isinstance(request, google.protobuf.message.Message):
+ request_payload = MessageToJson(request)
+ else:
+ request_payload = f"{type(request).__name__}: {pickle.dumps(request)}"
+
+ request_metadata = {
+ key: value.decode("utf-8") if isinstance(value, bytes) else value
+ for key, value in request_metadata
+ }
+ grpc_request = {
+ "payload": request_payload,
+ "requestMethod": "grpc",
+ "metadata": dict(request_metadata),
+ }
+ _LOGGER.debug(
+ f"Sending request for {client_call_details.method}",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": str(client_call_details.method),
+ "request": grpc_request,
+ "metadata": grpc_request["metadata"],
+ },
+ )
+ response = continuation(client_call_details, request)
+ if logging_enabled: # pragma: NO COVER
+ response_metadata = response.trailing_metadata()
+ # Convert gRPC metadata `` to list of tuples
+ metadata = (
+ dict([(k, str(v)) for k, v in response_metadata])
+ if response_metadata
+ else None
+ )
+ result = response.result()
+ if isinstance(result, proto.Message):
+ response_payload = type(result).to_json(result)
+ elif isinstance(result, google.protobuf.message.Message):
+ response_payload = MessageToJson(result)
+ else:
+ response_payload = f"{type(result).__name__}: {pickle.dumps(result)}"
+ grpc_response = {
+ "payload": response_payload,
+ "metadata": metadata,
+ "status": "OK",
+ }
+ _LOGGER.debug(
+ f"Received response for {client_call_details.method}.",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": client_call_details.method,
+ "response": grpc_response,
+ "metadata": grpc_response["metadata"],
+ },
+ )
+ return response
+
+
+class BigtableInstanceAdminGrpcTransport(BigtableInstanceAdminTransport):
+ """gRPC backend transport for BigtableInstanceAdmin.
+
+ Service for creating, configuring, and deleting Cloud
+ Bigtable Instances and Clusters. Provides access to the Instance
+ and Cluster schemas only, not the tables' metadata or data
+ stored in those tables.
+
+ This class defines the same methods as the primary client, so the
+ primary client can load the underlying transport implementation
+ and call it.
+
+ It sends protocol buffers over the wire using gRPC (which is built on
+ top of HTTP/2); the ``grpcio`` package must be installed.
+ """
+
+ _stubs: Dict[str, Callable]
+
+ def __init__(
+ self,
+ *,
+ host: str = "bigtableadmin.googleapis.com",
+ credentials: Optional[ga_credentials.Credentials] = None,
+ credentials_file: Optional[str] = None,
+ scopes: Optional[Sequence[str]] = None,
+ channel: Optional[Union[grpc.Channel, Callable[..., grpc.Channel]]] = None,
+ api_mtls_endpoint: Optional[str] = None,
+ client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
+ ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None,
+ client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
+ quota_project_id: Optional[str] = None,
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
+ always_use_jwt_access: Optional[bool] = False,
+ api_audience: Optional[str] = None,
+ ) -> None:
+ """Instantiate the transport.
+
+ Args:
+ host (Optional[str]):
+ The hostname to connect to (default: 'bigtableadmin.googleapis.com').
+ credentials (Optional[google.auth.credentials.Credentials]): The
+ authorization credentials to attach to requests. These
+ credentials identify the application to the service; if none
+ are specified, the client will attempt to ascertain the
+ credentials from the environment.
+ This argument is ignored if a ``channel`` instance is provided.
+ credentials_file (Optional[str]): Deprecated. A file with credentials that can
+ be loaded with :func:`google.auth.load_credentials_from_file`.
+ This argument is ignored if a ``channel`` instance is provided.
+ This argument will be removed in the next major version of this library.
+ scopes (Optional(Sequence[str])): A list of scopes. This argument is
+ ignored if a ``channel`` instance is provided.
+ channel (Optional[Union[grpc.Channel, Callable[..., grpc.Channel]]]):
+ A ``Channel`` instance through which to make calls, or a Callable
+ that constructs and returns one. If set to None, ``self.create_channel``
+ is used to create the channel. If a Callable is given, it will be called
+ with the same arguments as used in ``self.create_channel``.
+ api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint.
+ If provided, it overrides the ``host`` argument and tries to create
+ a mutual TLS channel with client SSL credentials from
+ ``client_cert_source`` or application default SSL credentials.
+ client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]):
+ Deprecated. A callback to provide client SSL certificate bytes and
+ private key bytes, both in PEM format. It is ignored if
+ ``api_mtls_endpoint`` is None.
+ ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials
+ for the grpc channel. It is ignored if a ``channel`` instance is provided.
+ client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]):
+ A callback to provide client certificate bytes and private key bytes,
+ both in PEM format. It is used to configure a mutual TLS channel. It is
+ ignored if a ``channel`` instance or ``ssl_channel_credentials`` is provided.
+ quota_project_id (Optional[str]): An optional project to use for billing
+ and quota.
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
+ The client info used to send a user-agent string along with
+ API requests. If ``None``, then default info will be used.
+ Generally, you only need to set this if you're developing
+ your own client library.
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
+ be used for service account credentials.
+
+ Raises:
+ google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport
+ creation failed for any reason.
+ google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
+ and ``credentials_file`` are passed.
+ """
+ self._grpc_channel = None
+ self._ssl_channel_credentials = ssl_channel_credentials
+ self._stubs: Dict[str, Callable] = {}
+ self._operations_client: Optional[operations_v1.OperationsClient] = None
+
+ if api_mtls_endpoint:
+ warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)
+ if client_cert_source:
+ warnings.warn("client_cert_source is deprecated", DeprecationWarning)
+
+ if isinstance(channel, grpc.Channel):
+ # Ignore credentials if a channel was passed.
+ credentials = None
+ self._ignore_credentials = True
+ # If a channel was explicitly provided, set it.
+ self._grpc_channel = channel
+ self._ssl_channel_credentials = None
+
+ else:
+ if api_mtls_endpoint:
+ host = api_mtls_endpoint
+
+ # Create SSL credentials with client_cert_source or application
+ # default SSL credentials.
+ if client_cert_source:
+ cert, key = client_cert_source()
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
+ certificate_chain=cert, private_key=key
+ )
+ else:
+ self._ssl_channel_credentials = SslCredentials().ssl_credentials
+
+ else:
+ if client_cert_source_for_mtls and not ssl_channel_credentials:
+ cert, key = client_cert_source_for_mtls()
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
+ certificate_chain=cert, private_key=key
+ )
+
+ # The base transport sets the host, credentials and scopes
+ super().__init__(
+ host=host,
+ credentials=credentials,
+ credentials_file=credentials_file,
+ scopes=scopes,
+ quota_project_id=quota_project_id,
+ client_info=client_info,
+ always_use_jwt_access=always_use_jwt_access,
+ api_audience=api_audience,
+ )
+
+ if not self._grpc_channel:
+ # initialize with the provided callable or the default channel
+ channel_init = channel or type(self).create_channel
+ self._grpc_channel = channel_init(
+ self._host,
+ # use the credentials which are saved
+ credentials=self._credentials,
+ # Set ``credentials_file`` to ``None`` here as
+ # the credentials that we saved earlier should be used.
+ credentials_file=None,
+ scopes=self._scopes,
+ ssl_credentials=self._ssl_channel_credentials,
+ quota_project_id=quota_project_id,
+ options=[
+ ("grpc.max_send_message_length", -1),
+ ("grpc.max_receive_message_length", -1),
+ ],
+ )
+
+ self._interceptor = _LoggingClientInterceptor()
+ self._logged_channel = grpc.intercept_channel(
+ self._grpc_channel, self._interceptor
+ )
+
+ # Wrap messages. This must be done after self._logged_channel exists
+ self._prep_wrapped_messages(client_info)
+
+ @classmethod
+ def create_channel(
+ cls,
+ host: str = "bigtableadmin.googleapis.com",
+ credentials: Optional[ga_credentials.Credentials] = None,
+ credentials_file: Optional[str] = None,
+ scopes: Optional[Sequence[str]] = None,
+ quota_project_id: Optional[str] = None,
+ **kwargs,
+ ) -> grpc.Channel:
+ """Create and return a gRPC channel object.
+ Args:
+ host (Optional[str]): The host for the channel to use.
+ credentials (Optional[~.Credentials]): The
+ authorization credentials to attach to requests. These
+ credentials identify this application to the service. If
+ none are specified, the client will attempt to ascertain
+ the credentials from the environment.
+ credentials_file (Optional[str]): Deprecated. A file with credentials that can
+ be loaded with :func:`google.auth.load_credentials_from_file`.
+ This argument is mutually exclusive with credentials. This argument will be
+ removed in the next major version of this library.
+ scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
+ service. These are only used when credentials are not specified and
+ are passed to :func:`google.auth.default`.
+ quota_project_id (Optional[str]): An optional project to use for billing
+ and quota.
+ kwargs (Optional[dict]): Keyword arguments, which are passed to the
+ channel creation.
+ Returns:
+ grpc.Channel: A gRPC channel object.
+
+ Raises:
+ google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
+ and ``credentials_file`` are passed.
+ """
+
+ return grpc_helpers.create_channel(
+ host,
+ credentials=credentials,
+ credentials_file=credentials_file,
+ quota_project_id=quota_project_id,
+ default_scopes=cls.AUTH_SCOPES,
+ scopes=scopes,
+ default_host=cls.DEFAULT_HOST,
+ **kwargs,
+ )
+
+ @property
+ def grpc_channel(self) -> grpc.Channel:
+ """Return the channel designed to connect to this service."""
+ return self._grpc_channel
+
+ @property
+ def operations_client(self) -> operations_v1.OperationsClient:
+ """Create the client designed to process long-running operations.
+
+ This property caches on the instance; repeated calls return the same
+ client.
+ """
+ # Quick check: Only create a new client if we do not already have one.
+ if self._operations_client is None:
+ self._operations_client = operations_v1.OperationsClient(
+ self._logged_channel
+ )
+
+ # Return the client from cache.
+ return self._operations_client
+
+ @property
+ def create_instance(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.CreateInstanceRequest], operations_pb2.Operation
+ ]:
+ r"""Return a callable for the create instance method over gRPC.
+
+ Create an instance within a project.
+
+ Note that exactly one of Cluster.serve_nodes and
+ Cluster.cluster_config.cluster_autoscaling_config can be set. If
+ serve_nodes is set to non-zero, then the cluster is manually
+ scaled. If cluster_config.cluster_autoscaling_config is
+ non-empty, then autoscaling is enabled.
+
+ Returns:
+ Callable[[~.CreateInstanceRequest],
+ ~.Operation]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "create_instance" not in self._stubs:
+ self._stubs["create_instance"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/CreateInstance",
+ request_serializer=bigtable_instance_admin.CreateInstanceRequest.serialize,
+ response_deserializer=operations_pb2.Operation.FromString,
+ )
+ return self._stubs["create_instance"]
+
+ @property
+ def get_instance(
+ self,
+ ) -> Callable[[bigtable_instance_admin.GetInstanceRequest], instance.Instance]:
+ r"""Return a callable for the get instance method over gRPC.
+
+ Gets information about an instance.
+
+ Returns:
+ Callable[[~.GetInstanceRequest],
+ ~.Instance]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "get_instance" not in self._stubs:
+ self._stubs["get_instance"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/GetInstance",
+ request_serializer=bigtable_instance_admin.GetInstanceRequest.serialize,
+ response_deserializer=instance.Instance.deserialize,
+ )
+ return self._stubs["get_instance"]
+
+ @property
+ def list_instances(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.ListInstancesRequest],
+ bigtable_instance_admin.ListInstancesResponse,
+ ]:
+ r"""Return a callable for the list instances method over gRPC.
+
+ Lists information about instances in a project.
+
+ Returns:
+ Callable[[~.ListInstancesRequest],
+ ~.ListInstancesResponse]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "list_instances" not in self._stubs:
+ self._stubs["list_instances"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/ListInstances",
+ request_serializer=bigtable_instance_admin.ListInstancesRequest.serialize,
+ response_deserializer=bigtable_instance_admin.ListInstancesResponse.deserialize,
+ )
+ return self._stubs["list_instances"]
+
+ @property
+ def update_instance(self) -> Callable[[instance.Instance], instance.Instance]:
+ r"""Return a callable for the update instance method over gRPC.
+
+ Updates an instance within a project. This method
+ updates only the display name and type for an Instance.
+ To update other Instance properties, such as labels, use
+ PartialUpdateInstance.
+
+ Returns:
+ Callable[[~.Instance],
+ ~.Instance]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "update_instance" not in self._stubs:
+ self._stubs["update_instance"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/UpdateInstance",
+ request_serializer=instance.Instance.serialize,
+ response_deserializer=instance.Instance.deserialize,
+ )
+ return self._stubs["update_instance"]
+
+ @property
+ def partial_update_instance(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.PartialUpdateInstanceRequest], operations_pb2.Operation
+ ]:
+ r"""Return a callable for the partial update instance method over gRPC.
+
+ Partially updates an instance within a project. This
+ method can modify all fields of an Instance and is the
+ preferred way to update an Instance.
+
+ Returns:
+ Callable[[~.PartialUpdateInstanceRequest],
+ ~.Operation]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "partial_update_instance" not in self._stubs:
+ self._stubs["partial_update_instance"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/PartialUpdateInstance",
+ request_serializer=bigtable_instance_admin.PartialUpdateInstanceRequest.serialize,
+ response_deserializer=operations_pb2.Operation.FromString,
+ )
+ return self._stubs["partial_update_instance"]
+
+ @property
+ def delete_instance(
+ self,
+ ) -> Callable[[bigtable_instance_admin.DeleteInstanceRequest], empty_pb2.Empty]:
+ r"""Return a callable for the delete instance method over gRPC.
+
+ Delete an instance from a project.
+
+ Returns:
+ Callable[[~.DeleteInstanceRequest],
+ ~.Empty]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "delete_instance" not in self._stubs:
+ self._stubs["delete_instance"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/DeleteInstance",
+ request_serializer=bigtable_instance_admin.DeleteInstanceRequest.serialize,
+ response_deserializer=empty_pb2.Empty.FromString,
+ )
+ return self._stubs["delete_instance"]
+
+ @property
+ def create_cluster(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.CreateClusterRequest], operations_pb2.Operation
+ ]:
+ r"""Return a callable for the create cluster method over gRPC.
+
+ Creates a cluster within an instance.
+
+ Note that exactly one of Cluster.serve_nodes and
+ Cluster.cluster_config.cluster_autoscaling_config can be set. If
+ serve_nodes is set to non-zero, then the cluster is manually
+ scaled. If cluster_config.cluster_autoscaling_config is
+ non-empty, then autoscaling is enabled.
+
+ Returns:
+ Callable[[~.CreateClusterRequest],
+ ~.Operation]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "create_cluster" not in self._stubs:
+ self._stubs["create_cluster"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/CreateCluster",
+ request_serializer=bigtable_instance_admin.CreateClusterRequest.serialize,
+ response_deserializer=operations_pb2.Operation.FromString,
+ )
+ return self._stubs["create_cluster"]
+
+ @property
+ def get_cluster(
+ self,
+ ) -> Callable[[bigtable_instance_admin.GetClusterRequest], instance.Cluster]:
+ r"""Return a callable for the get cluster method over gRPC.
+
+ Gets information about a cluster.
+
+ Returns:
+ Callable[[~.GetClusterRequest],
+ ~.Cluster]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "get_cluster" not in self._stubs:
+ self._stubs["get_cluster"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/GetCluster",
+ request_serializer=bigtable_instance_admin.GetClusterRequest.serialize,
+ response_deserializer=instance.Cluster.deserialize,
+ )
+ return self._stubs["get_cluster"]
+
+ @property
+ def list_clusters(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.ListClustersRequest],
+ bigtable_instance_admin.ListClustersResponse,
+ ]:
+ r"""Return a callable for the list clusters method over gRPC.
+
+ Lists information about clusters in an instance.
+
+ Returns:
+ Callable[[~.ListClustersRequest],
+ ~.ListClustersResponse]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "list_clusters" not in self._stubs:
+ self._stubs["list_clusters"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/ListClusters",
+ request_serializer=bigtable_instance_admin.ListClustersRequest.serialize,
+ response_deserializer=bigtable_instance_admin.ListClustersResponse.deserialize,
+ )
+ return self._stubs["list_clusters"]
+
+ @property
+ def update_cluster(self) -> Callable[[instance.Cluster], operations_pb2.Operation]:
+ r"""Return a callable for the update cluster method over gRPC.
+
+ Updates a cluster within an instance.
+
+ Note that UpdateCluster does not support updating
+ cluster_config.cluster_autoscaling_config. In order to update
+ it, you must use PartialUpdateCluster.
+
+ Returns:
+ Callable[[~.Cluster],
+ ~.Operation]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "update_cluster" not in self._stubs:
+ self._stubs["update_cluster"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/UpdateCluster",
+ request_serializer=instance.Cluster.serialize,
+ response_deserializer=operations_pb2.Operation.FromString,
+ )
+ return self._stubs["update_cluster"]
+
+ @property
+ def partial_update_cluster(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.PartialUpdateClusterRequest], operations_pb2.Operation
+ ]:
+ r"""Return a callable for the partial update cluster method over gRPC.
+
+ Partially updates a cluster within a project. This method is the
+ preferred way to update a Cluster.
+
+ To enable and update autoscaling, set
+ cluster_config.cluster_autoscaling_config. When autoscaling is
+ enabled, serve_nodes is treated as an OUTPUT_ONLY field, meaning
+ that updates to it are ignored. Note that an update cannot
+ simultaneously set serve_nodes to non-zero and
+ cluster_config.cluster_autoscaling_config to non-empty, and also
+ specify both in the update_mask.
+
+ To disable autoscaling, clear
+ cluster_config.cluster_autoscaling_config, and explicitly set a
+ serve_node count via the update_mask.
+
+ Returns:
+ Callable[[~.PartialUpdateClusterRequest],
+ ~.Operation]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "partial_update_cluster" not in self._stubs:
+ self._stubs["partial_update_cluster"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/PartialUpdateCluster",
+ request_serializer=bigtable_instance_admin.PartialUpdateClusterRequest.serialize,
+ response_deserializer=operations_pb2.Operation.FromString,
+ )
+ return self._stubs["partial_update_cluster"]
+
+ @property
+ def delete_cluster(
+ self,
+ ) -> Callable[[bigtable_instance_admin.DeleteClusterRequest], empty_pb2.Empty]:
+ r"""Return a callable for the delete cluster method over gRPC.
+
+ Deletes a cluster from an instance.
+
+ Returns:
+ Callable[[~.DeleteClusterRequest],
+ ~.Empty]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "delete_cluster" not in self._stubs:
+ self._stubs["delete_cluster"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/DeleteCluster",
+ request_serializer=bigtable_instance_admin.DeleteClusterRequest.serialize,
+ response_deserializer=empty_pb2.Empty.FromString,
+ )
+ return self._stubs["delete_cluster"]
+
+ @property
+ def create_app_profile(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.CreateAppProfileRequest], instance.AppProfile
+ ]:
+ r"""Return a callable for the create app profile method over gRPC.
+
+ Creates an app profile within an instance.
+
+ Returns:
+ Callable[[~.CreateAppProfileRequest],
+ ~.AppProfile]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "create_app_profile" not in self._stubs:
+ self._stubs["create_app_profile"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/CreateAppProfile",
+ request_serializer=bigtable_instance_admin.CreateAppProfileRequest.serialize,
+ response_deserializer=instance.AppProfile.deserialize,
+ )
+ return self._stubs["create_app_profile"]
+
+ @property
+ def get_app_profile(
+ self,
+ ) -> Callable[[bigtable_instance_admin.GetAppProfileRequest], instance.AppProfile]:
+ r"""Return a callable for the get app profile method over gRPC.
+
+ Gets information about an app profile.
+
+ Returns:
+ Callable[[~.GetAppProfileRequest],
+ ~.AppProfile]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "get_app_profile" not in self._stubs:
+ self._stubs["get_app_profile"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/GetAppProfile",
+ request_serializer=bigtable_instance_admin.GetAppProfileRequest.serialize,
+ response_deserializer=instance.AppProfile.deserialize,
+ )
+ return self._stubs["get_app_profile"]
+
+ @property
+ def list_app_profiles(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.ListAppProfilesRequest],
+ bigtable_instance_admin.ListAppProfilesResponse,
+ ]:
+ r"""Return a callable for the list app profiles method over gRPC.
+
+ Lists information about app profiles in an instance.
+
+ Returns:
+ Callable[[~.ListAppProfilesRequest],
+ ~.ListAppProfilesResponse]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "list_app_profiles" not in self._stubs:
+ self._stubs["list_app_profiles"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/ListAppProfiles",
+ request_serializer=bigtable_instance_admin.ListAppProfilesRequest.serialize,
+ response_deserializer=bigtable_instance_admin.ListAppProfilesResponse.deserialize,
+ )
+ return self._stubs["list_app_profiles"]
+
+ @property
+ def update_app_profile(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.UpdateAppProfileRequest], operations_pb2.Operation
+ ]:
+ r"""Return a callable for the update app profile method over gRPC.
+
+ Updates an app profile within an instance.
+
+ Returns:
+ Callable[[~.UpdateAppProfileRequest],
+ ~.Operation]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "update_app_profile" not in self._stubs:
+ self._stubs["update_app_profile"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/UpdateAppProfile",
+ request_serializer=bigtable_instance_admin.UpdateAppProfileRequest.serialize,
+ response_deserializer=operations_pb2.Operation.FromString,
+ )
+ return self._stubs["update_app_profile"]
+
+ @property
+ def delete_app_profile(
+ self,
+ ) -> Callable[[bigtable_instance_admin.DeleteAppProfileRequest], empty_pb2.Empty]:
+ r"""Return a callable for the delete app profile method over gRPC.
+
+ Deletes an app profile from an instance.
+
+ Returns:
+ Callable[[~.DeleteAppProfileRequest],
+ ~.Empty]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "delete_app_profile" not in self._stubs:
+ self._stubs["delete_app_profile"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/DeleteAppProfile",
+ request_serializer=bigtable_instance_admin.DeleteAppProfileRequest.serialize,
+ response_deserializer=empty_pb2.Empty.FromString,
+ )
+ return self._stubs["delete_app_profile"]
+
+ @property
+ def get_iam_policy(
+ self,
+ ) -> Callable[[iam_policy_pb2.GetIamPolicyRequest], policy_pb2.Policy]:
+ r"""Return a callable for the get iam policy method over gRPC.
+
+ Gets the access control policy for an instance
+ resource. Returns an empty policy if an instance exists
+ but does not have a policy set.
+
+ Returns:
+ Callable[[~.GetIamPolicyRequest],
+ ~.Policy]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "get_iam_policy" not in self._stubs:
+ self._stubs["get_iam_policy"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/GetIamPolicy",
+ request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString,
+ response_deserializer=policy_pb2.Policy.FromString,
+ )
+ return self._stubs["get_iam_policy"]
+
+ @property
+ def set_iam_policy(
+ self,
+ ) -> Callable[[iam_policy_pb2.SetIamPolicyRequest], policy_pb2.Policy]:
+ r"""Return a callable for the set iam policy method over gRPC.
+
+ Sets the access control policy on an instance
+ resource. Replaces any existing policy.
+
+ Returns:
+ Callable[[~.SetIamPolicyRequest],
+ ~.Policy]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "set_iam_policy" not in self._stubs:
+ self._stubs["set_iam_policy"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/SetIamPolicy",
+ request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString,
+ response_deserializer=policy_pb2.Policy.FromString,
+ )
+ return self._stubs["set_iam_policy"]
+
+ @property
+ def test_iam_permissions(
+ self,
+ ) -> Callable[
+ [iam_policy_pb2.TestIamPermissionsRequest],
+ iam_policy_pb2.TestIamPermissionsResponse,
+ ]:
+ r"""Return a callable for the test iam permissions method over gRPC.
+
+ Returns permissions that the caller has on the
+ specified instance resource.
+
+ Returns:
+ Callable[[~.TestIamPermissionsRequest],
+ ~.TestIamPermissionsResponse]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "test_iam_permissions" not in self._stubs:
+ self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/TestIamPermissions",
+ request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString,
+ response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString,
+ )
+ return self._stubs["test_iam_permissions"]
+
+ @property
+ def list_hot_tablets(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.ListHotTabletsRequest],
+ bigtable_instance_admin.ListHotTabletsResponse,
+ ]:
+ r"""Return a callable for the list hot tablets method over gRPC.
+
+ Lists hot tablets in a cluster, within the time range
+ provided. Hot tablets are ordered based on CPU usage.
+
+ Returns:
+ Callable[[~.ListHotTabletsRequest],
+ ~.ListHotTabletsResponse]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "list_hot_tablets" not in self._stubs:
+ self._stubs["list_hot_tablets"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/ListHotTablets",
+ request_serializer=bigtable_instance_admin.ListHotTabletsRequest.serialize,
+ response_deserializer=bigtable_instance_admin.ListHotTabletsResponse.deserialize,
+ )
+ return self._stubs["list_hot_tablets"]
+
+ @property
+ def create_logical_view(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.CreateLogicalViewRequest], operations_pb2.Operation
+ ]:
+ r"""Return a callable for the create logical view method over gRPC.
+
+ Creates a logical view within an instance.
+
+ Returns:
+ Callable[[~.CreateLogicalViewRequest],
+ ~.Operation]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "create_logical_view" not in self._stubs:
+ self._stubs["create_logical_view"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/CreateLogicalView",
+ request_serializer=bigtable_instance_admin.CreateLogicalViewRequest.serialize,
+ response_deserializer=operations_pb2.Operation.FromString,
+ )
+ return self._stubs["create_logical_view"]
+
+ @property
+ def get_logical_view(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.GetLogicalViewRequest], instance.LogicalView
+ ]:
+ r"""Return a callable for the get logical view method over gRPC.
+
+ Gets information about a logical view.
+
+ Returns:
+ Callable[[~.GetLogicalViewRequest],
+ ~.LogicalView]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "get_logical_view" not in self._stubs:
+ self._stubs["get_logical_view"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/GetLogicalView",
+ request_serializer=bigtable_instance_admin.GetLogicalViewRequest.serialize,
+ response_deserializer=instance.LogicalView.deserialize,
+ )
+ return self._stubs["get_logical_view"]
+
+ @property
+ def list_logical_views(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.ListLogicalViewsRequest],
+ bigtable_instance_admin.ListLogicalViewsResponse,
+ ]:
+ r"""Return a callable for the list logical views method over gRPC.
+
+ Lists information about logical views in an instance.
+
+ Returns:
+ Callable[[~.ListLogicalViewsRequest],
+ ~.ListLogicalViewsResponse]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "list_logical_views" not in self._stubs:
+ self._stubs["list_logical_views"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/ListLogicalViews",
+ request_serializer=bigtable_instance_admin.ListLogicalViewsRequest.serialize,
+ response_deserializer=bigtable_instance_admin.ListLogicalViewsResponse.deserialize,
+ )
+ return self._stubs["list_logical_views"]
+
+ @property
+ def update_logical_view(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.UpdateLogicalViewRequest], operations_pb2.Operation
+ ]:
+ r"""Return a callable for the update logical view method over gRPC.
+
+ Updates a logical view within an instance.
+
+ Returns:
+ Callable[[~.UpdateLogicalViewRequest],
+ ~.Operation]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "update_logical_view" not in self._stubs:
+ self._stubs["update_logical_view"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/UpdateLogicalView",
+ request_serializer=bigtable_instance_admin.UpdateLogicalViewRequest.serialize,
+ response_deserializer=operations_pb2.Operation.FromString,
+ )
+ return self._stubs["update_logical_view"]
+
+ @property
+ def delete_logical_view(
+ self,
+ ) -> Callable[[bigtable_instance_admin.DeleteLogicalViewRequest], empty_pb2.Empty]:
+ r"""Return a callable for the delete logical view method over gRPC.
+
+ Deletes a logical view from an instance.
+
+ Returns:
+ Callable[[~.DeleteLogicalViewRequest],
+ ~.Empty]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "delete_logical_view" not in self._stubs:
+ self._stubs["delete_logical_view"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/DeleteLogicalView",
+ request_serializer=bigtable_instance_admin.DeleteLogicalViewRequest.serialize,
+ response_deserializer=empty_pb2.Empty.FromString,
+ )
+ return self._stubs["delete_logical_view"]
+
+ @property
+ def create_materialized_view(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.CreateMaterializedViewRequest],
+ operations_pb2.Operation,
+ ]:
+ r"""Return a callable for the create materialized view method over gRPC.
+
+ Creates a materialized view within an instance.
+
+ Returns:
+ Callable[[~.CreateMaterializedViewRequest],
+ ~.Operation]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "create_materialized_view" not in self._stubs:
+ self._stubs["create_materialized_view"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/CreateMaterializedView",
+ request_serializer=bigtable_instance_admin.CreateMaterializedViewRequest.serialize,
+ response_deserializer=operations_pb2.Operation.FromString,
+ )
+ return self._stubs["create_materialized_view"]
+
+ @property
+ def get_materialized_view(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.GetMaterializedViewRequest], instance.MaterializedView
+ ]:
+ r"""Return a callable for the get materialized view method over gRPC.
+
+ Gets information about a materialized view.
+
+ Returns:
+ Callable[[~.GetMaterializedViewRequest],
+ ~.MaterializedView]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "get_materialized_view" not in self._stubs:
+ self._stubs["get_materialized_view"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/GetMaterializedView",
+ request_serializer=bigtable_instance_admin.GetMaterializedViewRequest.serialize,
+ response_deserializer=instance.MaterializedView.deserialize,
+ )
+ return self._stubs["get_materialized_view"]
+
+ @property
+ def list_materialized_views(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.ListMaterializedViewsRequest],
+ bigtable_instance_admin.ListMaterializedViewsResponse,
+ ]:
+ r"""Return a callable for the list materialized views method over gRPC.
+
+ Lists information about materialized views in an
+ instance.
+
+ Returns:
+ Callable[[~.ListMaterializedViewsRequest],
+ ~.ListMaterializedViewsResponse]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "list_materialized_views" not in self._stubs:
+ self._stubs["list_materialized_views"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/ListMaterializedViews",
+ request_serializer=bigtable_instance_admin.ListMaterializedViewsRequest.serialize,
+ response_deserializer=bigtable_instance_admin.ListMaterializedViewsResponse.deserialize,
+ )
+ return self._stubs["list_materialized_views"]
+
+ @property
+ def update_materialized_view(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.UpdateMaterializedViewRequest],
+ operations_pb2.Operation,
+ ]:
+ r"""Return a callable for the update materialized view method over gRPC.
+
+ Updates a materialized view within an instance.
+
+ Returns:
+ Callable[[~.UpdateMaterializedViewRequest],
+ ~.Operation]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "update_materialized_view" not in self._stubs:
+ self._stubs["update_materialized_view"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/UpdateMaterializedView",
+ request_serializer=bigtable_instance_admin.UpdateMaterializedViewRequest.serialize,
+ response_deserializer=operations_pb2.Operation.FromString,
+ )
+ return self._stubs["update_materialized_view"]
+
+ @property
+ def delete_materialized_view(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.DeleteMaterializedViewRequest], empty_pb2.Empty
+ ]:
+ r"""Return a callable for the delete materialized view method over gRPC.
+
+ Deletes a materialized view from an instance.
+
+ Returns:
+ Callable[[~.DeleteMaterializedViewRequest],
+ ~.Empty]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "delete_materialized_view" not in self._stubs:
+ self._stubs["delete_materialized_view"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/DeleteMaterializedView",
+ request_serializer=bigtable_instance_admin.DeleteMaterializedViewRequest.serialize,
+ response_deserializer=empty_pb2.Empty.FromString,
+ )
+ return self._stubs["delete_materialized_view"]
+
+ def close(self):
+ self._logged_channel.close()
+
+ @property
+ def kind(self) -> str:
+ return "grpc"
+
+
+__all__ = ("BigtableInstanceAdminGrpcTransport",)
diff --git a/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/grpc_asyncio.py b/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/grpc_asyncio.py
new file mode 100644
index 000000000..7ce762764
--- /dev/null
+++ b/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/grpc_asyncio.py
@@ -0,0 +1,1581 @@
+# -*- coding: utf-8 -*-
+# Copyright 2025 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.
+#
+import inspect
+import json
+import pickle
+import logging as std_logging
+import warnings
+from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union
+
+from google.api_core import gapic_v1
+from google.api_core import grpc_helpers_async
+from google.api_core import exceptions as core_exceptions
+from google.api_core import retry_async as retries
+from google.api_core import operations_v1
+from google.auth import credentials as ga_credentials # type: ignore
+from google.auth.transport.grpc import SslCredentials # type: ignore
+from google.protobuf.json_format import MessageToJson
+import google.protobuf.message
+
+import grpc # type: ignore
+import proto # type: ignore
+from grpc.experimental import aio # type: ignore
+
+from google.cloud.bigtable_admin_v2.types import bigtable_instance_admin
+from google.cloud.bigtable_admin_v2.types import instance
+from google.iam.v1 import iam_policy_pb2 # type: ignore
+from google.iam.v1 import policy_pb2 # type: ignore
+from google.longrunning import operations_pb2 # type: ignore
+from google.protobuf import empty_pb2 # type: ignore
+from .base import BigtableInstanceAdminTransport, DEFAULT_CLIENT_INFO
+from .grpc import BigtableInstanceAdminGrpcTransport
+
+try:
+ from google.api_core import client_logging # type: ignore
+
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
+except ImportError: # pragma: NO COVER
+ CLIENT_LOGGING_SUPPORTED = False
+
+_LOGGER = std_logging.getLogger(__name__)
+
+
+class _LoggingClientAIOInterceptor(
+ grpc.aio.UnaryUnaryClientInterceptor
+): # pragma: NO COVER
+ async def intercept_unary_unary(self, continuation, client_call_details, request):
+ logging_enabled = CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ std_logging.DEBUG
+ )
+ if logging_enabled: # pragma: NO COVER
+ request_metadata = client_call_details.metadata
+ if isinstance(request, proto.Message):
+ request_payload = type(request).to_json(request)
+ elif isinstance(request, google.protobuf.message.Message):
+ request_payload = MessageToJson(request)
+ else:
+ request_payload = f"{type(request).__name__}: {pickle.dumps(request)}"
+
+ request_metadata = {
+ key: value.decode("utf-8") if isinstance(value, bytes) else value
+ for key, value in request_metadata
+ }
+ grpc_request = {
+ "payload": request_payload,
+ "requestMethod": "grpc",
+ "metadata": dict(request_metadata),
+ }
+ _LOGGER.debug(
+ f"Sending request for {client_call_details.method}",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": str(client_call_details.method),
+ "request": grpc_request,
+ "metadata": grpc_request["metadata"],
+ },
+ )
+ response = await continuation(client_call_details, request)
+ if logging_enabled: # pragma: NO COVER
+ response_metadata = await response.trailing_metadata()
+ # Convert gRPC metadata `` to list of tuples
+ metadata = (
+ dict([(k, str(v)) for k, v in response_metadata])
+ if response_metadata
+ else None
+ )
+ result = await response
+ if isinstance(result, proto.Message):
+ response_payload = type(result).to_json(result)
+ elif isinstance(result, google.protobuf.message.Message):
+ response_payload = MessageToJson(result)
+ else:
+ response_payload = f"{type(result).__name__}: {pickle.dumps(result)}"
+ grpc_response = {
+ "payload": response_payload,
+ "metadata": metadata,
+ "status": "OK",
+ }
+ _LOGGER.debug(
+ f"Received response to rpc {client_call_details.method}.",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": str(client_call_details.method),
+ "response": grpc_response,
+ "metadata": grpc_response["metadata"],
+ },
+ )
+ return response
+
+
+class BigtableInstanceAdminGrpcAsyncIOTransport(BigtableInstanceAdminTransport):
+ """gRPC AsyncIO backend transport for BigtableInstanceAdmin.
+
+ Service for creating, configuring, and deleting Cloud
+ Bigtable Instances and Clusters. Provides access to the Instance
+ and Cluster schemas only, not the tables' metadata or data
+ stored in those tables.
+
+ This class defines the same methods as the primary client, so the
+ primary client can load the underlying transport implementation
+ and call it.
+
+ It sends protocol buffers over the wire using gRPC (which is built on
+ top of HTTP/2); the ``grpcio`` package must be installed.
+ """
+
+ _grpc_channel: aio.Channel
+ _stubs: Dict[str, Callable] = {}
+
+ @classmethod
+ def create_channel(
+ cls,
+ host: str = "bigtableadmin.googleapis.com",
+ credentials: Optional[ga_credentials.Credentials] = None,
+ credentials_file: Optional[str] = None,
+ scopes: Optional[Sequence[str]] = None,
+ quota_project_id: Optional[str] = None,
+ **kwargs,
+ ) -> aio.Channel:
+ """Create and return a gRPC AsyncIO channel object.
+ Args:
+ host (Optional[str]): The host for the channel to use.
+ credentials (Optional[~.Credentials]): The
+ authorization credentials to attach to requests. These
+ credentials identify this application to the service. If
+ none are specified, the client will attempt to ascertain
+ the credentials from the environment.
+ credentials_file (Optional[str]): Deprecated. A file with credentials that can
+ be loaded with :func:`google.auth.load_credentials_from_file`. This argument will be
+ removed in the next major version of this library.
+ scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
+ service. These are only used when credentials are not specified and
+ are passed to :func:`google.auth.default`.
+ quota_project_id (Optional[str]): An optional project to use for billing
+ and quota.
+ kwargs (Optional[dict]): Keyword arguments, which are passed to the
+ channel creation.
+ Returns:
+ aio.Channel: A gRPC AsyncIO channel object.
+ """
+
+ return grpc_helpers_async.create_channel(
+ host,
+ credentials=credentials,
+ credentials_file=credentials_file,
+ quota_project_id=quota_project_id,
+ default_scopes=cls.AUTH_SCOPES,
+ scopes=scopes,
+ default_host=cls.DEFAULT_HOST,
+ **kwargs,
+ )
+
+ def __init__(
+ self,
+ *,
+ host: str = "bigtableadmin.googleapis.com",
+ credentials: Optional[ga_credentials.Credentials] = None,
+ credentials_file: Optional[str] = None,
+ scopes: Optional[Sequence[str]] = None,
+ channel: Optional[Union[aio.Channel, Callable[..., aio.Channel]]] = None,
+ api_mtls_endpoint: Optional[str] = None,
+ client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
+ ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None,
+ client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
+ quota_project_id: Optional[str] = None,
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
+ always_use_jwt_access: Optional[bool] = False,
+ api_audience: Optional[str] = None,
+ ) -> None:
+ """Instantiate the transport.
+
+ Args:
+ host (Optional[str]):
+ The hostname to connect to (default: 'bigtableadmin.googleapis.com').
+ credentials (Optional[google.auth.credentials.Credentials]): The
+ authorization credentials to attach to requests. These
+ credentials identify the application to the service; if none
+ are specified, the client will attempt to ascertain the
+ credentials from the environment.
+ This argument is ignored if a ``channel`` instance is provided.
+ credentials_file (Optional[str]): Deprecated. A file with credentials that can
+ be loaded with :func:`google.auth.load_credentials_from_file`.
+ This argument is ignored if a ``channel`` instance is provided.
+ This argument will be removed in the next major version of this library.
+ scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
+ service. These are only used when credentials are not specified and
+ are passed to :func:`google.auth.default`.
+ channel (Optional[Union[aio.Channel, Callable[..., aio.Channel]]]):
+ A ``Channel`` instance through which to make calls, or a Callable
+ that constructs and returns one. If set to None, ``self.create_channel``
+ is used to create the channel. If a Callable is given, it will be called
+ with the same arguments as used in ``self.create_channel``.
+ api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint.
+ If provided, it overrides the ``host`` argument and tries to create
+ a mutual TLS channel with client SSL credentials from
+ ``client_cert_source`` or application default SSL credentials.
+ client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]):
+ Deprecated. A callback to provide client SSL certificate bytes and
+ private key bytes, both in PEM format. It is ignored if
+ ``api_mtls_endpoint`` is None.
+ ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials
+ for the grpc channel. It is ignored if a ``channel`` instance is provided.
+ client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]):
+ A callback to provide client certificate bytes and private key bytes,
+ both in PEM format. It is used to configure a mutual TLS channel. It is
+ ignored if a ``channel`` instance or ``ssl_channel_credentials`` is provided.
+ quota_project_id (Optional[str]): An optional project to use for billing
+ and quota.
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
+ The client info used to send a user-agent string along with
+ API requests. If ``None``, then default info will be used.
+ Generally, you only need to set this if you're developing
+ your own client library.
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
+ be used for service account credentials.
+
+ Raises:
+ google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
+ creation failed for any reason.
+ google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
+ and ``credentials_file`` are passed.
+ """
+ self._grpc_channel = None
+ self._ssl_channel_credentials = ssl_channel_credentials
+ self._stubs: Dict[str, Callable] = {}
+ self._operations_client: Optional[operations_v1.OperationsAsyncClient] = None
+
+ if api_mtls_endpoint:
+ warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)
+ if client_cert_source:
+ warnings.warn("client_cert_source is deprecated", DeprecationWarning)
+
+ if isinstance(channel, aio.Channel):
+ # Ignore credentials if a channel was passed.
+ credentials = None
+ self._ignore_credentials = True
+ # If a channel was explicitly provided, set it.
+ self._grpc_channel = channel
+ self._ssl_channel_credentials = None
+ else:
+ if api_mtls_endpoint:
+ host = api_mtls_endpoint
+
+ # Create SSL credentials with client_cert_source or application
+ # default SSL credentials.
+ if client_cert_source:
+ cert, key = client_cert_source()
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
+ certificate_chain=cert, private_key=key
+ )
+ else:
+ self._ssl_channel_credentials = SslCredentials().ssl_credentials
+
+ else:
+ if client_cert_source_for_mtls and not ssl_channel_credentials:
+ cert, key = client_cert_source_for_mtls()
+ self._ssl_channel_credentials = grpc.ssl_channel_credentials(
+ certificate_chain=cert, private_key=key
+ )
+
+ # The base transport sets the host, credentials and scopes
+ super().__init__(
+ host=host,
+ credentials=credentials,
+ credentials_file=credentials_file,
+ scopes=scopes,
+ quota_project_id=quota_project_id,
+ client_info=client_info,
+ always_use_jwt_access=always_use_jwt_access,
+ api_audience=api_audience,
+ )
+
+ if not self._grpc_channel:
+ # initialize with the provided callable or the default channel
+ channel_init = channel or type(self).create_channel
+ self._grpc_channel = channel_init(
+ self._host,
+ # use the credentials which are saved
+ credentials=self._credentials,
+ # Set ``credentials_file`` to ``None`` here as
+ # the credentials that we saved earlier should be used.
+ credentials_file=None,
+ scopes=self._scopes,
+ ssl_credentials=self._ssl_channel_credentials,
+ quota_project_id=quota_project_id,
+ options=[
+ ("grpc.max_send_message_length", -1),
+ ("grpc.max_receive_message_length", -1),
+ ],
+ )
+
+ self._interceptor = _LoggingClientAIOInterceptor()
+ self._grpc_channel._unary_unary_interceptors.append(self._interceptor)
+ self._logged_channel = self._grpc_channel
+ self._wrap_with_kind = (
+ "kind" in inspect.signature(gapic_v1.method_async.wrap_method).parameters
+ )
+ # Wrap messages. This must be done after self._logged_channel exists
+ self._prep_wrapped_messages(client_info)
+
+ @property
+ def grpc_channel(self) -> aio.Channel:
+ """Create the channel designed to connect to this service.
+
+ This property caches on the instance; repeated calls return
+ the same channel.
+ """
+ # Return the channel from cache.
+ return self._grpc_channel
+
+ @property
+ def operations_client(self) -> operations_v1.OperationsAsyncClient:
+ """Create the client designed to process long-running operations.
+
+ This property caches on the instance; repeated calls return the same
+ client.
+ """
+ # Quick check: Only create a new client if we do not already have one.
+ if self._operations_client is None:
+ self._operations_client = operations_v1.OperationsAsyncClient(
+ self._logged_channel
+ )
+
+ # Return the client from cache.
+ return self._operations_client
+
+ @property
+ def create_instance(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.CreateInstanceRequest],
+ Awaitable[operations_pb2.Operation],
+ ]:
+ r"""Return a callable for the create instance method over gRPC.
+
+ Create an instance within a project.
+
+ Note that exactly one of Cluster.serve_nodes and
+ Cluster.cluster_config.cluster_autoscaling_config can be set. If
+ serve_nodes is set to non-zero, then the cluster is manually
+ scaled. If cluster_config.cluster_autoscaling_config is
+ non-empty, then autoscaling is enabled.
+
+ Returns:
+ Callable[[~.CreateInstanceRequest],
+ Awaitable[~.Operation]]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "create_instance" not in self._stubs:
+ self._stubs["create_instance"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/CreateInstance",
+ request_serializer=bigtable_instance_admin.CreateInstanceRequest.serialize,
+ response_deserializer=operations_pb2.Operation.FromString,
+ )
+ return self._stubs["create_instance"]
+
+ @property
+ def get_instance(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.GetInstanceRequest], Awaitable[instance.Instance]
+ ]:
+ r"""Return a callable for the get instance method over gRPC.
+
+ Gets information about an instance.
+
+ Returns:
+ Callable[[~.GetInstanceRequest],
+ Awaitable[~.Instance]]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "get_instance" not in self._stubs:
+ self._stubs["get_instance"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/GetInstance",
+ request_serializer=bigtable_instance_admin.GetInstanceRequest.serialize,
+ response_deserializer=instance.Instance.deserialize,
+ )
+ return self._stubs["get_instance"]
+
+ @property
+ def list_instances(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.ListInstancesRequest],
+ Awaitable[bigtable_instance_admin.ListInstancesResponse],
+ ]:
+ r"""Return a callable for the list instances method over gRPC.
+
+ Lists information about instances in a project.
+
+ Returns:
+ Callable[[~.ListInstancesRequest],
+ Awaitable[~.ListInstancesResponse]]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "list_instances" not in self._stubs:
+ self._stubs["list_instances"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/ListInstances",
+ request_serializer=bigtable_instance_admin.ListInstancesRequest.serialize,
+ response_deserializer=bigtable_instance_admin.ListInstancesResponse.deserialize,
+ )
+ return self._stubs["list_instances"]
+
+ @property
+ def update_instance(
+ self,
+ ) -> Callable[[instance.Instance], Awaitable[instance.Instance]]:
+ r"""Return a callable for the update instance method over gRPC.
+
+ Updates an instance within a project. This method
+ updates only the display name and type for an Instance.
+ To update other Instance properties, such as labels, use
+ PartialUpdateInstance.
+
+ Returns:
+ Callable[[~.Instance],
+ Awaitable[~.Instance]]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "update_instance" not in self._stubs:
+ self._stubs["update_instance"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/UpdateInstance",
+ request_serializer=instance.Instance.serialize,
+ response_deserializer=instance.Instance.deserialize,
+ )
+ return self._stubs["update_instance"]
+
+ @property
+ def partial_update_instance(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.PartialUpdateInstanceRequest],
+ Awaitable[operations_pb2.Operation],
+ ]:
+ r"""Return a callable for the partial update instance method over gRPC.
+
+ Partially updates an instance within a project. This
+ method can modify all fields of an Instance and is the
+ preferred way to update an Instance.
+
+ Returns:
+ Callable[[~.PartialUpdateInstanceRequest],
+ Awaitable[~.Operation]]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "partial_update_instance" not in self._stubs:
+ self._stubs["partial_update_instance"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/PartialUpdateInstance",
+ request_serializer=bigtable_instance_admin.PartialUpdateInstanceRequest.serialize,
+ response_deserializer=operations_pb2.Operation.FromString,
+ )
+ return self._stubs["partial_update_instance"]
+
+ @property
+ def delete_instance(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.DeleteInstanceRequest], Awaitable[empty_pb2.Empty]
+ ]:
+ r"""Return a callable for the delete instance method over gRPC.
+
+ Delete an instance from a project.
+
+ Returns:
+ Callable[[~.DeleteInstanceRequest],
+ Awaitable[~.Empty]]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "delete_instance" not in self._stubs:
+ self._stubs["delete_instance"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/DeleteInstance",
+ request_serializer=bigtable_instance_admin.DeleteInstanceRequest.serialize,
+ response_deserializer=empty_pb2.Empty.FromString,
+ )
+ return self._stubs["delete_instance"]
+
+ @property
+ def create_cluster(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.CreateClusterRequest],
+ Awaitable[operations_pb2.Operation],
+ ]:
+ r"""Return a callable for the create cluster method over gRPC.
+
+ Creates a cluster within an instance.
+
+ Note that exactly one of Cluster.serve_nodes and
+ Cluster.cluster_config.cluster_autoscaling_config can be set. If
+ serve_nodes is set to non-zero, then the cluster is manually
+ scaled. If cluster_config.cluster_autoscaling_config is
+ non-empty, then autoscaling is enabled.
+
+ Returns:
+ Callable[[~.CreateClusterRequest],
+ Awaitable[~.Operation]]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "create_cluster" not in self._stubs:
+ self._stubs["create_cluster"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/CreateCluster",
+ request_serializer=bigtable_instance_admin.CreateClusterRequest.serialize,
+ response_deserializer=operations_pb2.Operation.FromString,
+ )
+ return self._stubs["create_cluster"]
+
+ @property
+ def get_cluster(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.GetClusterRequest], Awaitable[instance.Cluster]
+ ]:
+ r"""Return a callable for the get cluster method over gRPC.
+
+ Gets information about a cluster.
+
+ Returns:
+ Callable[[~.GetClusterRequest],
+ Awaitable[~.Cluster]]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "get_cluster" not in self._stubs:
+ self._stubs["get_cluster"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/GetCluster",
+ request_serializer=bigtable_instance_admin.GetClusterRequest.serialize,
+ response_deserializer=instance.Cluster.deserialize,
+ )
+ return self._stubs["get_cluster"]
+
+ @property
+ def list_clusters(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.ListClustersRequest],
+ Awaitable[bigtable_instance_admin.ListClustersResponse],
+ ]:
+ r"""Return a callable for the list clusters method over gRPC.
+
+ Lists information about clusters in an instance.
+
+ Returns:
+ Callable[[~.ListClustersRequest],
+ Awaitable[~.ListClustersResponse]]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "list_clusters" not in self._stubs:
+ self._stubs["list_clusters"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/ListClusters",
+ request_serializer=bigtable_instance_admin.ListClustersRequest.serialize,
+ response_deserializer=bigtable_instance_admin.ListClustersResponse.deserialize,
+ )
+ return self._stubs["list_clusters"]
+
+ @property
+ def update_cluster(
+ self,
+ ) -> Callable[[instance.Cluster], Awaitable[operations_pb2.Operation]]:
+ r"""Return a callable for the update cluster method over gRPC.
+
+ Updates a cluster within an instance.
+
+ Note that UpdateCluster does not support updating
+ cluster_config.cluster_autoscaling_config. In order to update
+ it, you must use PartialUpdateCluster.
+
+ Returns:
+ Callable[[~.Cluster],
+ Awaitable[~.Operation]]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "update_cluster" not in self._stubs:
+ self._stubs["update_cluster"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/UpdateCluster",
+ request_serializer=instance.Cluster.serialize,
+ response_deserializer=operations_pb2.Operation.FromString,
+ )
+ return self._stubs["update_cluster"]
+
+ @property
+ def partial_update_cluster(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.PartialUpdateClusterRequest],
+ Awaitable[operations_pb2.Operation],
+ ]:
+ r"""Return a callable for the partial update cluster method over gRPC.
+
+ Partially updates a cluster within a project. This method is the
+ preferred way to update a Cluster.
+
+ To enable and update autoscaling, set
+ cluster_config.cluster_autoscaling_config. When autoscaling is
+ enabled, serve_nodes is treated as an OUTPUT_ONLY field, meaning
+ that updates to it are ignored. Note that an update cannot
+ simultaneously set serve_nodes to non-zero and
+ cluster_config.cluster_autoscaling_config to non-empty, and also
+ specify both in the update_mask.
+
+ To disable autoscaling, clear
+ cluster_config.cluster_autoscaling_config, and explicitly set a
+ serve_node count via the update_mask.
+
+ Returns:
+ Callable[[~.PartialUpdateClusterRequest],
+ Awaitable[~.Operation]]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "partial_update_cluster" not in self._stubs:
+ self._stubs["partial_update_cluster"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/PartialUpdateCluster",
+ request_serializer=bigtable_instance_admin.PartialUpdateClusterRequest.serialize,
+ response_deserializer=operations_pb2.Operation.FromString,
+ )
+ return self._stubs["partial_update_cluster"]
+
+ @property
+ def delete_cluster(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.DeleteClusterRequest], Awaitable[empty_pb2.Empty]
+ ]:
+ r"""Return a callable for the delete cluster method over gRPC.
+
+ Deletes a cluster from an instance.
+
+ Returns:
+ Callable[[~.DeleteClusterRequest],
+ Awaitable[~.Empty]]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "delete_cluster" not in self._stubs:
+ self._stubs["delete_cluster"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/DeleteCluster",
+ request_serializer=bigtable_instance_admin.DeleteClusterRequest.serialize,
+ response_deserializer=empty_pb2.Empty.FromString,
+ )
+ return self._stubs["delete_cluster"]
+
+ @property
+ def create_app_profile(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.CreateAppProfileRequest],
+ Awaitable[instance.AppProfile],
+ ]:
+ r"""Return a callable for the create app profile method over gRPC.
+
+ Creates an app profile within an instance.
+
+ Returns:
+ Callable[[~.CreateAppProfileRequest],
+ Awaitable[~.AppProfile]]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "create_app_profile" not in self._stubs:
+ self._stubs["create_app_profile"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/CreateAppProfile",
+ request_serializer=bigtable_instance_admin.CreateAppProfileRequest.serialize,
+ response_deserializer=instance.AppProfile.deserialize,
+ )
+ return self._stubs["create_app_profile"]
+
+ @property
+ def get_app_profile(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.GetAppProfileRequest], Awaitable[instance.AppProfile]
+ ]:
+ r"""Return a callable for the get app profile method over gRPC.
+
+ Gets information about an app profile.
+
+ Returns:
+ Callable[[~.GetAppProfileRequest],
+ Awaitable[~.AppProfile]]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "get_app_profile" not in self._stubs:
+ self._stubs["get_app_profile"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/GetAppProfile",
+ request_serializer=bigtable_instance_admin.GetAppProfileRequest.serialize,
+ response_deserializer=instance.AppProfile.deserialize,
+ )
+ return self._stubs["get_app_profile"]
+
+ @property
+ def list_app_profiles(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.ListAppProfilesRequest],
+ Awaitable[bigtable_instance_admin.ListAppProfilesResponse],
+ ]:
+ r"""Return a callable for the list app profiles method over gRPC.
+
+ Lists information about app profiles in an instance.
+
+ Returns:
+ Callable[[~.ListAppProfilesRequest],
+ Awaitable[~.ListAppProfilesResponse]]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "list_app_profiles" not in self._stubs:
+ self._stubs["list_app_profiles"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/ListAppProfiles",
+ request_serializer=bigtable_instance_admin.ListAppProfilesRequest.serialize,
+ response_deserializer=bigtable_instance_admin.ListAppProfilesResponse.deserialize,
+ )
+ return self._stubs["list_app_profiles"]
+
+ @property
+ def update_app_profile(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.UpdateAppProfileRequest],
+ Awaitable[operations_pb2.Operation],
+ ]:
+ r"""Return a callable for the update app profile method over gRPC.
+
+ Updates an app profile within an instance.
+
+ Returns:
+ Callable[[~.UpdateAppProfileRequest],
+ Awaitable[~.Operation]]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "update_app_profile" not in self._stubs:
+ self._stubs["update_app_profile"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/UpdateAppProfile",
+ request_serializer=bigtable_instance_admin.UpdateAppProfileRequest.serialize,
+ response_deserializer=operations_pb2.Operation.FromString,
+ )
+ return self._stubs["update_app_profile"]
+
+ @property
+ def delete_app_profile(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.DeleteAppProfileRequest], Awaitable[empty_pb2.Empty]
+ ]:
+ r"""Return a callable for the delete app profile method over gRPC.
+
+ Deletes an app profile from an instance.
+
+ Returns:
+ Callable[[~.DeleteAppProfileRequest],
+ Awaitable[~.Empty]]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "delete_app_profile" not in self._stubs:
+ self._stubs["delete_app_profile"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/DeleteAppProfile",
+ request_serializer=bigtable_instance_admin.DeleteAppProfileRequest.serialize,
+ response_deserializer=empty_pb2.Empty.FromString,
+ )
+ return self._stubs["delete_app_profile"]
+
+ @property
+ def get_iam_policy(
+ self,
+ ) -> Callable[[iam_policy_pb2.GetIamPolicyRequest], Awaitable[policy_pb2.Policy]]:
+ r"""Return a callable for the get iam policy method over gRPC.
+
+ Gets the access control policy for an instance
+ resource. Returns an empty policy if an instance exists
+ but does not have a policy set.
+
+ Returns:
+ Callable[[~.GetIamPolicyRequest],
+ Awaitable[~.Policy]]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "get_iam_policy" not in self._stubs:
+ self._stubs["get_iam_policy"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/GetIamPolicy",
+ request_serializer=iam_policy_pb2.GetIamPolicyRequest.SerializeToString,
+ response_deserializer=policy_pb2.Policy.FromString,
+ )
+ return self._stubs["get_iam_policy"]
+
+ @property
+ def set_iam_policy(
+ self,
+ ) -> Callable[[iam_policy_pb2.SetIamPolicyRequest], Awaitable[policy_pb2.Policy]]:
+ r"""Return a callable for the set iam policy method over gRPC.
+
+ Sets the access control policy on an instance
+ resource. Replaces any existing policy.
+
+ Returns:
+ Callable[[~.SetIamPolicyRequest],
+ Awaitable[~.Policy]]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "set_iam_policy" not in self._stubs:
+ self._stubs["set_iam_policy"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/SetIamPolicy",
+ request_serializer=iam_policy_pb2.SetIamPolicyRequest.SerializeToString,
+ response_deserializer=policy_pb2.Policy.FromString,
+ )
+ return self._stubs["set_iam_policy"]
+
+ @property
+ def test_iam_permissions(
+ self,
+ ) -> Callable[
+ [iam_policy_pb2.TestIamPermissionsRequest],
+ Awaitable[iam_policy_pb2.TestIamPermissionsResponse],
+ ]:
+ r"""Return a callable for the test iam permissions method over gRPC.
+
+ Returns permissions that the caller has on the
+ specified instance resource.
+
+ Returns:
+ Callable[[~.TestIamPermissionsRequest],
+ Awaitable[~.TestIamPermissionsResponse]]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "test_iam_permissions" not in self._stubs:
+ self._stubs["test_iam_permissions"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/TestIamPermissions",
+ request_serializer=iam_policy_pb2.TestIamPermissionsRequest.SerializeToString,
+ response_deserializer=iam_policy_pb2.TestIamPermissionsResponse.FromString,
+ )
+ return self._stubs["test_iam_permissions"]
+
+ @property
+ def list_hot_tablets(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.ListHotTabletsRequest],
+ Awaitable[bigtable_instance_admin.ListHotTabletsResponse],
+ ]:
+ r"""Return a callable for the list hot tablets method over gRPC.
+
+ Lists hot tablets in a cluster, within the time range
+ provided. Hot tablets are ordered based on CPU usage.
+
+ Returns:
+ Callable[[~.ListHotTabletsRequest],
+ Awaitable[~.ListHotTabletsResponse]]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "list_hot_tablets" not in self._stubs:
+ self._stubs["list_hot_tablets"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/ListHotTablets",
+ request_serializer=bigtable_instance_admin.ListHotTabletsRequest.serialize,
+ response_deserializer=bigtable_instance_admin.ListHotTabletsResponse.deserialize,
+ )
+ return self._stubs["list_hot_tablets"]
+
+ @property
+ def create_logical_view(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.CreateLogicalViewRequest],
+ Awaitable[operations_pb2.Operation],
+ ]:
+ r"""Return a callable for the create logical view method over gRPC.
+
+ Creates a logical view within an instance.
+
+ Returns:
+ Callable[[~.CreateLogicalViewRequest],
+ Awaitable[~.Operation]]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "create_logical_view" not in self._stubs:
+ self._stubs["create_logical_view"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/CreateLogicalView",
+ request_serializer=bigtable_instance_admin.CreateLogicalViewRequest.serialize,
+ response_deserializer=operations_pb2.Operation.FromString,
+ )
+ return self._stubs["create_logical_view"]
+
+ @property
+ def get_logical_view(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.GetLogicalViewRequest], Awaitable[instance.LogicalView]
+ ]:
+ r"""Return a callable for the get logical view method over gRPC.
+
+ Gets information about a logical view.
+
+ Returns:
+ Callable[[~.GetLogicalViewRequest],
+ Awaitable[~.LogicalView]]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "get_logical_view" not in self._stubs:
+ self._stubs["get_logical_view"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/GetLogicalView",
+ request_serializer=bigtable_instance_admin.GetLogicalViewRequest.serialize,
+ response_deserializer=instance.LogicalView.deserialize,
+ )
+ return self._stubs["get_logical_view"]
+
+ @property
+ def list_logical_views(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.ListLogicalViewsRequest],
+ Awaitable[bigtable_instance_admin.ListLogicalViewsResponse],
+ ]:
+ r"""Return a callable for the list logical views method over gRPC.
+
+ Lists information about logical views in an instance.
+
+ Returns:
+ Callable[[~.ListLogicalViewsRequest],
+ Awaitable[~.ListLogicalViewsResponse]]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "list_logical_views" not in self._stubs:
+ self._stubs["list_logical_views"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/ListLogicalViews",
+ request_serializer=bigtable_instance_admin.ListLogicalViewsRequest.serialize,
+ response_deserializer=bigtable_instance_admin.ListLogicalViewsResponse.deserialize,
+ )
+ return self._stubs["list_logical_views"]
+
+ @property
+ def update_logical_view(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.UpdateLogicalViewRequest],
+ Awaitable[operations_pb2.Operation],
+ ]:
+ r"""Return a callable for the update logical view method over gRPC.
+
+ Updates a logical view within an instance.
+
+ Returns:
+ Callable[[~.UpdateLogicalViewRequest],
+ Awaitable[~.Operation]]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "update_logical_view" not in self._stubs:
+ self._stubs["update_logical_view"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/UpdateLogicalView",
+ request_serializer=bigtable_instance_admin.UpdateLogicalViewRequest.serialize,
+ response_deserializer=operations_pb2.Operation.FromString,
+ )
+ return self._stubs["update_logical_view"]
+
+ @property
+ def delete_logical_view(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.DeleteLogicalViewRequest], Awaitable[empty_pb2.Empty]
+ ]:
+ r"""Return a callable for the delete logical view method over gRPC.
+
+ Deletes a logical view from an instance.
+
+ Returns:
+ Callable[[~.DeleteLogicalViewRequest],
+ Awaitable[~.Empty]]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "delete_logical_view" not in self._stubs:
+ self._stubs["delete_logical_view"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/DeleteLogicalView",
+ request_serializer=bigtable_instance_admin.DeleteLogicalViewRequest.serialize,
+ response_deserializer=empty_pb2.Empty.FromString,
+ )
+ return self._stubs["delete_logical_view"]
+
+ @property
+ def create_materialized_view(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.CreateMaterializedViewRequest],
+ Awaitable[operations_pb2.Operation],
+ ]:
+ r"""Return a callable for the create materialized view method over gRPC.
+
+ Creates a materialized view within an instance.
+
+ Returns:
+ Callable[[~.CreateMaterializedViewRequest],
+ Awaitable[~.Operation]]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "create_materialized_view" not in self._stubs:
+ self._stubs["create_materialized_view"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/CreateMaterializedView",
+ request_serializer=bigtable_instance_admin.CreateMaterializedViewRequest.serialize,
+ response_deserializer=operations_pb2.Operation.FromString,
+ )
+ return self._stubs["create_materialized_view"]
+
+ @property
+ def get_materialized_view(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.GetMaterializedViewRequest],
+ Awaitable[instance.MaterializedView],
+ ]:
+ r"""Return a callable for the get materialized view method over gRPC.
+
+ Gets information about a materialized view.
+
+ Returns:
+ Callable[[~.GetMaterializedViewRequest],
+ Awaitable[~.MaterializedView]]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "get_materialized_view" not in self._stubs:
+ self._stubs["get_materialized_view"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/GetMaterializedView",
+ request_serializer=bigtable_instance_admin.GetMaterializedViewRequest.serialize,
+ response_deserializer=instance.MaterializedView.deserialize,
+ )
+ return self._stubs["get_materialized_view"]
+
+ @property
+ def list_materialized_views(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.ListMaterializedViewsRequest],
+ Awaitable[bigtable_instance_admin.ListMaterializedViewsResponse],
+ ]:
+ r"""Return a callable for the list materialized views method over gRPC.
+
+ Lists information about materialized views in an
+ instance.
+
+ Returns:
+ Callable[[~.ListMaterializedViewsRequest],
+ Awaitable[~.ListMaterializedViewsResponse]]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "list_materialized_views" not in self._stubs:
+ self._stubs["list_materialized_views"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/ListMaterializedViews",
+ request_serializer=bigtable_instance_admin.ListMaterializedViewsRequest.serialize,
+ response_deserializer=bigtable_instance_admin.ListMaterializedViewsResponse.deserialize,
+ )
+ return self._stubs["list_materialized_views"]
+
+ @property
+ def update_materialized_view(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.UpdateMaterializedViewRequest],
+ Awaitable[operations_pb2.Operation],
+ ]:
+ r"""Return a callable for the update materialized view method over gRPC.
+
+ Updates a materialized view within an instance.
+
+ Returns:
+ Callable[[~.UpdateMaterializedViewRequest],
+ Awaitable[~.Operation]]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "update_materialized_view" not in self._stubs:
+ self._stubs["update_materialized_view"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/UpdateMaterializedView",
+ request_serializer=bigtable_instance_admin.UpdateMaterializedViewRequest.serialize,
+ response_deserializer=operations_pb2.Operation.FromString,
+ )
+ return self._stubs["update_materialized_view"]
+
+ @property
+ def delete_materialized_view(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.DeleteMaterializedViewRequest],
+ Awaitable[empty_pb2.Empty],
+ ]:
+ r"""Return a callable for the delete materialized view method over gRPC.
+
+ Deletes a materialized view from an instance.
+
+ Returns:
+ Callable[[~.DeleteMaterializedViewRequest],
+ Awaitable[~.Empty]]:
+ A function that, when called, will call the underlying RPC
+ on the server.
+ """
+ # Generate a "stub function" on-the-fly which will actually make
+ # the request.
+ # gRPC handles serialization and deserialization, so we just need
+ # to pass in the functions for each.
+ if "delete_materialized_view" not in self._stubs:
+ self._stubs["delete_materialized_view"] = self._logged_channel.unary_unary(
+ "/google.bigtable.admin.v2.BigtableInstanceAdmin/DeleteMaterializedView",
+ request_serializer=bigtable_instance_admin.DeleteMaterializedViewRequest.serialize,
+ response_deserializer=empty_pb2.Empty.FromString,
+ )
+ return self._stubs["delete_materialized_view"]
+
+ def _prep_wrapped_messages(self, client_info):
+ """Precompute the wrapped methods, overriding the base class method to use async wrappers."""
+ self._wrapped_methods = {
+ self.create_instance: self._wrap_method(
+ self.create_instance,
+ default_timeout=300.0,
+ client_info=client_info,
+ ),
+ self.get_instance: self._wrap_method(
+ self.get_instance,
+ default_retry=retries.AsyncRetry(
+ initial=1.0,
+ maximum=60.0,
+ multiplier=2,
+ predicate=retries.if_exception_type(
+ core_exceptions.DeadlineExceeded,
+ core_exceptions.ServiceUnavailable,
+ ),
+ deadline=60.0,
+ ),
+ default_timeout=60.0,
+ client_info=client_info,
+ ),
+ self.list_instances: self._wrap_method(
+ self.list_instances,
+ default_retry=retries.AsyncRetry(
+ initial=1.0,
+ maximum=60.0,
+ multiplier=2,
+ predicate=retries.if_exception_type(
+ core_exceptions.DeadlineExceeded,
+ core_exceptions.ServiceUnavailable,
+ ),
+ deadline=60.0,
+ ),
+ default_timeout=60.0,
+ client_info=client_info,
+ ),
+ self.update_instance: self._wrap_method(
+ self.update_instance,
+ default_retry=retries.AsyncRetry(
+ initial=1.0,
+ maximum=60.0,
+ multiplier=2,
+ predicate=retries.if_exception_type(
+ core_exceptions.DeadlineExceeded,
+ core_exceptions.ServiceUnavailable,
+ ),
+ deadline=60.0,
+ ),
+ default_timeout=60.0,
+ client_info=client_info,
+ ),
+ self.partial_update_instance: self._wrap_method(
+ self.partial_update_instance,
+ default_retry=retries.AsyncRetry(
+ initial=1.0,
+ maximum=60.0,
+ multiplier=2,
+ predicate=retries.if_exception_type(
+ core_exceptions.DeadlineExceeded,
+ core_exceptions.ServiceUnavailable,
+ ),
+ deadline=60.0,
+ ),
+ default_timeout=60.0,
+ client_info=client_info,
+ ),
+ self.delete_instance: self._wrap_method(
+ self.delete_instance,
+ default_timeout=60.0,
+ client_info=client_info,
+ ),
+ self.create_cluster: self._wrap_method(
+ self.create_cluster,
+ default_timeout=60.0,
+ client_info=client_info,
+ ),
+ self.get_cluster: self._wrap_method(
+ self.get_cluster,
+ default_retry=retries.AsyncRetry(
+ initial=1.0,
+ maximum=60.0,
+ multiplier=2,
+ predicate=retries.if_exception_type(
+ core_exceptions.DeadlineExceeded,
+ core_exceptions.ServiceUnavailable,
+ ),
+ deadline=60.0,
+ ),
+ default_timeout=60.0,
+ client_info=client_info,
+ ),
+ self.list_clusters: self._wrap_method(
+ self.list_clusters,
+ default_retry=retries.AsyncRetry(
+ initial=1.0,
+ maximum=60.0,
+ multiplier=2,
+ predicate=retries.if_exception_type(
+ core_exceptions.DeadlineExceeded,
+ core_exceptions.ServiceUnavailable,
+ ),
+ deadline=60.0,
+ ),
+ default_timeout=60.0,
+ client_info=client_info,
+ ),
+ self.update_cluster: self._wrap_method(
+ self.update_cluster,
+ default_retry=retries.AsyncRetry(
+ initial=1.0,
+ maximum=60.0,
+ multiplier=2,
+ predicate=retries.if_exception_type(
+ core_exceptions.DeadlineExceeded,
+ core_exceptions.ServiceUnavailable,
+ ),
+ deadline=60.0,
+ ),
+ default_timeout=60.0,
+ client_info=client_info,
+ ),
+ self.partial_update_cluster: self._wrap_method(
+ self.partial_update_cluster,
+ default_timeout=None,
+ client_info=client_info,
+ ),
+ self.delete_cluster: self._wrap_method(
+ self.delete_cluster,
+ default_timeout=60.0,
+ client_info=client_info,
+ ),
+ self.create_app_profile: self._wrap_method(
+ self.create_app_profile,
+ default_timeout=60.0,
+ client_info=client_info,
+ ),
+ self.get_app_profile: self._wrap_method(
+ self.get_app_profile,
+ default_retry=retries.AsyncRetry(
+ initial=1.0,
+ maximum=60.0,
+ multiplier=2,
+ predicate=retries.if_exception_type(
+ core_exceptions.DeadlineExceeded,
+ core_exceptions.ServiceUnavailable,
+ ),
+ deadline=60.0,
+ ),
+ default_timeout=60.0,
+ client_info=client_info,
+ ),
+ self.list_app_profiles: self._wrap_method(
+ self.list_app_profiles,
+ default_retry=retries.AsyncRetry(
+ initial=1.0,
+ maximum=60.0,
+ multiplier=2,
+ predicate=retries.if_exception_type(
+ core_exceptions.DeadlineExceeded,
+ core_exceptions.ServiceUnavailable,
+ ),
+ deadline=60.0,
+ ),
+ default_timeout=60.0,
+ client_info=client_info,
+ ),
+ self.update_app_profile: self._wrap_method(
+ self.update_app_profile,
+ default_retry=retries.AsyncRetry(
+ initial=1.0,
+ maximum=60.0,
+ multiplier=2,
+ predicate=retries.if_exception_type(
+ core_exceptions.DeadlineExceeded,
+ core_exceptions.ServiceUnavailable,
+ ),
+ deadline=60.0,
+ ),
+ default_timeout=60.0,
+ client_info=client_info,
+ ),
+ self.delete_app_profile: self._wrap_method(
+ self.delete_app_profile,
+ default_timeout=60.0,
+ client_info=client_info,
+ ),
+ self.get_iam_policy: self._wrap_method(
+ self.get_iam_policy,
+ default_retry=retries.AsyncRetry(
+ initial=1.0,
+ maximum=60.0,
+ multiplier=2,
+ predicate=retries.if_exception_type(
+ core_exceptions.DeadlineExceeded,
+ core_exceptions.ServiceUnavailable,
+ ),
+ deadline=60.0,
+ ),
+ default_timeout=60.0,
+ client_info=client_info,
+ ),
+ self.set_iam_policy: self._wrap_method(
+ self.set_iam_policy,
+ default_timeout=60.0,
+ client_info=client_info,
+ ),
+ self.test_iam_permissions: self._wrap_method(
+ self.test_iam_permissions,
+ default_retry=retries.AsyncRetry(
+ initial=1.0,
+ maximum=60.0,
+ multiplier=2,
+ predicate=retries.if_exception_type(
+ core_exceptions.DeadlineExceeded,
+ core_exceptions.ServiceUnavailable,
+ ),
+ deadline=60.0,
+ ),
+ default_timeout=60.0,
+ client_info=client_info,
+ ),
+ self.list_hot_tablets: self._wrap_method(
+ self.list_hot_tablets,
+ default_retry=retries.AsyncRetry(
+ initial=1.0,
+ maximum=60.0,
+ multiplier=2,
+ predicate=retries.if_exception_type(
+ core_exceptions.DeadlineExceeded,
+ core_exceptions.ServiceUnavailable,
+ ),
+ deadline=60.0,
+ ),
+ default_timeout=60.0,
+ client_info=client_info,
+ ),
+ self.create_logical_view: self._wrap_method(
+ self.create_logical_view,
+ default_timeout=None,
+ client_info=client_info,
+ ),
+ self.get_logical_view: self._wrap_method(
+ self.get_logical_view,
+ default_timeout=None,
+ client_info=client_info,
+ ),
+ self.list_logical_views: self._wrap_method(
+ self.list_logical_views,
+ default_timeout=None,
+ client_info=client_info,
+ ),
+ self.update_logical_view: self._wrap_method(
+ self.update_logical_view,
+ default_timeout=None,
+ client_info=client_info,
+ ),
+ self.delete_logical_view: self._wrap_method(
+ self.delete_logical_view,
+ default_timeout=None,
+ client_info=client_info,
+ ),
+ self.create_materialized_view: self._wrap_method(
+ self.create_materialized_view,
+ default_timeout=None,
+ client_info=client_info,
+ ),
+ self.get_materialized_view: self._wrap_method(
+ self.get_materialized_view,
+ default_timeout=None,
+ client_info=client_info,
+ ),
+ self.list_materialized_views: self._wrap_method(
+ self.list_materialized_views,
+ default_timeout=None,
+ client_info=client_info,
+ ),
+ self.update_materialized_view: self._wrap_method(
+ self.update_materialized_view,
+ default_timeout=None,
+ client_info=client_info,
+ ),
+ self.delete_materialized_view: self._wrap_method(
+ self.delete_materialized_view,
+ default_timeout=None,
+ client_info=client_info,
+ ),
+ }
+
+ def _wrap_method(self, func, *args, **kwargs):
+ if self._wrap_with_kind: # pragma: NO COVER
+ kwargs["kind"] = self.kind
+ return gapic_v1.method_async.wrap_method(func, *args, **kwargs)
+
+ def close(self):
+ return self._logged_channel.close()
+
+ @property
+ def kind(self) -> str:
+ return "grpc_asyncio"
+
+
+__all__ = ("BigtableInstanceAdminGrpcAsyncIOTransport",)
diff --git a/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/rest.py b/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/rest.py
new file mode 100644
index 000000000..9879c4c45
--- /dev/null
+++ b/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/rest.py
@@ -0,0 +1,6825 @@
+# -*- coding: utf-8 -*-
+# Copyright 2025 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.
+#
+import logging
+import json # type: ignore
+
+from google.auth.transport.requests import AuthorizedSession # type: ignore
+from google.auth import credentials as ga_credentials # type: ignore
+from google.api_core import exceptions as core_exceptions
+from google.api_core import retry as retries
+from google.api_core import rest_helpers
+from google.api_core import rest_streaming
+from google.api_core import gapic_v1
+import google.protobuf
+
+from google.protobuf import json_format
+from google.api_core import operations_v1
+
+from requests import __version__ as requests_version
+import dataclasses
+from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union
+import warnings
+
+
+from google.cloud.bigtable_admin_v2.types import bigtable_instance_admin
+from google.cloud.bigtable_admin_v2.types import instance
+from google.iam.v1 import iam_policy_pb2 # type: ignore
+from google.iam.v1 import policy_pb2 # type: ignore
+from google.protobuf import empty_pb2 # type: ignore
+from google.longrunning import operations_pb2 # type: ignore
+
+
+from .rest_base import _BaseBigtableInstanceAdminRestTransport
+from .base import DEFAULT_CLIENT_INFO as BASE_DEFAULT_CLIENT_INFO
+
+try:
+ OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault, None]
+except AttributeError: # pragma: NO COVER
+ OptionalRetry = Union[retries.Retry, object, None] # type: ignore
+
+try:
+ from google.api_core import client_logging # type: ignore
+
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
+except ImportError: # pragma: NO COVER
+ CLIENT_LOGGING_SUPPORTED = False
+
+_LOGGER = logging.getLogger(__name__)
+
+DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
+ gapic_version=BASE_DEFAULT_CLIENT_INFO.gapic_version,
+ grpc_version=None,
+ rest_version=f"requests@{requests_version}",
+)
+
+if hasattr(DEFAULT_CLIENT_INFO, "protobuf_runtime_version"): # pragma: NO COVER
+ DEFAULT_CLIENT_INFO.protobuf_runtime_version = google.protobuf.__version__
+
+
+class BigtableInstanceAdminRestInterceptor:
+ """Interceptor for BigtableInstanceAdmin.
+
+ Interceptors are used to manipulate requests, request metadata, and responses
+ in arbitrary ways.
+ Example use cases include:
+ * Logging
+ * Verifying requests according to service or custom semantics
+ * Stripping extraneous information from responses
+
+ These use cases and more can be enabled by injecting an
+ instance of a custom subclass when constructing the BigtableInstanceAdminRestTransport.
+
+ .. code-block:: python
+ class MyCustomBigtableInstanceAdminInterceptor(BigtableInstanceAdminRestInterceptor):
+ def pre_create_app_profile(self, request, metadata):
+ logging.log(f"Received request: {request}")
+ return request, metadata
+
+ def post_create_app_profile(self, response):
+ logging.log(f"Received response: {response}")
+ return response
+
+ def pre_create_cluster(self, request, metadata):
+ logging.log(f"Received request: {request}")
+ return request, metadata
+
+ def post_create_cluster(self, response):
+ logging.log(f"Received response: {response}")
+ return response
+
+ def pre_create_instance(self, request, metadata):
+ logging.log(f"Received request: {request}")
+ return request, metadata
+
+ def post_create_instance(self, response):
+ logging.log(f"Received response: {response}")
+ return response
+
+ def pre_create_logical_view(self, request, metadata):
+ logging.log(f"Received request: {request}")
+ return request, metadata
+
+ def post_create_logical_view(self, response):
+ logging.log(f"Received response: {response}")
+ return response
+
+ def pre_create_materialized_view(self, request, metadata):
+ logging.log(f"Received request: {request}")
+ return request, metadata
+
+ def post_create_materialized_view(self, response):
+ logging.log(f"Received response: {response}")
+ return response
+
+ def pre_delete_app_profile(self, request, metadata):
+ logging.log(f"Received request: {request}")
+ return request, metadata
+
+ def pre_delete_cluster(self, request, metadata):
+ logging.log(f"Received request: {request}")
+ return request, metadata
+
+ def pre_delete_instance(self, request, metadata):
+ logging.log(f"Received request: {request}")
+ return request, metadata
+
+ def pre_delete_logical_view(self, request, metadata):
+ logging.log(f"Received request: {request}")
+ return request, metadata
+
+ def pre_delete_materialized_view(self, request, metadata):
+ logging.log(f"Received request: {request}")
+ return request, metadata
+
+ def pre_get_app_profile(self, request, metadata):
+ logging.log(f"Received request: {request}")
+ return request, metadata
+
+ def post_get_app_profile(self, response):
+ logging.log(f"Received response: {response}")
+ return response
+
+ def pre_get_cluster(self, request, metadata):
+ logging.log(f"Received request: {request}")
+ return request, metadata
+
+ def post_get_cluster(self, response):
+ logging.log(f"Received response: {response}")
+ return response
+
+ def pre_get_iam_policy(self, request, metadata):
+ logging.log(f"Received request: {request}")
+ return request, metadata
+
+ def post_get_iam_policy(self, response):
+ logging.log(f"Received response: {response}")
+ return response
+
+ def pre_get_instance(self, request, metadata):
+ logging.log(f"Received request: {request}")
+ return request, metadata
+
+ def post_get_instance(self, response):
+ logging.log(f"Received response: {response}")
+ return response
+
+ def pre_get_logical_view(self, request, metadata):
+ logging.log(f"Received request: {request}")
+ return request, metadata
+
+ def post_get_logical_view(self, response):
+ logging.log(f"Received response: {response}")
+ return response
+
+ def pre_get_materialized_view(self, request, metadata):
+ logging.log(f"Received request: {request}")
+ return request, metadata
+
+ def post_get_materialized_view(self, response):
+ logging.log(f"Received response: {response}")
+ return response
+
+ def pre_list_app_profiles(self, request, metadata):
+ logging.log(f"Received request: {request}")
+ return request, metadata
+
+ def post_list_app_profiles(self, response):
+ logging.log(f"Received response: {response}")
+ return response
+
+ def pre_list_clusters(self, request, metadata):
+ logging.log(f"Received request: {request}")
+ return request, metadata
+
+ def post_list_clusters(self, response):
+ logging.log(f"Received response: {response}")
+ return response
+
+ def pre_list_hot_tablets(self, request, metadata):
+ logging.log(f"Received request: {request}")
+ return request, metadata
+
+ def post_list_hot_tablets(self, response):
+ logging.log(f"Received response: {response}")
+ return response
+
+ def pre_list_instances(self, request, metadata):
+ logging.log(f"Received request: {request}")
+ return request, metadata
+
+ def post_list_instances(self, response):
+ logging.log(f"Received response: {response}")
+ return response
+
+ def pre_list_logical_views(self, request, metadata):
+ logging.log(f"Received request: {request}")
+ return request, metadata
+
+ def post_list_logical_views(self, response):
+ logging.log(f"Received response: {response}")
+ return response
+
+ def pre_list_materialized_views(self, request, metadata):
+ logging.log(f"Received request: {request}")
+ return request, metadata
+
+ def post_list_materialized_views(self, response):
+ logging.log(f"Received response: {response}")
+ return response
+
+ def pre_partial_update_cluster(self, request, metadata):
+ logging.log(f"Received request: {request}")
+ return request, metadata
+
+ def post_partial_update_cluster(self, response):
+ logging.log(f"Received response: {response}")
+ return response
+
+ def pre_partial_update_instance(self, request, metadata):
+ logging.log(f"Received request: {request}")
+ return request, metadata
+
+ def post_partial_update_instance(self, response):
+ logging.log(f"Received response: {response}")
+ return response
+
+ def pre_set_iam_policy(self, request, metadata):
+ logging.log(f"Received request: {request}")
+ return request, metadata
+
+ def post_set_iam_policy(self, response):
+ logging.log(f"Received response: {response}")
+ return response
+
+ def pre_test_iam_permissions(self, request, metadata):
+ logging.log(f"Received request: {request}")
+ return request, metadata
+
+ def post_test_iam_permissions(self, response):
+ logging.log(f"Received response: {response}")
+ return response
+
+ def pre_update_app_profile(self, request, metadata):
+ logging.log(f"Received request: {request}")
+ return request, metadata
+
+ def post_update_app_profile(self, response):
+ logging.log(f"Received response: {response}")
+ return response
+
+ def pre_update_cluster(self, request, metadata):
+ logging.log(f"Received request: {request}")
+ return request, metadata
+
+ def post_update_cluster(self, response):
+ logging.log(f"Received response: {response}")
+ return response
+
+ def pre_update_instance(self, request, metadata):
+ logging.log(f"Received request: {request}")
+ return request, metadata
+
+ def post_update_instance(self, response):
+ logging.log(f"Received response: {response}")
+ return response
+
+ def pre_update_logical_view(self, request, metadata):
+ logging.log(f"Received request: {request}")
+ return request, metadata
+
+ def post_update_logical_view(self, response):
+ logging.log(f"Received response: {response}")
+ return response
+
+ def pre_update_materialized_view(self, request, metadata):
+ logging.log(f"Received request: {request}")
+ return request, metadata
+
+ def post_update_materialized_view(self, response):
+ logging.log(f"Received response: {response}")
+ return response
+
+ transport = BigtableInstanceAdminRestTransport(interceptor=MyCustomBigtableInstanceAdminInterceptor())
+ client = BigtableInstanceAdminClient(transport=transport)
+
+
+ """
+
+ def pre_create_app_profile(
+ self,
+ request: bigtable_instance_admin.CreateAppProfileRequest,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[
+ bigtable_instance_admin.CreateAppProfileRequest,
+ Sequence[Tuple[str, Union[str, bytes]]],
+ ]:
+ """Pre-rpc interceptor for create_app_profile
+
+ Override in a subclass to manipulate the request or metadata
+ before they are sent to the BigtableInstanceAdmin server.
+ """
+ return request, metadata
+
+ def post_create_app_profile(
+ self, response: instance.AppProfile
+ ) -> instance.AppProfile:
+ """Post-rpc interceptor for create_app_profile
+
+ DEPRECATED. Please use the `post_create_app_profile_with_metadata`
+ interceptor instead.
+
+ Override in a subclass to read or manipulate the response
+ after it is returned by the BigtableInstanceAdmin server but before
+ it is returned to user code. This `post_create_app_profile` interceptor runs
+ before the `post_create_app_profile_with_metadata` interceptor.
+ """
+ return response
+
+ def post_create_app_profile_with_metadata(
+ self,
+ response: instance.AppProfile,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[instance.AppProfile, Sequence[Tuple[str, Union[str, bytes]]]]:
+ """Post-rpc interceptor for create_app_profile
+
+ Override in a subclass to read or manipulate the response or metadata after it
+ is returned by the BigtableInstanceAdmin server but before it is returned to user code.
+
+ We recommend only using this `post_create_app_profile_with_metadata`
+ interceptor in new development instead of the `post_create_app_profile` interceptor.
+ When both interceptors are used, this `post_create_app_profile_with_metadata` interceptor runs after the
+ `post_create_app_profile` interceptor. The (possibly modified) response returned by
+ `post_create_app_profile` will be passed to
+ `post_create_app_profile_with_metadata`.
+ """
+ return response, metadata
+
+ def pre_create_cluster(
+ self,
+ request: bigtable_instance_admin.CreateClusterRequest,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[
+ bigtable_instance_admin.CreateClusterRequest,
+ Sequence[Tuple[str, Union[str, bytes]]],
+ ]:
+ """Pre-rpc interceptor for create_cluster
+
+ Override in a subclass to manipulate the request or metadata
+ before they are sent to the BigtableInstanceAdmin server.
+ """
+ return request, metadata
+
+ def post_create_cluster(
+ self, response: operations_pb2.Operation
+ ) -> operations_pb2.Operation:
+ """Post-rpc interceptor for create_cluster
+
+ DEPRECATED. Please use the `post_create_cluster_with_metadata`
+ interceptor instead.
+
+ Override in a subclass to read or manipulate the response
+ after it is returned by the BigtableInstanceAdmin server but before
+ it is returned to user code. This `post_create_cluster` interceptor runs
+ before the `post_create_cluster_with_metadata` interceptor.
+ """
+ return response
+
+ def post_create_cluster_with_metadata(
+ self,
+ response: operations_pb2.Operation,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[operations_pb2.Operation, Sequence[Tuple[str, Union[str, bytes]]]]:
+ """Post-rpc interceptor for create_cluster
+
+ Override in a subclass to read or manipulate the response or metadata after it
+ is returned by the BigtableInstanceAdmin server but before it is returned to user code.
+
+ We recommend only using this `post_create_cluster_with_metadata`
+ interceptor in new development instead of the `post_create_cluster` interceptor.
+ When both interceptors are used, this `post_create_cluster_with_metadata` interceptor runs after the
+ `post_create_cluster` interceptor. The (possibly modified) response returned by
+ `post_create_cluster` will be passed to
+ `post_create_cluster_with_metadata`.
+ """
+ return response, metadata
+
+ def pre_create_instance(
+ self,
+ request: bigtable_instance_admin.CreateInstanceRequest,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[
+ bigtable_instance_admin.CreateInstanceRequest,
+ Sequence[Tuple[str, Union[str, bytes]]],
+ ]:
+ """Pre-rpc interceptor for create_instance
+
+ Override in a subclass to manipulate the request or metadata
+ before they are sent to the BigtableInstanceAdmin server.
+ """
+ return request, metadata
+
+ def post_create_instance(
+ self, response: operations_pb2.Operation
+ ) -> operations_pb2.Operation:
+ """Post-rpc interceptor for create_instance
+
+ DEPRECATED. Please use the `post_create_instance_with_metadata`
+ interceptor instead.
+
+ Override in a subclass to read or manipulate the response
+ after it is returned by the BigtableInstanceAdmin server but before
+ it is returned to user code. This `post_create_instance` interceptor runs
+ before the `post_create_instance_with_metadata` interceptor.
+ """
+ return response
+
+ def post_create_instance_with_metadata(
+ self,
+ response: operations_pb2.Operation,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[operations_pb2.Operation, Sequence[Tuple[str, Union[str, bytes]]]]:
+ """Post-rpc interceptor for create_instance
+
+ Override in a subclass to read or manipulate the response or metadata after it
+ is returned by the BigtableInstanceAdmin server but before it is returned to user code.
+
+ We recommend only using this `post_create_instance_with_metadata`
+ interceptor in new development instead of the `post_create_instance` interceptor.
+ When both interceptors are used, this `post_create_instance_with_metadata` interceptor runs after the
+ `post_create_instance` interceptor. The (possibly modified) response returned by
+ `post_create_instance` will be passed to
+ `post_create_instance_with_metadata`.
+ """
+ return response, metadata
+
+ def pre_create_logical_view(
+ self,
+ request: bigtable_instance_admin.CreateLogicalViewRequest,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[
+ bigtable_instance_admin.CreateLogicalViewRequest,
+ Sequence[Tuple[str, Union[str, bytes]]],
+ ]:
+ """Pre-rpc interceptor for create_logical_view
+
+ Override in a subclass to manipulate the request or metadata
+ before they are sent to the BigtableInstanceAdmin server.
+ """
+ return request, metadata
+
+ def post_create_logical_view(
+ self, response: operations_pb2.Operation
+ ) -> operations_pb2.Operation:
+ """Post-rpc interceptor for create_logical_view
+
+ DEPRECATED. Please use the `post_create_logical_view_with_metadata`
+ interceptor instead.
+
+ Override in a subclass to read or manipulate the response
+ after it is returned by the BigtableInstanceAdmin server but before
+ it is returned to user code. This `post_create_logical_view` interceptor runs
+ before the `post_create_logical_view_with_metadata` interceptor.
+ """
+ return response
+
+ def post_create_logical_view_with_metadata(
+ self,
+ response: operations_pb2.Operation,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[operations_pb2.Operation, Sequence[Tuple[str, Union[str, bytes]]]]:
+ """Post-rpc interceptor for create_logical_view
+
+ Override in a subclass to read or manipulate the response or metadata after it
+ is returned by the BigtableInstanceAdmin server but before it is returned to user code.
+
+ We recommend only using this `post_create_logical_view_with_metadata`
+ interceptor in new development instead of the `post_create_logical_view` interceptor.
+ When both interceptors are used, this `post_create_logical_view_with_metadata` interceptor runs after the
+ `post_create_logical_view` interceptor. The (possibly modified) response returned by
+ `post_create_logical_view` will be passed to
+ `post_create_logical_view_with_metadata`.
+ """
+ return response, metadata
+
+ def pre_create_materialized_view(
+ self,
+ request: bigtable_instance_admin.CreateMaterializedViewRequest,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[
+ bigtable_instance_admin.CreateMaterializedViewRequest,
+ Sequence[Tuple[str, Union[str, bytes]]],
+ ]:
+ """Pre-rpc interceptor for create_materialized_view
+
+ Override in a subclass to manipulate the request or metadata
+ before they are sent to the BigtableInstanceAdmin server.
+ """
+ return request, metadata
+
+ def post_create_materialized_view(
+ self, response: operations_pb2.Operation
+ ) -> operations_pb2.Operation:
+ """Post-rpc interceptor for create_materialized_view
+
+ DEPRECATED. Please use the `post_create_materialized_view_with_metadata`
+ interceptor instead.
+
+ Override in a subclass to read or manipulate the response
+ after it is returned by the BigtableInstanceAdmin server but before
+ it is returned to user code. This `post_create_materialized_view` interceptor runs
+ before the `post_create_materialized_view_with_metadata` interceptor.
+ """
+ return response
+
+ def post_create_materialized_view_with_metadata(
+ self,
+ response: operations_pb2.Operation,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[operations_pb2.Operation, Sequence[Tuple[str, Union[str, bytes]]]]:
+ """Post-rpc interceptor for create_materialized_view
+
+ Override in a subclass to read or manipulate the response or metadata after it
+ is returned by the BigtableInstanceAdmin server but before it is returned to user code.
+
+ We recommend only using this `post_create_materialized_view_with_metadata`
+ interceptor in new development instead of the `post_create_materialized_view` interceptor.
+ When both interceptors are used, this `post_create_materialized_view_with_metadata` interceptor runs after the
+ `post_create_materialized_view` interceptor. The (possibly modified) response returned by
+ `post_create_materialized_view` will be passed to
+ `post_create_materialized_view_with_metadata`.
+ """
+ return response, metadata
+
+ def pre_delete_app_profile(
+ self,
+ request: bigtable_instance_admin.DeleteAppProfileRequest,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[
+ bigtable_instance_admin.DeleteAppProfileRequest,
+ Sequence[Tuple[str, Union[str, bytes]]],
+ ]:
+ """Pre-rpc interceptor for delete_app_profile
+
+ Override in a subclass to manipulate the request or metadata
+ before they are sent to the BigtableInstanceAdmin server.
+ """
+ return request, metadata
+
+ def pre_delete_cluster(
+ self,
+ request: bigtable_instance_admin.DeleteClusterRequest,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[
+ bigtable_instance_admin.DeleteClusterRequest,
+ Sequence[Tuple[str, Union[str, bytes]]],
+ ]:
+ """Pre-rpc interceptor for delete_cluster
+
+ Override in a subclass to manipulate the request or metadata
+ before they are sent to the BigtableInstanceAdmin server.
+ """
+ return request, metadata
+
+ def pre_delete_instance(
+ self,
+ request: bigtable_instance_admin.DeleteInstanceRequest,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[
+ bigtable_instance_admin.DeleteInstanceRequest,
+ Sequence[Tuple[str, Union[str, bytes]]],
+ ]:
+ """Pre-rpc interceptor for delete_instance
+
+ Override in a subclass to manipulate the request or metadata
+ before they are sent to the BigtableInstanceAdmin server.
+ """
+ return request, metadata
+
+ def pre_delete_logical_view(
+ self,
+ request: bigtable_instance_admin.DeleteLogicalViewRequest,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[
+ bigtable_instance_admin.DeleteLogicalViewRequest,
+ Sequence[Tuple[str, Union[str, bytes]]],
+ ]:
+ """Pre-rpc interceptor for delete_logical_view
+
+ Override in a subclass to manipulate the request or metadata
+ before they are sent to the BigtableInstanceAdmin server.
+ """
+ return request, metadata
+
+ def pre_delete_materialized_view(
+ self,
+ request: bigtable_instance_admin.DeleteMaterializedViewRequest,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[
+ bigtable_instance_admin.DeleteMaterializedViewRequest,
+ Sequence[Tuple[str, Union[str, bytes]]],
+ ]:
+ """Pre-rpc interceptor for delete_materialized_view
+
+ Override in a subclass to manipulate the request or metadata
+ before they are sent to the BigtableInstanceAdmin server.
+ """
+ return request, metadata
+
+ def pre_get_app_profile(
+ self,
+ request: bigtable_instance_admin.GetAppProfileRequest,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[
+ bigtable_instance_admin.GetAppProfileRequest,
+ Sequence[Tuple[str, Union[str, bytes]]],
+ ]:
+ """Pre-rpc interceptor for get_app_profile
+
+ Override in a subclass to manipulate the request or metadata
+ before they are sent to the BigtableInstanceAdmin server.
+ """
+ return request, metadata
+
+ def post_get_app_profile(
+ self, response: instance.AppProfile
+ ) -> instance.AppProfile:
+ """Post-rpc interceptor for get_app_profile
+
+ DEPRECATED. Please use the `post_get_app_profile_with_metadata`
+ interceptor instead.
+
+ Override in a subclass to read or manipulate the response
+ after it is returned by the BigtableInstanceAdmin server but before
+ it is returned to user code. This `post_get_app_profile` interceptor runs
+ before the `post_get_app_profile_with_metadata` interceptor.
+ """
+ return response
+
+ def post_get_app_profile_with_metadata(
+ self,
+ response: instance.AppProfile,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[instance.AppProfile, Sequence[Tuple[str, Union[str, bytes]]]]:
+ """Post-rpc interceptor for get_app_profile
+
+ Override in a subclass to read or manipulate the response or metadata after it
+ is returned by the BigtableInstanceAdmin server but before it is returned to user code.
+
+ We recommend only using this `post_get_app_profile_with_metadata`
+ interceptor in new development instead of the `post_get_app_profile` interceptor.
+ When both interceptors are used, this `post_get_app_profile_with_metadata` interceptor runs after the
+ `post_get_app_profile` interceptor. The (possibly modified) response returned by
+ `post_get_app_profile` will be passed to
+ `post_get_app_profile_with_metadata`.
+ """
+ return response, metadata
+
+ def pre_get_cluster(
+ self,
+ request: bigtable_instance_admin.GetClusterRequest,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[
+ bigtable_instance_admin.GetClusterRequest,
+ Sequence[Tuple[str, Union[str, bytes]]],
+ ]:
+ """Pre-rpc interceptor for get_cluster
+
+ Override in a subclass to manipulate the request or metadata
+ before they are sent to the BigtableInstanceAdmin server.
+ """
+ return request, metadata
+
+ def post_get_cluster(self, response: instance.Cluster) -> instance.Cluster:
+ """Post-rpc interceptor for get_cluster
+
+ DEPRECATED. Please use the `post_get_cluster_with_metadata`
+ interceptor instead.
+
+ Override in a subclass to read or manipulate the response
+ after it is returned by the BigtableInstanceAdmin server but before
+ it is returned to user code. This `post_get_cluster` interceptor runs
+ before the `post_get_cluster_with_metadata` interceptor.
+ """
+ return response
+
+ def post_get_cluster_with_metadata(
+ self,
+ response: instance.Cluster,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[instance.Cluster, Sequence[Tuple[str, Union[str, bytes]]]]:
+ """Post-rpc interceptor for get_cluster
+
+ Override in a subclass to read or manipulate the response or metadata after it
+ is returned by the BigtableInstanceAdmin server but before it is returned to user code.
+
+ We recommend only using this `post_get_cluster_with_metadata`
+ interceptor in new development instead of the `post_get_cluster` interceptor.
+ When both interceptors are used, this `post_get_cluster_with_metadata` interceptor runs after the
+ `post_get_cluster` interceptor. The (possibly modified) response returned by
+ `post_get_cluster` will be passed to
+ `post_get_cluster_with_metadata`.
+ """
+ return response, metadata
+
+ def pre_get_iam_policy(
+ self,
+ request: iam_policy_pb2.GetIamPolicyRequest,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[
+ iam_policy_pb2.GetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]]
+ ]:
+ """Pre-rpc interceptor for get_iam_policy
+
+ Override in a subclass to manipulate the request or metadata
+ before they are sent to the BigtableInstanceAdmin server.
+ """
+ return request, metadata
+
+ def post_get_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy:
+ """Post-rpc interceptor for get_iam_policy
+
+ DEPRECATED. Please use the `post_get_iam_policy_with_metadata`
+ interceptor instead.
+
+ Override in a subclass to read or manipulate the response
+ after it is returned by the BigtableInstanceAdmin server but before
+ it is returned to user code. This `post_get_iam_policy` interceptor runs
+ before the `post_get_iam_policy_with_metadata` interceptor.
+ """
+ return response
+
+ def post_get_iam_policy_with_metadata(
+ self,
+ response: policy_pb2.Policy,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[policy_pb2.Policy, Sequence[Tuple[str, Union[str, bytes]]]]:
+ """Post-rpc interceptor for get_iam_policy
+
+ Override in a subclass to read or manipulate the response or metadata after it
+ is returned by the BigtableInstanceAdmin server but before it is returned to user code.
+
+ We recommend only using this `post_get_iam_policy_with_metadata`
+ interceptor in new development instead of the `post_get_iam_policy` interceptor.
+ When both interceptors are used, this `post_get_iam_policy_with_metadata` interceptor runs after the
+ `post_get_iam_policy` interceptor. The (possibly modified) response returned by
+ `post_get_iam_policy` will be passed to
+ `post_get_iam_policy_with_metadata`.
+ """
+ return response, metadata
+
+ def pre_get_instance(
+ self,
+ request: bigtable_instance_admin.GetInstanceRequest,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[
+ bigtable_instance_admin.GetInstanceRequest,
+ Sequence[Tuple[str, Union[str, bytes]]],
+ ]:
+ """Pre-rpc interceptor for get_instance
+
+ Override in a subclass to manipulate the request or metadata
+ before they are sent to the BigtableInstanceAdmin server.
+ """
+ return request, metadata
+
+ def post_get_instance(self, response: instance.Instance) -> instance.Instance:
+ """Post-rpc interceptor for get_instance
+
+ DEPRECATED. Please use the `post_get_instance_with_metadata`
+ interceptor instead.
+
+ Override in a subclass to read or manipulate the response
+ after it is returned by the BigtableInstanceAdmin server but before
+ it is returned to user code. This `post_get_instance` interceptor runs
+ before the `post_get_instance_with_metadata` interceptor.
+ """
+ return response
+
+ def post_get_instance_with_metadata(
+ self,
+ response: instance.Instance,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[instance.Instance, Sequence[Tuple[str, Union[str, bytes]]]]:
+ """Post-rpc interceptor for get_instance
+
+ Override in a subclass to read or manipulate the response or metadata after it
+ is returned by the BigtableInstanceAdmin server but before it is returned to user code.
+
+ We recommend only using this `post_get_instance_with_metadata`
+ interceptor in new development instead of the `post_get_instance` interceptor.
+ When both interceptors are used, this `post_get_instance_with_metadata` interceptor runs after the
+ `post_get_instance` interceptor. The (possibly modified) response returned by
+ `post_get_instance` will be passed to
+ `post_get_instance_with_metadata`.
+ """
+ return response, metadata
+
+ def pre_get_logical_view(
+ self,
+ request: bigtable_instance_admin.GetLogicalViewRequest,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[
+ bigtable_instance_admin.GetLogicalViewRequest,
+ Sequence[Tuple[str, Union[str, bytes]]],
+ ]:
+ """Pre-rpc interceptor for get_logical_view
+
+ Override in a subclass to manipulate the request or metadata
+ before they are sent to the BigtableInstanceAdmin server.
+ """
+ return request, metadata
+
+ def post_get_logical_view(
+ self, response: instance.LogicalView
+ ) -> instance.LogicalView:
+ """Post-rpc interceptor for get_logical_view
+
+ DEPRECATED. Please use the `post_get_logical_view_with_metadata`
+ interceptor instead.
+
+ Override in a subclass to read or manipulate the response
+ after it is returned by the BigtableInstanceAdmin server but before
+ it is returned to user code. This `post_get_logical_view` interceptor runs
+ before the `post_get_logical_view_with_metadata` interceptor.
+ """
+ return response
+
+ def post_get_logical_view_with_metadata(
+ self,
+ response: instance.LogicalView,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[instance.LogicalView, Sequence[Tuple[str, Union[str, bytes]]]]:
+ """Post-rpc interceptor for get_logical_view
+
+ Override in a subclass to read or manipulate the response or metadata after it
+ is returned by the BigtableInstanceAdmin server but before it is returned to user code.
+
+ We recommend only using this `post_get_logical_view_with_metadata`
+ interceptor in new development instead of the `post_get_logical_view` interceptor.
+ When both interceptors are used, this `post_get_logical_view_with_metadata` interceptor runs after the
+ `post_get_logical_view` interceptor. The (possibly modified) response returned by
+ `post_get_logical_view` will be passed to
+ `post_get_logical_view_with_metadata`.
+ """
+ return response, metadata
+
+ def pre_get_materialized_view(
+ self,
+ request: bigtable_instance_admin.GetMaterializedViewRequest,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[
+ bigtable_instance_admin.GetMaterializedViewRequest,
+ Sequence[Tuple[str, Union[str, bytes]]],
+ ]:
+ """Pre-rpc interceptor for get_materialized_view
+
+ Override in a subclass to manipulate the request or metadata
+ before they are sent to the BigtableInstanceAdmin server.
+ """
+ return request, metadata
+
+ def post_get_materialized_view(
+ self, response: instance.MaterializedView
+ ) -> instance.MaterializedView:
+ """Post-rpc interceptor for get_materialized_view
+
+ DEPRECATED. Please use the `post_get_materialized_view_with_metadata`
+ interceptor instead.
+
+ Override in a subclass to read or manipulate the response
+ after it is returned by the BigtableInstanceAdmin server but before
+ it is returned to user code. This `post_get_materialized_view` interceptor runs
+ before the `post_get_materialized_view_with_metadata` interceptor.
+ """
+ return response
+
+ def post_get_materialized_view_with_metadata(
+ self,
+ response: instance.MaterializedView,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[instance.MaterializedView, Sequence[Tuple[str, Union[str, bytes]]]]:
+ """Post-rpc interceptor for get_materialized_view
+
+ Override in a subclass to read or manipulate the response or metadata after it
+ is returned by the BigtableInstanceAdmin server but before it is returned to user code.
+
+ We recommend only using this `post_get_materialized_view_with_metadata`
+ interceptor in new development instead of the `post_get_materialized_view` interceptor.
+ When both interceptors are used, this `post_get_materialized_view_with_metadata` interceptor runs after the
+ `post_get_materialized_view` interceptor. The (possibly modified) response returned by
+ `post_get_materialized_view` will be passed to
+ `post_get_materialized_view_with_metadata`.
+ """
+ return response, metadata
+
+ def pre_list_app_profiles(
+ self,
+ request: bigtable_instance_admin.ListAppProfilesRequest,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[
+ bigtable_instance_admin.ListAppProfilesRequest,
+ Sequence[Tuple[str, Union[str, bytes]]],
+ ]:
+ """Pre-rpc interceptor for list_app_profiles
+
+ Override in a subclass to manipulate the request or metadata
+ before they are sent to the BigtableInstanceAdmin server.
+ """
+ return request, metadata
+
+ def post_list_app_profiles(
+ self, response: bigtable_instance_admin.ListAppProfilesResponse
+ ) -> bigtable_instance_admin.ListAppProfilesResponse:
+ """Post-rpc interceptor for list_app_profiles
+
+ DEPRECATED. Please use the `post_list_app_profiles_with_metadata`
+ interceptor instead.
+
+ Override in a subclass to read or manipulate the response
+ after it is returned by the BigtableInstanceAdmin server but before
+ it is returned to user code. This `post_list_app_profiles` interceptor runs
+ before the `post_list_app_profiles_with_metadata` interceptor.
+ """
+ return response
+
+ def post_list_app_profiles_with_metadata(
+ self,
+ response: bigtable_instance_admin.ListAppProfilesResponse,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[
+ bigtable_instance_admin.ListAppProfilesResponse,
+ Sequence[Tuple[str, Union[str, bytes]]],
+ ]:
+ """Post-rpc interceptor for list_app_profiles
+
+ Override in a subclass to read or manipulate the response or metadata after it
+ is returned by the BigtableInstanceAdmin server but before it is returned to user code.
+
+ We recommend only using this `post_list_app_profiles_with_metadata`
+ interceptor in new development instead of the `post_list_app_profiles` interceptor.
+ When both interceptors are used, this `post_list_app_profiles_with_metadata` interceptor runs after the
+ `post_list_app_profiles` interceptor. The (possibly modified) response returned by
+ `post_list_app_profiles` will be passed to
+ `post_list_app_profiles_with_metadata`.
+ """
+ return response, metadata
+
+ def pre_list_clusters(
+ self,
+ request: bigtable_instance_admin.ListClustersRequest,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[
+ bigtable_instance_admin.ListClustersRequest,
+ Sequence[Tuple[str, Union[str, bytes]]],
+ ]:
+ """Pre-rpc interceptor for list_clusters
+
+ Override in a subclass to manipulate the request or metadata
+ before they are sent to the BigtableInstanceAdmin server.
+ """
+ return request, metadata
+
+ def post_list_clusters(
+ self, response: bigtable_instance_admin.ListClustersResponse
+ ) -> bigtable_instance_admin.ListClustersResponse:
+ """Post-rpc interceptor for list_clusters
+
+ DEPRECATED. Please use the `post_list_clusters_with_metadata`
+ interceptor instead.
+
+ Override in a subclass to read or manipulate the response
+ after it is returned by the BigtableInstanceAdmin server but before
+ it is returned to user code. This `post_list_clusters` interceptor runs
+ before the `post_list_clusters_with_metadata` interceptor.
+ """
+ return response
+
+ def post_list_clusters_with_metadata(
+ self,
+ response: bigtable_instance_admin.ListClustersResponse,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[
+ bigtable_instance_admin.ListClustersResponse,
+ Sequence[Tuple[str, Union[str, bytes]]],
+ ]:
+ """Post-rpc interceptor for list_clusters
+
+ Override in a subclass to read or manipulate the response or metadata after it
+ is returned by the BigtableInstanceAdmin server but before it is returned to user code.
+
+ We recommend only using this `post_list_clusters_with_metadata`
+ interceptor in new development instead of the `post_list_clusters` interceptor.
+ When both interceptors are used, this `post_list_clusters_with_metadata` interceptor runs after the
+ `post_list_clusters` interceptor. The (possibly modified) response returned by
+ `post_list_clusters` will be passed to
+ `post_list_clusters_with_metadata`.
+ """
+ return response, metadata
+
+ def pre_list_hot_tablets(
+ self,
+ request: bigtable_instance_admin.ListHotTabletsRequest,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[
+ bigtable_instance_admin.ListHotTabletsRequest,
+ Sequence[Tuple[str, Union[str, bytes]]],
+ ]:
+ """Pre-rpc interceptor for list_hot_tablets
+
+ Override in a subclass to manipulate the request or metadata
+ before they are sent to the BigtableInstanceAdmin server.
+ """
+ return request, metadata
+
+ def post_list_hot_tablets(
+ self, response: bigtable_instance_admin.ListHotTabletsResponse
+ ) -> bigtable_instance_admin.ListHotTabletsResponse:
+ """Post-rpc interceptor for list_hot_tablets
+
+ DEPRECATED. Please use the `post_list_hot_tablets_with_metadata`
+ interceptor instead.
+
+ Override in a subclass to read or manipulate the response
+ after it is returned by the BigtableInstanceAdmin server but before
+ it is returned to user code. This `post_list_hot_tablets` interceptor runs
+ before the `post_list_hot_tablets_with_metadata` interceptor.
+ """
+ return response
+
+ def post_list_hot_tablets_with_metadata(
+ self,
+ response: bigtable_instance_admin.ListHotTabletsResponse,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[
+ bigtable_instance_admin.ListHotTabletsResponse,
+ Sequence[Tuple[str, Union[str, bytes]]],
+ ]:
+ """Post-rpc interceptor for list_hot_tablets
+
+ Override in a subclass to read or manipulate the response or metadata after it
+ is returned by the BigtableInstanceAdmin server but before it is returned to user code.
+
+ We recommend only using this `post_list_hot_tablets_with_metadata`
+ interceptor in new development instead of the `post_list_hot_tablets` interceptor.
+ When both interceptors are used, this `post_list_hot_tablets_with_metadata` interceptor runs after the
+ `post_list_hot_tablets` interceptor. The (possibly modified) response returned by
+ `post_list_hot_tablets` will be passed to
+ `post_list_hot_tablets_with_metadata`.
+ """
+ return response, metadata
+
+ def pre_list_instances(
+ self,
+ request: bigtable_instance_admin.ListInstancesRequest,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[
+ bigtable_instance_admin.ListInstancesRequest,
+ Sequence[Tuple[str, Union[str, bytes]]],
+ ]:
+ """Pre-rpc interceptor for list_instances
+
+ Override in a subclass to manipulate the request or metadata
+ before they are sent to the BigtableInstanceAdmin server.
+ """
+ return request, metadata
+
+ def post_list_instances(
+ self, response: bigtable_instance_admin.ListInstancesResponse
+ ) -> bigtable_instance_admin.ListInstancesResponse:
+ """Post-rpc interceptor for list_instances
+
+ DEPRECATED. Please use the `post_list_instances_with_metadata`
+ interceptor instead.
+
+ Override in a subclass to read or manipulate the response
+ after it is returned by the BigtableInstanceAdmin server but before
+ it is returned to user code. This `post_list_instances` interceptor runs
+ before the `post_list_instances_with_metadata` interceptor.
+ """
+ return response
+
+ def post_list_instances_with_metadata(
+ self,
+ response: bigtable_instance_admin.ListInstancesResponse,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[
+ bigtable_instance_admin.ListInstancesResponse,
+ Sequence[Tuple[str, Union[str, bytes]]],
+ ]:
+ """Post-rpc interceptor for list_instances
+
+ Override in a subclass to read or manipulate the response or metadata after it
+ is returned by the BigtableInstanceAdmin server but before it is returned to user code.
+
+ We recommend only using this `post_list_instances_with_metadata`
+ interceptor in new development instead of the `post_list_instances` interceptor.
+ When both interceptors are used, this `post_list_instances_with_metadata` interceptor runs after the
+ `post_list_instances` interceptor. The (possibly modified) response returned by
+ `post_list_instances` will be passed to
+ `post_list_instances_with_metadata`.
+ """
+ return response, metadata
+
+ def pre_list_logical_views(
+ self,
+ request: bigtable_instance_admin.ListLogicalViewsRequest,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[
+ bigtable_instance_admin.ListLogicalViewsRequest,
+ Sequence[Tuple[str, Union[str, bytes]]],
+ ]:
+ """Pre-rpc interceptor for list_logical_views
+
+ Override in a subclass to manipulate the request or metadata
+ before they are sent to the BigtableInstanceAdmin server.
+ """
+ return request, metadata
+
+ def post_list_logical_views(
+ self, response: bigtable_instance_admin.ListLogicalViewsResponse
+ ) -> bigtable_instance_admin.ListLogicalViewsResponse:
+ """Post-rpc interceptor for list_logical_views
+
+ DEPRECATED. Please use the `post_list_logical_views_with_metadata`
+ interceptor instead.
+
+ Override in a subclass to read or manipulate the response
+ after it is returned by the BigtableInstanceAdmin server but before
+ it is returned to user code. This `post_list_logical_views` interceptor runs
+ before the `post_list_logical_views_with_metadata` interceptor.
+ """
+ return response
+
+ def post_list_logical_views_with_metadata(
+ self,
+ response: bigtable_instance_admin.ListLogicalViewsResponse,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[
+ bigtable_instance_admin.ListLogicalViewsResponse,
+ Sequence[Tuple[str, Union[str, bytes]]],
+ ]:
+ """Post-rpc interceptor for list_logical_views
+
+ Override in a subclass to read or manipulate the response or metadata after it
+ is returned by the BigtableInstanceAdmin server but before it is returned to user code.
+
+ We recommend only using this `post_list_logical_views_with_metadata`
+ interceptor in new development instead of the `post_list_logical_views` interceptor.
+ When both interceptors are used, this `post_list_logical_views_with_metadata` interceptor runs after the
+ `post_list_logical_views` interceptor. The (possibly modified) response returned by
+ `post_list_logical_views` will be passed to
+ `post_list_logical_views_with_metadata`.
+ """
+ return response, metadata
+
+ def pre_list_materialized_views(
+ self,
+ request: bigtable_instance_admin.ListMaterializedViewsRequest,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[
+ bigtable_instance_admin.ListMaterializedViewsRequest,
+ Sequence[Tuple[str, Union[str, bytes]]],
+ ]:
+ """Pre-rpc interceptor for list_materialized_views
+
+ Override in a subclass to manipulate the request or metadata
+ before they are sent to the BigtableInstanceAdmin server.
+ """
+ return request, metadata
+
+ def post_list_materialized_views(
+ self, response: bigtable_instance_admin.ListMaterializedViewsResponse
+ ) -> bigtable_instance_admin.ListMaterializedViewsResponse:
+ """Post-rpc interceptor for list_materialized_views
+
+ DEPRECATED. Please use the `post_list_materialized_views_with_metadata`
+ interceptor instead.
+
+ Override in a subclass to read or manipulate the response
+ after it is returned by the BigtableInstanceAdmin server but before
+ it is returned to user code. This `post_list_materialized_views` interceptor runs
+ before the `post_list_materialized_views_with_metadata` interceptor.
+ """
+ return response
+
+ def post_list_materialized_views_with_metadata(
+ self,
+ response: bigtable_instance_admin.ListMaterializedViewsResponse,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[
+ bigtable_instance_admin.ListMaterializedViewsResponse,
+ Sequence[Tuple[str, Union[str, bytes]]],
+ ]:
+ """Post-rpc interceptor for list_materialized_views
+
+ Override in a subclass to read or manipulate the response or metadata after it
+ is returned by the BigtableInstanceAdmin server but before it is returned to user code.
+
+ We recommend only using this `post_list_materialized_views_with_metadata`
+ interceptor in new development instead of the `post_list_materialized_views` interceptor.
+ When both interceptors are used, this `post_list_materialized_views_with_metadata` interceptor runs after the
+ `post_list_materialized_views` interceptor. The (possibly modified) response returned by
+ `post_list_materialized_views` will be passed to
+ `post_list_materialized_views_with_metadata`.
+ """
+ return response, metadata
+
+ def pre_partial_update_cluster(
+ self,
+ request: bigtable_instance_admin.PartialUpdateClusterRequest,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[
+ bigtable_instance_admin.PartialUpdateClusterRequest,
+ Sequence[Tuple[str, Union[str, bytes]]],
+ ]:
+ """Pre-rpc interceptor for partial_update_cluster
+
+ Override in a subclass to manipulate the request or metadata
+ before they are sent to the BigtableInstanceAdmin server.
+ """
+ return request, metadata
+
+ def post_partial_update_cluster(
+ self, response: operations_pb2.Operation
+ ) -> operations_pb2.Operation:
+ """Post-rpc interceptor for partial_update_cluster
+
+ DEPRECATED. Please use the `post_partial_update_cluster_with_metadata`
+ interceptor instead.
+
+ Override in a subclass to read or manipulate the response
+ after it is returned by the BigtableInstanceAdmin server but before
+ it is returned to user code. This `post_partial_update_cluster` interceptor runs
+ before the `post_partial_update_cluster_with_metadata` interceptor.
+ """
+ return response
+
+ def post_partial_update_cluster_with_metadata(
+ self,
+ response: operations_pb2.Operation,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[operations_pb2.Operation, Sequence[Tuple[str, Union[str, bytes]]]]:
+ """Post-rpc interceptor for partial_update_cluster
+
+ Override in a subclass to read or manipulate the response or metadata after it
+ is returned by the BigtableInstanceAdmin server but before it is returned to user code.
+
+ We recommend only using this `post_partial_update_cluster_with_metadata`
+ interceptor in new development instead of the `post_partial_update_cluster` interceptor.
+ When both interceptors are used, this `post_partial_update_cluster_with_metadata` interceptor runs after the
+ `post_partial_update_cluster` interceptor. The (possibly modified) response returned by
+ `post_partial_update_cluster` will be passed to
+ `post_partial_update_cluster_with_metadata`.
+ """
+ return response, metadata
+
+ def pre_partial_update_instance(
+ self,
+ request: bigtable_instance_admin.PartialUpdateInstanceRequest,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[
+ bigtable_instance_admin.PartialUpdateInstanceRequest,
+ Sequence[Tuple[str, Union[str, bytes]]],
+ ]:
+ """Pre-rpc interceptor for partial_update_instance
+
+ Override in a subclass to manipulate the request or metadata
+ before they are sent to the BigtableInstanceAdmin server.
+ """
+ return request, metadata
+
+ def post_partial_update_instance(
+ self, response: operations_pb2.Operation
+ ) -> operations_pb2.Operation:
+ """Post-rpc interceptor for partial_update_instance
+
+ DEPRECATED. Please use the `post_partial_update_instance_with_metadata`
+ interceptor instead.
+
+ Override in a subclass to read or manipulate the response
+ after it is returned by the BigtableInstanceAdmin server but before
+ it is returned to user code. This `post_partial_update_instance` interceptor runs
+ before the `post_partial_update_instance_with_metadata` interceptor.
+ """
+ return response
+
+ def post_partial_update_instance_with_metadata(
+ self,
+ response: operations_pb2.Operation,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[operations_pb2.Operation, Sequence[Tuple[str, Union[str, bytes]]]]:
+ """Post-rpc interceptor for partial_update_instance
+
+ Override in a subclass to read or manipulate the response or metadata after it
+ is returned by the BigtableInstanceAdmin server but before it is returned to user code.
+
+ We recommend only using this `post_partial_update_instance_with_metadata`
+ interceptor in new development instead of the `post_partial_update_instance` interceptor.
+ When both interceptors are used, this `post_partial_update_instance_with_metadata` interceptor runs after the
+ `post_partial_update_instance` interceptor. The (possibly modified) response returned by
+ `post_partial_update_instance` will be passed to
+ `post_partial_update_instance_with_metadata`.
+ """
+ return response, metadata
+
+ def pre_set_iam_policy(
+ self,
+ request: iam_policy_pb2.SetIamPolicyRequest,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[
+ iam_policy_pb2.SetIamPolicyRequest, Sequence[Tuple[str, Union[str, bytes]]]
+ ]:
+ """Pre-rpc interceptor for set_iam_policy
+
+ Override in a subclass to manipulate the request or metadata
+ before they are sent to the BigtableInstanceAdmin server.
+ """
+ return request, metadata
+
+ def post_set_iam_policy(self, response: policy_pb2.Policy) -> policy_pb2.Policy:
+ """Post-rpc interceptor for set_iam_policy
+
+ DEPRECATED. Please use the `post_set_iam_policy_with_metadata`
+ interceptor instead.
+
+ Override in a subclass to read or manipulate the response
+ after it is returned by the BigtableInstanceAdmin server but before
+ it is returned to user code. This `post_set_iam_policy` interceptor runs
+ before the `post_set_iam_policy_with_metadata` interceptor.
+ """
+ return response
+
+ def post_set_iam_policy_with_metadata(
+ self,
+ response: policy_pb2.Policy,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[policy_pb2.Policy, Sequence[Tuple[str, Union[str, bytes]]]]:
+ """Post-rpc interceptor for set_iam_policy
+
+ Override in a subclass to read or manipulate the response or metadata after it
+ is returned by the BigtableInstanceAdmin server but before it is returned to user code.
+
+ We recommend only using this `post_set_iam_policy_with_metadata`
+ interceptor in new development instead of the `post_set_iam_policy` interceptor.
+ When both interceptors are used, this `post_set_iam_policy_with_metadata` interceptor runs after the
+ `post_set_iam_policy` interceptor. The (possibly modified) response returned by
+ `post_set_iam_policy` will be passed to
+ `post_set_iam_policy_with_metadata`.
+ """
+ return response, metadata
+
+ def pre_test_iam_permissions(
+ self,
+ request: iam_policy_pb2.TestIamPermissionsRequest,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[
+ iam_policy_pb2.TestIamPermissionsRequest,
+ Sequence[Tuple[str, Union[str, bytes]]],
+ ]:
+ """Pre-rpc interceptor for test_iam_permissions
+
+ Override in a subclass to manipulate the request or metadata
+ before they are sent to the BigtableInstanceAdmin server.
+ """
+ return request, metadata
+
+ def post_test_iam_permissions(
+ self, response: iam_policy_pb2.TestIamPermissionsResponse
+ ) -> iam_policy_pb2.TestIamPermissionsResponse:
+ """Post-rpc interceptor for test_iam_permissions
+
+ DEPRECATED. Please use the `post_test_iam_permissions_with_metadata`
+ interceptor instead.
+
+ Override in a subclass to read or manipulate the response
+ after it is returned by the BigtableInstanceAdmin server but before
+ it is returned to user code. This `post_test_iam_permissions` interceptor runs
+ before the `post_test_iam_permissions_with_metadata` interceptor.
+ """
+ return response
+
+ def post_test_iam_permissions_with_metadata(
+ self,
+ response: iam_policy_pb2.TestIamPermissionsResponse,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[
+ iam_policy_pb2.TestIamPermissionsResponse,
+ Sequence[Tuple[str, Union[str, bytes]]],
+ ]:
+ """Post-rpc interceptor for test_iam_permissions
+
+ Override in a subclass to read or manipulate the response or metadata after it
+ is returned by the BigtableInstanceAdmin server but before it is returned to user code.
+
+ We recommend only using this `post_test_iam_permissions_with_metadata`
+ interceptor in new development instead of the `post_test_iam_permissions` interceptor.
+ When both interceptors are used, this `post_test_iam_permissions_with_metadata` interceptor runs after the
+ `post_test_iam_permissions` interceptor. The (possibly modified) response returned by
+ `post_test_iam_permissions` will be passed to
+ `post_test_iam_permissions_with_metadata`.
+ """
+ return response, metadata
+
+ def pre_update_app_profile(
+ self,
+ request: bigtable_instance_admin.UpdateAppProfileRequest,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[
+ bigtable_instance_admin.UpdateAppProfileRequest,
+ Sequence[Tuple[str, Union[str, bytes]]],
+ ]:
+ """Pre-rpc interceptor for update_app_profile
+
+ Override in a subclass to manipulate the request or metadata
+ before they are sent to the BigtableInstanceAdmin server.
+ """
+ return request, metadata
+
+ def post_update_app_profile(
+ self, response: operations_pb2.Operation
+ ) -> operations_pb2.Operation:
+ """Post-rpc interceptor for update_app_profile
+
+ DEPRECATED. Please use the `post_update_app_profile_with_metadata`
+ interceptor instead.
+
+ Override in a subclass to read or manipulate the response
+ after it is returned by the BigtableInstanceAdmin server but before
+ it is returned to user code. This `post_update_app_profile` interceptor runs
+ before the `post_update_app_profile_with_metadata` interceptor.
+ """
+ return response
+
+ def post_update_app_profile_with_metadata(
+ self,
+ response: operations_pb2.Operation,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[operations_pb2.Operation, Sequence[Tuple[str, Union[str, bytes]]]]:
+ """Post-rpc interceptor for update_app_profile
+
+ Override in a subclass to read or manipulate the response or metadata after it
+ is returned by the BigtableInstanceAdmin server but before it is returned to user code.
+
+ We recommend only using this `post_update_app_profile_with_metadata`
+ interceptor in new development instead of the `post_update_app_profile` interceptor.
+ When both interceptors are used, this `post_update_app_profile_with_metadata` interceptor runs after the
+ `post_update_app_profile` interceptor. The (possibly modified) response returned by
+ `post_update_app_profile` will be passed to
+ `post_update_app_profile_with_metadata`.
+ """
+ return response, metadata
+
+ def pre_update_cluster(
+ self,
+ request: instance.Cluster,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[instance.Cluster, Sequence[Tuple[str, Union[str, bytes]]]]:
+ """Pre-rpc interceptor for update_cluster
+
+ Override in a subclass to manipulate the request or metadata
+ before they are sent to the BigtableInstanceAdmin server.
+ """
+ return request, metadata
+
+ def post_update_cluster(
+ self, response: operations_pb2.Operation
+ ) -> operations_pb2.Operation:
+ """Post-rpc interceptor for update_cluster
+
+ DEPRECATED. Please use the `post_update_cluster_with_metadata`
+ interceptor instead.
+
+ Override in a subclass to read or manipulate the response
+ after it is returned by the BigtableInstanceAdmin server but before
+ it is returned to user code. This `post_update_cluster` interceptor runs
+ before the `post_update_cluster_with_metadata` interceptor.
+ """
+ return response
+
+ def post_update_cluster_with_metadata(
+ self,
+ response: operations_pb2.Operation,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[operations_pb2.Operation, Sequence[Tuple[str, Union[str, bytes]]]]:
+ """Post-rpc interceptor for update_cluster
+
+ Override in a subclass to read or manipulate the response or metadata after it
+ is returned by the BigtableInstanceAdmin server but before it is returned to user code.
+
+ We recommend only using this `post_update_cluster_with_metadata`
+ interceptor in new development instead of the `post_update_cluster` interceptor.
+ When both interceptors are used, this `post_update_cluster_with_metadata` interceptor runs after the
+ `post_update_cluster` interceptor. The (possibly modified) response returned by
+ `post_update_cluster` will be passed to
+ `post_update_cluster_with_metadata`.
+ """
+ return response, metadata
+
+ def pre_update_instance(
+ self,
+ request: instance.Instance,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[instance.Instance, Sequence[Tuple[str, Union[str, bytes]]]]:
+ """Pre-rpc interceptor for update_instance
+
+ Override in a subclass to manipulate the request or metadata
+ before they are sent to the BigtableInstanceAdmin server.
+ """
+ return request, metadata
+
+ def post_update_instance(self, response: instance.Instance) -> instance.Instance:
+ """Post-rpc interceptor for update_instance
+
+ DEPRECATED. Please use the `post_update_instance_with_metadata`
+ interceptor instead.
+
+ Override in a subclass to read or manipulate the response
+ after it is returned by the BigtableInstanceAdmin server but before
+ it is returned to user code. This `post_update_instance` interceptor runs
+ before the `post_update_instance_with_metadata` interceptor.
+ """
+ return response
+
+ def post_update_instance_with_metadata(
+ self,
+ response: instance.Instance,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[instance.Instance, Sequence[Tuple[str, Union[str, bytes]]]]:
+ """Post-rpc interceptor for update_instance
+
+ Override in a subclass to read or manipulate the response or metadata after it
+ is returned by the BigtableInstanceAdmin server but before it is returned to user code.
+
+ We recommend only using this `post_update_instance_with_metadata`
+ interceptor in new development instead of the `post_update_instance` interceptor.
+ When both interceptors are used, this `post_update_instance_with_metadata` interceptor runs after the
+ `post_update_instance` interceptor. The (possibly modified) response returned by
+ `post_update_instance` will be passed to
+ `post_update_instance_with_metadata`.
+ """
+ return response, metadata
+
+ def pre_update_logical_view(
+ self,
+ request: bigtable_instance_admin.UpdateLogicalViewRequest,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[
+ bigtable_instance_admin.UpdateLogicalViewRequest,
+ Sequence[Tuple[str, Union[str, bytes]]],
+ ]:
+ """Pre-rpc interceptor for update_logical_view
+
+ Override in a subclass to manipulate the request or metadata
+ before they are sent to the BigtableInstanceAdmin server.
+ """
+ return request, metadata
+
+ def post_update_logical_view(
+ self, response: operations_pb2.Operation
+ ) -> operations_pb2.Operation:
+ """Post-rpc interceptor for update_logical_view
+
+ DEPRECATED. Please use the `post_update_logical_view_with_metadata`
+ interceptor instead.
+
+ Override in a subclass to read or manipulate the response
+ after it is returned by the BigtableInstanceAdmin server but before
+ it is returned to user code. This `post_update_logical_view` interceptor runs
+ before the `post_update_logical_view_with_metadata` interceptor.
+ """
+ return response
+
+ def post_update_logical_view_with_metadata(
+ self,
+ response: operations_pb2.Operation,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[operations_pb2.Operation, Sequence[Tuple[str, Union[str, bytes]]]]:
+ """Post-rpc interceptor for update_logical_view
+
+ Override in a subclass to read or manipulate the response or metadata after it
+ is returned by the BigtableInstanceAdmin server but before it is returned to user code.
+
+ We recommend only using this `post_update_logical_view_with_metadata`
+ interceptor in new development instead of the `post_update_logical_view` interceptor.
+ When both interceptors are used, this `post_update_logical_view_with_metadata` interceptor runs after the
+ `post_update_logical_view` interceptor. The (possibly modified) response returned by
+ `post_update_logical_view` will be passed to
+ `post_update_logical_view_with_metadata`.
+ """
+ return response, metadata
+
+ def pre_update_materialized_view(
+ self,
+ request: bigtable_instance_admin.UpdateMaterializedViewRequest,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[
+ bigtable_instance_admin.UpdateMaterializedViewRequest,
+ Sequence[Tuple[str, Union[str, bytes]]],
+ ]:
+ """Pre-rpc interceptor for update_materialized_view
+
+ Override in a subclass to manipulate the request or metadata
+ before they are sent to the BigtableInstanceAdmin server.
+ """
+ return request, metadata
+
+ def post_update_materialized_view(
+ self, response: operations_pb2.Operation
+ ) -> operations_pb2.Operation:
+ """Post-rpc interceptor for update_materialized_view
+
+ DEPRECATED. Please use the `post_update_materialized_view_with_metadata`
+ interceptor instead.
+
+ Override in a subclass to read or manipulate the response
+ after it is returned by the BigtableInstanceAdmin server but before
+ it is returned to user code. This `post_update_materialized_view` interceptor runs
+ before the `post_update_materialized_view_with_metadata` interceptor.
+ """
+ return response
+
+ def post_update_materialized_view_with_metadata(
+ self,
+ response: operations_pb2.Operation,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]],
+ ) -> Tuple[operations_pb2.Operation, Sequence[Tuple[str, Union[str, bytes]]]]:
+ """Post-rpc interceptor for update_materialized_view
+
+ Override in a subclass to read or manipulate the response or metadata after it
+ is returned by the BigtableInstanceAdmin server but before it is returned to user code.
+
+ We recommend only using this `post_update_materialized_view_with_metadata`
+ interceptor in new development instead of the `post_update_materialized_view` interceptor.
+ When both interceptors are used, this `post_update_materialized_view_with_metadata` interceptor runs after the
+ `post_update_materialized_view` interceptor. The (possibly modified) response returned by
+ `post_update_materialized_view` will be passed to
+ `post_update_materialized_view_with_metadata`.
+ """
+ return response, metadata
+
+
+@dataclasses.dataclass
+class BigtableInstanceAdminRestStub:
+ _session: AuthorizedSession
+ _host: str
+ _interceptor: BigtableInstanceAdminRestInterceptor
+
+
+class BigtableInstanceAdminRestTransport(_BaseBigtableInstanceAdminRestTransport):
+ """REST backend synchronous transport for BigtableInstanceAdmin.
+
+ Service for creating, configuring, and deleting Cloud
+ Bigtable Instances and Clusters. Provides access to the Instance
+ and Cluster schemas only, not the tables' metadata or data
+ stored in those tables.
+
+ This class defines the same methods as the primary client, so the
+ primary client can load the underlying transport implementation
+ and call it.
+
+ It sends JSON representations of protocol buffers over HTTP/1.1
+ """
+
+ def __init__(
+ self,
+ *,
+ host: str = "bigtableadmin.googleapis.com",
+ credentials: Optional[ga_credentials.Credentials] = None,
+ credentials_file: Optional[str] = None,
+ scopes: Optional[Sequence[str]] = None,
+ client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
+ quota_project_id: Optional[str] = None,
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
+ always_use_jwt_access: Optional[bool] = False,
+ url_scheme: str = "https",
+ interceptor: Optional[BigtableInstanceAdminRestInterceptor] = None,
+ api_audience: Optional[str] = None,
+ ) -> None:
+ """Instantiate the transport.
+
+ Args:
+ host (Optional[str]):
+ The hostname to connect to (default: 'bigtableadmin.googleapis.com').
+ credentials (Optional[google.auth.credentials.Credentials]): The
+ authorization credentials to attach to requests. These
+ credentials identify the application to the service; if none
+ are specified, the client will attempt to ascertain the
+ credentials from the environment.
+
+ credentials_file (Optional[str]): Deprecated. A file with credentials that can
+ be loaded with :func:`google.auth.load_credentials_from_file`.
+ This argument is ignored if ``channel`` is provided. This argument will be
+ removed in the next major version of this library.
+ scopes (Optional(Sequence[str])): A list of scopes. This argument is
+ ignored if ``channel`` is provided.
+ client_cert_source_for_mtls (Callable[[], Tuple[bytes, bytes]]): Client
+ certificate to configure mutual TLS HTTP channel. It is ignored
+ if ``channel`` is provided.
+ quota_project_id (Optional[str]): An optional project to use for billing
+ and quota.
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
+ The client info used to send a user-agent string along with
+ API requests. If ``None``, then default info will be used.
+ Generally, you only need to set this if you are developing
+ your own client library.
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
+ be used for service account credentials.
+ url_scheme: the protocol scheme for the API endpoint. Normally
+ "https", but for testing or local servers,
+ "http" can be specified.
+ """
+ # Run the base constructor
+ # TODO(yon-mg): resolve other ctor params i.e. scopes, quota, etc.
+ # TODO: When custom host (api_endpoint) is set, `scopes` must *also* be set on the
+ # credentials object
+ super().__init__(
+ host=host,
+ credentials=credentials,
+ client_info=client_info,
+ always_use_jwt_access=always_use_jwt_access,
+ url_scheme=url_scheme,
+ api_audience=api_audience,
+ )
+ self._session = AuthorizedSession(
+ self._credentials, default_host=self.DEFAULT_HOST
+ )
+ self._operations_client: Optional[operations_v1.AbstractOperationsClient] = None
+ if client_cert_source_for_mtls:
+ self._session.configure_mtls_channel(client_cert_source_for_mtls)
+ self._interceptor = interceptor or BigtableInstanceAdminRestInterceptor()
+ self._prep_wrapped_messages(client_info)
+
+ @property
+ def operations_client(self) -> operations_v1.AbstractOperationsClient:
+ """Create the client designed to process long-running operations.
+
+ This property caches on the instance; repeated calls return the same
+ client.
+ """
+ # Only create a new client if we do not already have one.
+ if self._operations_client is None:
+ http_options: Dict[str, List[Dict[str, str]]] = {
+ "google.longrunning.Operations.CancelOperation": [
+ {
+ "method": "post",
+ "uri": "/v2/{name=operations/**}:cancel",
+ },
+ ],
+ "google.longrunning.Operations.DeleteOperation": [
+ {
+ "method": "delete",
+ "uri": "/v2/{name=operations/**}",
+ },
+ ],
+ "google.longrunning.Operations.GetOperation": [
+ {
+ "method": "get",
+ "uri": "/v2/{name=operations/**}",
+ },
+ ],
+ "google.longrunning.Operations.ListOperations": [
+ {
+ "method": "get",
+ "uri": "/v2/{name=operations/projects/**}/operations",
+ },
+ ],
+ }
+
+ rest_transport = operations_v1.OperationsRestTransport(
+ host=self._host,
+ # use the credentials which are saved
+ credentials=self._credentials,
+ scopes=self._scopes,
+ http_options=http_options,
+ path_prefix="v2",
+ )
+
+ self._operations_client = operations_v1.AbstractOperationsClient(
+ transport=rest_transport
+ )
+
+ # Return the client from cache.
+ return self._operations_client
+
+ class _CreateAppProfile(
+ _BaseBigtableInstanceAdminRestTransport._BaseCreateAppProfile,
+ BigtableInstanceAdminRestStub,
+ ):
+ def __hash__(self):
+ return hash("BigtableInstanceAdminRestTransport.CreateAppProfile")
+
+ @staticmethod
+ def _get_response(
+ host,
+ metadata,
+ query_params,
+ session,
+ timeout,
+ transcoded_request,
+ body=None,
+ ):
+ uri = transcoded_request["uri"]
+ method = transcoded_request["method"]
+ headers = dict(metadata)
+ headers["Content-Type"] = "application/json"
+ response = getattr(session, method)(
+ "{host}{uri}".format(host=host, uri=uri),
+ timeout=timeout,
+ headers=headers,
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
+ data=body,
+ )
+ return response
+
+ def __call__(
+ self,
+ request: bigtable_instance_admin.CreateAppProfileRequest,
+ *,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Optional[float] = None,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> instance.AppProfile:
+ r"""Call the create app profile method over HTTP.
+
+ Args:
+ request (~.bigtable_instance_admin.CreateAppProfileRequest):
+ The request object. Request message for
+ BigtableInstanceAdmin.CreateAppProfile.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ ~.instance.AppProfile:
+ A configuration object describing how
+ Cloud Bigtable should treat traffic from
+ a particular end user application.
+
+ """
+
+ http_options = (
+ _BaseBigtableInstanceAdminRestTransport._BaseCreateAppProfile._get_http_options()
+ )
+
+ request, metadata = self._interceptor.pre_create_app_profile(
+ request, metadata
+ )
+ transcoded_request = _BaseBigtableInstanceAdminRestTransport._BaseCreateAppProfile._get_transcoded_request(
+ http_options, request
+ )
+
+ body = _BaseBigtableInstanceAdminRestTransport._BaseCreateAppProfile._get_request_body_json(
+ transcoded_request
+ )
+
+ # Jsonify the query params
+ query_params = _BaseBigtableInstanceAdminRestTransport._BaseCreateAppProfile._get_query_params_json(
+ transcoded_request
+ )
+
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ request_url = "{host}{uri}".format(
+ host=self._host, uri=transcoded_request["uri"]
+ )
+ method = transcoded_request["method"]
+ try:
+ request_payload = type(request).to_json(request)
+ except:
+ request_payload = None
+ http_request = {
+ "payload": request_payload,
+ "requestMethod": method,
+ "requestUrl": request_url,
+ "headers": dict(metadata),
+ }
+ _LOGGER.debug(
+ f"Sending request for google.bigtable.admin_v2.BigtableInstanceAdminClient.CreateAppProfile",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "CreateAppProfile",
+ "httpRequest": http_request,
+ "metadata": http_request["headers"],
+ },
+ )
+
+ # Send the request
+ response = (
+ BigtableInstanceAdminRestTransport._CreateAppProfile._get_response(
+ self._host,
+ metadata,
+ query_params,
+ self._session,
+ timeout,
+ transcoded_request,
+ body,
+ )
+ )
+
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
+ # subclass.
+ if response.status_code >= 400:
+ raise core_exceptions.from_http_response(response)
+
+ # Return the response
+ resp = instance.AppProfile()
+ pb_resp = instance.AppProfile.pb(resp)
+
+ json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True)
+
+ resp = self._interceptor.post_create_app_profile(resp)
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
+ resp, _ = self._interceptor.post_create_app_profile_with_metadata(
+ resp, response_metadata
+ )
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ try:
+ response_payload = instance.AppProfile.to_json(response)
+ except:
+ response_payload = None
+ http_response = {
+ "payload": response_payload,
+ "headers": dict(response.headers),
+ "status": response.status_code,
+ }
+ _LOGGER.debug(
+ "Received response for google.bigtable.admin_v2.BigtableInstanceAdminClient.create_app_profile",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "CreateAppProfile",
+ "metadata": http_response["headers"],
+ "httpResponse": http_response,
+ },
+ )
+ return resp
+
+ class _CreateCluster(
+ _BaseBigtableInstanceAdminRestTransport._BaseCreateCluster,
+ BigtableInstanceAdminRestStub,
+ ):
+ def __hash__(self):
+ return hash("BigtableInstanceAdminRestTransport.CreateCluster")
+
+ @staticmethod
+ def _get_response(
+ host,
+ metadata,
+ query_params,
+ session,
+ timeout,
+ transcoded_request,
+ body=None,
+ ):
+ uri = transcoded_request["uri"]
+ method = transcoded_request["method"]
+ headers = dict(metadata)
+ headers["Content-Type"] = "application/json"
+ response = getattr(session, method)(
+ "{host}{uri}".format(host=host, uri=uri),
+ timeout=timeout,
+ headers=headers,
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
+ data=body,
+ )
+ return response
+
+ def __call__(
+ self,
+ request: bigtable_instance_admin.CreateClusterRequest,
+ *,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Optional[float] = None,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operations_pb2.Operation:
+ r"""Call the create cluster method over HTTP.
+
+ Args:
+ request (~.bigtable_instance_admin.CreateClusterRequest):
+ The request object. Request message for
+ BigtableInstanceAdmin.CreateCluster.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ ~.operations_pb2.Operation:
+ This resource represents a
+ long-running operation that is the
+ result of a network API call.
+
+ """
+
+ http_options = (
+ _BaseBigtableInstanceAdminRestTransport._BaseCreateCluster._get_http_options()
+ )
+
+ request, metadata = self._interceptor.pre_create_cluster(request, metadata)
+ transcoded_request = _BaseBigtableInstanceAdminRestTransport._BaseCreateCluster._get_transcoded_request(
+ http_options, request
+ )
+
+ body = _BaseBigtableInstanceAdminRestTransport._BaseCreateCluster._get_request_body_json(
+ transcoded_request
+ )
+
+ # Jsonify the query params
+ query_params = _BaseBigtableInstanceAdminRestTransport._BaseCreateCluster._get_query_params_json(
+ transcoded_request
+ )
+
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ request_url = "{host}{uri}".format(
+ host=self._host, uri=transcoded_request["uri"]
+ )
+ method = transcoded_request["method"]
+ try:
+ request_payload = json_format.MessageToJson(request)
+ except:
+ request_payload = None
+ http_request = {
+ "payload": request_payload,
+ "requestMethod": method,
+ "requestUrl": request_url,
+ "headers": dict(metadata),
+ }
+ _LOGGER.debug(
+ f"Sending request for google.bigtable.admin_v2.BigtableInstanceAdminClient.CreateCluster",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "CreateCluster",
+ "httpRequest": http_request,
+ "metadata": http_request["headers"],
+ },
+ )
+
+ # Send the request
+ response = BigtableInstanceAdminRestTransport._CreateCluster._get_response(
+ self._host,
+ metadata,
+ query_params,
+ self._session,
+ timeout,
+ transcoded_request,
+ body,
+ )
+
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
+ # subclass.
+ if response.status_code >= 400:
+ raise core_exceptions.from_http_response(response)
+
+ # Return the response
+ resp = operations_pb2.Operation()
+ json_format.Parse(response.content, resp, ignore_unknown_fields=True)
+
+ resp = self._interceptor.post_create_cluster(resp)
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
+ resp, _ = self._interceptor.post_create_cluster_with_metadata(
+ resp, response_metadata
+ )
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ try:
+ response_payload = json_format.MessageToJson(resp)
+ except:
+ response_payload = None
+ http_response = {
+ "payload": response_payload,
+ "headers": dict(response.headers),
+ "status": response.status_code,
+ }
+ _LOGGER.debug(
+ "Received response for google.bigtable.admin_v2.BigtableInstanceAdminClient.create_cluster",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "CreateCluster",
+ "metadata": http_response["headers"],
+ "httpResponse": http_response,
+ },
+ )
+ return resp
+
+ class _CreateInstance(
+ _BaseBigtableInstanceAdminRestTransport._BaseCreateInstance,
+ BigtableInstanceAdminRestStub,
+ ):
+ def __hash__(self):
+ return hash("BigtableInstanceAdminRestTransport.CreateInstance")
+
+ @staticmethod
+ def _get_response(
+ host,
+ metadata,
+ query_params,
+ session,
+ timeout,
+ transcoded_request,
+ body=None,
+ ):
+ uri = transcoded_request["uri"]
+ method = transcoded_request["method"]
+ headers = dict(metadata)
+ headers["Content-Type"] = "application/json"
+ response = getattr(session, method)(
+ "{host}{uri}".format(host=host, uri=uri),
+ timeout=timeout,
+ headers=headers,
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
+ data=body,
+ )
+ return response
+
+ def __call__(
+ self,
+ request: bigtable_instance_admin.CreateInstanceRequest,
+ *,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Optional[float] = None,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operations_pb2.Operation:
+ r"""Call the create instance method over HTTP.
+
+ Args:
+ request (~.bigtable_instance_admin.CreateInstanceRequest):
+ The request object. Request message for
+ BigtableInstanceAdmin.CreateInstance.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ ~.operations_pb2.Operation:
+ This resource represents a
+ long-running operation that is the
+ result of a network API call.
+
+ """
+
+ http_options = (
+ _BaseBigtableInstanceAdminRestTransport._BaseCreateInstance._get_http_options()
+ )
+
+ request, metadata = self._interceptor.pre_create_instance(request, metadata)
+ transcoded_request = _BaseBigtableInstanceAdminRestTransport._BaseCreateInstance._get_transcoded_request(
+ http_options, request
+ )
+
+ body = _BaseBigtableInstanceAdminRestTransport._BaseCreateInstance._get_request_body_json(
+ transcoded_request
+ )
+
+ # Jsonify the query params
+ query_params = _BaseBigtableInstanceAdminRestTransport._BaseCreateInstance._get_query_params_json(
+ transcoded_request
+ )
+
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ request_url = "{host}{uri}".format(
+ host=self._host, uri=transcoded_request["uri"]
+ )
+ method = transcoded_request["method"]
+ try:
+ request_payload = json_format.MessageToJson(request)
+ except:
+ request_payload = None
+ http_request = {
+ "payload": request_payload,
+ "requestMethod": method,
+ "requestUrl": request_url,
+ "headers": dict(metadata),
+ }
+ _LOGGER.debug(
+ f"Sending request for google.bigtable.admin_v2.BigtableInstanceAdminClient.CreateInstance",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "CreateInstance",
+ "httpRequest": http_request,
+ "metadata": http_request["headers"],
+ },
+ )
+
+ # Send the request
+ response = BigtableInstanceAdminRestTransport._CreateInstance._get_response(
+ self._host,
+ metadata,
+ query_params,
+ self._session,
+ timeout,
+ transcoded_request,
+ body,
+ )
+
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
+ # subclass.
+ if response.status_code >= 400:
+ raise core_exceptions.from_http_response(response)
+
+ # Return the response
+ resp = operations_pb2.Operation()
+ json_format.Parse(response.content, resp, ignore_unknown_fields=True)
+
+ resp = self._interceptor.post_create_instance(resp)
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
+ resp, _ = self._interceptor.post_create_instance_with_metadata(
+ resp, response_metadata
+ )
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ try:
+ response_payload = json_format.MessageToJson(resp)
+ except:
+ response_payload = None
+ http_response = {
+ "payload": response_payload,
+ "headers": dict(response.headers),
+ "status": response.status_code,
+ }
+ _LOGGER.debug(
+ "Received response for google.bigtable.admin_v2.BigtableInstanceAdminClient.create_instance",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "CreateInstance",
+ "metadata": http_response["headers"],
+ "httpResponse": http_response,
+ },
+ )
+ return resp
+
+ class _CreateLogicalView(
+ _BaseBigtableInstanceAdminRestTransport._BaseCreateLogicalView,
+ BigtableInstanceAdminRestStub,
+ ):
+ def __hash__(self):
+ return hash("BigtableInstanceAdminRestTransport.CreateLogicalView")
+
+ @staticmethod
+ def _get_response(
+ host,
+ metadata,
+ query_params,
+ session,
+ timeout,
+ transcoded_request,
+ body=None,
+ ):
+ uri = transcoded_request["uri"]
+ method = transcoded_request["method"]
+ headers = dict(metadata)
+ headers["Content-Type"] = "application/json"
+ response = getattr(session, method)(
+ "{host}{uri}".format(host=host, uri=uri),
+ timeout=timeout,
+ headers=headers,
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
+ data=body,
+ )
+ return response
+
+ def __call__(
+ self,
+ request: bigtable_instance_admin.CreateLogicalViewRequest,
+ *,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Optional[float] = None,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operations_pb2.Operation:
+ r"""Call the create logical view method over HTTP.
+
+ Args:
+ request (~.bigtable_instance_admin.CreateLogicalViewRequest):
+ The request object. Request message for
+ BigtableInstanceAdmin.CreateLogicalView.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ ~.operations_pb2.Operation:
+ This resource represents a
+ long-running operation that is the
+ result of a network API call.
+
+ """
+
+ http_options = (
+ _BaseBigtableInstanceAdminRestTransport._BaseCreateLogicalView._get_http_options()
+ )
+
+ request, metadata = self._interceptor.pre_create_logical_view(
+ request, metadata
+ )
+ transcoded_request = _BaseBigtableInstanceAdminRestTransport._BaseCreateLogicalView._get_transcoded_request(
+ http_options, request
+ )
+
+ body = _BaseBigtableInstanceAdminRestTransport._BaseCreateLogicalView._get_request_body_json(
+ transcoded_request
+ )
+
+ # Jsonify the query params
+ query_params = _BaseBigtableInstanceAdminRestTransport._BaseCreateLogicalView._get_query_params_json(
+ transcoded_request
+ )
+
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ request_url = "{host}{uri}".format(
+ host=self._host, uri=transcoded_request["uri"]
+ )
+ method = transcoded_request["method"]
+ try:
+ request_payload = json_format.MessageToJson(request)
+ except:
+ request_payload = None
+ http_request = {
+ "payload": request_payload,
+ "requestMethod": method,
+ "requestUrl": request_url,
+ "headers": dict(metadata),
+ }
+ _LOGGER.debug(
+ f"Sending request for google.bigtable.admin_v2.BigtableInstanceAdminClient.CreateLogicalView",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "CreateLogicalView",
+ "httpRequest": http_request,
+ "metadata": http_request["headers"],
+ },
+ )
+
+ # Send the request
+ response = (
+ BigtableInstanceAdminRestTransport._CreateLogicalView._get_response(
+ self._host,
+ metadata,
+ query_params,
+ self._session,
+ timeout,
+ transcoded_request,
+ body,
+ )
+ )
+
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
+ # subclass.
+ if response.status_code >= 400:
+ raise core_exceptions.from_http_response(response)
+
+ # Return the response
+ resp = operations_pb2.Operation()
+ json_format.Parse(response.content, resp, ignore_unknown_fields=True)
+
+ resp = self._interceptor.post_create_logical_view(resp)
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
+ resp, _ = self._interceptor.post_create_logical_view_with_metadata(
+ resp, response_metadata
+ )
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ try:
+ response_payload = json_format.MessageToJson(resp)
+ except:
+ response_payload = None
+ http_response = {
+ "payload": response_payload,
+ "headers": dict(response.headers),
+ "status": response.status_code,
+ }
+ _LOGGER.debug(
+ "Received response for google.bigtable.admin_v2.BigtableInstanceAdminClient.create_logical_view",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "CreateLogicalView",
+ "metadata": http_response["headers"],
+ "httpResponse": http_response,
+ },
+ )
+ return resp
+
+ class _CreateMaterializedView(
+ _BaseBigtableInstanceAdminRestTransport._BaseCreateMaterializedView,
+ BigtableInstanceAdminRestStub,
+ ):
+ def __hash__(self):
+ return hash("BigtableInstanceAdminRestTransport.CreateMaterializedView")
+
+ @staticmethod
+ def _get_response(
+ host,
+ metadata,
+ query_params,
+ session,
+ timeout,
+ transcoded_request,
+ body=None,
+ ):
+ uri = transcoded_request["uri"]
+ method = transcoded_request["method"]
+ headers = dict(metadata)
+ headers["Content-Type"] = "application/json"
+ response = getattr(session, method)(
+ "{host}{uri}".format(host=host, uri=uri),
+ timeout=timeout,
+ headers=headers,
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
+ data=body,
+ )
+ return response
+
+ def __call__(
+ self,
+ request: bigtable_instance_admin.CreateMaterializedViewRequest,
+ *,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Optional[float] = None,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operations_pb2.Operation:
+ r"""Call the create materialized view method over HTTP.
+
+ Args:
+ request (~.bigtable_instance_admin.CreateMaterializedViewRequest):
+ The request object. Request message for
+ BigtableInstanceAdmin.CreateMaterializedView.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ ~.operations_pb2.Operation:
+ This resource represents a
+ long-running operation that is the
+ result of a network API call.
+
+ """
+
+ http_options = (
+ _BaseBigtableInstanceAdminRestTransport._BaseCreateMaterializedView._get_http_options()
+ )
+
+ request, metadata = self._interceptor.pre_create_materialized_view(
+ request, metadata
+ )
+ transcoded_request = _BaseBigtableInstanceAdminRestTransport._BaseCreateMaterializedView._get_transcoded_request(
+ http_options, request
+ )
+
+ body = _BaseBigtableInstanceAdminRestTransport._BaseCreateMaterializedView._get_request_body_json(
+ transcoded_request
+ )
+
+ # Jsonify the query params
+ query_params = _BaseBigtableInstanceAdminRestTransport._BaseCreateMaterializedView._get_query_params_json(
+ transcoded_request
+ )
+
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ request_url = "{host}{uri}".format(
+ host=self._host, uri=transcoded_request["uri"]
+ )
+ method = transcoded_request["method"]
+ try:
+ request_payload = json_format.MessageToJson(request)
+ except:
+ request_payload = None
+ http_request = {
+ "payload": request_payload,
+ "requestMethod": method,
+ "requestUrl": request_url,
+ "headers": dict(metadata),
+ }
+ _LOGGER.debug(
+ f"Sending request for google.bigtable.admin_v2.BigtableInstanceAdminClient.CreateMaterializedView",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "CreateMaterializedView",
+ "httpRequest": http_request,
+ "metadata": http_request["headers"],
+ },
+ )
+
+ # Send the request
+ response = BigtableInstanceAdminRestTransport._CreateMaterializedView._get_response(
+ self._host,
+ metadata,
+ query_params,
+ self._session,
+ timeout,
+ transcoded_request,
+ body,
+ )
+
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
+ # subclass.
+ if response.status_code >= 400:
+ raise core_exceptions.from_http_response(response)
+
+ # Return the response
+ resp = operations_pb2.Operation()
+ json_format.Parse(response.content, resp, ignore_unknown_fields=True)
+
+ resp = self._interceptor.post_create_materialized_view(resp)
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
+ resp, _ = self._interceptor.post_create_materialized_view_with_metadata(
+ resp, response_metadata
+ )
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ try:
+ response_payload = json_format.MessageToJson(resp)
+ except:
+ response_payload = None
+ http_response = {
+ "payload": response_payload,
+ "headers": dict(response.headers),
+ "status": response.status_code,
+ }
+ _LOGGER.debug(
+ "Received response for google.bigtable.admin_v2.BigtableInstanceAdminClient.create_materialized_view",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "CreateMaterializedView",
+ "metadata": http_response["headers"],
+ "httpResponse": http_response,
+ },
+ )
+ return resp
+
+ class _DeleteAppProfile(
+ _BaseBigtableInstanceAdminRestTransport._BaseDeleteAppProfile,
+ BigtableInstanceAdminRestStub,
+ ):
+ def __hash__(self):
+ return hash("BigtableInstanceAdminRestTransport.DeleteAppProfile")
+
+ @staticmethod
+ def _get_response(
+ host,
+ metadata,
+ query_params,
+ session,
+ timeout,
+ transcoded_request,
+ body=None,
+ ):
+ uri = transcoded_request["uri"]
+ method = transcoded_request["method"]
+ headers = dict(metadata)
+ headers["Content-Type"] = "application/json"
+ response = getattr(session, method)(
+ "{host}{uri}".format(host=host, uri=uri),
+ timeout=timeout,
+ headers=headers,
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
+ )
+ return response
+
+ def __call__(
+ self,
+ request: bigtable_instance_admin.DeleteAppProfileRequest,
+ *,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Optional[float] = None,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ):
+ r"""Call the delete app profile method over HTTP.
+
+ Args:
+ request (~.bigtable_instance_admin.DeleteAppProfileRequest):
+ The request object. Request message for
+ BigtableInstanceAdmin.DeleteAppProfile.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+ """
+
+ http_options = (
+ _BaseBigtableInstanceAdminRestTransport._BaseDeleteAppProfile._get_http_options()
+ )
+
+ request, metadata = self._interceptor.pre_delete_app_profile(
+ request, metadata
+ )
+ transcoded_request = _BaseBigtableInstanceAdminRestTransport._BaseDeleteAppProfile._get_transcoded_request(
+ http_options, request
+ )
+
+ # Jsonify the query params
+ query_params = _BaseBigtableInstanceAdminRestTransport._BaseDeleteAppProfile._get_query_params_json(
+ transcoded_request
+ )
+
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ request_url = "{host}{uri}".format(
+ host=self._host, uri=transcoded_request["uri"]
+ )
+ method = transcoded_request["method"]
+ try:
+ request_payload = json_format.MessageToJson(request)
+ except:
+ request_payload = None
+ http_request = {
+ "payload": request_payload,
+ "requestMethod": method,
+ "requestUrl": request_url,
+ "headers": dict(metadata),
+ }
+ _LOGGER.debug(
+ f"Sending request for google.bigtable.admin_v2.BigtableInstanceAdminClient.DeleteAppProfile",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "DeleteAppProfile",
+ "httpRequest": http_request,
+ "metadata": http_request["headers"],
+ },
+ )
+
+ # Send the request
+ response = (
+ BigtableInstanceAdminRestTransport._DeleteAppProfile._get_response(
+ self._host,
+ metadata,
+ query_params,
+ self._session,
+ timeout,
+ transcoded_request,
+ )
+ )
+
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
+ # subclass.
+ if response.status_code >= 400:
+ raise core_exceptions.from_http_response(response)
+
+ class _DeleteCluster(
+ _BaseBigtableInstanceAdminRestTransport._BaseDeleteCluster,
+ BigtableInstanceAdminRestStub,
+ ):
+ def __hash__(self):
+ return hash("BigtableInstanceAdminRestTransport.DeleteCluster")
+
+ @staticmethod
+ def _get_response(
+ host,
+ metadata,
+ query_params,
+ session,
+ timeout,
+ transcoded_request,
+ body=None,
+ ):
+ uri = transcoded_request["uri"]
+ method = transcoded_request["method"]
+ headers = dict(metadata)
+ headers["Content-Type"] = "application/json"
+ response = getattr(session, method)(
+ "{host}{uri}".format(host=host, uri=uri),
+ timeout=timeout,
+ headers=headers,
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
+ )
+ return response
+
+ def __call__(
+ self,
+ request: bigtable_instance_admin.DeleteClusterRequest,
+ *,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Optional[float] = None,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ):
+ r"""Call the delete cluster method over HTTP.
+
+ Args:
+ request (~.bigtable_instance_admin.DeleteClusterRequest):
+ The request object. Request message for
+ BigtableInstanceAdmin.DeleteCluster.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+ """
+
+ http_options = (
+ _BaseBigtableInstanceAdminRestTransport._BaseDeleteCluster._get_http_options()
+ )
+
+ request, metadata = self._interceptor.pre_delete_cluster(request, metadata)
+ transcoded_request = _BaseBigtableInstanceAdminRestTransport._BaseDeleteCluster._get_transcoded_request(
+ http_options, request
+ )
+
+ # Jsonify the query params
+ query_params = _BaseBigtableInstanceAdminRestTransport._BaseDeleteCluster._get_query_params_json(
+ transcoded_request
+ )
+
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ request_url = "{host}{uri}".format(
+ host=self._host, uri=transcoded_request["uri"]
+ )
+ method = transcoded_request["method"]
+ try:
+ request_payload = json_format.MessageToJson(request)
+ except:
+ request_payload = None
+ http_request = {
+ "payload": request_payload,
+ "requestMethod": method,
+ "requestUrl": request_url,
+ "headers": dict(metadata),
+ }
+ _LOGGER.debug(
+ f"Sending request for google.bigtable.admin_v2.BigtableInstanceAdminClient.DeleteCluster",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "DeleteCluster",
+ "httpRequest": http_request,
+ "metadata": http_request["headers"],
+ },
+ )
+
+ # Send the request
+ response = BigtableInstanceAdminRestTransport._DeleteCluster._get_response(
+ self._host,
+ metadata,
+ query_params,
+ self._session,
+ timeout,
+ transcoded_request,
+ )
+
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
+ # subclass.
+ if response.status_code >= 400:
+ raise core_exceptions.from_http_response(response)
+
+ class _DeleteInstance(
+ _BaseBigtableInstanceAdminRestTransport._BaseDeleteInstance,
+ BigtableInstanceAdminRestStub,
+ ):
+ def __hash__(self):
+ return hash("BigtableInstanceAdminRestTransport.DeleteInstance")
+
+ @staticmethod
+ def _get_response(
+ host,
+ metadata,
+ query_params,
+ session,
+ timeout,
+ transcoded_request,
+ body=None,
+ ):
+ uri = transcoded_request["uri"]
+ method = transcoded_request["method"]
+ headers = dict(metadata)
+ headers["Content-Type"] = "application/json"
+ response = getattr(session, method)(
+ "{host}{uri}".format(host=host, uri=uri),
+ timeout=timeout,
+ headers=headers,
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
+ )
+ return response
+
+ def __call__(
+ self,
+ request: bigtable_instance_admin.DeleteInstanceRequest,
+ *,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Optional[float] = None,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ):
+ r"""Call the delete instance method over HTTP.
+
+ Args:
+ request (~.bigtable_instance_admin.DeleteInstanceRequest):
+ The request object. Request message for
+ BigtableInstanceAdmin.DeleteInstance.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+ """
+
+ http_options = (
+ _BaseBigtableInstanceAdminRestTransport._BaseDeleteInstance._get_http_options()
+ )
+
+ request, metadata = self._interceptor.pre_delete_instance(request, metadata)
+ transcoded_request = _BaseBigtableInstanceAdminRestTransport._BaseDeleteInstance._get_transcoded_request(
+ http_options, request
+ )
+
+ # Jsonify the query params
+ query_params = _BaseBigtableInstanceAdminRestTransport._BaseDeleteInstance._get_query_params_json(
+ transcoded_request
+ )
+
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ request_url = "{host}{uri}".format(
+ host=self._host, uri=transcoded_request["uri"]
+ )
+ method = transcoded_request["method"]
+ try:
+ request_payload = json_format.MessageToJson(request)
+ except:
+ request_payload = None
+ http_request = {
+ "payload": request_payload,
+ "requestMethod": method,
+ "requestUrl": request_url,
+ "headers": dict(metadata),
+ }
+ _LOGGER.debug(
+ f"Sending request for google.bigtable.admin_v2.BigtableInstanceAdminClient.DeleteInstance",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "DeleteInstance",
+ "httpRequest": http_request,
+ "metadata": http_request["headers"],
+ },
+ )
+
+ # Send the request
+ response = BigtableInstanceAdminRestTransport._DeleteInstance._get_response(
+ self._host,
+ metadata,
+ query_params,
+ self._session,
+ timeout,
+ transcoded_request,
+ )
+
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
+ # subclass.
+ if response.status_code >= 400:
+ raise core_exceptions.from_http_response(response)
+
+ class _DeleteLogicalView(
+ _BaseBigtableInstanceAdminRestTransport._BaseDeleteLogicalView,
+ BigtableInstanceAdminRestStub,
+ ):
+ def __hash__(self):
+ return hash("BigtableInstanceAdminRestTransport.DeleteLogicalView")
+
+ @staticmethod
+ def _get_response(
+ host,
+ metadata,
+ query_params,
+ session,
+ timeout,
+ transcoded_request,
+ body=None,
+ ):
+ uri = transcoded_request["uri"]
+ method = transcoded_request["method"]
+ headers = dict(metadata)
+ headers["Content-Type"] = "application/json"
+ response = getattr(session, method)(
+ "{host}{uri}".format(host=host, uri=uri),
+ timeout=timeout,
+ headers=headers,
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
+ )
+ return response
+
+ def __call__(
+ self,
+ request: bigtable_instance_admin.DeleteLogicalViewRequest,
+ *,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Optional[float] = None,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ):
+ r"""Call the delete logical view method over HTTP.
+
+ Args:
+ request (~.bigtable_instance_admin.DeleteLogicalViewRequest):
+ The request object. Request message for
+ BigtableInstanceAdmin.DeleteLogicalView.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+ """
+
+ http_options = (
+ _BaseBigtableInstanceAdminRestTransport._BaseDeleteLogicalView._get_http_options()
+ )
+
+ request, metadata = self._interceptor.pre_delete_logical_view(
+ request, metadata
+ )
+ transcoded_request = _BaseBigtableInstanceAdminRestTransport._BaseDeleteLogicalView._get_transcoded_request(
+ http_options, request
+ )
+
+ # Jsonify the query params
+ query_params = _BaseBigtableInstanceAdminRestTransport._BaseDeleteLogicalView._get_query_params_json(
+ transcoded_request
+ )
+
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ request_url = "{host}{uri}".format(
+ host=self._host, uri=transcoded_request["uri"]
+ )
+ method = transcoded_request["method"]
+ try:
+ request_payload = json_format.MessageToJson(request)
+ except:
+ request_payload = None
+ http_request = {
+ "payload": request_payload,
+ "requestMethod": method,
+ "requestUrl": request_url,
+ "headers": dict(metadata),
+ }
+ _LOGGER.debug(
+ f"Sending request for google.bigtable.admin_v2.BigtableInstanceAdminClient.DeleteLogicalView",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "DeleteLogicalView",
+ "httpRequest": http_request,
+ "metadata": http_request["headers"],
+ },
+ )
+
+ # Send the request
+ response = (
+ BigtableInstanceAdminRestTransport._DeleteLogicalView._get_response(
+ self._host,
+ metadata,
+ query_params,
+ self._session,
+ timeout,
+ transcoded_request,
+ )
+ )
+
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
+ # subclass.
+ if response.status_code >= 400:
+ raise core_exceptions.from_http_response(response)
+
+ class _DeleteMaterializedView(
+ _BaseBigtableInstanceAdminRestTransport._BaseDeleteMaterializedView,
+ BigtableInstanceAdminRestStub,
+ ):
+ def __hash__(self):
+ return hash("BigtableInstanceAdminRestTransport.DeleteMaterializedView")
+
+ @staticmethod
+ def _get_response(
+ host,
+ metadata,
+ query_params,
+ session,
+ timeout,
+ transcoded_request,
+ body=None,
+ ):
+ uri = transcoded_request["uri"]
+ method = transcoded_request["method"]
+ headers = dict(metadata)
+ headers["Content-Type"] = "application/json"
+ response = getattr(session, method)(
+ "{host}{uri}".format(host=host, uri=uri),
+ timeout=timeout,
+ headers=headers,
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
+ )
+ return response
+
+ def __call__(
+ self,
+ request: bigtable_instance_admin.DeleteMaterializedViewRequest,
+ *,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Optional[float] = None,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ):
+ r"""Call the delete materialized view method over HTTP.
+
+ Args:
+ request (~.bigtable_instance_admin.DeleteMaterializedViewRequest):
+ The request object. Request message for
+ BigtableInstanceAdmin.DeleteMaterializedView.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+ """
+
+ http_options = (
+ _BaseBigtableInstanceAdminRestTransport._BaseDeleteMaterializedView._get_http_options()
+ )
+
+ request, metadata = self._interceptor.pre_delete_materialized_view(
+ request, metadata
+ )
+ transcoded_request = _BaseBigtableInstanceAdminRestTransport._BaseDeleteMaterializedView._get_transcoded_request(
+ http_options, request
+ )
+
+ # Jsonify the query params
+ query_params = _BaseBigtableInstanceAdminRestTransport._BaseDeleteMaterializedView._get_query_params_json(
+ transcoded_request
+ )
+
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ request_url = "{host}{uri}".format(
+ host=self._host, uri=transcoded_request["uri"]
+ )
+ method = transcoded_request["method"]
+ try:
+ request_payload = json_format.MessageToJson(request)
+ except:
+ request_payload = None
+ http_request = {
+ "payload": request_payload,
+ "requestMethod": method,
+ "requestUrl": request_url,
+ "headers": dict(metadata),
+ }
+ _LOGGER.debug(
+ f"Sending request for google.bigtable.admin_v2.BigtableInstanceAdminClient.DeleteMaterializedView",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "DeleteMaterializedView",
+ "httpRequest": http_request,
+ "metadata": http_request["headers"],
+ },
+ )
+
+ # Send the request
+ response = BigtableInstanceAdminRestTransport._DeleteMaterializedView._get_response(
+ self._host,
+ metadata,
+ query_params,
+ self._session,
+ timeout,
+ transcoded_request,
+ )
+
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
+ # subclass.
+ if response.status_code >= 400:
+ raise core_exceptions.from_http_response(response)
+
+ class _GetAppProfile(
+ _BaseBigtableInstanceAdminRestTransport._BaseGetAppProfile,
+ BigtableInstanceAdminRestStub,
+ ):
+ def __hash__(self):
+ return hash("BigtableInstanceAdminRestTransport.GetAppProfile")
+
+ @staticmethod
+ def _get_response(
+ host,
+ metadata,
+ query_params,
+ session,
+ timeout,
+ transcoded_request,
+ body=None,
+ ):
+ uri = transcoded_request["uri"]
+ method = transcoded_request["method"]
+ headers = dict(metadata)
+ headers["Content-Type"] = "application/json"
+ response = getattr(session, method)(
+ "{host}{uri}".format(host=host, uri=uri),
+ timeout=timeout,
+ headers=headers,
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
+ )
+ return response
+
+ def __call__(
+ self,
+ request: bigtable_instance_admin.GetAppProfileRequest,
+ *,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Optional[float] = None,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> instance.AppProfile:
+ r"""Call the get app profile method over HTTP.
+
+ Args:
+ request (~.bigtable_instance_admin.GetAppProfileRequest):
+ The request object. Request message for
+ BigtableInstanceAdmin.GetAppProfile.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ ~.instance.AppProfile:
+ A configuration object describing how
+ Cloud Bigtable should treat traffic from
+ a particular end user application.
+
+ """
+
+ http_options = (
+ _BaseBigtableInstanceAdminRestTransport._BaseGetAppProfile._get_http_options()
+ )
+
+ request, metadata = self._interceptor.pre_get_app_profile(request, metadata)
+ transcoded_request = _BaseBigtableInstanceAdminRestTransport._BaseGetAppProfile._get_transcoded_request(
+ http_options, request
+ )
+
+ # Jsonify the query params
+ query_params = _BaseBigtableInstanceAdminRestTransport._BaseGetAppProfile._get_query_params_json(
+ transcoded_request
+ )
+
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ request_url = "{host}{uri}".format(
+ host=self._host, uri=transcoded_request["uri"]
+ )
+ method = transcoded_request["method"]
+ try:
+ request_payload = type(request).to_json(request)
+ except:
+ request_payload = None
+ http_request = {
+ "payload": request_payload,
+ "requestMethod": method,
+ "requestUrl": request_url,
+ "headers": dict(metadata),
+ }
+ _LOGGER.debug(
+ f"Sending request for google.bigtable.admin_v2.BigtableInstanceAdminClient.GetAppProfile",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "GetAppProfile",
+ "httpRequest": http_request,
+ "metadata": http_request["headers"],
+ },
+ )
+
+ # Send the request
+ response = BigtableInstanceAdminRestTransport._GetAppProfile._get_response(
+ self._host,
+ metadata,
+ query_params,
+ self._session,
+ timeout,
+ transcoded_request,
+ )
+
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
+ # subclass.
+ if response.status_code >= 400:
+ raise core_exceptions.from_http_response(response)
+
+ # Return the response
+ resp = instance.AppProfile()
+ pb_resp = instance.AppProfile.pb(resp)
+
+ json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True)
+
+ resp = self._interceptor.post_get_app_profile(resp)
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
+ resp, _ = self._interceptor.post_get_app_profile_with_metadata(
+ resp, response_metadata
+ )
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ try:
+ response_payload = instance.AppProfile.to_json(response)
+ except:
+ response_payload = None
+ http_response = {
+ "payload": response_payload,
+ "headers": dict(response.headers),
+ "status": response.status_code,
+ }
+ _LOGGER.debug(
+ "Received response for google.bigtable.admin_v2.BigtableInstanceAdminClient.get_app_profile",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "GetAppProfile",
+ "metadata": http_response["headers"],
+ "httpResponse": http_response,
+ },
+ )
+ return resp
+
+ class _GetCluster(
+ _BaseBigtableInstanceAdminRestTransport._BaseGetCluster,
+ BigtableInstanceAdminRestStub,
+ ):
+ def __hash__(self):
+ return hash("BigtableInstanceAdminRestTransport.GetCluster")
+
+ @staticmethod
+ def _get_response(
+ host,
+ metadata,
+ query_params,
+ session,
+ timeout,
+ transcoded_request,
+ body=None,
+ ):
+ uri = transcoded_request["uri"]
+ method = transcoded_request["method"]
+ headers = dict(metadata)
+ headers["Content-Type"] = "application/json"
+ response = getattr(session, method)(
+ "{host}{uri}".format(host=host, uri=uri),
+ timeout=timeout,
+ headers=headers,
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
+ )
+ return response
+
+ def __call__(
+ self,
+ request: bigtable_instance_admin.GetClusterRequest,
+ *,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Optional[float] = None,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> instance.Cluster:
+ r"""Call the get cluster method over HTTP.
+
+ Args:
+ request (~.bigtable_instance_admin.GetClusterRequest):
+ The request object. Request message for
+ BigtableInstanceAdmin.GetCluster.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ ~.instance.Cluster:
+ A resizable group of nodes in a particular cloud
+ location, capable of serving all
+ [Tables][google.bigtable.admin.v2.Table] in the parent
+ [Instance][google.bigtable.admin.v2.Instance].
+
+ """
+
+ http_options = (
+ _BaseBigtableInstanceAdminRestTransport._BaseGetCluster._get_http_options()
+ )
+
+ request, metadata = self._interceptor.pre_get_cluster(request, metadata)
+ transcoded_request = _BaseBigtableInstanceAdminRestTransport._BaseGetCluster._get_transcoded_request(
+ http_options, request
+ )
+
+ # Jsonify the query params
+ query_params = _BaseBigtableInstanceAdminRestTransport._BaseGetCluster._get_query_params_json(
+ transcoded_request
+ )
+
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ request_url = "{host}{uri}".format(
+ host=self._host, uri=transcoded_request["uri"]
+ )
+ method = transcoded_request["method"]
+ try:
+ request_payload = type(request).to_json(request)
+ except:
+ request_payload = None
+ http_request = {
+ "payload": request_payload,
+ "requestMethod": method,
+ "requestUrl": request_url,
+ "headers": dict(metadata),
+ }
+ _LOGGER.debug(
+ f"Sending request for google.bigtable.admin_v2.BigtableInstanceAdminClient.GetCluster",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "GetCluster",
+ "httpRequest": http_request,
+ "metadata": http_request["headers"],
+ },
+ )
+
+ # Send the request
+ response = BigtableInstanceAdminRestTransport._GetCluster._get_response(
+ self._host,
+ metadata,
+ query_params,
+ self._session,
+ timeout,
+ transcoded_request,
+ )
+
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
+ # subclass.
+ if response.status_code >= 400:
+ raise core_exceptions.from_http_response(response)
+
+ # Return the response
+ resp = instance.Cluster()
+ pb_resp = instance.Cluster.pb(resp)
+
+ json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True)
+
+ resp = self._interceptor.post_get_cluster(resp)
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
+ resp, _ = self._interceptor.post_get_cluster_with_metadata(
+ resp, response_metadata
+ )
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ try:
+ response_payload = instance.Cluster.to_json(response)
+ except:
+ response_payload = None
+ http_response = {
+ "payload": response_payload,
+ "headers": dict(response.headers),
+ "status": response.status_code,
+ }
+ _LOGGER.debug(
+ "Received response for google.bigtable.admin_v2.BigtableInstanceAdminClient.get_cluster",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "GetCluster",
+ "metadata": http_response["headers"],
+ "httpResponse": http_response,
+ },
+ )
+ return resp
+
+ class _GetIamPolicy(
+ _BaseBigtableInstanceAdminRestTransport._BaseGetIamPolicy,
+ BigtableInstanceAdminRestStub,
+ ):
+ def __hash__(self):
+ return hash("BigtableInstanceAdminRestTransport.GetIamPolicy")
+
+ @staticmethod
+ def _get_response(
+ host,
+ metadata,
+ query_params,
+ session,
+ timeout,
+ transcoded_request,
+ body=None,
+ ):
+ uri = transcoded_request["uri"]
+ method = transcoded_request["method"]
+ headers = dict(metadata)
+ headers["Content-Type"] = "application/json"
+ response = getattr(session, method)(
+ "{host}{uri}".format(host=host, uri=uri),
+ timeout=timeout,
+ headers=headers,
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
+ data=body,
+ )
+ return response
+
+ def __call__(
+ self,
+ request: iam_policy_pb2.GetIamPolicyRequest,
+ *,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Optional[float] = None,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> policy_pb2.Policy:
+ r"""Call the get iam policy method over HTTP.
+
+ Args:
+ request (~.iam_policy_pb2.GetIamPolicyRequest):
+ The request object. Request message for ``GetIamPolicy`` method.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ ~.policy_pb2.Policy:
+ An Identity and Access Management (IAM) policy, which
+ specifies access controls for Google Cloud resources.
+
+ A ``Policy`` is a collection of ``bindings``. A
+ ``binding`` binds one or more ``members``, or
+ principals, to a single ``role``. Principals can be user
+ accounts, service accounts, Google groups, and domains
+ (such as G Suite). A ``role`` is a named list of
+ permissions; each ``role`` can be an IAM predefined role
+ or a user-created custom role.
+
+ For some types of Google Cloud resources, a ``binding``
+ can also specify a ``condition``, which is a logical
+ expression that allows access to a resource only if the
+ expression evaluates to ``true``. A condition can add
+ constraints based on attributes of the request, the
+ resource, or both. To learn which resources support
+ conditions in their IAM policies, see the `IAM
+ documentation `__.
+
+ **JSON example:**
+
+ ::
+
+ {
+ "bindings": [
+ {
+ "role": "roles/resourcemanager.organizationAdmin",
+ "members": [
+ "user:mike@example.com",
+ "group:admins@example.com",
+ "domain:google.com",
+ "serviceAccount:my-project-id@appspot.gserviceaccount.com"
+ ]
+ },
+ {
+ "role": "roles/resourcemanager.organizationViewer",
+ "members": [
+ "user:eve@example.com"
+ ],
+ "condition": {
+ "title": "expirable access",
+ "description": "Does not grant access after Sep 2020",
+ "expression": "request.time <
+ timestamp('2020-10-01T00:00:00.000Z')",
+ }
+ }
+ ],
+ "etag": "BwWWja0YfJA=",
+ "version": 3
+ }
+
+ **YAML example:**
+
+ ::
+
+ bindings:
+ - members:
+ - user:mike@example.com
+ - group:admins@example.com
+ - domain:google.com
+ - serviceAccount:my-project-id@appspot.gserviceaccount.com
+ role: roles/resourcemanager.organizationAdmin
+ - members:
+ - user:eve@example.com
+ role: roles/resourcemanager.organizationViewer
+ condition:
+ title: expirable access
+ description: Does not grant access after Sep 2020
+ expression: request.time < timestamp('2020-10-01T00:00:00.000Z')
+ etag: BwWWja0YfJA=
+ version: 3
+
+ For a description of IAM and its features, see the `IAM
+ documentation `__.
+
+ """
+
+ http_options = (
+ _BaseBigtableInstanceAdminRestTransport._BaseGetIamPolicy._get_http_options()
+ )
+
+ request, metadata = self._interceptor.pre_get_iam_policy(request, metadata)
+ transcoded_request = _BaseBigtableInstanceAdminRestTransport._BaseGetIamPolicy._get_transcoded_request(
+ http_options, request
+ )
+
+ body = _BaseBigtableInstanceAdminRestTransport._BaseGetIamPolicy._get_request_body_json(
+ transcoded_request
+ )
+
+ # Jsonify the query params
+ query_params = _BaseBigtableInstanceAdminRestTransport._BaseGetIamPolicy._get_query_params_json(
+ transcoded_request
+ )
+
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ request_url = "{host}{uri}".format(
+ host=self._host, uri=transcoded_request["uri"]
+ )
+ method = transcoded_request["method"]
+ try:
+ request_payload = json_format.MessageToJson(request)
+ except:
+ request_payload = None
+ http_request = {
+ "payload": request_payload,
+ "requestMethod": method,
+ "requestUrl": request_url,
+ "headers": dict(metadata),
+ }
+ _LOGGER.debug(
+ f"Sending request for google.bigtable.admin_v2.BigtableInstanceAdminClient.GetIamPolicy",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "GetIamPolicy",
+ "httpRequest": http_request,
+ "metadata": http_request["headers"],
+ },
+ )
+
+ # Send the request
+ response = BigtableInstanceAdminRestTransport._GetIamPolicy._get_response(
+ self._host,
+ metadata,
+ query_params,
+ self._session,
+ timeout,
+ transcoded_request,
+ body,
+ )
+
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
+ # subclass.
+ if response.status_code >= 400:
+ raise core_exceptions.from_http_response(response)
+
+ # Return the response
+ resp = policy_pb2.Policy()
+ pb_resp = resp
+
+ json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True)
+
+ resp = self._interceptor.post_get_iam_policy(resp)
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
+ resp, _ = self._interceptor.post_get_iam_policy_with_metadata(
+ resp, response_metadata
+ )
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ try:
+ response_payload = json_format.MessageToJson(resp)
+ except:
+ response_payload = None
+ http_response = {
+ "payload": response_payload,
+ "headers": dict(response.headers),
+ "status": response.status_code,
+ }
+ _LOGGER.debug(
+ "Received response for google.bigtable.admin_v2.BigtableInstanceAdminClient.get_iam_policy",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "GetIamPolicy",
+ "metadata": http_response["headers"],
+ "httpResponse": http_response,
+ },
+ )
+ return resp
+
+ class _GetInstance(
+ _BaseBigtableInstanceAdminRestTransport._BaseGetInstance,
+ BigtableInstanceAdminRestStub,
+ ):
+ def __hash__(self):
+ return hash("BigtableInstanceAdminRestTransport.GetInstance")
+
+ @staticmethod
+ def _get_response(
+ host,
+ metadata,
+ query_params,
+ session,
+ timeout,
+ transcoded_request,
+ body=None,
+ ):
+ uri = transcoded_request["uri"]
+ method = transcoded_request["method"]
+ headers = dict(metadata)
+ headers["Content-Type"] = "application/json"
+ response = getattr(session, method)(
+ "{host}{uri}".format(host=host, uri=uri),
+ timeout=timeout,
+ headers=headers,
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
+ )
+ return response
+
+ def __call__(
+ self,
+ request: bigtable_instance_admin.GetInstanceRequest,
+ *,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Optional[float] = None,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> instance.Instance:
+ r"""Call the get instance method over HTTP.
+
+ Args:
+ request (~.bigtable_instance_admin.GetInstanceRequest):
+ The request object. Request message for
+ BigtableInstanceAdmin.GetInstance.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ ~.instance.Instance:
+ A collection of Bigtable
+ [Tables][google.bigtable.admin.v2.Table] and the
+ resources that serve them. All tables in an instance are
+ served from all
+ [Clusters][google.bigtable.admin.v2.Cluster] in the
+ instance.
+
+ """
+
+ http_options = (
+ _BaseBigtableInstanceAdminRestTransport._BaseGetInstance._get_http_options()
+ )
+
+ request, metadata = self._interceptor.pre_get_instance(request, metadata)
+ transcoded_request = _BaseBigtableInstanceAdminRestTransport._BaseGetInstance._get_transcoded_request(
+ http_options, request
+ )
+
+ # Jsonify the query params
+ query_params = _BaseBigtableInstanceAdminRestTransport._BaseGetInstance._get_query_params_json(
+ transcoded_request
+ )
+
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ request_url = "{host}{uri}".format(
+ host=self._host, uri=transcoded_request["uri"]
+ )
+ method = transcoded_request["method"]
+ try:
+ request_payload = type(request).to_json(request)
+ except:
+ request_payload = None
+ http_request = {
+ "payload": request_payload,
+ "requestMethod": method,
+ "requestUrl": request_url,
+ "headers": dict(metadata),
+ }
+ _LOGGER.debug(
+ f"Sending request for google.bigtable.admin_v2.BigtableInstanceAdminClient.GetInstance",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "GetInstance",
+ "httpRequest": http_request,
+ "metadata": http_request["headers"],
+ },
+ )
+
+ # Send the request
+ response = BigtableInstanceAdminRestTransport._GetInstance._get_response(
+ self._host,
+ metadata,
+ query_params,
+ self._session,
+ timeout,
+ transcoded_request,
+ )
+
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
+ # subclass.
+ if response.status_code >= 400:
+ raise core_exceptions.from_http_response(response)
+
+ # Return the response
+ resp = instance.Instance()
+ pb_resp = instance.Instance.pb(resp)
+
+ json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True)
+
+ resp = self._interceptor.post_get_instance(resp)
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
+ resp, _ = self._interceptor.post_get_instance_with_metadata(
+ resp, response_metadata
+ )
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ try:
+ response_payload = instance.Instance.to_json(response)
+ except:
+ response_payload = None
+ http_response = {
+ "payload": response_payload,
+ "headers": dict(response.headers),
+ "status": response.status_code,
+ }
+ _LOGGER.debug(
+ "Received response for google.bigtable.admin_v2.BigtableInstanceAdminClient.get_instance",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "GetInstance",
+ "metadata": http_response["headers"],
+ "httpResponse": http_response,
+ },
+ )
+ return resp
+
+ class _GetLogicalView(
+ _BaseBigtableInstanceAdminRestTransport._BaseGetLogicalView,
+ BigtableInstanceAdminRestStub,
+ ):
+ def __hash__(self):
+ return hash("BigtableInstanceAdminRestTransport.GetLogicalView")
+
+ @staticmethod
+ def _get_response(
+ host,
+ metadata,
+ query_params,
+ session,
+ timeout,
+ transcoded_request,
+ body=None,
+ ):
+ uri = transcoded_request["uri"]
+ method = transcoded_request["method"]
+ headers = dict(metadata)
+ headers["Content-Type"] = "application/json"
+ response = getattr(session, method)(
+ "{host}{uri}".format(host=host, uri=uri),
+ timeout=timeout,
+ headers=headers,
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
+ )
+ return response
+
+ def __call__(
+ self,
+ request: bigtable_instance_admin.GetLogicalViewRequest,
+ *,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Optional[float] = None,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> instance.LogicalView:
+ r"""Call the get logical view method over HTTP.
+
+ Args:
+ request (~.bigtable_instance_admin.GetLogicalViewRequest):
+ The request object. Request message for
+ BigtableInstanceAdmin.GetLogicalView.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ ~.instance.LogicalView:
+ A SQL logical view object that can be
+ referenced in SQL queries.
+
+ """
+
+ http_options = (
+ _BaseBigtableInstanceAdminRestTransport._BaseGetLogicalView._get_http_options()
+ )
+
+ request, metadata = self._interceptor.pre_get_logical_view(
+ request, metadata
+ )
+ transcoded_request = _BaseBigtableInstanceAdminRestTransport._BaseGetLogicalView._get_transcoded_request(
+ http_options, request
+ )
+
+ # Jsonify the query params
+ query_params = _BaseBigtableInstanceAdminRestTransport._BaseGetLogicalView._get_query_params_json(
+ transcoded_request
+ )
+
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ request_url = "{host}{uri}".format(
+ host=self._host, uri=transcoded_request["uri"]
+ )
+ method = transcoded_request["method"]
+ try:
+ request_payload = type(request).to_json(request)
+ except:
+ request_payload = None
+ http_request = {
+ "payload": request_payload,
+ "requestMethod": method,
+ "requestUrl": request_url,
+ "headers": dict(metadata),
+ }
+ _LOGGER.debug(
+ f"Sending request for google.bigtable.admin_v2.BigtableInstanceAdminClient.GetLogicalView",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "GetLogicalView",
+ "httpRequest": http_request,
+ "metadata": http_request["headers"],
+ },
+ )
+
+ # Send the request
+ response = BigtableInstanceAdminRestTransport._GetLogicalView._get_response(
+ self._host,
+ metadata,
+ query_params,
+ self._session,
+ timeout,
+ transcoded_request,
+ )
+
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
+ # subclass.
+ if response.status_code >= 400:
+ raise core_exceptions.from_http_response(response)
+
+ # Return the response
+ resp = instance.LogicalView()
+ pb_resp = instance.LogicalView.pb(resp)
+
+ json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True)
+
+ resp = self._interceptor.post_get_logical_view(resp)
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
+ resp, _ = self._interceptor.post_get_logical_view_with_metadata(
+ resp, response_metadata
+ )
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ try:
+ response_payload = instance.LogicalView.to_json(response)
+ except:
+ response_payload = None
+ http_response = {
+ "payload": response_payload,
+ "headers": dict(response.headers),
+ "status": response.status_code,
+ }
+ _LOGGER.debug(
+ "Received response for google.bigtable.admin_v2.BigtableInstanceAdminClient.get_logical_view",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "GetLogicalView",
+ "metadata": http_response["headers"],
+ "httpResponse": http_response,
+ },
+ )
+ return resp
+
+ class _GetMaterializedView(
+ _BaseBigtableInstanceAdminRestTransport._BaseGetMaterializedView,
+ BigtableInstanceAdminRestStub,
+ ):
+ def __hash__(self):
+ return hash("BigtableInstanceAdminRestTransport.GetMaterializedView")
+
+ @staticmethod
+ def _get_response(
+ host,
+ metadata,
+ query_params,
+ session,
+ timeout,
+ transcoded_request,
+ body=None,
+ ):
+ uri = transcoded_request["uri"]
+ method = transcoded_request["method"]
+ headers = dict(metadata)
+ headers["Content-Type"] = "application/json"
+ response = getattr(session, method)(
+ "{host}{uri}".format(host=host, uri=uri),
+ timeout=timeout,
+ headers=headers,
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
+ )
+ return response
+
+ def __call__(
+ self,
+ request: bigtable_instance_admin.GetMaterializedViewRequest,
+ *,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Optional[float] = None,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> instance.MaterializedView:
+ r"""Call the get materialized view method over HTTP.
+
+ Args:
+ request (~.bigtable_instance_admin.GetMaterializedViewRequest):
+ The request object. Request message for
+ BigtableInstanceAdmin.GetMaterializedView.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ ~.instance.MaterializedView:
+ A materialized view object that can
+ be referenced in SQL queries.
+
+ """
+
+ http_options = (
+ _BaseBigtableInstanceAdminRestTransport._BaseGetMaterializedView._get_http_options()
+ )
+
+ request, metadata = self._interceptor.pre_get_materialized_view(
+ request, metadata
+ )
+ transcoded_request = _BaseBigtableInstanceAdminRestTransport._BaseGetMaterializedView._get_transcoded_request(
+ http_options, request
+ )
+
+ # Jsonify the query params
+ query_params = _BaseBigtableInstanceAdminRestTransport._BaseGetMaterializedView._get_query_params_json(
+ transcoded_request
+ )
+
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ request_url = "{host}{uri}".format(
+ host=self._host, uri=transcoded_request["uri"]
+ )
+ method = transcoded_request["method"]
+ try:
+ request_payload = type(request).to_json(request)
+ except:
+ request_payload = None
+ http_request = {
+ "payload": request_payload,
+ "requestMethod": method,
+ "requestUrl": request_url,
+ "headers": dict(metadata),
+ }
+ _LOGGER.debug(
+ f"Sending request for google.bigtable.admin_v2.BigtableInstanceAdminClient.GetMaterializedView",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "GetMaterializedView",
+ "httpRequest": http_request,
+ "metadata": http_request["headers"],
+ },
+ )
+
+ # Send the request
+ response = (
+ BigtableInstanceAdminRestTransport._GetMaterializedView._get_response(
+ self._host,
+ metadata,
+ query_params,
+ self._session,
+ timeout,
+ transcoded_request,
+ )
+ )
+
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
+ # subclass.
+ if response.status_code >= 400:
+ raise core_exceptions.from_http_response(response)
+
+ # Return the response
+ resp = instance.MaterializedView()
+ pb_resp = instance.MaterializedView.pb(resp)
+
+ json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True)
+
+ resp = self._interceptor.post_get_materialized_view(resp)
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
+ resp, _ = self._interceptor.post_get_materialized_view_with_metadata(
+ resp, response_metadata
+ )
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ try:
+ response_payload = instance.MaterializedView.to_json(response)
+ except:
+ response_payload = None
+ http_response = {
+ "payload": response_payload,
+ "headers": dict(response.headers),
+ "status": response.status_code,
+ }
+ _LOGGER.debug(
+ "Received response for google.bigtable.admin_v2.BigtableInstanceAdminClient.get_materialized_view",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "GetMaterializedView",
+ "metadata": http_response["headers"],
+ "httpResponse": http_response,
+ },
+ )
+ return resp
+
+ class _ListAppProfiles(
+ _BaseBigtableInstanceAdminRestTransport._BaseListAppProfiles,
+ BigtableInstanceAdminRestStub,
+ ):
+ def __hash__(self):
+ return hash("BigtableInstanceAdminRestTransport.ListAppProfiles")
+
+ @staticmethod
+ def _get_response(
+ host,
+ metadata,
+ query_params,
+ session,
+ timeout,
+ transcoded_request,
+ body=None,
+ ):
+ uri = transcoded_request["uri"]
+ method = transcoded_request["method"]
+ headers = dict(metadata)
+ headers["Content-Type"] = "application/json"
+ response = getattr(session, method)(
+ "{host}{uri}".format(host=host, uri=uri),
+ timeout=timeout,
+ headers=headers,
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
+ )
+ return response
+
+ def __call__(
+ self,
+ request: bigtable_instance_admin.ListAppProfilesRequest,
+ *,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Optional[float] = None,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> bigtable_instance_admin.ListAppProfilesResponse:
+ r"""Call the list app profiles method over HTTP.
+
+ Args:
+ request (~.bigtable_instance_admin.ListAppProfilesRequest):
+ The request object. Request message for
+ BigtableInstanceAdmin.ListAppProfiles.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ ~.bigtable_instance_admin.ListAppProfilesResponse:
+ Response message for
+ BigtableInstanceAdmin.ListAppProfiles.
+
+ """
+
+ http_options = (
+ _BaseBigtableInstanceAdminRestTransport._BaseListAppProfiles._get_http_options()
+ )
+
+ request, metadata = self._interceptor.pre_list_app_profiles(
+ request, metadata
+ )
+ transcoded_request = _BaseBigtableInstanceAdminRestTransport._BaseListAppProfiles._get_transcoded_request(
+ http_options, request
+ )
+
+ # Jsonify the query params
+ query_params = _BaseBigtableInstanceAdminRestTransport._BaseListAppProfiles._get_query_params_json(
+ transcoded_request
+ )
+
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ request_url = "{host}{uri}".format(
+ host=self._host, uri=transcoded_request["uri"]
+ )
+ method = transcoded_request["method"]
+ try:
+ request_payload = type(request).to_json(request)
+ except:
+ request_payload = None
+ http_request = {
+ "payload": request_payload,
+ "requestMethod": method,
+ "requestUrl": request_url,
+ "headers": dict(metadata),
+ }
+ _LOGGER.debug(
+ f"Sending request for google.bigtable.admin_v2.BigtableInstanceAdminClient.ListAppProfiles",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "ListAppProfiles",
+ "httpRequest": http_request,
+ "metadata": http_request["headers"],
+ },
+ )
+
+ # Send the request
+ response = (
+ BigtableInstanceAdminRestTransport._ListAppProfiles._get_response(
+ self._host,
+ metadata,
+ query_params,
+ self._session,
+ timeout,
+ transcoded_request,
+ )
+ )
+
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
+ # subclass.
+ if response.status_code >= 400:
+ raise core_exceptions.from_http_response(response)
+
+ # Return the response
+ resp = bigtable_instance_admin.ListAppProfilesResponse()
+ pb_resp = bigtable_instance_admin.ListAppProfilesResponse.pb(resp)
+
+ json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True)
+
+ resp = self._interceptor.post_list_app_profiles(resp)
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
+ resp, _ = self._interceptor.post_list_app_profiles_with_metadata(
+ resp, response_metadata
+ )
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ try:
+ response_payload = (
+ bigtable_instance_admin.ListAppProfilesResponse.to_json(
+ response
+ )
+ )
+ except:
+ response_payload = None
+ http_response = {
+ "payload": response_payload,
+ "headers": dict(response.headers),
+ "status": response.status_code,
+ }
+ _LOGGER.debug(
+ "Received response for google.bigtable.admin_v2.BigtableInstanceAdminClient.list_app_profiles",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "ListAppProfiles",
+ "metadata": http_response["headers"],
+ "httpResponse": http_response,
+ },
+ )
+ return resp
+
+ class _ListClusters(
+ _BaseBigtableInstanceAdminRestTransport._BaseListClusters,
+ BigtableInstanceAdminRestStub,
+ ):
+ def __hash__(self):
+ return hash("BigtableInstanceAdminRestTransport.ListClusters")
+
+ @staticmethod
+ def _get_response(
+ host,
+ metadata,
+ query_params,
+ session,
+ timeout,
+ transcoded_request,
+ body=None,
+ ):
+ uri = transcoded_request["uri"]
+ method = transcoded_request["method"]
+ headers = dict(metadata)
+ headers["Content-Type"] = "application/json"
+ response = getattr(session, method)(
+ "{host}{uri}".format(host=host, uri=uri),
+ timeout=timeout,
+ headers=headers,
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
+ )
+ return response
+
+ def __call__(
+ self,
+ request: bigtable_instance_admin.ListClustersRequest,
+ *,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Optional[float] = None,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> bigtable_instance_admin.ListClustersResponse:
+ r"""Call the list clusters method over HTTP.
+
+ Args:
+ request (~.bigtable_instance_admin.ListClustersRequest):
+ The request object. Request message for
+ BigtableInstanceAdmin.ListClusters.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ ~.bigtable_instance_admin.ListClustersResponse:
+ Response message for
+ BigtableInstanceAdmin.ListClusters.
+
+ """
+
+ http_options = (
+ _BaseBigtableInstanceAdminRestTransport._BaseListClusters._get_http_options()
+ )
+
+ request, metadata = self._interceptor.pre_list_clusters(request, metadata)
+ transcoded_request = _BaseBigtableInstanceAdminRestTransport._BaseListClusters._get_transcoded_request(
+ http_options, request
+ )
+
+ # Jsonify the query params
+ query_params = _BaseBigtableInstanceAdminRestTransport._BaseListClusters._get_query_params_json(
+ transcoded_request
+ )
+
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ request_url = "{host}{uri}".format(
+ host=self._host, uri=transcoded_request["uri"]
+ )
+ method = transcoded_request["method"]
+ try:
+ request_payload = type(request).to_json(request)
+ except:
+ request_payload = None
+ http_request = {
+ "payload": request_payload,
+ "requestMethod": method,
+ "requestUrl": request_url,
+ "headers": dict(metadata),
+ }
+ _LOGGER.debug(
+ f"Sending request for google.bigtable.admin_v2.BigtableInstanceAdminClient.ListClusters",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "ListClusters",
+ "httpRequest": http_request,
+ "metadata": http_request["headers"],
+ },
+ )
+
+ # Send the request
+ response = BigtableInstanceAdminRestTransport._ListClusters._get_response(
+ self._host,
+ metadata,
+ query_params,
+ self._session,
+ timeout,
+ transcoded_request,
+ )
+
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
+ # subclass.
+ if response.status_code >= 400:
+ raise core_exceptions.from_http_response(response)
+
+ # Return the response
+ resp = bigtable_instance_admin.ListClustersResponse()
+ pb_resp = bigtable_instance_admin.ListClustersResponse.pb(resp)
+
+ json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True)
+
+ resp = self._interceptor.post_list_clusters(resp)
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
+ resp, _ = self._interceptor.post_list_clusters_with_metadata(
+ resp, response_metadata
+ )
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ try:
+ response_payload = (
+ bigtable_instance_admin.ListClustersResponse.to_json(response)
+ )
+ except:
+ response_payload = None
+ http_response = {
+ "payload": response_payload,
+ "headers": dict(response.headers),
+ "status": response.status_code,
+ }
+ _LOGGER.debug(
+ "Received response for google.bigtable.admin_v2.BigtableInstanceAdminClient.list_clusters",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "ListClusters",
+ "metadata": http_response["headers"],
+ "httpResponse": http_response,
+ },
+ )
+ return resp
+
+ class _ListHotTablets(
+ _BaseBigtableInstanceAdminRestTransport._BaseListHotTablets,
+ BigtableInstanceAdminRestStub,
+ ):
+ def __hash__(self):
+ return hash("BigtableInstanceAdminRestTransport.ListHotTablets")
+
+ @staticmethod
+ def _get_response(
+ host,
+ metadata,
+ query_params,
+ session,
+ timeout,
+ transcoded_request,
+ body=None,
+ ):
+ uri = transcoded_request["uri"]
+ method = transcoded_request["method"]
+ headers = dict(metadata)
+ headers["Content-Type"] = "application/json"
+ response = getattr(session, method)(
+ "{host}{uri}".format(host=host, uri=uri),
+ timeout=timeout,
+ headers=headers,
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
+ )
+ return response
+
+ def __call__(
+ self,
+ request: bigtable_instance_admin.ListHotTabletsRequest,
+ *,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Optional[float] = None,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> bigtable_instance_admin.ListHotTabletsResponse:
+ r"""Call the list hot tablets method over HTTP.
+
+ Args:
+ request (~.bigtable_instance_admin.ListHotTabletsRequest):
+ The request object. Request message for
+ BigtableInstanceAdmin.ListHotTablets.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ ~.bigtable_instance_admin.ListHotTabletsResponse:
+ Response message for
+ BigtableInstanceAdmin.ListHotTablets.
+
+ """
+
+ http_options = (
+ _BaseBigtableInstanceAdminRestTransport._BaseListHotTablets._get_http_options()
+ )
+
+ request, metadata = self._interceptor.pre_list_hot_tablets(
+ request, metadata
+ )
+ transcoded_request = _BaseBigtableInstanceAdminRestTransport._BaseListHotTablets._get_transcoded_request(
+ http_options, request
+ )
+
+ # Jsonify the query params
+ query_params = _BaseBigtableInstanceAdminRestTransport._BaseListHotTablets._get_query_params_json(
+ transcoded_request
+ )
+
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ request_url = "{host}{uri}".format(
+ host=self._host, uri=transcoded_request["uri"]
+ )
+ method = transcoded_request["method"]
+ try:
+ request_payload = type(request).to_json(request)
+ except:
+ request_payload = None
+ http_request = {
+ "payload": request_payload,
+ "requestMethod": method,
+ "requestUrl": request_url,
+ "headers": dict(metadata),
+ }
+ _LOGGER.debug(
+ f"Sending request for google.bigtable.admin_v2.BigtableInstanceAdminClient.ListHotTablets",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "ListHotTablets",
+ "httpRequest": http_request,
+ "metadata": http_request["headers"],
+ },
+ )
+
+ # Send the request
+ response = BigtableInstanceAdminRestTransport._ListHotTablets._get_response(
+ self._host,
+ metadata,
+ query_params,
+ self._session,
+ timeout,
+ transcoded_request,
+ )
+
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
+ # subclass.
+ if response.status_code >= 400:
+ raise core_exceptions.from_http_response(response)
+
+ # Return the response
+ resp = bigtable_instance_admin.ListHotTabletsResponse()
+ pb_resp = bigtable_instance_admin.ListHotTabletsResponse.pb(resp)
+
+ json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True)
+
+ resp = self._interceptor.post_list_hot_tablets(resp)
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
+ resp, _ = self._interceptor.post_list_hot_tablets_with_metadata(
+ resp, response_metadata
+ )
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ try:
+ response_payload = (
+ bigtable_instance_admin.ListHotTabletsResponse.to_json(response)
+ )
+ except:
+ response_payload = None
+ http_response = {
+ "payload": response_payload,
+ "headers": dict(response.headers),
+ "status": response.status_code,
+ }
+ _LOGGER.debug(
+ "Received response for google.bigtable.admin_v2.BigtableInstanceAdminClient.list_hot_tablets",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "ListHotTablets",
+ "metadata": http_response["headers"],
+ "httpResponse": http_response,
+ },
+ )
+ return resp
+
+ class _ListInstances(
+ _BaseBigtableInstanceAdminRestTransport._BaseListInstances,
+ BigtableInstanceAdminRestStub,
+ ):
+ def __hash__(self):
+ return hash("BigtableInstanceAdminRestTransport.ListInstances")
+
+ @staticmethod
+ def _get_response(
+ host,
+ metadata,
+ query_params,
+ session,
+ timeout,
+ transcoded_request,
+ body=None,
+ ):
+ uri = transcoded_request["uri"]
+ method = transcoded_request["method"]
+ headers = dict(metadata)
+ headers["Content-Type"] = "application/json"
+ response = getattr(session, method)(
+ "{host}{uri}".format(host=host, uri=uri),
+ timeout=timeout,
+ headers=headers,
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
+ )
+ return response
+
+ def __call__(
+ self,
+ request: bigtable_instance_admin.ListInstancesRequest,
+ *,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Optional[float] = None,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> bigtable_instance_admin.ListInstancesResponse:
+ r"""Call the list instances method over HTTP.
+
+ Args:
+ request (~.bigtable_instance_admin.ListInstancesRequest):
+ The request object. Request message for
+ BigtableInstanceAdmin.ListInstances.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ ~.bigtable_instance_admin.ListInstancesResponse:
+ Response message for
+ BigtableInstanceAdmin.ListInstances.
+
+ """
+
+ http_options = (
+ _BaseBigtableInstanceAdminRestTransport._BaseListInstances._get_http_options()
+ )
+
+ request, metadata = self._interceptor.pre_list_instances(request, metadata)
+ transcoded_request = _BaseBigtableInstanceAdminRestTransport._BaseListInstances._get_transcoded_request(
+ http_options, request
+ )
+
+ # Jsonify the query params
+ query_params = _BaseBigtableInstanceAdminRestTransport._BaseListInstances._get_query_params_json(
+ transcoded_request
+ )
+
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ request_url = "{host}{uri}".format(
+ host=self._host, uri=transcoded_request["uri"]
+ )
+ method = transcoded_request["method"]
+ try:
+ request_payload = type(request).to_json(request)
+ except:
+ request_payload = None
+ http_request = {
+ "payload": request_payload,
+ "requestMethod": method,
+ "requestUrl": request_url,
+ "headers": dict(metadata),
+ }
+ _LOGGER.debug(
+ f"Sending request for google.bigtable.admin_v2.BigtableInstanceAdminClient.ListInstances",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "ListInstances",
+ "httpRequest": http_request,
+ "metadata": http_request["headers"],
+ },
+ )
+
+ # Send the request
+ response = BigtableInstanceAdminRestTransport._ListInstances._get_response(
+ self._host,
+ metadata,
+ query_params,
+ self._session,
+ timeout,
+ transcoded_request,
+ )
+
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
+ # subclass.
+ if response.status_code >= 400:
+ raise core_exceptions.from_http_response(response)
+
+ # Return the response
+ resp = bigtable_instance_admin.ListInstancesResponse()
+ pb_resp = bigtable_instance_admin.ListInstancesResponse.pb(resp)
+
+ json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True)
+
+ resp = self._interceptor.post_list_instances(resp)
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
+ resp, _ = self._interceptor.post_list_instances_with_metadata(
+ resp, response_metadata
+ )
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ try:
+ response_payload = (
+ bigtable_instance_admin.ListInstancesResponse.to_json(response)
+ )
+ except:
+ response_payload = None
+ http_response = {
+ "payload": response_payload,
+ "headers": dict(response.headers),
+ "status": response.status_code,
+ }
+ _LOGGER.debug(
+ "Received response for google.bigtable.admin_v2.BigtableInstanceAdminClient.list_instances",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "ListInstances",
+ "metadata": http_response["headers"],
+ "httpResponse": http_response,
+ },
+ )
+ return resp
+
+ class _ListLogicalViews(
+ _BaseBigtableInstanceAdminRestTransport._BaseListLogicalViews,
+ BigtableInstanceAdminRestStub,
+ ):
+ def __hash__(self):
+ return hash("BigtableInstanceAdminRestTransport.ListLogicalViews")
+
+ @staticmethod
+ def _get_response(
+ host,
+ metadata,
+ query_params,
+ session,
+ timeout,
+ transcoded_request,
+ body=None,
+ ):
+ uri = transcoded_request["uri"]
+ method = transcoded_request["method"]
+ headers = dict(metadata)
+ headers["Content-Type"] = "application/json"
+ response = getattr(session, method)(
+ "{host}{uri}".format(host=host, uri=uri),
+ timeout=timeout,
+ headers=headers,
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
+ )
+ return response
+
+ def __call__(
+ self,
+ request: bigtable_instance_admin.ListLogicalViewsRequest,
+ *,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Optional[float] = None,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> bigtable_instance_admin.ListLogicalViewsResponse:
+ r"""Call the list logical views method over HTTP.
+
+ Args:
+ request (~.bigtable_instance_admin.ListLogicalViewsRequest):
+ The request object. Request message for
+ BigtableInstanceAdmin.ListLogicalViews.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ ~.bigtable_instance_admin.ListLogicalViewsResponse:
+ Response message for
+ BigtableInstanceAdmin.ListLogicalViews.
+
+ """
+
+ http_options = (
+ _BaseBigtableInstanceAdminRestTransport._BaseListLogicalViews._get_http_options()
+ )
+
+ request, metadata = self._interceptor.pre_list_logical_views(
+ request, metadata
+ )
+ transcoded_request = _BaseBigtableInstanceAdminRestTransport._BaseListLogicalViews._get_transcoded_request(
+ http_options, request
+ )
+
+ # Jsonify the query params
+ query_params = _BaseBigtableInstanceAdminRestTransport._BaseListLogicalViews._get_query_params_json(
+ transcoded_request
+ )
+
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ request_url = "{host}{uri}".format(
+ host=self._host, uri=transcoded_request["uri"]
+ )
+ method = transcoded_request["method"]
+ try:
+ request_payload = type(request).to_json(request)
+ except:
+ request_payload = None
+ http_request = {
+ "payload": request_payload,
+ "requestMethod": method,
+ "requestUrl": request_url,
+ "headers": dict(metadata),
+ }
+ _LOGGER.debug(
+ f"Sending request for google.bigtable.admin_v2.BigtableInstanceAdminClient.ListLogicalViews",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "ListLogicalViews",
+ "httpRequest": http_request,
+ "metadata": http_request["headers"],
+ },
+ )
+
+ # Send the request
+ response = (
+ BigtableInstanceAdminRestTransport._ListLogicalViews._get_response(
+ self._host,
+ metadata,
+ query_params,
+ self._session,
+ timeout,
+ transcoded_request,
+ )
+ )
+
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
+ # subclass.
+ if response.status_code >= 400:
+ raise core_exceptions.from_http_response(response)
+
+ # Return the response
+ resp = bigtable_instance_admin.ListLogicalViewsResponse()
+ pb_resp = bigtable_instance_admin.ListLogicalViewsResponse.pb(resp)
+
+ json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True)
+
+ resp = self._interceptor.post_list_logical_views(resp)
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
+ resp, _ = self._interceptor.post_list_logical_views_with_metadata(
+ resp, response_metadata
+ )
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ try:
+ response_payload = (
+ bigtable_instance_admin.ListLogicalViewsResponse.to_json(
+ response
+ )
+ )
+ except:
+ response_payload = None
+ http_response = {
+ "payload": response_payload,
+ "headers": dict(response.headers),
+ "status": response.status_code,
+ }
+ _LOGGER.debug(
+ "Received response for google.bigtable.admin_v2.BigtableInstanceAdminClient.list_logical_views",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "ListLogicalViews",
+ "metadata": http_response["headers"],
+ "httpResponse": http_response,
+ },
+ )
+ return resp
+
+ class _ListMaterializedViews(
+ _BaseBigtableInstanceAdminRestTransport._BaseListMaterializedViews,
+ BigtableInstanceAdminRestStub,
+ ):
+ def __hash__(self):
+ return hash("BigtableInstanceAdminRestTransport.ListMaterializedViews")
+
+ @staticmethod
+ def _get_response(
+ host,
+ metadata,
+ query_params,
+ session,
+ timeout,
+ transcoded_request,
+ body=None,
+ ):
+ uri = transcoded_request["uri"]
+ method = transcoded_request["method"]
+ headers = dict(metadata)
+ headers["Content-Type"] = "application/json"
+ response = getattr(session, method)(
+ "{host}{uri}".format(host=host, uri=uri),
+ timeout=timeout,
+ headers=headers,
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
+ )
+ return response
+
+ def __call__(
+ self,
+ request: bigtable_instance_admin.ListMaterializedViewsRequest,
+ *,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Optional[float] = None,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> bigtable_instance_admin.ListMaterializedViewsResponse:
+ r"""Call the list materialized views method over HTTP.
+
+ Args:
+ request (~.bigtable_instance_admin.ListMaterializedViewsRequest):
+ The request object. Request message for
+ BigtableInstanceAdmin.ListMaterializedViews.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ ~.bigtable_instance_admin.ListMaterializedViewsResponse:
+ Response message for
+ BigtableInstanceAdmin.ListMaterializedViews.
+
+ """
+
+ http_options = (
+ _BaseBigtableInstanceAdminRestTransport._BaseListMaterializedViews._get_http_options()
+ )
+
+ request, metadata = self._interceptor.pre_list_materialized_views(
+ request, metadata
+ )
+ transcoded_request = _BaseBigtableInstanceAdminRestTransport._BaseListMaterializedViews._get_transcoded_request(
+ http_options, request
+ )
+
+ # Jsonify the query params
+ query_params = _BaseBigtableInstanceAdminRestTransport._BaseListMaterializedViews._get_query_params_json(
+ transcoded_request
+ )
+
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ request_url = "{host}{uri}".format(
+ host=self._host, uri=transcoded_request["uri"]
+ )
+ method = transcoded_request["method"]
+ try:
+ request_payload = type(request).to_json(request)
+ except:
+ request_payload = None
+ http_request = {
+ "payload": request_payload,
+ "requestMethod": method,
+ "requestUrl": request_url,
+ "headers": dict(metadata),
+ }
+ _LOGGER.debug(
+ f"Sending request for google.bigtable.admin_v2.BigtableInstanceAdminClient.ListMaterializedViews",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "ListMaterializedViews",
+ "httpRequest": http_request,
+ "metadata": http_request["headers"],
+ },
+ )
+
+ # Send the request
+ response = (
+ BigtableInstanceAdminRestTransport._ListMaterializedViews._get_response(
+ self._host,
+ metadata,
+ query_params,
+ self._session,
+ timeout,
+ transcoded_request,
+ )
+ )
+
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
+ # subclass.
+ if response.status_code >= 400:
+ raise core_exceptions.from_http_response(response)
+
+ # Return the response
+ resp = bigtable_instance_admin.ListMaterializedViewsResponse()
+ pb_resp = bigtable_instance_admin.ListMaterializedViewsResponse.pb(resp)
+
+ json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True)
+
+ resp = self._interceptor.post_list_materialized_views(resp)
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
+ resp, _ = self._interceptor.post_list_materialized_views_with_metadata(
+ resp, response_metadata
+ )
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ try:
+ response_payload = (
+ bigtable_instance_admin.ListMaterializedViewsResponse.to_json(
+ response
+ )
+ )
+ except:
+ response_payload = None
+ http_response = {
+ "payload": response_payload,
+ "headers": dict(response.headers),
+ "status": response.status_code,
+ }
+ _LOGGER.debug(
+ "Received response for google.bigtable.admin_v2.BigtableInstanceAdminClient.list_materialized_views",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "ListMaterializedViews",
+ "metadata": http_response["headers"],
+ "httpResponse": http_response,
+ },
+ )
+ return resp
+
+ class _PartialUpdateCluster(
+ _BaseBigtableInstanceAdminRestTransport._BasePartialUpdateCluster,
+ BigtableInstanceAdminRestStub,
+ ):
+ def __hash__(self):
+ return hash("BigtableInstanceAdminRestTransport.PartialUpdateCluster")
+
+ @staticmethod
+ def _get_response(
+ host,
+ metadata,
+ query_params,
+ session,
+ timeout,
+ transcoded_request,
+ body=None,
+ ):
+ uri = transcoded_request["uri"]
+ method = transcoded_request["method"]
+ headers = dict(metadata)
+ headers["Content-Type"] = "application/json"
+ response = getattr(session, method)(
+ "{host}{uri}".format(host=host, uri=uri),
+ timeout=timeout,
+ headers=headers,
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
+ data=body,
+ )
+ return response
+
+ def __call__(
+ self,
+ request: bigtable_instance_admin.PartialUpdateClusterRequest,
+ *,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Optional[float] = None,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operations_pb2.Operation:
+ r"""Call the partial update cluster method over HTTP.
+
+ Args:
+ request (~.bigtable_instance_admin.PartialUpdateClusterRequest):
+ The request object. Request message for
+ BigtableInstanceAdmin.PartialUpdateCluster.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ ~.operations_pb2.Operation:
+ This resource represents a
+ long-running operation that is the
+ result of a network API call.
+
+ """
+
+ http_options = (
+ _BaseBigtableInstanceAdminRestTransport._BasePartialUpdateCluster._get_http_options()
+ )
+
+ request, metadata = self._interceptor.pre_partial_update_cluster(
+ request, metadata
+ )
+ transcoded_request = _BaseBigtableInstanceAdminRestTransport._BasePartialUpdateCluster._get_transcoded_request(
+ http_options, request
+ )
+
+ body = _BaseBigtableInstanceAdminRestTransport._BasePartialUpdateCluster._get_request_body_json(
+ transcoded_request
+ )
+
+ # Jsonify the query params
+ query_params = _BaseBigtableInstanceAdminRestTransport._BasePartialUpdateCluster._get_query_params_json(
+ transcoded_request
+ )
+
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ request_url = "{host}{uri}".format(
+ host=self._host, uri=transcoded_request["uri"]
+ )
+ method = transcoded_request["method"]
+ try:
+ request_payload = json_format.MessageToJson(request)
+ except:
+ request_payload = None
+ http_request = {
+ "payload": request_payload,
+ "requestMethod": method,
+ "requestUrl": request_url,
+ "headers": dict(metadata),
+ }
+ _LOGGER.debug(
+ f"Sending request for google.bigtable.admin_v2.BigtableInstanceAdminClient.PartialUpdateCluster",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "PartialUpdateCluster",
+ "httpRequest": http_request,
+ "metadata": http_request["headers"],
+ },
+ )
+
+ # Send the request
+ response = (
+ BigtableInstanceAdminRestTransport._PartialUpdateCluster._get_response(
+ self._host,
+ metadata,
+ query_params,
+ self._session,
+ timeout,
+ transcoded_request,
+ body,
+ )
+ )
+
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
+ # subclass.
+ if response.status_code >= 400:
+ raise core_exceptions.from_http_response(response)
+
+ # Return the response
+ resp = operations_pb2.Operation()
+ json_format.Parse(response.content, resp, ignore_unknown_fields=True)
+
+ resp = self._interceptor.post_partial_update_cluster(resp)
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
+ resp, _ = self._interceptor.post_partial_update_cluster_with_metadata(
+ resp, response_metadata
+ )
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ try:
+ response_payload = json_format.MessageToJson(resp)
+ except:
+ response_payload = None
+ http_response = {
+ "payload": response_payload,
+ "headers": dict(response.headers),
+ "status": response.status_code,
+ }
+ _LOGGER.debug(
+ "Received response for google.bigtable.admin_v2.BigtableInstanceAdminClient.partial_update_cluster",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "PartialUpdateCluster",
+ "metadata": http_response["headers"],
+ "httpResponse": http_response,
+ },
+ )
+ return resp
+
+ class _PartialUpdateInstance(
+ _BaseBigtableInstanceAdminRestTransport._BasePartialUpdateInstance,
+ BigtableInstanceAdminRestStub,
+ ):
+ def __hash__(self):
+ return hash("BigtableInstanceAdminRestTransport.PartialUpdateInstance")
+
+ @staticmethod
+ def _get_response(
+ host,
+ metadata,
+ query_params,
+ session,
+ timeout,
+ transcoded_request,
+ body=None,
+ ):
+ uri = transcoded_request["uri"]
+ method = transcoded_request["method"]
+ headers = dict(metadata)
+ headers["Content-Type"] = "application/json"
+ response = getattr(session, method)(
+ "{host}{uri}".format(host=host, uri=uri),
+ timeout=timeout,
+ headers=headers,
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
+ data=body,
+ )
+ return response
+
+ def __call__(
+ self,
+ request: bigtable_instance_admin.PartialUpdateInstanceRequest,
+ *,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Optional[float] = None,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operations_pb2.Operation:
+ r"""Call the partial update instance method over HTTP.
+
+ Args:
+ request (~.bigtable_instance_admin.PartialUpdateInstanceRequest):
+ The request object. Request message for
+ BigtableInstanceAdmin.PartialUpdateInstance.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ ~.operations_pb2.Operation:
+ This resource represents a
+ long-running operation that is the
+ result of a network API call.
+
+ """
+
+ http_options = (
+ _BaseBigtableInstanceAdminRestTransport._BasePartialUpdateInstance._get_http_options()
+ )
+
+ request, metadata = self._interceptor.pre_partial_update_instance(
+ request, metadata
+ )
+ transcoded_request = _BaseBigtableInstanceAdminRestTransport._BasePartialUpdateInstance._get_transcoded_request(
+ http_options, request
+ )
+
+ body = _BaseBigtableInstanceAdminRestTransport._BasePartialUpdateInstance._get_request_body_json(
+ transcoded_request
+ )
+
+ # Jsonify the query params
+ query_params = _BaseBigtableInstanceAdminRestTransport._BasePartialUpdateInstance._get_query_params_json(
+ transcoded_request
+ )
+
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ request_url = "{host}{uri}".format(
+ host=self._host, uri=transcoded_request["uri"]
+ )
+ method = transcoded_request["method"]
+ try:
+ request_payload = json_format.MessageToJson(request)
+ except:
+ request_payload = None
+ http_request = {
+ "payload": request_payload,
+ "requestMethod": method,
+ "requestUrl": request_url,
+ "headers": dict(metadata),
+ }
+ _LOGGER.debug(
+ f"Sending request for google.bigtable.admin_v2.BigtableInstanceAdminClient.PartialUpdateInstance",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "PartialUpdateInstance",
+ "httpRequest": http_request,
+ "metadata": http_request["headers"],
+ },
+ )
+
+ # Send the request
+ response = (
+ BigtableInstanceAdminRestTransport._PartialUpdateInstance._get_response(
+ self._host,
+ metadata,
+ query_params,
+ self._session,
+ timeout,
+ transcoded_request,
+ body,
+ )
+ )
+
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
+ # subclass.
+ if response.status_code >= 400:
+ raise core_exceptions.from_http_response(response)
+
+ # Return the response
+ resp = operations_pb2.Operation()
+ json_format.Parse(response.content, resp, ignore_unknown_fields=True)
+
+ resp = self._interceptor.post_partial_update_instance(resp)
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
+ resp, _ = self._interceptor.post_partial_update_instance_with_metadata(
+ resp, response_metadata
+ )
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ try:
+ response_payload = json_format.MessageToJson(resp)
+ except:
+ response_payload = None
+ http_response = {
+ "payload": response_payload,
+ "headers": dict(response.headers),
+ "status": response.status_code,
+ }
+ _LOGGER.debug(
+ "Received response for google.bigtable.admin_v2.BigtableInstanceAdminClient.partial_update_instance",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "PartialUpdateInstance",
+ "metadata": http_response["headers"],
+ "httpResponse": http_response,
+ },
+ )
+ return resp
+
+ class _SetIamPolicy(
+ _BaseBigtableInstanceAdminRestTransport._BaseSetIamPolicy,
+ BigtableInstanceAdminRestStub,
+ ):
+ def __hash__(self):
+ return hash("BigtableInstanceAdminRestTransport.SetIamPolicy")
+
+ @staticmethod
+ def _get_response(
+ host,
+ metadata,
+ query_params,
+ session,
+ timeout,
+ transcoded_request,
+ body=None,
+ ):
+ uri = transcoded_request["uri"]
+ method = transcoded_request["method"]
+ headers = dict(metadata)
+ headers["Content-Type"] = "application/json"
+ response = getattr(session, method)(
+ "{host}{uri}".format(host=host, uri=uri),
+ timeout=timeout,
+ headers=headers,
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
+ data=body,
+ )
+ return response
+
+ def __call__(
+ self,
+ request: iam_policy_pb2.SetIamPolicyRequest,
+ *,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Optional[float] = None,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> policy_pb2.Policy:
+ r"""Call the set iam policy method over HTTP.
+
+ Args:
+ request (~.iam_policy_pb2.SetIamPolicyRequest):
+ The request object. Request message for ``SetIamPolicy`` method.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ ~.policy_pb2.Policy:
+ An Identity and Access Management (IAM) policy, which
+ specifies access controls for Google Cloud resources.
+
+ A ``Policy`` is a collection of ``bindings``. A
+ ``binding`` binds one or more ``members``, or
+ principals, to a single ``role``. Principals can be user
+ accounts, service accounts, Google groups, and domains
+ (such as G Suite). A ``role`` is a named list of
+ permissions; each ``role`` can be an IAM predefined role
+ or a user-created custom role.
+
+ For some types of Google Cloud resources, a ``binding``
+ can also specify a ``condition``, which is a logical
+ expression that allows access to a resource only if the
+ expression evaluates to ``true``. A condition can add
+ constraints based on attributes of the request, the
+ resource, or both. To learn which resources support
+ conditions in their IAM policies, see the `IAM
+ documentation `__.
+
+ **JSON example:**
+
+ ::
+
+ {
+ "bindings": [
+ {
+ "role": "roles/resourcemanager.organizationAdmin",
+ "members": [
+ "user:mike@example.com",
+ "group:admins@example.com",
+ "domain:google.com",
+ "serviceAccount:my-project-id@appspot.gserviceaccount.com"
+ ]
+ },
+ {
+ "role": "roles/resourcemanager.organizationViewer",
+ "members": [
+ "user:eve@example.com"
+ ],
+ "condition": {
+ "title": "expirable access",
+ "description": "Does not grant access after Sep 2020",
+ "expression": "request.time <
+ timestamp('2020-10-01T00:00:00.000Z')",
+ }
+ }
+ ],
+ "etag": "BwWWja0YfJA=",
+ "version": 3
+ }
+
+ **YAML example:**
+
+ ::
+
+ bindings:
+ - members:
+ - user:mike@example.com
+ - group:admins@example.com
+ - domain:google.com
+ - serviceAccount:my-project-id@appspot.gserviceaccount.com
+ role: roles/resourcemanager.organizationAdmin
+ - members:
+ - user:eve@example.com
+ role: roles/resourcemanager.organizationViewer
+ condition:
+ title: expirable access
+ description: Does not grant access after Sep 2020
+ expression: request.time < timestamp('2020-10-01T00:00:00.000Z')
+ etag: BwWWja0YfJA=
+ version: 3
+
+ For a description of IAM and its features, see the `IAM
+ documentation `__.
+
+ """
+
+ http_options = (
+ _BaseBigtableInstanceAdminRestTransport._BaseSetIamPolicy._get_http_options()
+ )
+
+ request, metadata = self._interceptor.pre_set_iam_policy(request, metadata)
+ transcoded_request = _BaseBigtableInstanceAdminRestTransport._BaseSetIamPolicy._get_transcoded_request(
+ http_options, request
+ )
+
+ body = _BaseBigtableInstanceAdminRestTransport._BaseSetIamPolicy._get_request_body_json(
+ transcoded_request
+ )
+
+ # Jsonify the query params
+ query_params = _BaseBigtableInstanceAdminRestTransport._BaseSetIamPolicy._get_query_params_json(
+ transcoded_request
+ )
+
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ request_url = "{host}{uri}".format(
+ host=self._host, uri=transcoded_request["uri"]
+ )
+ method = transcoded_request["method"]
+ try:
+ request_payload = json_format.MessageToJson(request)
+ except:
+ request_payload = None
+ http_request = {
+ "payload": request_payload,
+ "requestMethod": method,
+ "requestUrl": request_url,
+ "headers": dict(metadata),
+ }
+ _LOGGER.debug(
+ f"Sending request for google.bigtable.admin_v2.BigtableInstanceAdminClient.SetIamPolicy",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "SetIamPolicy",
+ "httpRequest": http_request,
+ "metadata": http_request["headers"],
+ },
+ )
+
+ # Send the request
+ response = BigtableInstanceAdminRestTransport._SetIamPolicy._get_response(
+ self._host,
+ metadata,
+ query_params,
+ self._session,
+ timeout,
+ transcoded_request,
+ body,
+ )
+
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
+ # subclass.
+ if response.status_code >= 400:
+ raise core_exceptions.from_http_response(response)
+
+ # Return the response
+ resp = policy_pb2.Policy()
+ pb_resp = resp
+
+ json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True)
+
+ resp = self._interceptor.post_set_iam_policy(resp)
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
+ resp, _ = self._interceptor.post_set_iam_policy_with_metadata(
+ resp, response_metadata
+ )
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ try:
+ response_payload = json_format.MessageToJson(resp)
+ except:
+ response_payload = None
+ http_response = {
+ "payload": response_payload,
+ "headers": dict(response.headers),
+ "status": response.status_code,
+ }
+ _LOGGER.debug(
+ "Received response for google.bigtable.admin_v2.BigtableInstanceAdminClient.set_iam_policy",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "SetIamPolicy",
+ "metadata": http_response["headers"],
+ "httpResponse": http_response,
+ },
+ )
+ return resp
+
+ class _TestIamPermissions(
+ _BaseBigtableInstanceAdminRestTransport._BaseTestIamPermissions,
+ BigtableInstanceAdminRestStub,
+ ):
+ def __hash__(self):
+ return hash("BigtableInstanceAdminRestTransport.TestIamPermissions")
+
+ @staticmethod
+ def _get_response(
+ host,
+ metadata,
+ query_params,
+ session,
+ timeout,
+ transcoded_request,
+ body=None,
+ ):
+ uri = transcoded_request["uri"]
+ method = transcoded_request["method"]
+ headers = dict(metadata)
+ headers["Content-Type"] = "application/json"
+ response = getattr(session, method)(
+ "{host}{uri}".format(host=host, uri=uri),
+ timeout=timeout,
+ headers=headers,
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
+ data=body,
+ )
+ return response
+
+ def __call__(
+ self,
+ request: iam_policy_pb2.TestIamPermissionsRequest,
+ *,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Optional[float] = None,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> iam_policy_pb2.TestIamPermissionsResponse:
+ r"""Call the test iam permissions method over HTTP.
+
+ Args:
+ request (~.iam_policy_pb2.TestIamPermissionsRequest):
+ The request object. Request message for ``TestIamPermissions`` method.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ ~.iam_policy_pb2.TestIamPermissionsResponse:
+ Response message for ``TestIamPermissions`` method.
+ """
+
+ http_options = (
+ _BaseBigtableInstanceAdminRestTransport._BaseTestIamPermissions._get_http_options()
+ )
+
+ request, metadata = self._interceptor.pre_test_iam_permissions(
+ request, metadata
+ )
+ transcoded_request = _BaseBigtableInstanceAdminRestTransport._BaseTestIamPermissions._get_transcoded_request(
+ http_options, request
+ )
+
+ body = _BaseBigtableInstanceAdminRestTransport._BaseTestIamPermissions._get_request_body_json(
+ transcoded_request
+ )
+
+ # Jsonify the query params
+ query_params = _BaseBigtableInstanceAdminRestTransport._BaseTestIamPermissions._get_query_params_json(
+ transcoded_request
+ )
+
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ request_url = "{host}{uri}".format(
+ host=self._host, uri=transcoded_request["uri"]
+ )
+ method = transcoded_request["method"]
+ try:
+ request_payload = json_format.MessageToJson(request)
+ except:
+ request_payload = None
+ http_request = {
+ "payload": request_payload,
+ "requestMethod": method,
+ "requestUrl": request_url,
+ "headers": dict(metadata),
+ }
+ _LOGGER.debug(
+ f"Sending request for google.bigtable.admin_v2.BigtableInstanceAdminClient.TestIamPermissions",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "TestIamPermissions",
+ "httpRequest": http_request,
+ "metadata": http_request["headers"],
+ },
+ )
+
+ # Send the request
+ response = (
+ BigtableInstanceAdminRestTransport._TestIamPermissions._get_response(
+ self._host,
+ metadata,
+ query_params,
+ self._session,
+ timeout,
+ transcoded_request,
+ body,
+ )
+ )
+
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
+ # subclass.
+ if response.status_code >= 400:
+ raise core_exceptions.from_http_response(response)
+
+ # Return the response
+ resp = iam_policy_pb2.TestIamPermissionsResponse()
+ pb_resp = resp
+
+ json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True)
+
+ resp = self._interceptor.post_test_iam_permissions(resp)
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
+ resp, _ = self._interceptor.post_test_iam_permissions_with_metadata(
+ resp, response_metadata
+ )
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ try:
+ response_payload = json_format.MessageToJson(resp)
+ except:
+ response_payload = None
+ http_response = {
+ "payload": response_payload,
+ "headers": dict(response.headers),
+ "status": response.status_code,
+ }
+ _LOGGER.debug(
+ "Received response for google.bigtable.admin_v2.BigtableInstanceAdminClient.test_iam_permissions",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "TestIamPermissions",
+ "metadata": http_response["headers"],
+ "httpResponse": http_response,
+ },
+ )
+ return resp
+
+ class _UpdateAppProfile(
+ _BaseBigtableInstanceAdminRestTransport._BaseUpdateAppProfile,
+ BigtableInstanceAdminRestStub,
+ ):
+ def __hash__(self):
+ return hash("BigtableInstanceAdminRestTransport.UpdateAppProfile")
+
+ @staticmethod
+ def _get_response(
+ host,
+ metadata,
+ query_params,
+ session,
+ timeout,
+ transcoded_request,
+ body=None,
+ ):
+ uri = transcoded_request["uri"]
+ method = transcoded_request["method"]
+ headers = dict(metadata)
+ headers["Content-Type"] = "application/json"
+ response = getattr(session, method)(
+ "{host}{uri}".format(host=host, uri=uri),
+ timeout=timeout,
+ headers=headers,
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
+ data=body,
+ )
+ return response
+
+ def __call__(
+ self,
+ request: bigtable_instance_admin.UpdateAppProfileRequest,
+ *,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Optional[float] = None,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operations_pb2.Operation:
+ r"""Call the update app profile method over HTTP.
+
+ Args:
+ request (~.bigtable_instance_admin.UpdateAppProfileRequest):
+ The request object. Request message for
+ BigtableInstanceAdmin.UpdateAppProfile.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ ~.operations_pb2.Operation:
+ This resource represents a
+ long-running operation that is the
+ result of a network API call.
+
+ """
+
+ http_options = (
+ _BaseBigtableInstanceAdminRestTransport._BaseUpdateAppProfile._get_http_options()
+ )
+
+ request, metadata = self._interceptor.pre_update_app_profile(
+ request, metadata
+ )
+ transcoded_request = _BaseBigtableInstanceAdminRestTransport._BaseUpdateAppProfile._get_transcoded_request(
+ http_options, request
+ )
+
+ body = _BaseBigtableInstanceAdminRestTransport._BaseUpdateAppProfile._get_request_body_json(
+ transcoded_request
+ )
+
+ # Jsonify the query params
+ query_params = _BaseBigtableInstanceAdminRestTransport._BaseUpdateAppProfile._get_query_params_json(
+ transcoded_request
+ )
+
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ request_url = "{host}{uri}".format(
+ host=self._host, uri=transcoded_request["uri"]
+ )
+ method = transcoded_request["method"]
+ try:
+ request_payload = json_format.MessageToJson(request)
+ except:
+ request_payload = None
+ http_request = {
+ "payload": request_payload,
+ "requestMethod": method,
+ "requestUrl": request_url,
+ "headers": dict(metadata),
+ }
+ _LOGGER.debug(
+ f"Sending request for google.bigtable.admin_v2.BigtableInstanceAdminClient.UpdateAppProfile",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "UpdateAppProfile",
+ "httpRequest": http_request,
+ "metadata": http_request["headers"],
+ },
+ )
+
+ # Send the request
+ response = (
+ BigtableInstanceAdminRestTransport._UpdateAppProfile._get_response(
+ self._host,
+ metadata,
+ query_params,
+ self._session,
+ timeout,
+ transcoded_request,
+ body,
+ )
+ )
+
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
+ # subclass.
+ if response.status_code >= 400:
+ raise core_exceptions.from_http_response(response)
+
+ # Return the response
+ resp = operations_pb2.Operation()
+ json_format.Parse(response.content, resp, ignore_unknown_fields=True)
+
+ resp = self._interceptor.post_update_app_profile(resp)
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
+ resp, _ = self._interceptor.post_update_app_profile_with_metadata(
+ resp, response_metadata
+ )
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ try:
+ response_payload = json_format.MessageToJson(resp)
+ except:
+ response_payload = None
+ http_response = {
+ "payload": response_payload,
+ "headers": dict(response.headers),
+ "status": response.status_code,
+ }
+ _LOGGER.debug(
+ "Received response for google.bigtable.admin_v2.BigtableInstanceAdminClient.update_app_profile",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "UpdateAppProfile",
+ "metadata": http_response["headers"],
+ "httpResponse": http_response,
+ },
+ )
+ return resp
+
+ class _UpdateCluster(
+ _BaseBigtableInstanceAdminRestTransport._BaseUpdateCluster,
+ BigtableInstanceAdminRestStub,
+ ):
+ def __hash__(self):
+ return hash("BigtableInstanceAdminRestTransport.UpdateCluster")
+
+ @staticmethod
+ def _get_response(
+ host,
+ metadata,
+ query_params,
+ session,
+ timeout,
+ transcoded_request,
+ body=None,
+ ):
+ uri = transcoded_request["uri"]
+ method = transcoded_request["method"]
+ headers = dict(metadata)
+ headers["Content-Type"] = "application/json"
+ response = getattr(session, method)(
+ "{host}{uri}".format(host=host, uri=uri),
+ timeout=timeout,
+ headers=headers,
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
+ data=body,
+ )
+ return response
+
+ def __call__(
+ self,
+ request: instance.Cluster,
+ *,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Optional[float] = None,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operations_pb2.Operation:
+ r"""Call the update cluster method over HTTP.
+
+ Args:
+ request (~.instance.Cluster):
+ The request object. A resizable group of nodes in a particular cloud
+ location, capable of serving all
+ [Tables][google.bigtable.admin.v2.Table] in the parent
+ [Instance][google.bigtable.admin.v2.Instance].
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ ~.operations_pb2.Operation:
+ This resource represents a
+ long-running operation that is the
+ result of a network API call.
+
+ """
+
+ http_options = (
+ _BaseBigtableInstanceAdminRestTransport._BaseUpdateCluster._get_http_options()
+ )
+
+ request, metadata = self._interceptor.pre_update_cluster(request, metadata)
+ transcoded_request = _BaseBigtableInstanceAdminRestTransport._BaseUpdateCluster._get_transcoded_request(
+ http_options, request
+ )
+
+ body = _BaseBigtableInstanceAdminRestTransport._BaseUpdateCluster._get_request_body_json(
+ transcoded_request
+ )
+
+ # Jsonify the query params
+ query_params = _BaseBigtableInstanceAdminRestTransport._BaseUpdateCluster._get_query_params_json(
+ transcoded_request
+ )
+
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ request_url = "{host}{uri}".format(
+ host=self._host, uri=transcoded_request["uri"]
+ )
+ method = transcoded_request["method"]
+ try:
+ request_payload = json_format.MessageToJson(request)
+ except:
+ request_payload = None
+ http_request = {
+ "payload": request_payload,
+ "requestMethod": method,
+ "requestUrl": request_url,
+ "headers": dict(metadata),
+ }
+ _LOGGER.debug(
+ f"Sending request for google.bigtable.admin_v2.BigtableInstanceAdminClient.UpdateCluster",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "UpdateCluster",
+ "httpRequest": http_request,
+ "metadata": http_request["headers"],
+ },
+ )
+
+ # Send the request
+ response = BigtableInstanceAdminRestTransport._UpdateCluster._get_response(
+ self._host,
+ metadata,
+ query_params,
+ self._session,
+ timeout,
+ transcoded_request,
+ body,
+ )
+
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
+ # subclass.
+ if response.status_code >= 400:
+ raise core_exceptions.from_http_response(response)
+
+ # Return the response
+ resp = operations_pb2.Operation()
+ json_format.Parse(response.content, resp, ignore_unknown_fields=True)
+
+ resp = self._interceptor.post_update_cluster(resp)
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
+ resp, _ = self._interceptor.post_update_cluster_with_metadata(
+ resp, response_metadata
+ )
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ try:
+ response_payload = json_format.MessageToJson(resp)
+ except:
+ response_payload = None
+ http_response = {
+ "payload": response_payload,
+ "headers": dict(response.headers),
+ "status": response.status_code,
+ }
+ _LOGGER.debug(
+ "Received response for google.bigtable.admin_v2.BigtableInstanceAdminClient.update_cluster",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "UpdateCluster",
+ "metadata": http_response["headers"],
+ "httpResponse": http_response,
+ },
+ )
+ return resp
+
+ class _UpdateInstance(
+ _BaseBigtableInstanceAdminRestTransport._BaseUpdateInstance,
+ BigtableInstanceAdminRestStub,
+ ):
+ def __hash__(self):
+ return hash("BigtableInstanceAdminRestTransport.UpdateInstance")
+
+ @staticmethod
+ def _get_response(
+ host,
+ metadata,
+ query_params,
+ session,
+ timeout,
+ transcoded_request,
+ body=None,
+ ):
+ uri = transcoded_request["uri"]
+ method = transcoded_request["method"]
+ headers = dict(metadata)
+ headers["Content-Type"] = "application/json"
+ response = getattr(session, method)(
+ "{host}{uri}".format(host=host, uri=uri),
+ timeout=timeout,
+ headers=headers,
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
+ data=body,
+ )
+ return response
+
+ def __call__(
+ self,
+ request: instance.Instance,
+ *,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Optional[float] = None,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> instance.Instance:
+ r"""Call the update instance method over HTTP.
+
+ Args:
+ request (~.instance.Instance):
+ The request object. A collection of Bigtable
+ [Tables][google.bigtable.admin.v2.Table] and the
+ resources that serve them. All tables in an instance are
+ served from all
+ [Clusters][google.bigtable.admin.v2.Cluster] in the
+ instance.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ ~.instance.Instance:
+ A collection of Bigtable
+ [Tables][google.bigtable.admin.v2.Table] and the
+ resources that serve them. All tables in an instance are
+ served from all
+ [Clusters][google.bigtable.admin.v2.Cluster] in the
+ instance.
+
+ """
+
+ http_options = (
+ _BaseBigtableInstanceAdminRestTransport._BaseUpdateInstance._get_http_options()
+ )
+
+ request, metadata = self._interceptor.pre_update_instance(request, metadata)
+ transcoded_request = _BaseBigtableInstanceAdminRestTransport._BaseUpdateInstance._get_transcoded_request(
+ http_options, request
+ )
+
+ body = _BaseBigtableInstanceAdminRestTransport._BaseUpdateInstance._get_request_body_json(
+ transcoded_request
+ )
+
+ # Jsonify the query params
+ query_params = _BaseBigtableInstanceAdminRestTransport._BaseUpdateInstance._get_query_params_json(
+ transcoded_request
+ )
+
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ request_url = "{host}{uri}".format(
+ host=self._host, uri=transcoded_request["uri"]
+ )
+ method = transcoded_request["method"]
+ try:
+ request_payload = type(request).to_json(request)
+ except:
+ request_payload = None
+ http_request = {
+ "payload": request_payload,
+ "requestMethod": method,
+ "requestUrl": request_url,
+ "headers": dict(metadata),
+ }
+ _LOGGER.debug(
+ f"Sending request for google.bigtable.admin_v2.BigtableInstanceAdminClient.UpdateInstance",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "UpdateInstance",
+ "httpRequest": http_request,
+ "metadata": http_request["headers"],
+ },
+ )
+
+ # Send the request
+ response = BigtableInstanceAdminRestTransport._UpdateInstance._get_response(
+ self._host,
+ metadata,
+ query_params,
+ self._session,
+ timeout,
+ transcoded_request,
+ body,
+ )
+
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
+ # subclass.
+ if response.status_code >= 400:
+ raise core_exceptions.from_http_response(response)
+
+ # Return the response
+ resp = instance.Instance()
+ pb_resp = instance.Instance.pb(resp)
+
+ json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True)
+
+ resp = self._interceptor.post_update_instance(resp)
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
+ resp, _ = self._interceptor.post_update_instance_with_metadata(
+ resp, response_metadata
+ )
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ try:
+ response_payload = instance.Instance.to_json(response)
+ except:
+ response_payload = None
+ http_response = {
+ "payload": response_payload,
+ "headers": dict(response.headers),
+ "status": response.status_code,
+ }
+ _LOGGER.debug(
+ "Received response for google.bigtable.admin_v2.BigtableInstanceAdminClient.update_instance",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "UpdateInstance",
+ "metadata": http_response["headers"],
+ "httpResponse": http_response,
+ },
+ )
+ return resp
+
+ class _UpdateLogicalView(
+ _BaseBigtableInstanceAdminRestTransport._BaseUpdateLogicalView,
+ BigtableInstanceAdminRestStub,
+ ):
+ def __hash__(self):
+ return hash("BigtableInstanceAdminRestTransport.UpdateLogicalView")
+
+ @staticmethod
+ def _get_response(
+ host,
+ metadata,
+ query_params,
+ session,
+ timeout,
+ transcoded_request,
+ body=None,
+ ):
+ uri = transcoded_request["uri"]
+ method = transcoded_request["method"]
+ headers = dict(metadata)
+ headers["Content-Type"] = "application/json"
+ response = getattr(session, method)(
+ "{host}{uri}".format(host=host, uri=uri),
+ timeout=timeout,
+ headers=headers,
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
+ data=body,
+ )
+ return response
+
+ def __call__(
+ self,
+ request: bigtable_instance_admin.UpdateLogicalViewRequest,
+ *,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Optional[float] = None,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operations_pb2.Operation:
+ r"""Call the update logical view method over HTTP.
+
+ Args:
+ request (~.bigtable_instance_admin.UpdateLogicalViewRequest):
+ The request object. Request message for
+ BigtableInstanceAdmin.UpdateLogicalView.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ ~.operations_pb2.Operation:
+ This resource represents a
+ long-running operation that is the
+ result of a network API call.
+
+ """
+
+ http_options = (
+ _BaseBigtableInstanceAdminRestTransport._BaseUpdateLogicalView._get_http_options()
+ )
+
+ request, metadata = self._interceptor.pre_update_logical_view(
+ request, metadata
+ )
+ transcoded_request = _BaseBigtableInstanceAdminRestTransport._BaseUpdateLogicalView._get_transcoded_request(
+ http_options, request
+ )
+
+ body = _BaseBigtableInstanceAdminRestTransport._BaseUpdateLogicalView._get_request_body_json(
+ transcoded_request
+ )
+
+ # Jsonify the query params
+ query_params = _BaseBigtableInstanceAdminRestTransport._BaseUpdateLogicalView._get_query_params_json(
+ transcoded_request
+ )
+
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ request_url = "{host}{uri}".format(
+ host=self._host, uri=transcoded_request["uri"]
+ )
+ method = transcoded_request["method"]
+ try:
+ request_payload = json_format.MessageToJson(request)
+ except:
+ request_payload = None
+ http_request = {
+ "payload": request_payload,
+ "requestMethod": method,
+ "requestUrl": request_url,
+ "headers": dict(metadata),
+ }
+ _LOGGER.debug(
+ f"Sending request for google.bigtable.admin_v2.BigtableInstanceAdminClient.UpdateLogicalView",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "UpdateLogicalView",
+ "httpRequest": http_request,
+ "metadata": http_request["headers"],
+ },
+ )
+
+ # Send the request
+ response = (
+ BigtableInstanceAdminRestTransport._UpdateLogicalView._get_response(
+ self._host,
+ metadata,
+ query_params,
+ self._session,
+ timeout,
+ transcoded_request,
+ body,
+ )
+ )
+
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
+ # subclass.
+ if response.status_code >= 400:
+ raise core_exceptions.from_http_response(response)
+
+ # Return the response
+ resp = operations_pb2.Operation()
+ json_format.Parse(response.content, resp, ignore_unknown_fields=True)
+
+ resp = self._interceptor.post_update_logical_view(resp)
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
+ resp, _ = self._interceptor.post_update_logical_view_with_metadata(
+ resp, response_metadata
+ )
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ try:
+ response_payload = json_format.MessageToJson(resp)
+ except:
+ response_payload = None
+ http_response = {
+ "payload": response_payload,
+ "headers": dict(response.headers),
+ "status": response.status_code,
+ }
+ _LOGGER.debug(
+ "Received response for google.bigtable.admin_v2.BigtableInstanceAdminClient.update_logical_view",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "UpdateLogicalView",
+ "metadata": http_response["headers"],
+ "httpResponse": http_response,
+ },
+ )
+ return resp
+
+ class _UpdateMaterializedView(
+ _BaseBigtableInstanceAdminRestTransport._BaseUpdateMaterializedView,
+ BigtableInstanceAdminRestStub,
+ ):
+ def __hash__(self):
+ return hash("BigtableInstanceAdminRestTransport.UpdateMaterializedView")
+
+ @staticmethod
+ def _get_response(
+ host,
+ metadata,
+ query_params,
+ session,
+ timeout,
+ transcoded_request,
+ body=None,
+ ):
+ uri = transcoded_request["uri"]
+ method = transcoded_request["method"]
+ headers = dict(metadata)
+ headers["Content-Type"] = "application/json"
+ response = getattr(session, method)(
+ "{host}{uri}".format(host=host, uri=uri),
+ timeout=timeout,
+ headers=headers,
+ params=rest_helpers.flatten_query_params(query_params, strict=True),
+ data=body,
+ )
+ return response
+
+ def __call__(
+ self,
+ request: bigtable_instance_admin.UpdateMaterializedViewRequest,
+ *,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Optional[float] = None,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operations_pb2.Operation:
+ r"""Call the update materialized view method over HTTP.
+
+ Args:
+ request (~.bigtable_instance_admin.UpdateMaterializedViewRequest):
+ The request object. Request message for
+ BigtableInstanceAdmin.UpdateMaterializedView.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ ~.operations_pb2.Operation:
+ This resource represents a
+ long-running operation that is the
+ result of a network API call.
+
+ """
+
+ http_options = (
+ _BaseBigtableInstanceAdminRestTransport._BaseUpdateMaterializedView._get_http_options()
+ )
+
+ request, metadata = self._interceptor.pre_update_materialized_view(
+ request, metadata
+ )
+ transcoded_request = _BaseBigtableInstanceAdminRestTransport._BaseUpdateMaterializedView._get_transcoded_request(
+ http_options, request
+ )
+
+ body = _BaseBigtableInstanceAdminRestTransport._BaseUpdateMaterializedView._get_request_body_json(
+ transcoded_request
+ )
+
+ # Jsonify the query params
+ query_params = _BaseBigtableInstanceAdminRestTransport._BaseUpdateMaterializedView._get_query_params_json(
+ transcoded_request
+ )
+
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ request_url = "{host}{uri}".format(
+ host=self._host, uri=transcoded_request["uri"]
+ )
+ method = transcoded_request["method"]
+ try:
+ request_payload = json_format.MessageToJson(request)
+ except:
+ request_payload = None
+ http_request = {
+ "payload": request_payload,
+ "requestMethod": method,
+ "requestUrl": request_url,
+ "headers": dict(metadata),
+ }
+ _LOGGER.debug(
+ f"Sending request for google.bigtable.admin_v2.BigtableInstanceAdminClient.UpdateMaterializedView",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "UpdateMaterializedView",
+ "httpRequest": http_request,
+ "metadata": http_request["headers"],
+ },
+ )
+
+ # Send the request
+ response = BigtableInstanceAdminRestTransport._UpdateMaterializedView._get_response(
+ self._host,
+ metadata,
+ query_params,
+ self._session,
+ timeout,
+ transcoded_request,
+ body,
+ )
+
+ # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception
+ # subclass.
+ if response.status_code >= 400:
+ raise core_exceptions.from_http_response(response)
+
+ # Return the response
+ resp = operations_pb2.Operation()
+ json_format.Parse(response.content, resp, ignore_unknown_fields=True)
+
+ resp = self._interceptor.post_update_materialized_view(resp)
+ response_metadata = [(k, str(v)) for k, v in response.headers.items()]
+ resp, _ = self._interceptor.post_update_materialized_view_with_metadata(
+ resp, response_metadata
+ )
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ logging.DEBUG
+ ): # pragma: NO COVER
+ try:
+ response_payload = json_format.MessageToJson(resp)
+ except:
+ response_payload = None
+ http_response = {
+ "payload": response_payload,
+ "headers": dict(response.headers),
+ "status": response.status_code,
+ }
+ _LOGGER.debug(
+ "Received response for google.bigtable.admin_v2.BigtableInstanceAdminClient.update_materialized_view",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableInstanceAdmin",
+ "rpcName": "UpdateMaterializedView",
+ "metadata": http_response["headers"],
+ "httpResponse": http_response,
+ },
+ )
+ return resp
+
+ @property
+ def create_app_profile(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.CreateAppProfileRequest], instance.AppProfile
+ ]:
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
+ # In C++ this would require a dynamic_cast
+ return self._CreateAppProfile(self._session, self._host, self._interceptor) # type: ignore
+
+ @property
+ def create_cluster(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.CreateClusterRequest], operations_pb2.Operation
+ ]:
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
+ # In C++ this would require a dynamic_cast
+ return self._CreateCluster(self._session, self._host, self._interceptor) # type: ignore
+
+ @property
+ def create_instance(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.CreateInstanceRequest], operations_pb2.Operation
+ ]:
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
+ # In C++ this would require a dynamic_cast
+ return self._CreateInstance(self._session, self._host, self._interceptor) # type: ignore
+
+ @property
+ def create_logical_view(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.CreateLogicalViewRequest], operations_pb2.Operation
+ ]:
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
+ # In C++ this would require a dynamic_cast
+ return self._CreateLogicalView(self._session, self._host, self._interceptor) # type: ignore
+
+ @property
+ def create_materialized_view(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.CreateMaterializedViewRequest],
+ operations_pb2.Operation,
+ ]:
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
+ # In C++ this would require a dynamic_cast
+ return self._CreateMaterializedView(self._session, self._host, self._interceptor) # type: ignore
+
+ @property
+ def delete_app_profile(
+ self,
+ ) -> Callable[[bigtable_instance_admin.DeleteAppProfileRequest], empty_pb2.Empty]:
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
+ # In C++ this would require a dynamic_cast
+ return self._DeleteAppProfile(self._session, self._host, self._interceptor) # type: ignore
+
+ @property
+ def delete_cluster(
+ self,
+ ) -> Callable[[bigtable_instance_admin.DeleteClusterRequest], empty_pb2.Empty]:
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
+ # In C++ this would require a dynamic_cast
+ return self._DeleteCluster(self._session, self._host, self._interceptor) # type: ignore
+
+ @property
+ def delete_instance(
+ self,
+ ) -> Callable[[bigtable_instance_admin.DeleteInstanceRequest], empty_pb2.Empty]:
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
+ # In C++ this would require a dynamic_cast
+ return self._DeleteInstance(self._session, self._host, self._interceptor) # type: ignore
+
+ @property
+ def delete_logical_view(
+ self,
+ ) -> Callable[[bigtable_instance_admin.DeleteLogicalViewRequest], empty_pb2.Empty]:
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
+ # In C++ this would require a dynamic_cast
+ return self._DeleteLogicalView(self._session, self._host, self._interceptor) # type: ignore
+
+ @property
+ def delete_materialized_view(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.DeleteMaterializedViewRequest], empty_pb2.Empty
+ ]:
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
+ # In C++ this would require a dynamic_cast
+ return self._DeleteMaterializedView(self._session, self._host, self._interceptor) # type: ignore
+
+ @property
+ def get_app_profile(
+ self,
+ ) -> Callable[[bigtable_instance_admin.GetAppProfileRequest], instance.AppProfile]:
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
+ # In C++ this would require a dynamic_cast
+ return self._GetAppProfile(self._session, self._host, self._interceptor) # type: ignore
+
+ @property
+ def get_cluster(
+ self,
+ ) -> Callable[[bigtable_instance_admin.GetClusterRequest], instance.Cluster]:
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
+ # In C++ this would require a dynamic_cast
+ return self._GetCluster(self._session, self._host, self._interceptor) # type: ignore
+
+ @property
+ def get_iam_policy(
+ self,
+ ) -> Callable[[iam_policy_pb2.GetIamPolicyRequest], policy_pb2.Policy]:
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
+ # In C++ this would require a dynamic_cast
+ return self._GetIamPolicy(self._session, self._host, self._interceptor) # type: ignore
+
+ @property
+ def get_instance(
+ self,
+ ) -> Callable[[bigtable_instance_admin.GetInstanceRequest], instance.Instance]:
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
+ # In C++ this would require a dynamic_cast
+ return self._GetInstance(self._session, self._host, self._interceptor) # type: ignore
+
+ @property
+ def get_logical_view(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.GetLogicalViewRequest], instance.LogicalView
+ ]:
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
+ # In C++ this would require a dynamic_cast
+ return self._GetLogicalView(self._session, self._host, self._interceptor) # type: ignore
+
+ @property
+ def get_materialized_view(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.GetMaterializedViewRequest], instance.MaterializedView
+ ]:
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
+ # In C++ this would require a dynamic_cast
+ return self._GetMaterializedView(self._session, self._host, self._interceptor) # type: ignore
+
+ @property
+ def list_app_profiles(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.ListAppProfilesRequest],
+ bigtable_instance_admin.ListAppProfilesResponse,
+ ]:
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
+ # In C++ this would require a dynamic_cast
+ return self._ListAppProfiles(self._session, self._host, self._interceptor) # type: ignore
+
+ @property
+ def list_clusters(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.ListClustersRequest],
+ bigtable_instance_admin.ListClustersResponse,
+ ]:
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
+ # In C++ this would require a dynamic_cast
+ return self._ListClusters(self._session, self._host, self._interceptor) # type: ignore
+
+ @property
+ def list_hot_tablets(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.ListHotTabletsRequest],
+ bigtable_instance_admin.ListHotTabletsResponse,
+ ]:
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
+ # In C++ this would require a dynamic_cast
+ return self._ListHotTablets(self._session, self._host, self._interceptor) # type: ignore
+
+ @property
+ def list_instances(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.ListInstancesRequest],
+ bigtable_instance_admin.ListInstancesResponse,
+ ]:
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
+ # In C++ this would require a dynamic_cast
+ return self._ListInstances(self._session, self._host, self._interceptor) # type: ignore
+
+ @property
+ def list_logical_views(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.ListLogicalViewsRequest],
+ bigtable_instance_admin.ListLogicalViewsResponse,
+ ]:
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
+ # In C++ this would require a dynamic_cast
+ return self._ListLogicalViews(self._session, self._host, self._interceptor) # type: ignore
+
+ @property
+ def list_materialized_views(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.ListMaterializedViewsRequest],
+ bigtable_instance_admin.ListMaterializedViewsResponse,
+ ]:
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
+ # In C++ this would require a dynamic_cast
+ return self._ListMaterializedViews(self._session, self._host, self._interceptor) # type: ignore
+
+ @property
+ def partial_update_cluster(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.PartialUpdateClusterRequest], operations_pb2.Operation
+ ]:
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
+ # In C++ this would require a dynamic_cast
+ return self._PartialUpdateCluster(self._session, self._host, self._interceptor) # type: ignore
+
+ @property
+ def partial_update_instance(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.PartialUpdateInstanceRequest], operations_pb2.Operation
+ ]:
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
+ # In C++ this would require a dynamic_cast
+ return self._PartialUpdateInstance(self._session, self._host, self._interceptor) # type: ignore
+
+ @property
+ def set_iam_policy(
+ self,
+ ) -> Callable[[iam_policy_pb2.SetIamPolicyRequest], policy_pb2.Policy]:
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
+ # In C++ this would require a dynamic_cast
+ return self._SetIamPolicy(self._session, self._host, self._interceptor) # type: ignore
+
+ @property
+ def test_iam_permissions(
+ self,
+ ) -> Callable[
+ [iam_policy_pb2.TestIamPermissionsRequest],
+ iam_policy_pb2.TestIamPermissionsResponse,
+ ]:
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
+ # In C++ this would require a dynamic_cast
+ return self._TestIamPermissions(self._session, self._host, self._interceptor) # type: ignore
+
+ @property
+ def update_app_profile(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.UpdateAppProfileRequest], operations_pb2.Operation
+ ]:
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
+ # In C++ this would require a dynamic_cast
+ return self._UpdateAppProfile(self._session, self._host, self._interceptor) # type: ignore
+
+ @property
+ def update_cluster(self) -> Callable[[instance.Cluster], operations_pb2.Operation]:
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
+ # In C++ this would require a dynamic_cast
+ return self._UpdateCluster(self._session, self._host, self._interceptor) # type: ignore
+
+ @property
+ def update_instance(self) -> Callable[[instance.Instance], instance.Instance]:
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
+ # In C++ this would require a dynamic_cast
+ return self._UpdateInstance(self._session, self._host, self._interceptor) # type: ignore
+
+ @property
+ def update_logical_view(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.UpdateLogicalViewRequest], operations_pb2.Operation
+ ]:
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
+ # In C++ this would require a dynamic_cast
+ return self._UpdateLogicalView(self._session, self._host, self._interceptor) # type: ignore
+
+ @property
+ def update_materialized_view(
+ self,
+ ) -> Callable[
+ [bigtable_instance_admin.UpdateMaterializedViewRequest],
+ operations_pb2.Operation,
+ ]:
+ # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here.
+ # In C++ this would require a dynamic_cast
+ return self._UpdateMaterializedView(self._session, self._host, self._interceptor) # type: ignore
+
+ @property
+ def kind(self) -> str:
+ return "rest"
+
+ def close(self):
+ self._session.close()
+
+
+__all__ = ("BigtableInstanceAdminRestTransport",)
diff --git a/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/rest_base.py b/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/rest_base.py
new file mode 100644
index 000000000..9855756b8
--- /dev/null
+++ b/google/cloud/bigtable_admin_v2/services/bigtable_instance_admin/transports/rest_base.py
@@ -0,0 +1,1746 @@
+# -*- coding: utf-8 -*-
+# Copyright 2025 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.
+#
+import json # type: ignore
+from google.api_core import path_template
+from google.api_core import gapic_v1
+
+from google.protobuf import json_format
+from .base import BigtableInstanceAdminTransport, DEFAULT_CLIENT_INFO
+
+import re
+from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union
+
+
+from google.cloud.bigtable_admin_v2.types import bigtable_instance_admin
+from google.cloud.bigtable_admin_v2.types import instance
+from google.iam.v1 import iam_policy_pb2 # type: ignore
+from google.iam.v1 import policy_pb2 # type: ignore
+from google.protobuf import empty_pb2 # type: ignore
+from google.longrunning import operations_pb2 # type: ignore
+
+
+class _BaseBigtableInstanceAdminRestTransport(BigtableInstanceAdminTransport):
+ """Base REST backend transport for BigtableInstanceAdmin.
+
+ Note: This class is not meant to be used directly. Use its sync and
+ async sub-classes instead.
+
+ This class defines the same methods as the primary client, so the
+ primary client can load the underlying transport implementation
+ and call it.
+
+ It sends JSON representations of protocol buffers over HTTP/1.1
+ """
+
+ def __init__(
+ self,
+ *,
+ host: str = "bigtableadmin.googleapis.com",
+ credentials: Optional[Any] = None,
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
+ always_use_jwt_access: Optional[bool] = False,
+ url_scheme: str = "https",
+ api_audience: Optional[str] = None,
+ ) -> None:
+ """Instantiate the transport.
+ Args:
+ host (Optional[str]):
+ The hostname to connect to (default: 'bigtableadmin.googleapis.com').
+ credentials (Optional[Any]): The
+ authorization credentials to attach to requests. These
+ credentials identify the application to the service; if none
+ are specified, the client will attempt to ascertain the
+ credentials from the environment.
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
+ The client info used to send a user-agent string along with
+ API requests. If ``None``, then default info will be used.
+ Generally, you only need to set this if you are developing
+ your own client library.
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
+ be used for service account credentials.
+ url_scheme: the protocol scheme for the API endpoint. Normally
+ "https", but for testing or local servers,
+ "http" can be specified.
+ """
+ # Run the base constructor
+ maybe_url_match = re.match("^(?Phttp(?:s)?://)?(?P.*)$", host)
+ if maybe_url_match is None:
+ raise ValueError(
+ f"Unexpected hostname structure: {host}"
+ ) # pragma: NO COVER
+
+ url_match_items = maybe_url_match.groupdict()
+
+ host = f"{url_scheme}://{host}" if not url_match_items["scheme"] else host
+
+ super().__init__(
+ host=host,
+ credentials=credentials,
+ client_info=client_info,
+ always_use_jwt_access=always_use_jwt_access,
+ api_audience=api_audience,
+ )
+
+ class _BaseCreateAppProfile:
+ def __hash__(self): # pragma: NO COVER
+ return NotImplementedError("__hash__ must be implemented.")
+
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {
+ "appProfileId": "",
+ }
+
+ @classmethod
+ def _get_unset_required_fields(cls, message_dict):
+ return {
+ k: v
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
+ if k not in message_dict
+ }
+
+ @staticmethod
+ def _get_http_options():
+ http_options: List[Dict[str, str]] = [
+ {
+ "method": "post",
+ "uri": "/v2/{parent=projects/*/instances/*}/appProfiles",
+ "body": "app_profile",
+ },
+ ]
+ return http_options
+
+ @staticmethod
+ def _get_transcoded_request(http_options, request):
+ pb_request = bigtable_instance_admin.CreateAppProfileRequest.pb(request)
+ transcoded_request = path_template.transcode(http_options, pb_request)
+ return transcoded_request
+
+ @staticmethod
+ def _get_request_body_json(transcoded_request):
+ # Jsonify the request body
+
+ body = json_format.MessageToJson(
+ transcoded_request["body"], use_integers_for_enums=True
+ )
+ return body
+
+ @staticmethod
+ def _get_query_params_json(transcoded_request):
+ query_params = json.loads(
+ json_format.MessageToJson(
+ transcoded_request["query_params"],
+ use_integers_for_enums=True,
+ )
+ )
+ query_params.update(
+ _BaseBigtableInstanceAdminRestTransport._BaseCreateAppProfile._get_unset_required_fields(
+ query_params
+ )
+ )
+
+ query_params["$alt"] = "json;enum-encoding=int"
+ return query_params
+
+ class _BaseCreateCluster:
+ def __hash__(self): # pragma: NO COVER
+ return NotImplementedError("__hash__ must be implemented.")
+
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {
+ "clusterId": "",
+ }
+
+ @classmethod
+ def _get_unset_required_fields(cls, message_dict):
+ return {
+ k: v
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
+ if k not in message_dict
+ }
+
+ @staticmethod
+ def _get_http_options():
+ http_options: List[Dict[str, str]] = [
+ {
+ "method": "post",
+ "uri": "/v2/{parent=projects/*/instances/*}/clusters",
+ "body": "cluster",
+ },
+ ]
+ return http_options
+
+ @staticmethod
+ def _get_transcoded_request(http_options, request):
+ pb_request = bigtable_instance_admin.CreateClusterRequest.pb(request)
+ transcoded_request = path_template.transcode(http_options, pb_request)
+ return transcoded_request
+
+ @staticmethod
+ def _get_request_body_json(transcoded_request):
+ # Jsonify the request body
+
+ body = json_format.MessageToJson(
+ transcoded_request["body"], use_integers_for_enums=True
+ )
+ return body
+
+ @staticmethod
+ def _get_query_params_json(transcoded_request):
+ query_params = json.loads(
+ json_format.MessageToJson(
+ transcoded_request["query_params"],
+ use_integers_for_enums=True,
+ )
+ )
+ query_params.update(
+ _BaseBigtableInstanceAdminRestTransport._BaseCreateCluster._get_unset_required_fields(
+ query_params
+ )
+ )
+
+ query_params["$alt"] = "json;enum-encoding=int"
+ return query_params
+
+ class _BaseCreateInstance:
+ def __hash__(self): # pragma: NO COVER
+ return NotImplementedError("__hash__ must be implemented.")
+
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
+
+ @classmethod
+ def _get_unset_required_fields(cls, message_dict):
+ return {
+ k: v
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
+ if k not in message_dict
+ }
+
+ @staticmethod
+ def _get_http_options():
+ http_options: List[Dict[str, str]] = [
+ {
+ "method": "post",
+ "uri": "/v2/{parent=projects/*}/instances",
+ "body": "*",
+ },
+ ]
+ return http_options
+
+ @staticmethod
+ def _get_transcoded_request(http_options, request):
+ pb_request = bigtable_instance_admin.CreateInstanceRequest.pb(request)
+ transcoded_request = path_template.transcode(http_options, pb_request)
+ return transcoded_request
+
+ @staticmethod
+ def _get_request_body_json(transcoded_request):
+ # Jsonify the request body
+
+ body = json_format.MessageToJson(
+ transcoded_request["body"], use_integers_for_enums=True
+ )
+ return body
+
+ @staticmethod
+ def _get_query_params_json(transcoded_request):
+ query_params = json.loads(
+ json_format.MessageToJson(
+ transcoded_request["query_params"],
+ use_integers_for_enums=True,
+ )
+ )
+ query_params.update(
+ _BaseBigtableInstanceAdminRestTransport._BaseCreateInstance._get_unset_required_fields(
+ query_params
+ )
+ )
+
+ query_params["$alt"] = "json;enum-encoding=int"
+ return query_params
+
+ class _BaseCreateLogicalView:
+ def __hash__(self): # pragma: NO COVER
+ return NotImplementedError("__hash__ must be implemented.")
+
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {
+ "logicalViewId": "",
+ }
+
+ @classmethod
+ def _get_unset_required_fields(cls, message_dict):
+ return {
+ k: v
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
+ if k not in message_dict
+ }
+
+ @staticmethod
+ def _get_http_options():
+ http_options: List[Dict[str, str]] = [
+ {
+ "method": "post",
+ "uri": "/v2/{parent=projects/*/instances/*}/logicalViews",
+ "body": "logical_view",
+ },
+ ]
+ return http_options
+
+ @staticmethod
+ def _get_transcoded_request(http_options, request):
+ pb_request = bigtable_instance_admin.CreateLogicalViewRequest.pb(request)
+ transcoded_request = path_template.transcode(http_options, pb_request)
+ return transcoded_request
+
+ @staticmethod
+ def _get_request_body_json(transcoded_request):
+ # Jsonify the request body
+
+ body = json_format.MessageToJson(
+ transcoded_request["body"], use_integers_for_enums=True
+ )
+ return body
+
+ @staticmethod
+ def _get_query_params_json(transcoded_request):
+ query_params = json.loads(
+ json_format.MessageToJson(
+ transcoded_request["query_params"],
+ use_integers_for_enums=True,
+ )
+ )
+ query_params.update(
+ _BaseBigtableInstanceAdminRestTransport._BaseCreateLogicalView._get_unset_required_fields(
+ query_params
+ )
+ )
+
+ query_params["$alt"] = "json;enum-encoding=int"
+ return query_params
+
+ class _BaseCreateMaterializedView:
+ def __hash__(self): # pragma: NO COVER
+ return NotImplementedError("__hash__ must be implemented.")
+
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {
+ "materializedViewId": "",
+ }
+
+ @classmethod
+ def _get_unset_required_fields(cls, message_dict):
+ return {
+ k: v
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
+ if k not in message_dict
+ }
+
+ @staticmethod
+ def _get_http_options():
+ http_options: List[Dict[str, str]] = [
+ {
+ "method": "post",
+ "uri": "/v2/{parent=projects/*/instances/*}/materializedViews",
+ "body": "materialized_view",
+ },
+ ]
+ return http_options
+
+ @staticmethod
+ def _get_transcoded_request(http_options, request):
+ pb_request = bigtable_instance_admin.CreateMaterializedViewRequest.pb(
+ request
+ )
+ transcoded_request = path_template.transcode(http_options, pb_request)
+ return transcoded_request
+
+ @staticmethod
+ def _get_request_body_json(transcoded_request):
+ # Jsonify the request body
+
+ body = json_format.MessageToJson(
+ transcoded_request["body"], use_integers_for_enums=True
+ )
+ return body
+
+ @staticmethod
+ def _get_query_params_json(transcoded_request):
+ query_params = json.loads(
+ json_format.MessageToJson(
+ transcoded_request["query_params"],
+ use_integers_for_enums=True,
+ )
+ )
+ query_params.update(
+ _BaseBigtableInstanceAdminRestTransport._BaseCreateMaterializedView._get_unset_required_fields(
+ query_params
+ )
+ )
+
+ query_params["$alt"] = "json;enum-encoding=int"
+ return query_params
+
+ class _BaseDeleteAppProfile:
+ def __hash__(self): # pragma: NO COVER
+ return NotImplementedError("__hash__ must be implemented.")
+
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {
+ "ignoreWarnings": False,
+ }
+
+ @classmethod
+ def _get_unset_required_fields(cls, message_dict):
+ return {
+ k: v
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
+ if k not in message_dict
+ }
+
+ @staticmethod
+ def _get_http_options():
+ http_options: List[Dict[str, str]] = [
+ {
+ "method": "delete",
+ "uri": "/v2/{name=projects/*/instances/*/appProfiles/*}",
+ },
+ ]
+ return http_options
+
+ @staticmethod
+ def _get_transcoded_request(http_options, request):
+ pb_request = bigtable_instance_admin.DeleteAppProfileRequest.pb(request)
+ transcoded_request = path_template.transcode(http_options, pb_request)
+ return transcoded_request
+
+ @staticmethod
+ def _get_query_params_json(transcoded_request):
+ query_params = json.loads(
+ json_format.MessageToJson(
+ transcoded_request["query_params"],
+ use_integers_for_enums=True,
+ )
+ )
+ query_params.update(
+ _BaseBigtableInstanceAdminRestTransport._BaseDeleteAppProfile._get_unset_required_fields(
+ query_params
+ )
+ )
+
+ query_params["$alt"] = "json;enum-encoding=int"
+ return query_params
+
+ class _BaseDeleteCluster:
+ def __hash__(self): # pragma: NO COVER
+ return NotImplementedError("__hash__ must be implemented.")
+
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
+
+ @classmethod
+ def _get_unset_required_fields(cls, message_dict):
+ return {
+ k: v
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
+ if k not in message_dict
+ }
+
+ @staticmethod
+ def _get_http_options():
+ http_options: List[Dict[str, str]] = [
+ {
+ "method": "delete",
+ "uri": "/v2/{name=projects/*/instances/*/clusters/*}",
+ },
+ ]
+ return http_options
+
+ @staticmethod
+ def _get_transcoded_request(http_options, request):
+ pb_request = bigtable_instance_admin.DeleteClusterRequest.pb(request)
+ transcoded_request = path_template.transcode(http_options, pb_request)
+ return transcoded_request
+
+ @staticmethod
+ def _get_query_params_json(transcoded_request):
+ query_params = json.loads(
+ json_format.MessageToJson(
+ transcoded_request["query_params"],
+ use_integers_for_enums=True,
+ )
+ )
+ query_params.update(
+ _BaseBigtableInstanceAdminRestTransport._BaseDeleteCluster._get_unset_required_fields(
+ query_params
+ )
+ )
+
+ query_params["$alt"] = "json;enum-encoding=int"
+ return query_params
+
+ class _BaseDeleteInstance:
+ def __hash__(self): # pragma: NO COVER
+ return NotImplementedError("__hash__ must be implemented.")
+
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
+
+ @classmethod
+ def _get_unset_required_fields(cls, message_dict):
+ return {
+ k: v
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
+ if k not in message_dict
+ }
+
+ @staticmethod
+ def _get_http_options():
+ http_options: List[Dict[str, str]] = [
+ {
+ "method": "delete",
+ "uri": "/v2/{name=projects/*/instances/*}",
+ },
+ ]
+ return http_options
+
+ @staticmethod
+ def _get_transcoded_request(http_options, request):
+ pb_request = bigtable_instance_admin.DeleteInstanceRequest.pb(request)
+ transcoded_request = path_template.transcode(http_options, pb_request)
+ return transcoded_request
+
+ @staticmethod
+ def _get_query_params_json(transcoded_request):
+ query_params = json.loads(
+ json_format.MessageToJson(
+ transcoded_request["query_params"],
+ use_integers_for_enums=True,
+ )
+ )
+ query_params.update(
+ _BaseBigtableInstanceAdminRestTransport._BaseDeleteInstance._get_unset_required_fields(
+ query_params
+ )
+ )
+
+ query_params["$alt"] = "json;enum-encoding=int"
+ return query_params
+
+ class _BaseDeleteLogicalView:
+ def __hash__(self): # pragma: NO COVER
+ return NotImplementedError("__hash__ must be implemented.")
+
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
+
+ @classmethod
+ def _get_unset_required_fields(cls, message_dict):
+ return {
+ k: v
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
+ if k not in message_dict
+ }
+
+ @staticmethod
+ def _get_http_options():
+ http_options: List[Dict[str, str]] = [
+ {
+ "method": "delete",
+ "uri": "/v2/{name=projects/*/instances/*/logicalViews/*}",
+ },
+ ]
+ return http_options
+
+ @staticmethod
+ def _get_transcoded_request(http_options, request):
+ pb_request = bigtable_instance_admin.DeleteLogicalViewRequest.pb(request)
+ transcoded_request = path_template.transcode(http_options, pb_request)
+ return transcoded_request
+
+ @staticmethod
+ def _get_query_params_json(transcoded_request):
+ query_params = json.loads(
+ json_format.MessageToJson(
+ transcoded_request["query_params"],
+ use_integers_for_enums=True,
+ )
+ )
+ query_params.update(
+ _BaseBigtableInstanceAdminRestTransport._BaseDeleteLogicalView._get_unset_required_fields(
+ query_params
+ )
+ )
+
+ query_params["$alt"] = "json;enum-encoding=int"
+ return query_params
+
+ class _BaseDeleteMaterializedView:
+ def __hash__(self): # pragma: NO COVER
+ return NotImplementedError("__hash__ must be implemented.")
+
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
+
+ @classmethod
+ def _get_unset_required_fields(cls, message_dict):
+ return {
+ k: v
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
+ if k not in message_dict
+ }
+
+ @staticmethod
+ def _get_http_options():
+ http_options: List[Dict[str, str]] = [
+ {
+ "method": "delete",
+ "uri": "/v2/{name=projects/*/instances/*/materializedViews/*}",
+ },
+ ]
+ return http_options
+
+ @staticmethod
+ def _get_transcoded_request(http_options, request):
+ pb_request = bigtable_instance_admin.DeleteMaterializedViewRequest.pb(
+ request
+ )
+ transcoded_request = path_template.transcode(http_options, pb_request)
+ return transcoded_request
+
+ @staticmethod
+ def _get_query_params_json(transcoded_request):
+ query_params = json.loads(
+ json_format.MessageToJson(
+ transcoded_request["query_params"],
+ use_integers_for_enums=True,
+ )
+ )
+ query_params.update(
+ _BaseBigtableInstanceAdminRestTransport._BaseDeleteMaterializedView._get_unset_required_fields(
+ query_params
+ )
+ )
+
+ query_params["$alt"] = "json;enum-encoding=int"
+ return query_params
+
+ class _BaseGetAppProfile:
+ def __hash__(self): # pragma: NO COVER
+ return NotImplementedError("__hash__ must be implemented.")
+
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
+
+ @classmethod
+ def _get_unset_required_fields(cls, message_dict):
+ return {
+ k: v
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
+ if k not in message_dict
+ }
+
+ @staticmethod
+ def _get_http_options():
+ http_options: List[Dict[str, str]] = [
+ {
+ "method": "get",
+ "uri": "/v2/{name=projects/*/instances/*/appProfiles/*}",
+ },
+ ]
+ return http_options
+
+ @staticmethod
+ def _get_transcoded_request(http_options, request):
+ pb_request = bigtable_instance_admin.GetAppProfileRequest.pb(request)
+ transcoded_request = path_template.transcode(http_options, pb_request)
+ return transcoded_request
+
+ @staticmethod
+ def _get_query_params_json(transcoded_request):
+ query_params = json.loads(
+ json_format.MessageToJson(
+ transcoded_request["query_params"],
+ use_integers_for_enums=True,
+ )
+ )
+ query_params.update(
+ _BaseBigtableInstanceAdminRestTransport._BaseGetAppProfile._get_unset_required_fields(
+ query_params
+ )
+ )
+
+ query_params["$alt"] = "json;enum-encoding=int"
+ return query_params
+
+ class _BaseGetCluster:
+ def __hash__(self): # pragma: NO COVER
+ return NotImplementedError("__hash__ must be implemented.")
+
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
+
+ @classmethod
+ def _get_unset_required_fields(cls, message_dict):
+ return {
+ k: v
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
+ if k not in message_dict
+ }
+
+ @staticmethod
+ def _get_http_options():
+ http_options: List[Dict[str, str]] = [
+ {
+ "method": "get",
+ "uri": "/v2/{name=projects/*/instances/*/clusters/*}",
+ },
+ ]
+ return http_options
+
+ @staticmethod
+ def _get_transcoded_request(http_options, request):
+ pb_request = bigtable_instance_admin.GetClusterRequest.pb(request)
+ transcoded_request = path_template.transcode(http_options, pb_request)
+ return transcoded_request
+
+ @staticmethod
+ def _get_query_params_json(transcoded_request):
+ query_params = json.loads(
+ json_format.MessageToJson(
+ transcoded_request["query_params"],
+ use_integers_for_enums=True,
+ )
+ )
+ query_params.update(
+ _BaseBigtableInstanceAdminRestTransport._BaseGetCluster._get_unset_required_fields(
+ query_params
+ )
+ )
+
+ query_params["$alt"] = "json;enum-encoding=int"
+ return query_params
+
+ class _BaseGetIamPolicy:
+ def __hash__(self): # pragma: NO COVER
+ return NotImplementedError("__hash__ must be implemented.")
+
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
+
+ @classmethod
+ def _get_unset_required_fields(cls, message_dict):
+ return {
+ k: v
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
+ if k not in message_dict
+ }
+
+ @staticmethod
+ def _get_http_options():
+ http_options: List[Dict[str, str]] = [
+ {
+ "method": "post",
+ "uri": "/v2/{resource=projects/*/instances/*}:getIamPolicy",
+ "body": "*",
+ },
+ {
+ "method": "post",
+ "uri": "/v2/{resource=projects/*/instances/*/materializedViews/*}:getIamPolicy",
+ "body": "*",
+ },
+ {
+ "method": "post",
+ "uri": "/v2/{resource=projects/*/instances/*/logicalViews/*}:getIamPolicy",
+ "body": "*",
+ },
+ ]
+ return http_options
+
+ @staticmethod
+ def _get_transcoded_request(http_options, request):
+ pb_request = request
+ transcoded_request = path_template.transcode(http_options, pb_request)
+ return transcoded_request
+
+ @staticmethod
+ def _get_request_body_json(transcoded_request):
+ # Jsonify the request body
+
+ body = json_format.MessageToJson(
+ transcoded_request["body"], use_integers_for_enums=True
+ )
+ return body
+
+ @staticmethod
+ def _get_query_params_json(transcoded_request):
+ query_params = json.loads(
+ json_format.MessageToJson(
+ transcoded_request["query_params"],
+ use_integers_for_enums=True,
+ )
+ )
+ query_params.update(
+ _BaseBigtableInstanceAdminRestTransport._BaseGetIamPolicy._get_unset_required_fields(
+ query_params
+ )
+ )
+
+ query_params["$alt"] = "json;enum-encoding=int"
+ return query_params
+
+ class _BaseGetInstance:
+ def __hash__(self): # pragma: NO COVER
+ return NotImplementedError("__hash__ must be implemented.")
+
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
+
+ @classmethod
+ def _get_unset_required_fields(cls, message_dict):
+ return {
+ k: v
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
+ if k not in message_dict
+ }
+
+ @staticmethod
+ def _get_http_options():
+ http_options: List[Dict[str, str]] = [
+ {
+ "method": "get",
+ "uri": "/v2/{name=projects/*/instances/*}",
+ },
+ ]
+ return http_options
+
+ @staticmethod
+ def _get_transcoded_request(http_options, request):
+ pb_request = bigtable_instance_admin.GetInstanceRequest.pb(request)
+ transcoded_request = path_template.transcode(http_options, pb_request)
+ return transcoded_request
+
+ @staticmethod
+ def _get_query_params_json(transcoded_request):
+ query_params = json.loads(
+ json_format.MessageToJson(
+ transcoded_request["query_params"],
+ use_integers_for_enums=True,
+ )
+ )
+ query_params.update(
+ _BaseBigtableInstanceAdminRestTransport._BaseGetInstance._get_unset_required_fields(
+ query_params
+ )
+ )
+
+ query_params["$alt"] = "json;enum-encoding=int"
+ return query_params
+
+ class _BaseGetLogicalView:
+ def __hash__(self): # pragma: NO COVER
+ return NotImplementedError("__hash__ must be implemented.")
+
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
+
+ @classmethod
+ def _get_unset_required_fields(cls, message_dict):
+ return {
+ k: v
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
+ if k not in message_dict
+ }
+
+ @staticmethod
+ def _get_http_options():
+ http_options: List[Dict[str, str]] = [
+ {
+ "method": "get",
+ "uri": "/v2/{name=projects/*/instances/*/logicalViews/*}",
+ },
+ ]
+ return http_options
+
+ @staticmethod
+ def _get_transcoded_request(http_options, request):
+ pb_request = bigtable_instance_admin.GetLogicalViewRequest.pb(request)
+ transcoded_request = path_template.transcode(http_options, pb_request)
+ return transcoded_request
+
+ @staticmethod
+ def _get_query_params_json(transcoded_request):
+ query_params = json.loads(
+ json_format.MessageToJson(
+ transcoded_request["query_params"],
+ use_integers_for_enums=True,
+ )
+ )
+ query_params.update(
+ _BaseBigtableInstanceAdminRestTransport._BaseGetLogicalView._get_unset_required_fields(
+ query_params
+ )
+ )
+
+ query_params["$alt"] = "json;enum-encoding=int"
+ return query_params
+
+ class _BaseGetMaterializedView:
+ def __hash__(self): # pragma: NO COVER
+ return NotImplementedError("__hash__ must be implemented.")
+
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
+
+ @classmethod
+ def _get_unset_required_fields(cls, message_dict):
+ return {
+ k: v
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
+ if k not in message_dict
+ }
+
+ @staticmethod
+ def _get_http_options():
+ http_options: List[Dict[str, str]] = [
+ {
+ "method": "get",
+ "uri": "/v2/{name=projects/*/instances/*/materializedViews/*}",
+ },
+ ]
+ return http_options
+
+ @staticmethod
+ def _get_transcoded_request(http_options, request):
+ pb_request = bigtable_instance_admin.GetMaterializedViewRequest.pb(request)
+ transcoded_request = path_template.transcode(http_options, pb_request)
+ return transcoded_request
+
+ @staticmethod
+ def _get_query_params_json(transcoded_request):
+ query_params = json.loads(
+ json_format.MessageToJson(
+ transcoded_request["query_params"],
+ use_integers_for_enums=True,
+ )
+ )
+ query_params.update(
+ _BaseBigtableInstanceAdminRestTransport._BaseGetMaterializedView._get_unset_required_fields(
+ query_params
+ )
+ )
+
+ query_params["$alt"] = "json;enum-encoding=int"
+ return query_params
+
+ class _BaseListAppProfiles:
+ def __hash__(self): # pragma: NO COVER
+ return NotImplementedError("__hash__ must be implemented.")
+
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
+
+ @classmethod
+ def _get_unset_required_fields(cls, message_dict):
+ return {
+ k: v
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
+ if k not in message_dict
+ }
+
+ @staticmethod
+ def _get_http_options():
+ http_options: List[Dict[str, str]] = [
+ {
+ "method": "get",
+ "uri": "/v2/{parent=projects/*/instances/*}/appProfiles",
+ },
+ ]
+ return http_options
+
+ @staticmethod
+ def _get_transcoded_request(http_options, request):
+ pb_request = bigtable_instance_admin.ListAppProfilesRequest.pb(request)
+ transcoded_request = path_template.transcode(http_options, pb_request)
+ return transcoded_request
+
+ @staticmethod
+ def _get_query_params_json(transcoded_request):
+ query_params = json.loads(
+ json_format.MessageToJson(
+ transcoded_request["query_params"],
+ use_integers_for_enums=True,
+ )
+ )
+ query_params.update(
+ _BaseBigtableInstanceAdminRestTransport._BaseListAppProfiles._get_unset_required_fields(
+ query_params
+ )
+ )
+
+ query_params["$alt"] = "json;enum-encoding=int"
+ return query_params
+
+ class _BaseListClusters:
+ def __hash__(self): # pragma: NO COVER
+ return NotImplementedError("__hash__ must be implemented.")
+
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
+
+ @classmethod
+ def _get_unset_required_fields(cls, message_dict):
+ return {
+ k: v
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
+ if k not in message_dict
+ }
+
+ @staticmethod
+ def _get_http_options():
+ http_options: List[Dict[str, str]] = [
+ {
+ "method": "get",
+ "uri": "/v2/{parent=projects/*/instances/*}/clusters",
+ },
+ ]
+ return http_options
+
+ @staticmethod
+ def _get_transcoded_request(http_options, request):
+ pb_request = bigtable_instance_admin.ListClustersRequest.pb(request)
+ transcoded_request = path_template.transcode(http_options, pb_request)
+ return transcoded_request
+
+ @staticmethod
+ def _get_query_params_json(transcoded_request):
+ query_params = json.loads(
+ json_format.MessageToJson(
+ transcoded_request["query_params"],
+ use_integers_for_enums=True,
+ )
+ )
+ query_params.update(
+ _BaseBigtableInstanceAdminRestTransport._BaseListClusters._get_unset_required_fields(
+ query_params
+ )
+ )
+
+ query_params["$alt"] = "json;enum-encoding=int"
+ return query_params
+
+ class _BaseListHotTablets:
+ def __hash__(self): # pragma: NO COVER
+ return NotImplementedError("__hash__ must be implemented.")
+
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
+
+ @classmethod
+ def _get_unset_required_fields(cls, message_dict):
+ return {
+ k: v
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
+ if k not in message_dict
+ }
+
+ @staticmethod
+ def _get_http_options():
+ http_options: List[Dict[str, str]] = [
+ {
+ "method": "get",
+ "uri": "/v2/{parent=projects/*/instances/*/clusters/*}/hotTablets",
+ },
+ ]
+ return http_options
+
+ @staticmethod
+ def _get_transcoded_request(http_options, request):
+ pb_request = bigtable_instance_admin.ListHotTabletsRequest.pb(request)
+ transcoded_request = path_template.transcode(http_options, pb_request)
+ return transcoded_request
+
+ @staticmethod
+ def _get_query_params_json(transcoded_request):
+ query_params = json.loads(
+ json_format.MessageToJson(
+ transcoded_request["query_params"],
+ use_integers_for_enums=True,
+ )
+ )
+ query_params.update(
+ _BaseBigtableInstanceAdminRestTransport._BaseListHotTablets._get_unset_required_fields(
+ query_params
+ )
+ )
+
+ query_params["$alt"] = "json;enum-encoding=int"
+ return query_params
+
+ class _BaseListInstances:
+ def __hash__(self): # pragma: NO COVER
+ return NotImplementedError("__hash__ must be implemented.")
+
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
+
+ @classmethod
+ def _get_unset_required_fields(cls, message_dict):
+ return {
+ k: v
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
+ if k not in message_dict
+ }
+
+ @staticmethod
+ def _get_http_options():
+ http_options: List[Dict[str, str]] = [
+ {
+ "method": "get",
+ "uri": "/v2/{parent=projects/*}/instances",
+ },
+ ]
+ return http_options
+
+ @staticmethod
+ def _get_transcoded_request(http_options, request):
+ pb_request = bigtable_instance_admin.ListInstancesRequest.pb(request)
+ transcoded_request = path_template.transcode(http_options, pb_request)
+ return transcoded_request
+
+ @staticmethod
+ def _get_query_params_json(transcoded_request):
+ query_params = json.loads(
+ json_format.MessageToJson(
+ transcoded_request["query_params"],
+ use_integers_for_enums=True,
+ )
+ )
+ query_params.update(
+ _BaseBigtableInstanceAdminRestTransport._BaseListInstances._get_unset_required_fields(
+ query_params
+ )
+ )
+
+ query_params["$alt"] = "json;enum-encoding=int"
+ return query_params
+
+ class _BaseListLogicalViews:
+ def __hash__(self): # pragma: NO COVER
+ return NotImplementedError("__hash__ must be implemented.")
+
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
+
+ @classmethod
+ def _get_unset_required_fields(cls, message_dict):
+ return {
+ k: v
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
+ if k not in message_dict
+ }
+
+ @staticmethod
+ def _get_http_options():
+ http_options: List[Dict[str, str]] = [
+ {
+ "method": "get",
+ "uri": "/v2/{parent=projects/*/instances/*}/logicalViews",
+ },
+ ]
+ return http_options
+
+ @staticmethod
+ def _get_transcoded_request(http_options, request):
+ pb_request = bigtable_instance_admin.ListLogicalViewsRequest.pb(request)
+ transcoded_request = path_template.transcode(http_options, pb_request)
+ return transcoded_request
+
+ @staticmethod
+ def _get_query_params_json(transcoded_request):
+ query_params = json.loads(
+ json_format.MessageToJson(
+ transcoded_request["query_params"],
+ use_integers_for_enums=True,
+ )
+ )
+ query_params.update(
+ _BaseBigtableInstanceAdminRestTransport._BaseListLogicalViews._get_unset_required_fields(
+ query_params
+ )
+ )
+
+ query_params["$alt"] = "json;enum-encoding=int"
+ return query_params
+
+ class _BaseListMaterializedViews:
+ def __hash__(self): # pragma: NO COVER
+ return NotImplementedError("__hash__ must be implemented.")
+
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
+
+ @classmethod
+ def _get_unset_required_fields(cls, message_dict):
+ return {
+ k: v
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
+ if k not in message_dict
+ }
+
+ @staticmethod
+ def _get_http_options():
+ http_options: List[Dict[str, str]] = [
+ {
+ "method": "get",
+ "uri": "/v2/{parent=projects/*/instances/*}/materializedViews",
+ },
+ ]
+ return http_options
+
+ @staticmethod
+ def _get_transcoded_request(http_options, request):
+ pb_request = bigtable_instance_admin.ListMaterializedViewsRequest.pb(
+ request
+ )
+ transcoded_request = path_template.transcode(http_options, pb_request)
+ return transcoded_request
+
+ @staticmethod
+ def _get_query_params_json(transcoded_request):
+ query_params = json.loads(
+ json_format.MessageToJson(
+ transcoded_request["query_params"],
+ use_integers_for_enums=True,
+ )
+ )
+ query_params.update(
+ _BaseBigtableInstanceAdminRestTransport._BaseListMaterializedViews._get_unset_required_fields(
+ query_params
+ )
+ )
+
+ query_params["$alt"] = "json;enum-encoding=int"
+ return query_params
+
+ class _BasePartialUpdateCluster:
+ def __hash__(self): # pragma: NO COVER
+ return NotImplementedError("__hash__ must be implemented.")
+
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {
+ "updateMask": {},
+ }
+
+ @classmethod
+ def _get_unset_required_fields(cls, message_dict):
+ return {
+ k: v
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
+ if k not in message_dict
+ }
+
+ @staticmethod
+ def _get_http_options():
+ http_options: List[Dict[str, str]] = [
+ {
+ "method": "patch",
+ "uri": "/v2/{cluster.name=projects/*/instances/*/clusters/*}",
+ "body": "cluster",
+ },
+ ]
+ return http_options
+
+ @staticmethod
+ def _get_transcoded_request(http_options, request):
+ pb_request = bigtable_instance_admin.PartialUpdateClusterRequest.pb(request)
+ transcoded_request = path_template.transcode(http_options, pb_request)
+ return transcoded_request
+
+ @staticmethod
+ def _get_request_body_json(transcoded_request):
+ # Jsonify the request body
+
+ body = json_format.MessageToJson(
+ transcoded_request["body"], use_integers_for_enums=True
+ )
+ return body
+
+ @staticmethod
+ def _get_query_params_json(transcoded_request):
+ query_params = json.loads(
+ json_format.MessageToJson(
+ transcoded_request["query_params"],
+ use_integers_for_enums=True,
+ )
+ )
+ query_params.update(
+ _BaseBigtableInstanceAdminRestTransport._BasePartialUpdateCluster._get_unset_required_fields(
+ query_params
+ )
+ )
+
+ query_params["$alt"] = "json;enum-encoding=int"
+ return query_params
+
+ class _BasePartialUpdateInstance:
+ def __hash__(self): # pragma: NO COVER
+ return NotImplementedError("__hash__ must be implemented.")
+
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {
+ "updateMask": {},
+ }
+
+ @classmethod
+ def _get_unset_required_fields(cls, message_dict):
+ return {
+ k: v
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
+ if k not in message_dict
+ }
+
+ @staticmethod
+ def _get_http_options():
+ http_options: List[Dict[str, str]] = [
+ {
+ "method": "patch",
+ "uri": "/v2/{instance.name=projects/*/instances/*}",
+ "body": "instance",
+ },
+ ]
+ return http_options
+
+ @staticmethod
+ def _get_transcoded_request(http_options, request):
+ pb_request = bigtable_instance_admin.PartialUpdateInstanceRequest.pb(
+ request
+ )
+ transcoded_request = path_template.transcode(http_options, pb_request)
+ return transcoded_request
+
+ @staticmethod
+ def _get_request_body_json(transcoded_request):
+ # Jsonify the request body
+
+ body = json_format.MessageToJson(
+ transcoded_request["body"], use_integers_for_enums=True
+ )
+ return body
+
+ @staticmethod
+ def _get_query_params_json(transcoded_request):
+ query_params = json.loads(
+ json_format.MessageToJson(
+ transcoded_request["query_params"],
+ use_integers_for_enums=True,
+ )
+ )
+ query_params.update(
+ _BaseBigtableInstanceAdminRestTransport._BasePartialUpdateInstance._get_unset_required_fields(
+ query_params
+ )
+ )
+
+ query_params["$alt"] = "json;enum-encoding=int"
+ return query_params
+
+ class _BaseSetIamPolicy:
+ def __hash__(self): # pragma: NO COVER
+ return NotImplementedError("__hash__ must be implemented.")
+
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
+
+ @classmethod
+ def _get_unset_required_fields(cls, message_dict):
+ return {
+ k: v
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
+ if k not in message_dict
+ }
+
+ @staticmethod
+ def _get_http_options():
+ http_options: List[Dict[str, str]] = [
+ {
+ "method": "post",
+ "uri": "/v2/{resource=projects/*/instances/*}:setIamPolicy",
+ "body": "*",
+ },
+ {
+ "method": "post",
+ "uri": "/v2/{resource=projects/*/instances/*/materializedViews/*}:setIamPolicy",
+ "body": "*",
+ },
+ {
+ "method": "post",
+ "uri": "/v2/{resource=projects/*/instances/*/logicalViews/*}:setIamPolicy",
+ "body": "*",
+ },
+ ]
+ return http_options
+
+ @staticmethod
+ def _get_transcoded_request(http_options, request):
+ pb_request = request
+ transcoded_request = path_template.transcode(http_options, pb_request)
+ return transcoded_request
+
+ @staticmethod
+ def _get_request_body_json(transcoded_request):
+ # Jsonify the request body
+
+ body = json_format.MessageToJson(
+ transcoded_request["body"], use_integers_for_enums=True
+ )
+ return body
+
+ @staticmethod
+ def _get_query_params_json(transcoded_request):
+ query_params = json.loads(
+ json_format.MessageToJson(
+ transcoded_request["query_params"],
+ use_integers_for_enums=True,
+ )
+ )
+ query_params.update(
+ _BaseBigtableInstanceAdminRestTransport._BaseSetIamPolicy._get_unset_required_fields(
+ query_params
+ )
+ )
+
+ query_params["$alt"] = "json;enum-encoding=int"
+ return query_params
+
+ class _BaseTestIamPermissions:
+ def __hash__(self): # pragma: NO COVER
+ return NotImplementedError("__hash__ must be implemented.")
+
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
+
+ @classmethod
+ def _get_unset_required_fields(cls, message_dict):
+ return {
+ k: v
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
+ if k not in message_dict
+ }
+
+ @staticmethod
+ def _get_http_options():
+ http_options: List[Dict[str, str]] = [
+ {
+ "method": "post",
+ "uri": "/v2/{resource=projects/*/instances/*}:testIamPermissions",
+ "body": "*",
+ },
+ {
+ "method": "post",
+ "uri": "/v2/{resource=projects/*/instances/*/materializedViews/*}:testIamPermissions",
+ "body": "*",
+ },
+ {
+ "method": "post",
+ "uri": "/v2/{resource=projects/*/instances/*/logicalViews/*}:testIamPermissions",
+ "body": "*",
+ },
+ ]
+ return http_options
+
+ @staticmethod
+ def _get_transcoded_request(http_options, request):
+ pb_request = request
+ transcoded_request = path_template.transcode(http_options, pb_request)
+ return transcoded_request
+
+ @staticmethod
+ def _get_request_body_json(transcoded_request):
+ # Jsonify the request body
+
+ body = json_format.MessageToJson(
+ transcoded_request["body"], use_integers_for_enums=True
+ )
+ return body
+
+ @staticmethod
+ def _get_query_params_json(transcoded_request):
+ query_params = json.loads(
+ json_format.MessageToJson(
+ transcoded_request["query_params"],
+ use_integers_for_enums=True,
+ )
+ )
+ query_params.update(
+ _BaseBigtableInstanceAdminRestTransport._BaseTestIamPermissions._get_unset_required_fields(
+ query_params
+ )
+ )
+
+ query_params["$alt"] = "json;enum-encoding=int"
+ return query_params
+
+ class _BaseUpdateAppProfile:
+ def __hash__(self): # pragma: NO COVER
+ return NotImplementedError("__hash__ must be implemented.")
+
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {
+ "updateMask": {},
+ }
+
+ @classmethod
+ def _get_unset_required_fields(cls, message_dict):
+ return {
+ k: v
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
+ if k not in message_dict
+ }
+
+ @staticmethod
+ def _get_http_options():
+ http_options: List[Dict[str, str]] = [
+ {
+ "method": "patch",
+ "uri": "/v2/{app_profile.name=projects/*/instances/*/appProfiles/*}",
+ "body": "app_profile",
+ },
+ ]
+ return http_options
+
+ @staticmethod
+ def _get_transcoded_request(http_options, request):
+ pb_request = bigtable_instance_admin.UpdateAppProfileRequest.pb(request)
+ transcoded_request = path_template.transcode(http_options, pb_request)
+ return transcoded_request
+
+ @staticmethod
+ def _get_request_body_json(transcoded_request):
+ # Jsonify the request body
+
+ body = json_format.MessageToJson(
+ transcoded_request["body"], use_integers_for_enums=True
+ )
+ return body
+
+ @staticmethod
+ def _get_query_params_json(transcoded_request):
+ query_params = json.loads(
+ json_format.MessageToJson(
+ transcoded_request["query_params"],
+ use_integers_for_enums=True,
+ )
+ )
+ query_params.update(
+ _BaseBigtableInstanceAdminRestTransport._BaseUpdateAppProfile._get_unset_required_fields(
+ query_params
+ )
+ )
+
+ query_params["$alt"] = "json;enum-encoding=int"
+ return query_params
+
+ class _BaseUpdateCluster:
+ def __hash__(self): # pragma: NO COVER
+ return NotImplementedError("__hash__ must be implemented.")
+
+ @staticmethod
+ def _get_http_options():
+ http_options: List[Dict[str, str]] = [
+ {
+ "method": "put",
+ "uri": "/v2/{name=projects/*/instances/*/clusters/*}",
+ "body": "*",
+ },
+ ]
+ return http_options
+
+ @staticmethod
+ def _get_transcoded_request(http_options, request):
+ pb_request = instance.Cluster.pb(request)
+ transcoded_request = path_template.transcode(http_options, pb_request)
+ return transcoded_request
+
+ @staticmethod
+ def _get_request_body_json(transcoded_request):
+ # Jsonify the request body
+
+ body = json_format.MessageToJson(
+ transcoded_request["body"], use_integers_for_enums=True
+ )
+ return body
+
+ @staticmethod
+ def _get_query_params_json(transcoded_request):
+ query_params = json.loads(
+ json_format.MessageToJson(
+ transcoded_request["query_params"],
+ use_integers_for_enums=True,
+ )
+ )
+
+ query_params["$alt"] = "json;enum-encoding=int"
+ return query_params
+
+ class _BaseUpdateInstance:
+ def __hash__(self): # pragma: NO COVER
+ return NotImplementedError("__hash__ must be implemented.")
+
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
+
+ @classmethod
+ def _get_unset_required_fields(cls, message_dict):
+ return {
+ k: v
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
+ if k not in message_dict
+ }
+
+ @staticmethod
+ def _get_http_options():
+ http_options: List[Dict[str, str]] = [
+ {
+ "method": "put",
+ "uri": "/v2/{name=projects/*/instances/*}",
+ "body": "*",
+ },
+ ]
+ return http_options
+
+ @staticmethod
+ def _get_transcoded_request(http_options, request):
+ pb_request = instance.Instance.pb(request)
+ transcoded_request = path_template.transcode(http_options, pb_request)
+ return transcoded_request
+
+ @staticmethod
+ def _get_request_body_json(transcoded_request):
+ # Jsonify the request body
+
+ body = json_format.MessageToJson(
+ transcoded_request["body"], use_integers_for_enums=True
+ )
+ return body
+
+ @staticmethod
+ def _get_query_params_json(transcoded_request):
+ query_params = json.loads(
+ json_format.MessageToJson(
+ transcoded_request["query_params"],
+ use_integers_for_enums=True,
+ )
+ )
+ query_params.update(
+ _BaseBigtableInstanceAdminRestTransport._BaseUpdateInstance._get_unset_required_fields(
+ query_params
+ )
+ )
+
+ query_params["$alt"] = "json;enum-encoding=int"
+ return query_params
+
+ class _BaseUpdateLogicalView:
+ def __hash__(self): # pragma: NO COVER
+ return NotImplementedError("__hash__ must be implemented.")
+
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
+
+ @classmethod
+ def _get_unset_required_fields(cls, message_dict):
+ return {
+ k: v
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
+ if k not in message_dict
+ }
+
+ @staticmethod
+ def _get_http_options():
+ http_options: List[Dict[str, str]] = [
+ {
+ "method": "patch",
+ "uri": "/v2/{logical_view.name=projects/*/instances/*/logicalViews/*}",
+ "body": "logical_view",
+ },
+ ]
+ return http_options
+
+ @staticmethod
+ def _get_transcoded_request(http_options, request):
+ pb_request = bigtable_instance_admin.UpdateLogicalViewRequest.pb(request)
+ transcoded_request = path_template.transcode(http_options, pb_request)
+ return transcoded_request
+
+ @staticmethod
+ def _get_request_body_json(transcoded_request):
+ # Jsonify the request body
+
+ body = json_format.MessageToJson(
+ transcoded_request["body"], use_integers_for_enums=True
+ )
+ return body
+
+ @staticmethod
+ def _get_query_params_json(transcoded_request):
+ query_params = json.loads(
+ json_format.MessageToJson(
+ transcoded_request["query_params"],
+ use_integers_for_enums=True,
+ )
+ )
+ query_params.update(
+ _BaseBigtableInstanceAdminRestTransport._BaseUpdateLogicalView._get_unset_required_fields(
+ query_params
+ )
+ )
+
+ query_params["$alt"] = "json;enum-encoding=int"
+ return query_params
+
+ class _BaseUpdateMaterializedView:
+ def __hash__(self): # pragma: NO COVER
+ return NotImplementedError("__hash__ must be implemented.")
+
+ __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {}
+
+ @classmethod
+ def _get_unset_required_fields(cls, message_dict):
+ return {
+ k: v
+ for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items()
+ if k not in message_dict
+ }
+
+ @staticmethod
+ def _get_http_options():
+ http_options: List[Dict[str, str]] = [
+ {
+ "method": "patch",
+ "uri": "/v2/{materialized_view.name=projects/*/instances/*/materializedViews/*}",
+ "body": "materialized_view",
+ },
+ ]
+ return http_options
+
+ @staticmethod
+ def _get_transcoded_request(http_options, request):
+ pb_request = bigtable_instance_admin.UpdateMaterializedViewRequest.pb(
+ request
+ )
+ transcoded_request = path_template.transcode(http_options, pb_request)
+ return transcoded_request
+
+ @staticmethod
+ def _get_request_body_json(transcoded_request):
+ # Jsonify the request body
+
+ body = json_format.MessageToJson(
+ transcoded_request["body"], use_integers_for_enums=True
+ )
+ return body
+
+ @staticmethod
+ def _get_query_params_json(transcoded_request):
+ query_params = json.loads(
+ json_format.MessageToJson(
+ transcoded_request["query_params"],
+ use_integers_for_enums=True,
+ )
+ )
+ query_params.update(
+ _BaseBigtableInstanceAdminRestTransport._BaseUpdateMaterializedView._get_unset_required_fields(
+ query_params
+ )
+ )
+
+ query_params["$alt"] = "json;enum-encoding=int"
+ return query_params
+
+
+__all__ = ("_BaseBigtableInstanceAdminRestTransport",)
diff --git a/google/cloud/bigtable_admin_v2/services/bigtable_table_admin/__init__.py b/google/cloud/bigtable_admin_v2/services/bigtable_table_admin/__init__.py
new file mode 100644
index 000000000..c5e8544d6
--- /dev/null
+++ b/google/cloud/bigtable_admin_v2/services/bigtable_table_admin/__init__.py
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+# Copyright 2025 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 .client import BaseBigtableTableAdminClient
+from .async_client import BaseBigtableTableAdminAsyncClient
+
+__all__ = (
+ "BaseBigtableTableAdminClient",
+ "BaseBigtableTableAdminAsyncClient",
+)
diff --git a/google/cloud/bigtable_admin_v2/services/bigtable_table_admin/async_client.py b/google/cloud/bigtable_admin_v2/services/bigtable_table_admin/async_client.py
new file mode 100644
index 000000000..7f772c87c
--- /dev/null
+++ b/google/cloud/bigtable_admin_v2/services/bigtable_table_admin/async_client.py
@@ -0,0 +1,4960 @@
+# -*- coding: utf-8 -*-
+# Copyright 2025 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.
+#
+import logging as std_logging
+from collections import OrderedDict
+import re
+from typing import (
+ Dict,
+ Callable,
+ Mapping,
+ MutableMapping,
+ MutableSequence,
+ Optional,
+ Sequence,
+ Tuple,
+ Type,
+ Union,
+)
+
+from google.cloud.bigtable_admin_v2 import gapic_version as package_version
+
+from google.api_core.client_options import ClientOptions
+from google.api_core import exceptions as core_exceptions
+from google.api_core import gapic_v1
+from google.api_core import retry_async as retries
+from google.auth import credentials as ga_credentials # type: ignore
+from google.oauth2 import service_account # type: ignore
+import google.protobuf
+
+
+try:
+ OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None]
+except AttributeError: # pragma: NO COVER
+ OptionalRetry = Union[retries.AsyncRetry, object, None] # type: ignore
+
+from google.api_core import operation # type: ignore
+from google.api_core import operation_async # type: ignore
+from google.cloud.bigtable_admin_v2.services.bigtable_table_admin import pagers
+from google.cloud.bigtable_admin_v2.types import bigtable_table_admin
+from google.cloud.bigtable_admin_v2.types import table
+from google.cloud.bigtable_admin_v2.types import table as gba_table
+from google.cloud.bigtable_admin_v2.types import types
+from google.iam.v1 import iam_policy_pb2 # type: ignore
+from google.iam.v1 import policy_pb2 # type: ignore
+from google.protobuf import field_mask_pb2 # type: ignore
+from google.protobuf import timestamp_pb2 # type: ignore
+from .transports.base import BigtableTableAdminTransport, DEFAULT_CLIENT_INFO
+from .transports.grpc_asyncio import BigtableTableAdminGrpcAsyncIOTransport
+from .client import BaseBigtableTableAdminClient
+
+try:
+ from google.api_core import client_logging # type: ignore
+
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
+except ImportError: # pragma: NO COVER
+ CLIENT_LOGGING_SUPPORTED = False
+
+_LOGGER = std_logging.getLogger(__name__)
+
+
+class BaseBigtableTableAdminAsyncClient:
+ """Service for creating, configuring, and deleting Cloud
+ Bigtable tables.
+
+ Provides access to the table schemas only, not the data stored
+ within the tables.
+ """
+
+ _client: BaseBigtableTableAdminClient
+
+ # Copy defaults from the synchronous client for use here.
+ # Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead.
+ DEFAULT_ENDPOINT = BaseBigtableTableAdminClient.DEFAULT_ENDPOINT
+ DEFAULT_MTLS_ENDPOINT = BaseBigtableTableAdminClient.DEFAULT_MTLS_ENDPOINT
+ _DEFAULT_ENDPOINT_TEMPLATE = BaseBigtableTableAdminClient._DEFAULT_ENDPOINT_TEMPLATE
+ _DEFAULT_UNIVERSE = BaseBigtableTableAdminClient._DEFAULT_UNIVERSE
+
+ authorized_view_path = staticmethod(
+ BaseBigtableTableAdminClient.authorized_view_path
+ )
+ parse_authorized_view_path = staticmethod(
+ BaseBigtableTableAdminClient.parse_authorized_view_path
+ )
+ backup_path = staticmethod(BaseBigtableTableAdminClient.backup_path)
+ parse_backup_path = staticmethod(BaseBigtableTableAdminClient.parse_backup_path)
+ cluster_path = staticmethod(BaseBigtableTableAdminClient.cluster_path)
+ parse_cluster_path = staticmethod(BaseBigtableTableAdminClient.parse_cluster_path)
+ crypto_key_version_path = staticmethod(
+ BaseBigtableTableAdminClient.crypto_key_version_path
+ )
+ parse_crypto_key_version_path = staticmethod(
+ BaseBigtableTableAdminClient.parse_crypto_key_version_path
+ )
+ instance_path = staticmethod(BaseBigtableTableAdminClient.instance_path)
+ parse_instance_path = staticmethod(BaseBigtableTableAdminClient.parse_instance_path)
+ schema_bundle_path = staticmethod(BaseBigtableTableAdminClient.schema_bundle_path)
+ parse_schema_bundle_path = staticmethod(
+ BaseBigtableTableAdminClient.parse_schema_bundle_path
+ )
+ snapshot_path = staticmethod(BaseBigtableTableAdminClient.snapshot_path)
+ parse_snapshot_path = staticmethod(BaseBigtableTableAdminClient.parse_snapshot_path)
+ table_path = staticmethod(BaseBigtableTableAdminClient.table_path)
+ parse_table_path = staticmethod(BaseBigtableTableAdminClient.parse_table_path)
+ common_billing_account_path = staticmethod(
+ BaseBigtableTableAdminClient.common_billing_account_path
+ )
+ parse_common_billing_account_path = staticmethod(
+ BaseBigtableTableAdminClient.parse_common_billing_account_path
+ )
+ common_folder_path = staticmethod(BaseBigtableTableAdminClient.common_folder_path)
+ parse_common_folder_path = staticmethod(
+ BaseBigtableTableAdminClient.parse_common_folder_path
+ )
+ common_organization_path = staticmethod(
+ BaseBigtableTableAdminClient.common_organization_path
+ )
+ parse_common_organization_path = staticmethod(
+ BaseBigtableTableAdminClient.parse_common_organization_path
+ )
+ common_project_path = staticmethod(BaseBigtableTableAdminClient.common_project_path)
+ parse_common_project_path = staticmethod(
+ BaseBigtableTableAdminClient.parse_common_project_path
+ )
+ common_location_path = staticmethod(
+ BaseBigtableTableAdminClient.common_location_path
+ )
+ parse_common_location_path = staticmethod(
+ BaseBigtableTableAdminClient.parse_common_location_path
+ )
+
+ @classmethod
+ def from_service_account_info(cls, info: dict, *args, **kwargs):
+ """Creates an instance of this client using the provided credentials
+ info.
+
+ Args:
+ info (dict): The service account private key info.
+ args: Additional arguments to pass to the constructor.
+ kwargs: Additional arguments to pass to the constructor.
+
+ Returns:
+ BaseBigtableTableAdminAsyncClient: The constructed client.
+ """
+ return BaseBigtableTableAdminClient.from_service_account_info.__func__(BaseBigtableTableAdminAsyncClient, info, *args, **kwargs) # type: ignore
+
+ @classmethod
+ def from_service_account_file(cls, filename: str, *args, **kwargs):
+ """Creates an instance of this client using the provided credentials
+ file.
+
+ Args:
+ filename (str): The path to the service account private key json
+ file.
+ args: Additional arguments to pass to the constructor.
+ kwargs: Additional arguments to pass to the constructor.
+
+ Returns:
+ BaseBigtableTableAdminAsyncClient: The constructed client.
+ """
+ return BaseBigtableTableAdminClient.from_service_account_file.__func__(BaseBigtableTableAdminAsyncClient, filename, *args, **kwargs) # type: ignore
+
+ from_service_account_json = from_service_account_file
+
+ @classmethod
+ def get_mtls_endpoint_and_cert_source(
+ cls, client_options: Optional[ClientOptions] = None
+ ):
+ """Return the API endpoint and client cert source for mutual TLS.
+
+ The client cert source is determined in the following order:
+ (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the
+ client cert source is None.
+ (2) if `client_options.client_cert_source` is provided, use the provided one; if the
+ default client cert source exists, use the default one; otherwise the client cert
+ source is None.
+
+ The API endpoint is determined in the following order:
+ (1) if `client_options.api_endpoint` if provided, use the provided one.
+ (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the
+ default mTLS endpoint; if the environment variable is "never", use the default API
+ endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise
+ use the default API endpoint.
+
+ More details can be found at https://google.aip.dev/auth/4114.
+
+ Args:
+ client_options (google.api_core.client_options.ClientOptions): Custom options for the
+ client. Only the `api_endpoint` and `client_cert_source` properties may be used
+ in this method.
+
+ Returns:
+ Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the
+ client cert source to use.
+
+ Raises:
+ google.auth.exceptions.MutualTLSChannelError: If any errors happen.
+ """
+ return BaseBigtableTableAdminClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore
+
+ @property
+ def transport(self) -> BigtableTableAdminTransport:
+ """Returns the transport used by the client instance.
+
+ Returns:
+ BigtableTableAdminTransport: The transport used by the client instance.
+ """
+ return self._client.transport
+
+ @property
+ def api_endpoint(self):
+ """Return the API endpoint used by the client instance.
+
+ Returns:
+ str: The API endpoint used by the client instance.
+ """
+ return self._client._api_endpoint
+
+ @property
+ def universe_domain(self) -> str:
+ """Return the universe domain used by the client instance.
+
+ Returns:
+ str: The universe domain used
+ by the client instance.
+ """
+ return self._client._universe_domain
+
+ get_transport_class = BaseBigtableTableAdminClient.get_transport_class
+
+ def __init__(
+ self,
+ *,
+ credentials: Optional[ga_credentials.Credentials] = None,
+ transport: Optional[
+ Union[
+ str,
+ BigtableTableAdminTransport,
+ Callable[..., BigtableTableAdminTransport],
+ ]
+ ] = "grpc_asyncio",
+ client_options: Optional[ClientOptions] = None,
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
+ ) -> None:
+ """Instantiates the base bigtable table admin async client.
+
+ Args:
+ credentials (Optional[google.auth.credentials.Credentials]): The
+ authorization credentials to attach to requests. These
+ credentials identify the application to the service; if none
+ are specified, the client will attempt to ascertain the
+ credentials from the environment.
+ transport (Optional[Union[str,BigtableTableAdminTransport,Callable[..., BigtableTableAdminTransport]]]):
+ The transport to use, or a Callable that constructs and returns a new transport to use.
+ If a Callable is given, it will be called with the same set of initialization
+ arguments as used in the BigtableTableAdminTransport constructor.
+ If set to None, a transport is chosen automatically.
+ client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]):
+ Custom options for the client.
+
+ 1. The ``api_endpoint`` property can be used to override the
+ default endpoint provided by the client when ``transport`` is
+ not explicitly provided. Only if this property is not set and
+ ``transport`` was not explicitly provided, the endpoint is
+ determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment
+ variable, which have one of the following values:
+ "always" (always use the default mTLS endpoint), "never" (always
+ use the default regular endpoint) and "auto" (auto-switch to the
+ default mTLS endpoint if client certificate is present; this is
+ the default value).
+
+ 2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable
+ is "true", then the ``client_cert_source`` property can be used
+ to provide a client certificate for mTLS transport. If
+ not provided, the default SSL client certificate will be used if
+ present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not
+ set, no client certificate will be used.
+
+ 3. The ``universe_domain`` property can be used to override the
+ default "googleapis.com" universe. Note that ``api_endpoint``
+ property still takes precedence; and ``universe_domain`` is
+ currently not supported for mTLS.
+
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
+ The client info used to send a user-agent string along with
+ API requests. If ``None``, then default info will be used.
+ Generally, you only need to set this if you're developing
+ your own client library.
+
+ Raises:
+ google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
+ creation failed for any reason.
+ """
+ self._client = BaseBigtableTableAdminClient(
+ credentials=credentials,
+ transport=transport,
+ client_options=client_options,
+ client_info=client_info,
+ )
+
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ std_logging.DEBUG
+ ): # pragma: NO COVER
+ _LOGGER.debug(
+ "Created client `google.bigtable.admin_v2.BaseBigtableTableAdminAsyncClient`.",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableTableAdmin",
+ "universeDomain": getattr(
+ self._client._transport._credentials, "universe_domain", ""
+ ),
+ "credentialsType": f"{type(self._client._transport._credentials).__module__}.{type(self._client._transport._credentials).__qualname__}",
+ "credentialsInfo": getattr(
+ self.transport._credentials, "get_cred_info", lambda: None
+ )(),
+ }
+ if hasattr(self._client._transport, "_credentials")
+ else {
+ "serviceName": "google.bigtable.admin.v2.BigtableTableAdmin",
+ "credentialsType": None,
+ },
+ )
+
+ async def create_table(
+ self,
+ request: Optional[Union[bigtable_table_admin.CreateTableRequest, dict]] = None,
+ *,
+ parent: Optional[str] = None,
+ table_id: Optional[str] = None,
+ table: Optional[gba_table.Table] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> gba_table.Table:
+ r"""Creates a new table in the specified instance.
+ The table can be created with a full set of initial
+ column families, specified in the request.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_create_table():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.CreateTableRequest(
+ parent="parent_value",
+ table_id="table_id_value",
+ )
+
+ # Make the request
+ response = await client.create_table(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.CreateTableRequest, dict]]):
+ The request object. Request message for
+ [google.bigtable.admin.v2.BigtableTableAdmin.CreateTable][google.bigtable.admin.v2.BigtableTableAdmin.CreateTable]
+ parent (:class:`str`):
+ Required. The unique name of the instance in which to
+ create the table. Values are of the form
+ ``projects/{project}/instances/{instance}``.
+
+ This corresponds to the ``parent`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ table_id (:class:`str`):
+ Required. The name by which the new table should be
+ referred to within the parent instance, e.g., ``foobar``
+ rather than ``{parent}/tables/foobar``. Maximum 50
+ characters.
+
+ This corresponds to the ``table_id`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ table (:class:`google.cloud.bigtable_admin_v2.types.Table`):
+ Required. The Table to create.
+ This corresponds to the ``table`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.types.Table:
+ A collection of user data indexed by
+ row, column, and timestamp. Each table
+ is served using the resources of its
+ parent cluster.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [parent, table_id, table]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.CreateTableRequest):
+ request = bigtable_table_admin.CreateTableRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if parent is not None:
+ request.parent = parent
+ if table_id is not None:
+ request.table_id = table_id
+ if table is not None:
+ request.table = table
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.create_table
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def create_table_from_snapshot(
+ self,
+ request: Optional[
+ Union[bigtable_table_admin.CreateTableFromSnapshotRequest, dict]
+ ] = None,
+ *,
+ parent: Optional[str] = None,
+ table_id: Optional[str] = None,
+ source_snapshot: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operation_async.AsyncOperation:
+ r"""Creates a new table from the specified snapshot. The
+ target table must not exist. The snapshot and the table
+ must be in the same instance.
+
+ Note: This is a private alpha release of Cloud Bigtable
+ snapshots. This feature is not currently available to
+ most Cloud Bigtable customers. This feature might be
+ changed in backward-incompatible ways and is not
+ recommended for production use. It is not subject to any
+ SLA or deprecation policy.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_create_table_from_snapshot():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.CreateTableFromSnapshotRequest(
+ parent="parent_value",
+ table_id="table_id_value",
+ source_snapshot="source_snapshot_value",
+ )
+
+ # Make the request
+ operation = client.create_table_from_snapshot(request=request)
+
+ print("Waiting for operation to complete...")
+
+ response = (await operation).result()
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.CreateTableFromSnapshotRequest, dict]]):
+ The request object. Request message for
+ [google.bigtable.admin.v2.BigtableTableAdmin.CreateTableFromSnapshot][google.bigtable.admin.v2.BigtableTableAdmin.CreateTableFromSnapshot]
+
+ Note: This is a private alpha release of Cloud Bigtable
+ snapshots. This feature is not currently available to
+ most Cloud Bigtable customers. This feature might be
+ changed in backward-incompatible ways and is not
+ recommended for production use. It is not subject to any
+ SLA or deprecation policy.
+ parent (:class:`str`):
+ Required. The unique name of the instance in which to
+ create the table. Values are of the form
+ ``projects/{project}/instances/{instance}``.
+
+ This corresponds to the ``parent`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ table_id (:class:`str`):
+ Required. The name by which the new table should be
+ referred to within the parent instance, e.g., ``foobar``
+ rather than ``{parent}/tables/foobar``.
+
+ This corresponds to the ``table_id`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ source_snapshot (:class:`str`):
+ Required. The unique name of the snapshot from which to
+ restore the table. The snapshot and the table must be in
+ the same instance. Values are of the form
+ ``projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}``.
+
+ This corresponds to the ``source_snapshot`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.api_core.operation_async.AsyncOperation:
+ An object representing a long-running operation.
+
+ The result type for the operation will be :class:`google.cloud.bigtable_admin_v2.types.Table` A collection of user data indexed by row, column, and timestamp.
+ Each table is served using the resources of its
+ parent cluster.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [parent, table_id, source_snapshot]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.CreateTableFromSnapshotRequest):
+ request = bigtable_table_admin.CreateTableFromSnapshotRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if parent is not None:
+ request.parent = parent
+ if table_id is not None:
+ request.table_id = table_id
+ if source_snapshot is not None:
+ request.source_snapshot = source_snapshot
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.create_table_from_snapshot
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Wrap the response in an operation future.
+ response = operation_async.from_gapic(
+ response,
+ self._client._transport.operations_client,
+ table.Table,
+ metadata_type=bigtable_table_admin.CreateTableFromSnapshotMetadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def list_tables(
+ self,
+ request: Optional[Union[bigtable_table_admin.ListTablesRequest, dict]] = None,
+ *,
+ parent: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> pagers.ListTablesAsyncPager:
+ r"""Lists all tables served from a specified instance.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_list_tables():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.ListTablesRequest(
+ parent="parent_value",
+ )
+
+ # Make the request
+ page_result = client.list_tables(request=request)
+
+ # Handle the response
+ async for response in page_result:
+ print(response)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.ListTablesRequest, dict]]):
+ The request object. Request message for
+ [google.bigtable.admin.v2.BigtableTableAdmin.ListTables][google.bigtable.admin.v2.BigtableTableAdmin.ListTables]
+ parent (:class:`str`):
+ Required. The unique name of the instance for which
+ tables should be listed. Values are of the form
+ ``projects/{project}/instances/{instance}``.
+
+ This corresponds to the ``parent`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.services.bigtable_table_admin.pagers.ListTablesAsyncPager:
+ Response message for
+ [google.bigtable.admin.v2.BigtableTableAdmin.ListTables][google.bigtable.admin.v2.BigtableTableAdmin.ListTables]
+
+ Iterating over this object will yield results and
+ resolve additional pages automatically.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [parent]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.ListTablesRequest):
+ request = bigtable_table_admin.ListTablesRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if parent is not None:
+ request.parent = parent
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.list_tables
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # This method is paged; wrap the response in a pager, which provides
+ # an `__aiter__` convenience method.
+ response = pagers.ListTablesAsyncPager(
+ method=rpc,
+ request=request,
+ response=response,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def get_table(
+ self,
+ request: Optional[Union[bigtable_table_admin.GetTableRequest, dict]] = None,
+ *,
+ name: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> table.Table:
+ r"""Gets metadata information about the specified table.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_get_table():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.GetTableRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = await client.get_table(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.GetTableRequest, dict]]):
+ The request object. Request message for
+ [google.bigtable.admin.v2.BigtableTableAdmin.GetTable][google.bigtable.admin.v2.BigtableTableAdmin.GetTable]
+ name (:class:`str`):
+ Required. The unique name of the requested table. Values
+ are of the form
+ ``projects/{project}/instances/{instance}/tables/{table}``.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.types.Table:
+ A collection of user data indexed by
+ row, column, and timestamp. Each table
+ is served using the resources of its
+ parent cluster.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.GetTableRequest):
+ request = bigtable_table_admin.GetTableRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.get_table
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def update_table(
+ self,
+ request: Optional[Union[bigtable_table_admin.UpdateTableRequest, dict]] = None,
+ *,
+ table: Optional[gba_table.Table] = None,
+ update_mask: Optional[field_mask_pb2.FieldMask] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operation_async.AsyncOperation:
+ r"""Updates a specified table.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_update_table():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.UpdateTableRequest(
+ )
+
+ # Make the request
+ operation = client.update_table(request=request)
+
+ print("Waiting for operation to complete...")
+
+ response = (await operation).result()
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.UpdateTableRequest, dict]]):
+ The request object. The request for
+ [UpdateTable][google.bigtable.admin.v2.BigtableTableAdmin.UpdateTable].
+ table (:class:`google.cloud.bigtable_admin_v2.types.Table`):
+ Required. The table to update. The table's ``name``
+ field is used to identify the table to update.
+
+ This corresponds to the ``table`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
+ Required. The list of fields to update. A mask
+ specifying which fields (e.g. ``change_stream_config``)
+ in the ``table`` field should be updated. This mask is
+ relative to the ``table`` field, not to the request
+ message. The wildcard (\*) path is currently not
+ supported. Currently UpdateTable is only supported for
+ the following fields:
+
+ - ``change_stream_config``
+ - ``change_stream_config.retention_period``
+ - ``deletion_protection``
+ - ``row_key_schema``
+
+ If ``column_families`` is set in ``update_mask``, it
+ will return an UNIMPLEMENTED error.
+
+ This corresponds to the ``update_mask`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.api_core.operation_async.AsyncOperation:
+ An object representing a long-running operation.
+
+ The result type for the operation will be :class:`google.cloud.bigtable_admin_v2.types.Table` A collection of user data indexed by row, column, and timestamp.
+ Each table is served using the resources of its
+ parent cluster.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [table, update_mask]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.UpdateTableRequest):
+ request = bigtable_table_admin.UpdateTableRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if table is not None:
+ request.table = table
+ if update_mask is not None:
+ request.update_mask = update_mask
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.update_table
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata(
+ (("table.name", request.table.name),)
+ ),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Wrap the response in an operation future.
+ response = operation_async.from_gapic(
+ response,
+ self._client._transport.operations_client,
+ gba_table.Table,
+ metadata_type=bigtable_table_admin.UpdateTableMetadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def delete_table(
+ self,
+ request: Optional[Union[bigtable_table_admin.DeleteTableRequest, dict]] = None,
+ *,
+ name: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> None:
+ r"""Permanently deletes a specified table and all of its
+ data.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_delete_table():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.DeleteTableRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ await client.delete_table(request=request)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.DeleteTableRequest, dict]]):
+ The request object. Request message for
+ [google.bigtable.admin.v2.BigtableTableAdmin.DeleteTable][google.bigtable.admin.v2.BigtableTableAdmin.DeleteTable]
+ name (:class:`str`):
+ Required. The unique name of the table to be deleted.
+ Values are of the form
+ ``projects/{project}/instances/{instance}/tables/{table}``.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.DeleteTableRequest):
+ request = bigtable_table_admin.DeleteTableRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.delete_table
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ async def undelete_table(
+ self,
+ request: Optional[
+ Union[bigtable_table_admin.UndeleteTableRequest, dict]
+ ] = None,
+ *,
+ name: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operation_async.AsyncOperation:
+ r"""Restores a specified table which was accidentally
+ deleted.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_undelete_table():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.UndeleteTableRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ operation = client.undelete_table(request=request)
+
+ print("Waiting for operation to complete...")
+
+ response = (await operation).result()
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.UndeleteTableRequest, dict]]):
+ The request object. Request message for
+ [google.bigtable.admin.v2.BigtableTableAdmin.UndeleteTable][google.bigtable.admin.v2.BigtableTableAdmin.UndeleteTable]
+ name (:class:`str`):
+ Required. The unique name of the table to be restored.
+ Values are of the form
+ ``projects/{project}/instances/{instance}/tables/{table}``.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.api_core.operation_async.AsyncOperation:
+ An object representing a long-running operation.
+
+ The result type for the operation will be :class:`google.cloud.bigtable_admin_v2.types.Table` A collection of user data indexed by row, column, and timestamp.
+ Each table is served using the resources of its
+ parent cluster.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.UndeleteTableRequest):
+ request = bigtable_table_admin.UndeleteTableRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.undelete_table
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Wrap the response in an operation future.
+ response = operation_async.from_gapic(
+ response,
+ self._client._transport.operations_client,
+ table.Table,
+ metadata_type=bigtable_table_admin.UndeleteTableMetadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def create_authorized_view(
+ self,
+ request: Optional[
+ Union[bigtable_table_admin.CreateAuthorizedViewRequest, dict]
+ ] = None,
+ *,
+ parent: Optional[str] = None,
+ authorized_view: Optional[table.AuthorizedView] = None,
+ authorized_view_id: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operation_async.AsyncOperation:
+ r"""Creates a new AuthorizedView in a table.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_create_authorized_view():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.CreateAuthorizedViewRequest(
+ parent="parent_value",
+ authorized_view_id="authorized_view_id_value",
+ )
+
+ # Make the request
+ operation = client.create_authorized_view(request=request)
+
+ print("Waiting for operation to complete...")
+
+ response = (await operation).result()
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.CreateAuthorizedViewRequest, dict]]):
+ The request object. The request for
+ [CreateAuthorizedView][google.bigtable.admin.v2.BigtableTableAdmin.CreateAuthorizedView]
+ parent (:class:`str`):
+ Required. This is the name of the table the
+ AuthorizedView belongs to. Values are of the form
+ ``projects/{project}/instances/{instance}/tables/{table}``.
+
+ This corresponds to the ``parent`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ authorized_view (:class:`google.cloud.bigtable_admin_v2.types.AuthorizedView`):
+ Required. The AuthorizedView to
+ create.
+
+ This corresponds to the ``authorized_view`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ authorized_view_id (:class:`str`):
+ Required. The id of the AuthorizedView to create. This
+ AuthorizedView must not already exist. The
+ ``authorized_view_id`` appended to ``parent`` forms the
+ full AuthorizedView name of the form
+ ``projects/{project}/instances/{instance}/tables/{table}/authorizedView/{authorized_view}``.
+
+ This corresponds to the ``authorized_view_id`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.api_core.operation_async.AsyncOperation:
+ An object representing a long-running operation.
+
+ The result type for the operation will be :class:`google.cloud.bigtable_admin_v2.types.AuthorizedView` AuthorizedViews represent subsets of a particular Cloud Bigtable table. Users
+ can configure access to each Authorized View
+ independently from the table and use the existing
+ Data APIs to access the subset of data.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [parent, authorized_view, authorized_view_id]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.CreateAuthorizedViewRequest):
+ request = bigtable_table_admin.CreateAuthorizedViewRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if parent is not None:
+ request.parent = parent
+ if authorized_view is not None:
+ request.authorized_view = authorized_view
+ if authorized_view_id is not None:
+ request.authorized_view_id = authorized_view_id
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.create_authorized_view
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Wrap the response in an operation future.
+ response = operation_async.from_gapic(
+ response,
+ self._client._transport.operations_client,
+ table.AuthorizedView,
+ metadata_type=bigtable_table_admin.CreateAuthorizedViewMetadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def list_authorized_views(
+ self,
+ request: Optional[
+ Union[bigtable_table_admin.ListAuthorizedViewsRequest, dict]
+ ] = None,
+ *,
+ parent: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> pagers.ListAuthorizedViewsAsyncPager:
+ r"""Lists all AuthorizedViews from a specific table.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_list_authorized_views():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.ListAuthorizedViewsRequest(
+ parent="parent_value",
+ )
+
+ # Make the request
+ page_result = client.list_authorized_views(request=request)
+
+ # Handle the response
+ async for response in page_result:
+ print(response)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.ListAuthorizedViewsRequest, dict]]):
+ The request object. Request message for
+ [google.bigtable.admin.v2.BigtableTableAdmin.ListAuthorizedViews][google.bigtable.admin.v2.BigtableTableAdmin.ListAuthorizedViews]
+ parent (:class:`str`):
+ Required. The unique name of the table for which
+ AuthorizedViews should be listed. Values are of the form
+ ``projects/{project}/instances/{instance}/tables/{table}``.
+
+ This corresponds to the ``parent`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.services.bigtable_table_admin.pagers.ListAuthorizedViewsAsyncPager:
+ Response message for
+ [google.bigtable.admin.v2.BigtableTableAdmin.ListAuthorizedViews][google.bigtable.admin.v2.BigtableTableAdmin.ListAuthorizedViews]
+
+ Iterating over this object will yield results and
+ resolve additional pages automatically.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [parent]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.ListAuthorizedViewsRequest):
+ request = bigtable_table_admin.ListAuthorizedViewsRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if parent is not None:
+ request.parent = parent
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.list_authorized_views
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # This method is paged; wrap the response in a pager, which provides
+ # an `__aiter__` convenience method.
+ response = pagers.ListAuthorizedViewsAsyncPager(
+ method=rpc,
+ request=request,
+ response=response,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def get_authorized_view(
+ self,
+ request: Optional[
+ Union[bigtable_table_admin.GetAuthorizedViewRequest, dict]
+ ] = None,
+ *,
+ name: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> table.AuthorizedView:
+ r"""Gets information from a specified AuthorizedView.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_get_authorized_view():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.GetAuthorizedViewRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = await client.get_authorized_view(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.GetAuthorizedViewRequest, dict]]):
+ The request object. Request message for
+ [google.bigtable.admin.v2.BigtableTableAdmin.GetAuthorizedView][google.bigtable.admin.v2.BigtableTableAdmin.GetAuthorizedView]
+ name (:class:`str`):
+ Required. The unique name of the requested
+ AuthorizedView. Values are of the form
+ ``projects/{project}/instances/{instance}/tables/{table}/authorizedViews/{authorized_view}``.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.types.AuthorizedView:
+ AuthorizedViews represent subsets of
+ a particular Cloud Bigtable table. Users
+ can configure access to each Authorized
+ View independently from the table and
+ use the existing Data APIs to access the
+ subset of data.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.GetAuthorizedViewRequest):
+ request = bigtable_table_admin.GetAuthorizedViewRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.get_authorized_view
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def update_authorized_view(
+ self,
+ request: Optional[
+ Union[bigtable_table_admin.UpdateAuthorizedViewRequest, dict]
+ ] = None,
+ *,
+ authorized_view: Optional[table.AuthorizedView] = None,
+ update_mask: Optional[field_mask_pb2.FieldMask] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operation_async.AsyncOperation:
+ r"""Updates an AuthorizedView in a table.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_update_authorized_view():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.UpdateAuthorizedViewRequest(
+ )
+
+ # Make the request
+ operation = client.update_authorized_view(request=request)
+
+ print("Waiting for operation to complete...")
+
+ response = (await operation).result()
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.UpdateAuthorizedViewRequest, dict]]):
+ The request object. The request for
+ [UpdateAuthorizedView][google.bigtable.admin.v2.BigtableTableAdmin.UpdateAuthorizedView].
+ authorized_view (:class:`google.cloud.bigtable_admin_v2.types.AuthorizedView`):
+ Required. The AuthorizedView to update. The ``name`` in
+ ``authorized_view`` is used to identify the
+ AuthorizedView. AuthorizedView name must in this format:
+ ``projects/{project}/instances/{instance}/tables/{table}/authorizedViews/{authorized_view}``.
+
+ This corresponds to the ``authorized_view`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
+ Optional. The list of fields to update. A mask
+ specifying which fields in the AuthorizedView resource
+ should be updated. This mask is relative to the
+ AuthorizedView resource, not to the request message. A
+ field will be overwritten if it is in the mask. If
+ empty, all fields set in the request will be
+ overwritten. A special value ``*`` means to overwrite
+ all fields (including fields not set in the request).
+
+ This corresponds to the ``update_mask`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.api_core.operation_async.AsyncOperation:
+ An object representing a long-running operation.
+
+ The result type for the operation will be :class:`google.cloud.bigtable_admin_v2.types.AuthorizedView` AuthorizedViews represent subsets of a particular Cloud Bigtable table. Users
+ can configure access to each Authorized View
+ independently from the table and use the existing
+ Data APIs to access the subset of data.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [authorized_view, update_mask]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.UpdateAuthorizedViewRequest):
+ request = bigtable_table_admin.UpdateAuthorizedViewRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if authorized_view is not None:
+ request.authorized_view = authorized_view
+ if update_mask is not None:
+ request.update_mask = update_mask
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.update_authorized_view
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata(
+ (("authorized_view.name", request.authorized_view.name),)
+ ),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Wrap the response in an operation future.
+ response = operation_async.from_gapic(
+ response,
+ self._client._transport.operations_client,
+ table.AuthorizedView,
+ metadata_type=bigtable_table_admin.UpdateAuthorizedViewMetadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def delete_authorized_view(
+ self,
+ request: Optional[
+ Union[bigtable_table_admin.DeleteAuthorizedViewRequest, dict]
+ ] = None,
+ *,
+ name: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> None:
+ r"""Permanently deletes a specified AuthorizedView.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_delete_authorized_view():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.DeleteAuthorizedViewRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ await client.delete_authorized_view(request=request)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.DeleteAuthorizedViewRequest, dict]]):
+ The request object. Request message for
+ [google.bigtable.admin.v2.BigtableTableAdmin.DeleteAuthorizedView][google.bigtable.admin.v2.BigtableTableAdmin.DeleteAuthorizedView]
+ name (:class:`str`):
+ Required. The unique name of the AuthorizedView to be
+ deleted. Values are of the form
+ ``projects/{project}/instances/{instance}/tables/{table}/authorizedViews/{authorized_view}``.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.DeleteAuthorizedViewRequest):
+ request = bigtable_table_admin.DeleteAuthorizedViewRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.delete_authorized_view
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ async def modify_column_families(
+ self,
+ request: Optional[
+ Union[bigtable_table_admin.ModifyColumnFamiliesRequest, dict]
+ ] = None,
+ *,
+ name: Optional[str] = None,
+ modifications: Optional[
+ MutableSequence[
+ bigtable_table_admin.ModifyColumnFamiliesRequest.Modification
+ ]
+ ] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> table.Table:
+ r"""Performs a series of column family modifications on
+ the specified table. Either all or none of the
+ modifications will occur before this method returns, but
+ data requests received prior to that point may see a
+ table where only some modifications have taken effect.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_modify_column_families():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.ModifyColumnFamiliesRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = await client.modify_column_families(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.ModifyColumnFamiliesRequest, dict]]):
+ The request object. Request message for
+ [google.bigtable.admin.v2.BigtableTableAdmin.ModifyColumnFamilies][google.bigtable.admin.v2.BigtableTableAdmin.ModifyColumnFamilies]
+ name (:class:`str`):
+ Required. The unique name of the table whose families
+ should be modified. Values are of the form
+ ``projects/{project}/instances/{instance}/tables/{table}``.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ modifications (:class:`MutableSequence[google.cloud.bigtable_admin_v2.types.ModifyColumnFamiliesRequest.Modification]`):
+ Required. Modifications to be
+ atomically applied to the specified
+ table's families. Entries are applied in
+ order, meaning that earlier
+ modifications can be masked by later
+ ones (in the case of repeated updates to
+ the same family, for example).
+
+ This corresponds to the ``modifications`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.types.Table:
+ A collection of user data indexed by
+ row, column, and timestamp. Each table
+ is served using the resources of its
+ parent cluster.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name, modifications]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.ModifyColumnFamiliesRequest):
+ request = bigtable_table_admin.ModifyColumnFamiliesRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+ if modifications:
+ request.modifications.extend(modifications)
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.modify_column_families
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def drop_row_range(
+ self,
+ request: Optional[Union[bigtable_table_admin.DropRowRangeRequest, dict]] = None,
+ *,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> None:
+ r"""Permanently drop/delete a row range from a specified
+ table. The request can specify whether to delete all
+ rows in a table, or only those that match a particular
+ prefix.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_drop_row_range():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.DropRowRangeRequest(
+ row_key_prefix=b'row_key_prefix_blob',
+ name="name_value",
+ )
+
+ # Make the request
+ await client.drop_row_range(request=request)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.DropRowRangeRequest, dict]]):
+ The request object. Request message for
+ [google.bigtable.admin.v2.BigtableTableAdmin.DropRowRange][google.bigtable.admin.v2.BigtableTableAdmin.DropRowRange]
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+ """
+ # Create or coerce a protobuf request object.
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.DropRowRangeRequest):
+ request = bigtable_table_admin.DropRowRangeRequest(request)
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.drop_row_range
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ async def generate_consistency_token(
+ self,
+ request: Optional[
+ Union[bigtable_table_admin.GenerateConsistencyTokenRequest, dict]
+ ] = None,
+ *,
+ name: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> bigtable_table_admin.GenerateConsistencyTokenResponse:
+ r"""Generates a consistency token for a Table, which can
+ be used in CheckConsistency to check whether mutations
+ to the table that finished before this call started have
+ been replicated. The tokens will be available for 90
+ days.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_generate_consistency_token():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.GenerateConsistencyTokenRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = await client.generate_consistency_token(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.GenerateConsistencyTokenRequest, dict]]):
+ The request object. Request message for
+ [google.bigtable.admin.v2.BigtableTableAdmin.GenerateConsistencyToken][google.bigtable.admin.v2.BigtableTableAdmin.GenerateConsistencyToken]
+ name (:class:`str`):
+ Required. The unique name of the Table for which to
+ create a consistency token. Values are of the form
+ ``projects/{project}/instances/{instance}/tables/{table}``.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.types.GenerateConsistencyTokenResponse:
+ Response message for
+ [google.bigtable.admin.v2.BigtableTableAdmin.GenerateConsistencyToken][google.bigtable.admin.v2.BigtableTableAdmin.GenerateConsistencyToken]
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(
+ request, bigtable_table_admin.GenerateConsistencyTokenRequest
+ ):
+ request = bigtable_table_admin.GenerateConsistencyTokenRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.generate_consistency_token
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def check_consistency(
+ self,
+ request: Optional[
+ Union[bigtable_table_admin.CheckConsistencyRequest, dict]
+ ] = None,
+ *,
+ name: Optional[str] = None,
+ consistency_token: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> bigtable_table_admin.CheckConsistencyResponse:
+ r"""Checks replication consistency based on a consistency
+ token, that is, if replication has caught up based on
+ the conditions specified in the token and the check
+ request.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_check_consistency():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.CheckConsistencyRequest(
+ name="name_value",
+ consistency_token="consistency_token_value",
+ )
+
+ # Make the request
+ response = await client.check_consistency(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.CheckConsistencyRequest, dict]]):
+ The request object. Request message for
+ [google.bigtable.admin.v2.BigtableTableAdmin.CheckConsistency][google.bigtable.admin.v2.BigtableTableAdmin.CheckConsistency]
+ name (:class:`str`):
+ Required. The unique name of the Table for which to
+ check replication consistency. Values are of the form
+ ``projects/{project}/instances/{instance}/tables/{table}``.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ consistency_token (:class:`str`):
+ Required. The token created using
+ GenerateConsistencyToken for the Table.
+
+ This corresponds to the ``consistency_token`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.types.CheckConsistencyResponse:
+ Response message for
+ [google.bigtable.admin.v2.BigtableTableAdmin.CheckConsistency][google.bigtable.admin.v2.BigtableTableAdmin.CheckConsistency]
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name, consistency_token]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.CheckConsistencyRequest):
+ request = bigtable_table_admin.CheckConsistencyRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+ if consistency_token is not None:
+ request.consistency_token = consistency_token
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.check_consistency
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def snapshot_table(
+ self,
+ request: Optional[
+ Union[bigtable_table_admin.SnapshotTableRequest, dict]
+ ] = None,
+ *,
+ name: Optional[str] = None,
+ cluster: Optional[str] = None,
+ snapshot_id: Optional[str] = None,
+ description: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operation_async.AsyncOperation:
+ r"""Creates a new snapshot in the specified cluster from
+ the specified source table. The cluster and the table
+ must be in the same instance.
+
+ Note: This is a private alpha release of Cloud Bigtable
+ snapshots. This feature is not currently available to
+ most Cloud Bigtable customers. This feature might be
+ changed in backward-incompatible ways and is not
+ recommended for production use. It is not subject to any
+ SLA or deprecation policy.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_snapshot_table():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.SnapshotTableRequest(
+ name="name_value",
+ cluster="cluster_value",
+ snapshot_id="snapshot_id_value",
+ )
+
+ # Make the request
+ operation = client.snapshot_table(request=request)
+
+ print("Waiting for operation to complete...")
+
+ response = (await operation).result()
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.SnapshotTableRequest, dict]]):
+ The request object. Request message for
+ [google.bigtable.admin.v2.BigtableTableAdmin.SnapshotTable][google.bigtable.admin.v2.BigtableTableAdmin.SnapshotTable]
+
+ Note: This is a private alpha release of Cloud Bigtable
+ snapshots. This feature is not currently available to
+ most Cloud Bigtable customers. This feature might be
+ changed in backward-incompatible ways and is not
+ recommended for production use. It is not subject to any
+ SLA or deprecation policy.
+ name (:class:`str`):
+ Required. The unique name of the table to have the
+ snapshot taken. Values are of the form
+ ``projects/{project}/instances/{instance}/tables/{table}``.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ cluster (:class:`str`):
+ Required. The name of the cluster where the snapshot
+ will be created in. Values are of the form
+ ``projects/{project}/instances/{instance}/clusters/{cluster}``.
+
+ This corresponds to the ``cluster`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ snapshot_id (:class:`str`):
+ Required. The ID by which the new snapshot should be
+ referred to within the parent cluster, e.g.,
+ ``mysnapshot`` of the form:
+ ``[_a-zA-Z0-9][-_.a-zA-Z0-9]*`` rather than
+ ``projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/mysnapshot``.
+
+ This corresponds to the ``snapshot_id`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ description (:class:`str`):
+ Description of the snapshot.
+ This corresponds to the ``description`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.api_core.operation_async.AsyncOperation:
+ An object representing a long-running operation.
+
+ The result type for the operation will be :class:`google.cloud.bigtable_admin_v2.types.Snapshot` A snapshot of a table at a particular time. A snapshot can be used as a
+ checkpoint for data restoration or a data source for
+ a new table.
+
+ Note: This is a private alpha release of Cloud
+ Bigtable snapshots. This feature is not currently
+ available to most Cloud Bigtable customers. This
+ feature might be changed in backward-incompatible
+ ways and is not recommended for production use. It is
+ not subject to any SLA or deprecation policy.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name, cluster, snapshot_id, description]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.SnapshotTableRequest):
+ request = bigtable_table_admin.SnapshotTableRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+ if cluster is not None:
+ request.cluster = cluster
+ if snapshot_id is not None:
+ request.snapshot_id = snapshot_id
+ if description is not None:
+ request.description = description
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.snapshot_table
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Wrap the response in an operation future.
+ response = operation_async.from_gapic(
+ response,
+ self._client._transport.operations_client,
+ table.Snapshot,
+ metadata_type=bigtable_table_admin.SnapshotTableMetadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def get_snapshot(
+ self,
+ request: Optional[Union[bigtable_table_admin.GetSnapshotRequest, dict]] = None,
+ *,
+ name: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> table.Snapshot:
+ r"""Gets metadata information about the specified
+ snapshot.
+ Note: This is a private alpha release of Cloud Bigtable
+ snapshots. This feature is not currently available to
+ most Cloud Bigtable customers. This feature might be
+ changed in backward-incompatible ways and is not
+ recommended for production use. It is not subject to any
+ SLA or deprecation policy.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_get_snapshot():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.GetSnapshotRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = await client.get_snapshot(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.GetSnapshotRequest, dict]]):
+ The request object. Request message for
+ [google.bigtable.admin.v2.BigtableTableAdmin.GetSnapshot][google.bigtable.admin.v2.BigtableTableAdmin.GetSnapshot]
+
+ Note: This is a private alpha release of Cloud Bigtable
+ snapshots. This feature is not currently available to
+ most Cloud Bigtable customers. This feature might be
+ changed in backward-incompatible ways and is not
+ recommended for production use. It is not subject to any
+ SLA or deprecation policy.
+ name (:class:`str`):
+ Required. The unique name of the requested snapshot.
+ Values are of the form
+ ``projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}``.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.types.Snapshot:
+ A snapshot of a table at a particular
+ time. A snapshot can be used as a
+ checkpoint for data restoration or a
+ data source for a new table.
+
+ Note: This is a private alpha release of
+ Cloud Bigtable snapshots. This feature
+ is not currently available to most Cloud
+ Bigtable customers. This feature might
+ be changed in backward-incompatible ways
+ and is not recommended for production
+ use. It is not subject to any SLA or
+ deprecation policy.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.GetSnapshotRequest):
+ request = bigtable_table_admin.GetSnapshotRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.get_snapshot
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def list_snapshots(
+ self,
+ request: Optional[
+ Union[bigtable_table_admin.ListSnapshotsRequest, dict]
+ ] = None,
+ *,
+ parent: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> pagers.ListSnapshotsAsyncPager:
+ r"""Lists all snapshots associated with the specified
+ cluster.
+ Note: This is a private alpha release of Cloud Bigtable
+ snapshots. This feature is not currently available to
+ most Cloud Bigtable customers. This feature might be
+ changed in backward-incompatible ways and is not
+ recommended for production use. It is not subject to any
+ SLA or deprecation policy.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_list_snapshots():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.ListSnapshotsRequest(
+ parent="parent_value",
+ )
+
+ # Make the request
+ page_result = client.list_snapshots(request=request)
+
+ # Handle the response
+ async for response in page_result:
+ print(response)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.ListSnapshotsRequest, dict]]):
+ The request object. Request message for
+ [google.bigtable.admin.v2.BigtableTableAdmin.ListSnapshots][google.bigtable.admin.v2.BigtableTableAdmin.ListSnapshots]
+
+ Note: This is a private alpha release of Cloud Bigtable
+ snapshots. This feature is not currently available to
+ most Cloud Bigtable customers. This feature might be
+ changed in backward-incompatible ways and is not
+ recommended for production use. It is not subject to any
+ SLA or deprecation policy.
+ parent (:class:`str`):
+ Required. The unique name of the cluster for which
+ snapshots should be listed. Values are of the form
+ ``projects/{project}/instances/{instance}/clusters/{cluster}``.
+ Use ``{cluster} = '-'`` to list snapshots for all
+ clusters in an instance, e.g.,
+ ``projects/{project}/instances/{instance}/clusters/-``.
+
+ This corresponds to the ``parent`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.services.bigtable_table_admin.pagers.ListSnapshotsAsyncPager:
+ Response message for
+ [google.bigtable.admin.v2.BigtableTableAdmin.ListSnapshots][google.bigtable.admin.v2.BigtableTableAdmin.ListSnapshots]
+
+ Note: This is a private alpha release of Cloud
+ Bigtable snapshots. This feature is not currently
+ available to most Cloud Bigtable customers. This
+ feature might be changed in backward-incompatible
+ ways and is not recommended for production use. It is
+ not subject to any SLA or deprecation policy.
+
+ Iterating over this object will yield results and
+ resolve additional pages automatically.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [parent]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.ListSnapshotsRequest):
+ request = bigtable_table_admin.ListSnapshotsRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if parent is not None:
+ request.parent = parent
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.list_snapshots
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # This method is paged; wrap the response in a pager, which provides
+ # an `__aiter__` convenience method.
+ response = pagers.ListSnapshotsAsyncPager(
+ method=rpc,
+ request=request,
+ response=response,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def delete_snapshot(
+ self,
+ request: Optional[
+ Union[bigtable_table_admin.DeleteSnapshotRequest, dict]
+ ] = None,
+ *,
+ name: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> None:
+ r"""Permanently deletes the specified snapshot.
+
+ Note: This is a private alpha release of Cloud Bigtable
+ snapshots. This feature is not currently available to
+ most Cloud Bigtable customers. This feature might be
+ changed in backward-incompatible ways and is not
+ recommended for production use. It is not subject to any
+ SLA or deprecation policy.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_delete_snapshot():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.DeleteSnapshotRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ await client.delete_snapshot(request=request)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.DeleteSnapshotRequest, dict]]):
+ The request object. Request message for
+ [google.bigtable.admin.v2.BigtableTableAdmin.DeleteSnapshot][google.bigtable.admin.v2.BigtableTableAdmin.DeleteSnapshot]
+
+ Note: This is a private alpha release of Cloud Bigtable
+ snapshots. This feature is not currently available to
+ most Cloud Bigtable customers. This feature might be
+ changed in backward-incompatible ways and is not
+ recommended for production use. It is not subject to any
+ SLA or deprecation policy.
+ name (:class:`str`):
+ Required. The unique name of the snapshot to be deleted.
+ Values are of the form
+ ``projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}``.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.DeleteSnapshotRequest):
+ request = bigtable_table_admin.DeleteSnapshotRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.delete_snapshot
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ async def create_backup(
+ self,
+ request: Optional[Union[bigtable_table_admin.CreateBackupRequest, dict]] = None,
+ *,
+ parent: Optional[str] = None,
+ backup_id: Optional[str] = None,
+ backup: Optional[table.Backup] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operation_async.AsyncOperation:
+ r"""Starts creating a new Cloud Bigtable Backup. The returned backup
+ [long-running operation][google.longrunning.Operation] can be
+ used to track creation of the backup. The
+ [metadata][google.longrunning.Operation.metadata] field type is
+ [CreateBackupMetadata][google.bigtable.admin.v2.CreateBackupMetadata].
+ The [response][google.longrunning.Operation.response] field type
+ is [Backup][google.bigtable.admin.v2.Backup], if successful.
+ Cancelling the returned operation will stop the creation and
+ delete the backup.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_create_backup():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminAsyncClient()
+
+ # Initialize request argument(s)
+ backup = bigtable_admin_v2.Backup()
+ backup.source_table = "source_table_value"
+
+ request = bigtable_admin_v2.CreateBackupRequest(
+ parent="parent_value",
+ backup_id="backup_id_value",
+ backup=backup,
+ )
+
+ # Make the request
+ operation = client.create_backup(request=request)
+
+ print("Waiting for operation to complete...")
+
+ response = (await operation).result()
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.CreateBackupRequest, dict]]):
+ The request object. The request for
+ [CreateBackup][google.bigtable.admin.v2.BigtableTableAdmin.CreateBackup].
+ parent (:class:`str`):
+ Required. This must be one of the clusters in the
+ instance in which this table is located. The backup will
+ be stored in this cluster. Values are of the form
+ ``projects/{project}/instances/{instance}/clusters/{cluster}``.
+
+ This corresponds to the ``parent`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ backup_id (:class:`str`):
+ Required. The id of the backup to be created. The
+ ``backup_id`` along with the parent ``parent`` are
+ combined as {parent}/backups/{backup_id} to create the
+ full backup name, of the form:
+ ``projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup_id}``.
+ This string must be between 1 and 50 characters in
+ length and match the regex [*a-zA-Z0-9][-*.a-zA-Z0-9]\*.
+
+ This corresponds to the ``backup_id`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ backup (:class:`google.cloud.bigtable_admin_v2.types.Backup`):
+ Required. The backup to create.
+ This corresponds to the ``backup`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.api_core.operation_async.AsyncOperation:
+ An object representing a long-running operation.
+
+ The result type for the operation will be
+ :class:`google.cloud.bigtable_admin_v2.types.Backup` A
+ backup of a Cloud Bigtable table.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [parent, backup_id, backup]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.CreateBackupRequest):
+ request = bigtable_table_admin.CreateBackupRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if parent is not None:
+ request.parent = parent
+ if backup_id is not None:
+ request.backup_id = backup_id
+ if backup is not None:
+ request.backup = backup
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.create_backup
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Wrap the response in an operation future.
+ response = operation_async.from_gapic(
+ response,
+ self._client._transport.operations_client,
+ table.Backup,
+ metadata_type=bigtable_table_admin.CreateBackupMetadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def get_backup(
+ self,
+ request: Optional[Union[bigtable_table_admin.GetBackupRequest, dict]] = None,
+ *,
+ name: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> table.Backup:
+ r"""Gets metadata on a pending or completed Cloud
+ Bigtable Backup.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_get_backup():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.GetBackupRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = await client.get_backup(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.GetBackupRequest, dict]]):
+ The request object. The request for
+ [GetBackup][google.bigtable.admin.v2.BigtableTableAdmin.GetBackup].
+ name (:class:`str`):
+ Required. Name of the backup. Values are of the form
+ ``projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}``.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.types.Backup:
+ A backup of a Cloud Bigtable table.
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.GetBackupRequest):
+ request = bigtable_table_admin.GetBackupRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.get_backup
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def update_backup(
+ self,
+ request: Optional[Union[bigtable_table_admin.UpdateBackupRequest, dict]] = None,
+ *,
+ backup: Optional[table.Backup] = None,
+ update_mask: Optional[field_mask_pb2.FieldMask] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> table.Backup:
+ r"""Updates a pending or completed Cloud Bigtable Backup.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_update_backup():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminAsyncClient()
+
+ # Initialize request argument(s)
+ backup = bigtable_admin_v2.Backup()
+ backup.source_table = "source_table_value"
+
+ request = bigtable_admin_v2.UpdateBackupRequest(
+ backup=backup,
+ )
+
+ # Make the request
+ response = await client.update_backup(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.UpdateBackupRequest, dict]]):
+ The request object. The request for
+ [UpdateBackup][google.bigtable.admin.v2.BigtableTableAdmin.UpdateBackup].
+ backup (:class:`google.cloud.bigtable_admin_v2.types.Backup`):
+ Required. The backup to update. ``backup.name``, and the
+ fields to be updated as specified by ``update_mask`` are
+ required. Other fields are ignored. Update is only
+ supported for the following fields:
+
+ - ``backup.expire_time``.
+
+ This corresponds to the ``backup`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
+ Required. A mask specifying which fields (e.g.
+ ``expire_time``) in the Backup resource should be
+ updated. This mask is relative to the Backup resource,
+ not to the request message. The field mask must always
+ be specified; this prevents any future fields from being
+ erased accidentally by clients that do not know about
+ them.
+
+ This corresponds to the ``update_mask`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.types.Backup:
+ A backup of a Cloud Bigtable table.
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [backup, update_mask]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.UpdateBackupRequest):
+ request = bigtable_table_admin.UpdateBackupRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if backup is not None:
+ request.backup = backup
+ if update_mask is not None:
+ request.update_mask = update_mask
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.update_backup
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata(
+ (("backup.name", request.backup.name),)
+ ),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def delete_backup(
+ self,
+ request: Optional[Union[bigtable_table_admin.DeleteBackupRequest, dict]] = None,
+ *,
+ name: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> None:
+ r"""Deletes a pending or completed Cloud Bigtable backup.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_delete_backup():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.DeleteBackupRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ await client.delete_backup(request=request)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.DeleteBackupRequest, dict]]):
+ The request object. The request for
+ [DeleteBackup][google.bigtable.admin.v2.BigtableTableAdmin.DeleteBackup].
+ name (:class:`str`):
+ Required. Name of the backup to delete. Values are of
+ the form
+ ``projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}``.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.DeleteBackupRequest):
+ request = bigtable_table_admin.DeleteBackupRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.delete_backup
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ async def list_backups(
+ self,
+ request: Optional[Union[bigtable_table_admin.ListBackupsRequest, dict]] = None,
+ *,
+ parent: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> pagers.ListBackupsAsyncPager:
+ r"""Lists Cloud Bigtable backups. Returns both completed
+ and pending backups.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_list_backups():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.ListBackupsRequest(
+ parent="parent_value",
+ )
+
+ # Make the request
+ page_result = client.list_backups(request=request)
+
+ # Handle the response
+ async for response in page_result:
+ print(response)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.ListBackupsRequest, dict]]):
+ The request object. The request for
+ [ListBackups][google.bigtable.admin.v2.BigtableTableAdmin.ListBackups].
+ parent (:class:`str`):
+ Required. The cluster to list backups from. Values are
+ of the form
+ ``projects/{project}/instances/{instance}/clusters/{cluster}``.
+ Use ``{cluster} = '-'`` to list backups for all clusters
+ in an instance, e.g.,
+ ``projects/{project}/instances/{instance}/clusters/-``.
+
+ This corresponds to the ``parent`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.services.bigtable_table_admin.pagers.ListBackupsAsyncPager:
+ The response for
+ [ListBackups][google.bigtable.admin.v2.BigtableTableAdmin.ListBackups].
+
+ Iterating over this object will yield results and
+ resolve additional pages automatically.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [parent]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.ListBackupsRequest):
+ request = bigtable_table_admin.ListBackupsRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if parent is not None:
+ request.parent = parent
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.list_backups
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # This method is paged; wrap the response in a pager, which provides
+ # an `__aiter__` convenience method.
+ response = pagers.ListBackupsAsyncPager(
+ method=rpc,
+ request=request,
+ response=response,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def _restore_table(
+ self,
+ request: Optional[Union[bigtable_table_admin.RestoreTableRequest, dict]] = None,
+ *,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operation_async.AsyncOperation:
+ r"""Create a new table by restoring from a completed backup. The
+ returned table [long-running
+ operation][google.longrunning.Operation] can be used to track
+ the progress of the operation, and to cancel it. The
+ [metadata][google.longrunning.Operation.metadata] field type is
+ [RestoreTableMetadata][google.bigtable.admin.v2.RestoreTableMetadata].
+ The [response][google.longrunning.Operation.response] type is
+ [Table][google.bigtable.admin.v2.Table], if successful.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_restore_table():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.RestoreTableRequest(
+ backup="backup_value",
+ parent="parent_value",
+ table_id="table_id_value",
+ )
+
+ # Make the request
+ operation = client._restore_table(request=request)
+
+ print("Waiting for operation to complete...")
+
+ response = (await operation).result()
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.RestoreTableRequest, dict]]):
+ The request object. The request for
+ [RestoreTable][google.bigtable.admin.v2.BigtableTableAdmin.RestoreTable].
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.api_core.operation_async.AsyncOperation:
+ An object representing a long-running operation.
+
+ The result type for the operation will be :class:`google.cloud.bigtable_admin_v2.types.Table` A collection of user data indexed by row, column, and timestamp.
+ Each table is served using the resources of its
+ parent cluster.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.RestoreTableRequest):
+ request = bigtable_table_admin.RestoreTableRequest(request)
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.restore_table
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Wrap the response in an operation future.
+ response = operation_async.from_gapic(
+ response,
+ self._client._transport.operations_client,
+ table.Table,
+ metadata_type=bigtable_table_admin.RestoreTableMetadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def copy_backup(
+ self,
+ request: Optional[Union[bigtable_table_admin.CopyBackupRequest, dict]] = None,
+ *,
+ parent: Optional[str] = None,
+ backup_id: Optional[str] = None,
+ source_backup: Optional[str] = None,
+ expire_time: Optional[timestamp_pb2.Timestamp] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operation_async.AsyncOperation:
+ r"""Copy a Cloud Bigtable backup to a new backup in the
+ destination cluster located in the destination instance
+ and project.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_copy_backup():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.CopyBackupRequest(
+ parent="parent_value",
+ backup_id="backup_id_value",
+ source_backup="source_backup_value",
+ )
+
+ # Make the request
+ operation = client.copy_backup(request=request)
+
+ print("Waiting for operation to complete...")
+
+ response = (await operation).result()
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.CopyBackupRequest, dict]]):
+ The request object. The request for
+ [CopyBackup][google.bigtable.admin.v2.BigtableTableAdmin.CopyBackup].
+ parent (:class:`str`):
+ Required. The name of the destination cluster that will
+ contain the backup copy. The cluster must already exist.
+ Values are of the form:
+ ``projects/{project}/instances/{instance}/clusters/{cluster}``.
+
+ This corresponds to the ``parent`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ backup_id (:class:`str`):
+ Required. The id of the new backup. The ``backup_id``
+ along with ``parent`` are combined as
+ {parent}/backups/{backup_id} to create the full backup
+ name, of the form:
+ ``projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup_id}``.
+ This string must be between 1 and 50 characters in
+ length and match the regex [*a-zA-Z0-9][-*.a-zA-Z0-9]\*.
+
+ This corresponds to the ``backup_id`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ source_backup (:class:`str`):
+ Required. The source backup to be copied from. The
+ source backup needs to be in READY state for it to be
+ copied. Copying a copied backup is not allowed. Once
+ CopyBackup is in progress, the source backup cannot be
+ deleted or cleaned up on expiration until CopyBackup is
+ finished. Values are of the form:
+ ``projects//instances//clusters//backups/``.
+
+ This corresponds to the ``source_backup`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ expire_time (:class:`google.protobuf.timestamp_pb2.Timestamp`):
+ Required. Required. The expiration time of the copied
+ backup with microsecond granularity that must be at
+ least 6 hours and at most 30 days from the time the
+ request is received. Once the ``expire_time`` has
+ passed, Cloud Bigtable will delete the backup and free
+ the resources used by the backup.
+
+ This corresponds to the ``expire_time`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.api_core.operation_async.AsyncOperation:
+ An object representing a long-running operation.
+
+ The result type for the operation will be
+ :class:`google.cloud.bigtable_admin_v2.types.Backup` A
+ backup of a Cloud Bigtable table.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [parent, backup_id, source_backup, expire_time]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.CopyBackupRequest):
+ request = bigtable_table_admin.CopyBackupRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if parent is not None:
+ request.parent = parent
+ if backup_id is not None:
+ request.backup_id = backup_id
+ if source_backup is not None:
+ request.source_backup = source_backup
+ if expire_time is not None:
+ request.expire_time = expire_time
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.copy_backup
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Wrap the response in an operation future.
+ response = operation_async.from_gapic(
+ response,
+ self._client._transport.operations_client,
+ table.Backup,
+ metadata_type=bigtable_table_admin.CopyBackupMetadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def get_iam_policy(
+ self,
+ request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None,
+ *,
+ resource: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> policy_pb2.Policy:
+ r"""Gets the access control policy for a Bigtable
+ resource. Returns an empty policy if the resource exists
+ but does not have a policy set.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+ from google.iam.v1 import iam_policy_pb2 # type: ignore
+
+ async def sample_get_iam_policy():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = iam_policy_pb2.GetIamPolicyRequest(
+ resource="resource_value",
+ )
+
+ # Make the request
+ response = await client.get_iam_policy(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Optional[Union[google.iam.v1.iam_policy_pb2.GetIamPolicyRequest, dict]]):
+ The request object. Request message for ``GetIamPolicy`` method.
+ resource (:class:`str`):
+ REQUIRED: The resource for which the
+ policy is being requested. See the
+ operation documentation for the
+ appropriate value for this field.
+
+ This corresponds to the ``resource`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.iam.v1.policy_pb2.Policy:
+ An Identity and Access Management (IAM) policy, which specifies access
+ controls for Google Cloud resources.
+
+ A Policy is a collection of bindings. A binding binds
+ one or more members, or principals, to a single role.
+ Principals can be user accounts, service accounts,
+ Google groups, and domains (such as G Suite). A role
+ is a named list of permissions; each role can be an
+ IAM predefined role or a user-created custom role.
+
+ For some types of Google Cloud resources, a binding
+ can also specify a condition, which is a logical
+ expression that allows access to a resource only if
+ the expression evaluates to true. A condition can add
+ constraints based on attributes of the request, the
+ resource, or both. To learn which resources support
+ conditions in their IAM policies, see the [IAM
+ documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
+
+ **JSON example:**
+
+ :literal:`` { "bindings": [ { "role": "roles/resourcemanager.organizationAdmin", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-project-id@appspot.gserviceaccount.com" ] }, { "role": "roles/resourcemanager.organizationViewer", "members": [ "user:eve@example.com" ], "condition": { "title": "expirable access", "description": "Does not grant access after Sep 2020", "expression": "request.time < timestamp('2020-10-01T00:00:00.000Z')", } } ], "etag": "BwWWja0YfJA=", "version": 3 }`\ \`
+
+ **YAML example:**
+
+ :literal:`` bindings: - members: - user:mike@example.com - group:admins@example.com - domain:google.com - serviceAccount:my-project-id@appspot.gserviceaccount.com role: roles/resourcemanager.organizationAdmin - members: - user:eve@example.com role: roles/resourcemanager.organizationViewer condition: title: expirable access description: Does not grant access after Sep 2020 expression: request.time < timestamp('2020-10-01T00:00:00.000Z') etag: BwWWja0YfJA= version: 3`\ \`
+
+ For a description of IAM and its features, see the
+ [IAM
+ documentation](https://cloud.google.com/iam/docs/).
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [resource]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - The request isn't a proto-plus wrapped type,
+ # so it must be constructed via keyword expansion.
+ if isinstance(request, dict):
+ request = iam_policy_pb2.GetIamPolicyRequest(**request)
+ elif not request:
+ request = iam_policy_pb2.GetIamPolicyRequest(resource=resource)
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.get_iam_policy
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def set_iam_policy(
+ self,
+ request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None,
+ *,
+ resource: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> policy_pb2.Policy:
+ r"""Sets the access control policy on a Bigtable
+ resource. Replaces any existing policy.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+ from google.iam.v1 import iam_policy_pb2 # type: ignore
+
+ async def sample_set_iam_policy():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = iam_policy_pb2.SetIamPolicyRequest(
+ resource="resource_value",
+ )
+
+ # Make the request
+ response = await client.set_iam_policy(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Optional[Union[google.iam.v1.iam_policy_pb2.SetIamPolicyRequest, dict]]):
+ The request object. Request message for ``SetIamPolicy`` method.
+ resource (:class:`str`):
+ REQUIRED: The resource for which the
+ policy is being specified. See the
+ operation documentation for the
+ appropriate value for this field.
+
+ This corresponds to the ``resource`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.iam.v1.policy_pb2.Policy:
+ An Identity and Access Management (IAM) policy, which specifies access
+ controls for Google Cloud resources.
+
+ A Policy is a collection of bindings. A binding binds
+ one or more members, or principals, to a single role.
+ Principals can be user accounts, service accounts,
+ Google groups, and domains (such as G Suite). A role
+ is a named list of permissions; each role can be an
+ IAM predefined role or a user-created custom role.
+
+ For some types of Google Cloud resources, a binding
+ can also specify a condition, which is a logical
+ expression that allows access to a resource only if
+ the expression evaluates to true. A condition can add
+ constraints based on attributes of the request, the
+ resource, or both. To learn which resources support
+ conditions in their IAM policies, see the [IAM
+ documentation](https://cloud.google.com/iam/help/conditions/resource-policies).
+
+ **JSON example:**
+
+ :literal:`` { "bindings": [ { "role": "roles/resourcemanager.organizationAdmin", "members": [ "user:mike@example.com", "group:admins@example.com", "domain:google.com", "serviceAccount:my-project-id@appspot.gserviceaccount.com" ] }, { "role": "roles/resourcemanager.organizationViewer", "members": [ "user:eve@example.com" ], "condition": { "title": "expirable access", "description": "Does not grant access after Sep 2020", "expression": "request.time < timestamp('2020-10-01T00:00:00.000Z')", } } ], "etag": "BwWWja0YfJA=", "version": 3 }`\ \`
+
+ **YAML example:**
+
+ :literal:`` bindings: - members: - user:mike@example.com - group:admins@example.com - domain:google.com - serviceAccount:my-project-id@appspot.gserviceaccount.com role: roles/resourcemanager.organizationAdmin - members: - user:eve@example.com role: roles/resourcemanager.organizationViewer condition: title: expirable access description: Does not grant access after Sep 2020 expression: request.time < timestamp('2020-10-01T00:00:00.000Z') etag: BwWWja0YfJA= version: 3`\ \`
+
+ For a description of IAM and its features, see the
+ [IAM
+ documentation](https://cloud.google.com/iam/docs/).
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [resource]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - The request isn't a proto-plus wrapped type,
+ # so it must be constructed via keyword expansion.
+ if isinstance(request, dict):
+ request = iam_policy_pb2.SetIamPolicyRequest(**request)
+ elif not request:
+ request = iam_policy_pb2.SetIamPolicyRequest(resource=resource)
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.set_iam_policy
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def test_iam_permissions(
+ self,
+ request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None,
+ *,
+ resource: Optional[str] = None,
+ permissions: Optional[MutableSequence[str]] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> iam_policy_pb2.TestIamPermissionsResponse:
+ r"""Returns permissions that the caller has on the
+ specified Bigtable resource.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+ from google.iam.v1 import iam_policy_pb2 # type: ignore
+
+ async def sample_test_iam_permissions():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = iam_policy_pb2.TestIamPermissionsRequest(
+ resource="resource_value",
+ permissions=['permissions_value1', 'permissions_value2'],
+ )
+
+ # Make the request
+ response = await client.test_iam_permissions(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Optional[Union[google.iam.v1.iam_policy_pb2.TestIamPermissionsRequest, dict]]):
+ The request object. Request message for ``TestIamPermissions`` method.
+ resource (:class:`str`):
+ REQUIRED: The resource for which the
+ policy detail is being requested. See
+ the operation documentation for the
+ appropriate value for this field.
+
+ This corresponds to the ``resource`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ permissions (:class:`MutableSequence[str]`):
+ The set of permissions to check for the ``resource``.
+ Permissions with wildcards (such as '*' or 'storage.*')
+ are not allowed. For more information see `IAM
+ Overview `__.
+
+ This corresponds to the ``permissions`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.iam.v1.iam_policy_pb2.TestIamPermissionsResponse:
+ Response message for TestIamPermissions method.
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [resource, permissions]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - The request isn't a proto-plus wrapped type,
+ # so it must be constructed via keyword expansion.
+ if isinstance(request, dict):
+ request = iam_policy_pb2.TestIamPermissionsRequest(**request)
+ elif not request:
+ request = iam_policy_pb2.TestIamPermissionsRequest(
+ resource=resource, permissions=permissions
+ )
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.test_iam_permissions
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("resource", request.resource),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def create_schema_bundle(
+ self,
+ request: Optional[
+ Union[bigtable_table_admin.CreateSchemaBundleRequest, dict]
+ ] = None,
+ *,
+ parent: Optional[str] = None,
+ schema_bundle_id: Optional[str] = None,
+ schema_bundle: Optional[table.SchemaBundle] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operation_async.AsyncOperation:
+ r"""Creates a new schema bundle in the specified table.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_create_schema_bundle():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminAsyncClient()
+
+ # Initialize request argument(s)
+ schema_bundle = bigtable_admin_v2.SchemaBundle()
+ schema_bundle.proto_schema.proto_descriptors = b'proto_descriptors_blob'
+
+ request = bigtable_admin_v2.CreateSchemaBundleRequest(
+ parent="parent_value",
+ schema_bundle_id="schema_bundle_id_value",
+ schema_bundle=schema_bundle,
+ )
+
+ # Make the request
+ operation = client.create_schema_bundle(request=request)
+
+ print("Waiting for operation to complete...")
+
+ response = (await operation).result()
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.CreateSchemaBundleRequest, dict]]):
+ The request object. The request for
+ [CreateSchemaBundle][google.bigtable.admin.v2.BigtableTableAdmin.CreateSchemaBundle].
+ parent (:class:`str`):
+ Required. The parent resource where this schema bundle
+ will be created. Values are of the form
+ ``projects/{project}/instances/{instance}/tables/{table}``.
+
+ This corresponds to the ``parent`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ schema_bundle_id (:class:`str`):
+ Required. The unique ID to use for
+ the schema bundle, which will become the
+ final component of the schema bundle's
+ resource name.
+
+ This corresponds to the ``schema_bundle_id`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ schema_bundle (:class:`google.cloud.bigtable_admin_v2.types.SchemaBundle`):
+ Required. The schema bundle to
+ create.
+
+ This corresponds to the ``schema_bundle`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.api_core.operation_async.AsyncOperation:
+ An object representing a long-running operation.
+
+ The result type for the operation will be
+ :class:`google.cloud.bigtable_admin_v2.types.SchemaBundle`
+ A named collection of related schemas.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [parent, schema_bundle_id, schema_bundle]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.CreateSchemaBundleRequest):
+ request = bigtable_table_admin.CreateSchemaBundleRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if parent is not None:
+ request.parent = parent
+ if schema_bundle_id is not None:
+ request.schema_bundle_id = schema_bundle_id
+ if schema_bundle is not None:
+ request.schema_bundle = schema_bundle
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.create_schema_bundle
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Wrap the response in an operation future.
+ response = operation_async.from_gapic(
+ response,
+ self._client._transport.operations_client,
+ table.SchemaBundle,
+ metadata_type=bigtable_table_admin.CreateSchemaBundleMetadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def update_schema_bundle(
+ self,
+ request: Optional[
+ Union[bigtable_table_admin.UpdateSchemaBundleRequest, dict]
+ ] = None,
+ *,
+ schema_bundle: Optional[table.SchemaBundle] = None,
+ update_mask: Optional[field_mask_pb2.FieldMask] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operation_async.AsyncOperation:
+ r"""Updates a schema bundle in the specified table.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_update_schema_bundle():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminAsyncClient()
+
+ # Initialize request argument(s)
+ schema_bundle = bigtable_admin_v2.SchemaBundle()
+ schema_bundle.proto_schema.proto_descriptors = b'proto_descriptors_blob'
+
+ request = bigtable_admin_v2.UpdateSchemaBundleRequest(
+ schema_bundle=schema_bundle,
+ )
+
+ # Make the request
+ operation = client.update_schema_bundle(request=request)
+
+ print("Waiting for operation to complete...")
+
+ response = (await operation).result()
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.UpdateSchemaBundleRequest, dict]]):
+ The request object. The request for
+ [UpdateSchemaBundle][google.bigtable.admin.v2.BigtableTableAdmin.UpdateSchemaBundle].
+ schema_bundle (:class:`google.cloud.bigtable_admin_v2.types.SchemaBundle`):
+ Required. The schema bundle to update.
+
+ The schema bundle's ``name`` field is used to identify
+ the schema bundle to update. Values are of the form
+ ``projects/{project}/instances/{instance}/tables/{table}/schemaBundles/{schema_bundle}``
+
+ This corresponds to the ``schema_bundle`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`):
+ Optional. The list of fields to
+ update.
+
+ This corresponds to the ``update_mask`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.api_core.operation_async.AsyncOperation:
+ An object representing a long-running operation.
+
+ The result type for the operation will be
+ :class:`google.cloud.bigtable_admin_v2.types.SchemaBundle`
+ A named collection of related schemas.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [schema_bundle, update_mask]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.UpdateSchemaBundleRequest):
+ request = bigtable_table_admin.UpdateSchemaBundleRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if schema_bundle is not None:
+ request.schema_bundle = schema_bundle
+ if update_mask is not None:
+ request.update_mask = update_mask
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.update_schema_bundle
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata(
+ (("schema_bundle.name", request.schema_bundle.name),)
+ ),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Wrap the response in an operation future.
+ response = operation_async.from_gapic(
+ response,
+ self._client._transport.operations_client,
+ table.SchemaBundle,
+ metadata_type=bigtable_table_admin.UpdateSchemaBundleMetadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def get_schema_bundle(
+ self,
+ request: Optional[
+ Union[bigtable_table_admin.GetSchemaBundleRequest, dict]
+ ] = None,
+ *,
+ name: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> table.SchemaBundle:
+ r"""Gets metadata information about the specified schema
+ bundle.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_get_schema_bundle():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.GetSchemaBundleRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = await client.get_schema_bundle(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.GetSchemaBundleRequest, dict]]):
+ The request object. The request for
+ [GetSchemaBundle][google.bigtable.admin.v2.BigtableTableAdmin.GetSchemaBundle].
+ name (:class:`str`):
+ Required. The unique name of the schema bundle to
+ retrieve. Values are of the form
+ ``projects/{project}/instances/{instance}/tables/{table}/schemaBundles/{schema_bundle}``
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.types.SchemaBundle:
+ A named collection of related
+ schemas.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.GetSchemaBundleRequest):
+ request = bigtable_table_admin.GetSchemaBundleRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.get_schema_bundle
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def list_schema_bundles(
+ self,
+ request: Optional[
+ Union[bigtable_table_admin.ListSchemaBundlesRequest, dict]
+ ] = None,
+ *,
+ parent: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> pagers.ListSchemaBundlesAsyncPager:
+ r"""Lists all schema bundles associated with the
+ specified table.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_list_schema_bundles():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.ListSchemaBundlesRequest(
+ parent="parent_value",
+ )
+
+ # Make the request
+ page_result = client.list_schema_bundles(request=request)
+
+ # Handle the response
+ async for response in page_result:
+ print(response)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.ListSchemaBundlesRequest, dict]]):
+ The request object. The request for
+ [ListSchemaBundles][google.bigtable.admin.v2.BigtableTableAdmin.ListSchemaBundles].
+ parent (:class:`str`):
+ Required. The parent, which owns this collection of
+ schema bundles. Values are of the form
+ ``projects/{project}/instances/{instance}/tables/{table}``.
+
+ This corresponds to the ``parent`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.services.bigtable_table_admin.pagers.ListSchemaBundlesAsyncPager:
+ The response for
+ [ListSchemaBundles][google.bigtable.admin.v2.BigtableTableAdmin.ListSchemaBundles].
+
+ Iterating over this object will yield results and
+ resolve additional pages automatically.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [parent]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.ListSchemaBundlesRequest):
+ request = bigtable_table_admin.ListSchemaBundlesRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if parent is not None:
+ request.parent = parent
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.list_schema_bundles
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ response = await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # This method is paged; wrap the response in a pager, which provides
+ # an `__aiter__` convenience method.
+ response = pagers.ListSchemaBundlesAsyncPager(
+ method=rpc,
+ request=request,
+ response=response,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ async def delete_schema_bundle(
+ self,
+ request: Optional[
+ Union[bigtable_table_admin.DeleteSchemaBundleRequest, dict]
+ ] = None,
+ *,
+ name: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> None:
+ r"""Deletes a schema bundle in the specified table.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ async def sample_delete_schema_bundle():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminAsyncClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.DeleteSchemaBundleRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ await client.delete_schema_bundle(request=request)
+
+ Args:
+ request (Optional[Union[google.cloud.bigtable_admin_v2.types.DeleteSchemaBundleRequest, dict]]):
+ The request object. The request for
+ [DeleteSchemaBundle][google.bigtable.admin.v2.BigtableTableAdmin.DeleteSchemaBundle].
+ name (:class:`str`):
+ Required. The unique name of the schema bundle to
+ delete. Values are of the form
+ ``projects/{project}/instances/{instance}/tables/{table}/schemaBundles/{schema_bundle}``
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.DeleteSchemaBundleRequest):
+ request = bigtable_table_admin.DeleteSchemaBundleRequest(request)
+
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._client._transport._wrapped_methods[
+ self._client._transport.delete_schema_bundle
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._client._validate_universe_domain()
+
+ # Send the request.
+ await rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ async def __aenter__(self) -> "BaseBigtableTableAdminAsyncClient":
+ return self
+
+ async def __aexit__(self, exc_type, exc, tb):
+ await self.transport.close()
+
+
+DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
+ gapic_version=package_version.__version__
+)
+
+if hasattr(DEFAULT_CLIENT_INFO, "protobuf_runtime_version"): # pragma: NO COVER
+ DEFAULT_CLIENT_INFO.protobuf_runtime_version = google.protobuf.__version__
+
+
+__all__ = ("BaseBigtableTableAdminAsyncClient",)
diff --git a/google/cloud/bigtable_admin_v2/services/bigtable_table_admin/client.py b/google/cloud/bigtable_admin_v2/services/bigtable_table_admin/client.py
new file mode 100644
index 000000000..ce251db7d
--- /dev/null
+++ b/google/cloud/bigtable_admin_v2/services/bigtable_table_admin/client.py
@@ -0,0 +1,5457 @@
+# -*- coding: utf-8 -*-
+# Copyright 2025 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+from collections import OrderedDict
+from http import HTTPStatus
+import json
+import logging as std_logging
+import os
+import re
+from typing import (
+ Dict,
+ Callable,
+ Mapping,
+ MutableMapping,
+ MutableSequence,
+ Optional,
+ Sequence,
+ Tuple,
+ Type,
+ Union,
+ cast,
+)
+import warnings
+
+from google.cloud.bigtable_admin_v2 import gapic_version as package_version
+
+from google.api_core import client_options as client_options_lib
+from google.api_core import exceptions as core_exceptions
+from google.api_core import gapic_v1
+from google.api_core import retry as retries
+from google.auth import credentials as ga_credentials # type: ignore
+from google.auth.transport import mtls # type: ignore
+from google.auth.transport.grpc import SslCredentials # type: ignore
+from google.auth.exceptions import MutualTLSChannelError # type: ignore
+from google.oauth2 import service_account # type: ignore
+import google.protobuf
+
+try:
+ OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault, None]
+except AttributeError: # pragma: NO COVER
+ OptionalRetry = Union[retries.Retry, object, None] # type: ignore
+
+try:
+ from google.api_core import client_logging # type: ignore
+
+ CLIENT_LOGGING_SUPPORTED = True # pragma: NO COVER
+except ImportError: # pragma: NO COVER
+ CLIENT_LOGGING_SUPPORTED = False
+
+_LOGGER = std_logging.getLogger(__name__)
+
+from google.api_core import operation # type: ignore
+from google.api_core import operation_async # type: ignore
+from google.cloud.bigtable_admin_v2.services.bigtable_table_admin import pagers
+from google.cloud.bigtable_admin_v2.types import bigtable_table_admin
+from google.cloud.bigtable_admin_v2.types import table
+from google.cloud.bigtable_admin_v2.types import table as gba_table
+from google.cloud.bigtable_admin_v2.types import types
+from google.iam.v1 import iam_policy_pb2 # type: ignore
+from google.iam.v1 import policy_pb2 # type: ignore
+from google.protobuf import field_mask_pb2 # type: ignore
+from google.protobuf import timestamp_pb2 # type: ignore
+from .transports.base import BigtableTableAdminTransport, DEFAULT_CLIENT_INFO
+from .transports.grpc import BigtableTableAdminGrpcTransport
+from .transports.grpc_asyncio import BigtableTableAdminGrpcAsyncIOTransport
+from .transports.rest import BigtableTableAdminRestTransport
+
+
+class BaseBigtableTableAdminClientMeta(type):
+ """Metaclass for the BigtableTableAdmin client.
+
+ This provides class-level methods for building and retrieving
+ support objects (e.g. transport) without polluting the client instance
+ objects.
+ """
+
+ _transport_registry = (
+ OrderedDict()
+ ) # type: Dict[str, Type[BigtableTableAdminTransport]]
+ _transport_registry["grpc"] = BigtableTableAdminGrpcTransport
+ _transport_registry["grpc_asyncio"] = BigtableTableAdminGrpcAsyncIOTransport
+ _transport_registry["rest"] = BigtableTableAdminRestTransport
+
+ def get_transport_class(
+ cls,
+ label: Optional[str] = None,
+ ) -> Type[BigtableTableAdminTransport]:
+ """Returns an appropriate transport class.
+
+ Args:
+ label: The name of the desired transport. If none is
+ provided, then the first transport in the registry is used.
+
+ Returns:
+ The transport class to use.
+ """
+ # If a specific transport is requested, return that one.
+ if label:
+ return cls._transport_registry[label]
+
+ # No transport is requested; return the default (that is, the first one
+ # in the dictionary).
+ return next(iter(cls._transport_registry.values()))
+
+
+class BaseBigtableTableAdminClient(metaclass=BaseBigtableTableAdminClientMeta):
+ """Service for creating, configuring, and deleting Cloud
+ Bigtable tables.
+
+ Provides access to the table schemas only, not the data stored
+ within the tables.
+ """
+
+ @staticmethod
+ def _get_default_mtls_endpoint(api_endpoint):
+ """Converts api endpoint to mTLS endpoint.
+
+ Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to
+ "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively.
+ Args:
+ api_endpoint (Optional[str]): the api endpoint to convert.
+ Returns:
+ str: converted mTLS api endpoint.
+ """
+ if not api_endpoint:
+ return api_endpoint
+
+ mtls_endpoint_re = re.compile(
+ r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?"
+ )
+
+ m = mtls_endpoint_re.match(api_endpoint)
+ name, mtls, sandbox, googledomain = m.groups()
+ if mtls or not googledomain:
+ return api_endpoint
+
+ if sandbox:
+ return api_endpoint.replace(
+ "sandbox.googleapis.com", "mtls.sandbox.googleapis.com"
+ )
+
+ return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com")
+
+ # Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead.
+ DEFAULT_ENDPOINT = "bigtableadmin.googleapis.com"
+ DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore
+ DEFAULT_ENDPOINT
+ )
+
+ _DEFAULT_ENDPOINT_TEMPLATE = "bigtableadmin.{UNIVERSE_DOMAIN}"
+ _DEFAULT_UNIVERSE = "googleapis.com"
+
+ @staticmethod
+ def _use_client_cert_effective():
+ """Returns whether client certificate should be used for mTLS if the
+ google-auth version supports should_use_client_cert automatic mTLS enablement.
+
+ Alternatively, read from the GOOGLE_API_USE_CLIENT_CERTIFICATE env var.
+
+ Returns:
+ bool: whether client certificate should be used for mTLS
+ Raises:
+ ValueError: (If using a version of google-auth without should_use_client_cert and
+ GOOGLE_API_USE_CLIENT_CERTIFICATE is set to an unexpected value.)
+ """
+ # check if google-auth version supports should_use_client_cert for automatic mTLS enablement
+ if hasattr(mtls, "should_use_client_cert"): # pragma: NO COVER
+ return mtls.should_use_client_cert()
+ else: # pragma: NO COVER
+ # if unsupported, fallback to reading from env var
+ use_client_cert_str = os.getenv(
+ "GOOGLE_API_USE_CLIENT_CERTIFICATE", "false"
+ ).lower()
+ if use_client_cert_str not in ("true", "false"):
+ raise ValueError(
+ "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be"
+ " either `true` or `false`"
+ )
+ return use_client_cert_str == "true"
+
+ @classmethod
+ def from_service_account_info(cls, info: dict, *args, **kwargs):
+ """Creates an instance of this client using the provided credentials
+ info.
+
+ Args:
+ info (dict): The service account private key info.
+ args: Additional arguments to pass to the constructor.
+ kwargs: Additional arguments to pass to the constructor.
+
+ Returns:
+ BaseBigtableTableAdminClient: The constructed client.
+ """
+ credentials = service_account.Credentials.from_service_account_info(info)
+ kwargs["credentials"] = credentials
+ return cls(*args, **kwargs)
+
+ @classmethod
+ def from_service_account_file(cls, filename: str, *args, **kwargs):
+ """Creates an instance of this client using the provided credentials
+ file.
+
+ Args:
+ filename (str): The path to the service account private key json
+ file.
+ args: Additional arguments to pass to the constructor.
+ kwargs: Additional arguments to pass to the constructor.
+
+ Returns:
+ BaseBigtableTableAdminClient: The constructed client.
+ """
+ credentials = service_account.Credentials.from_service_account_file(filename)
+ kwargs["credentials"] = credentials
+ return cls(*args, **kwargs)
+
+ from_service_account_json = from_service_account_file
+
+ @property
+ def transport(self) -> BigtableTableAdminTransport:
+ """Returns the transport used by the client instance.
+
+ Returns:
+ BigtableTableAdminTransport: The transport used by the client
+ instance.
+ """
+ return self._transport
+
+ @staticmethod
+ def authorized_view_path(
+ project: str,
+ instance: str,
+ table: str,
+ authorized_view: str,
+ ) -> str:
+ """Returns a fully-qualified authorized_view string."""
+ return "projects/{project}/instances/{instance}/tables/{table}/authorizedViews/{authorized_view}".format(
+ project=project,
+ instance=instance,
+ table=table,
+ authorized_view=authorized_view,
+ )
+
+ @staticmethod
+ def parse_authorized_view_path(path: str) -> Dict[str, str]:
+ """Parses a authorized_view path into its component segments."""
+ m = re.match(
+ r"^projects/(?P.+?)/instances/(?P.+?)/tables/(?P.+?)/authorizedViews/(?P.+?)$",
+ path,
+ )
+ return m.groupdict() if m else {}
+
+ @staticmethod
+ def backup_path(
+ project: str,
+ instance: str,
+ cluster: str,
+ backup: str,
+ ) -> str:
+ """Returns a fully-qualified backup string."""
+ return "projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}".format(
+ project=project,
+ instance=instance,
+ cluster=cluster,
+ backup=backup,
+ )
+
+ @staticmethod
+ def parse_backup_path(path: str) -> Dict[str, str]:
+ """Parses a backup path into its component segments."""
+ m = re.match(
+ r"^projects/(?P.+?)/instances/(?P.+?)/clusters/(?P.+?)/backups/(?P.+?)$",
+ path,
+ )
+ return m.groupdict() if m else {}
+
+ @staticmethod
+ def cluster_path(
+ project: str,
+ instance: str,
+ cluster: str,
+ ) -> str:
+ """Returns a fully-qualified cluster string."""
+ return "projects/{project}/instances/{instance}/clusters/{cluster}".format(
+ project=project,
+ instance=instance,
+ cluster=cluster,
+ )
+
+ @staticmethod
+ def parse_cluster_path(path: str) -> Dict[str, str]:
+ """Parses a cluster path into its component segments."""
+ m = re.match(
+ r"^projects/(?P.+?)/instances/(?P.+?)/clusters/(?P.+?)$",
+ path,
+ )
+ return m.groupdict() if m else {}
+
+ @staticmethod
+ def crypto_key_version_path(
+ project: str,
+ location: str,
+ key_ring: str,
+ crypto_key: str,
+ crypto_key_version: str,
+ ) -> str:
+ """Returns a fully-qualified crypto_key_version string."""
+ return "projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}".format(
+ project=project,
+ location=location,
+ key_ring=key_ring,
+ crypto_key=crypto_key,
+ crypto_key_version=crypto_key_version,
+ )
+
+ @staticmethod
+ def parse_crypto_key_version_path(path: str) -> Dict[str, str]:
+ """Parses a crypto_key_version path into its component segments."""
+ m = re.match(
+ r"^projects/(?P.+?)/locations/(?P.+?)/keyRings/(?P.+?)/cryptoKeys/(?P.+?)/cryptoKeyVersions/(?P.+?)$",
+ path,
+ )
+ return m.groupdict() if m else {}
+
+ @staticmethod
+ def instance_path(
+ project: str,
+ instance: str,
+ ) -> str:
+ """Returns a fully-qualified instance string."""
+ return "projects/{project}/instances/{instance}".format(
+ project=project,
+ instance=instance,
+ )
+
+ @staticmethod
+ def parse_instance_path(path: str) -> Dict[str, str]:
+ """Parses a instance path into its component segments."""
+ m = re.match(r"^projects/(?P.+?)/instances/(?P.+?)$", path)
+ return m.groupdict() if m else {}
+
+ @staticmethod
+ def schema_bundle_path(
+ project: str,
+ instance: str,
+ table: str,
+ schema_bundle: str,
+ ) -> str:
+ """Returns a fully-qualified schema_bundle string."""
+ return "projects/{project}/instances/{instance}/tables/{table}/schemaBundles/{schema_bundle}".format(
+ project=project,
+ instance=instance,
+ table=table,
+ schema_bundle=schema_bundle,
+ )
+
+ @staticmethod
+ def parse_schema_bundle_path(path: str) -> Dict[str, str]:
+ """Parses a schema_bundle path into its component segments."""
+ m = re.match(
+ r"^projects/(?P.+?)/instances/(?P.+?)/tables/(?P.+?)/schemaBundles/(?P.+?)$",
+ path,
+ )
+ return m.groupdict() if m else {}
+
+ @staticmethod
+ def snapshot_path(
+ project: str,
+ instance: str,
+ cluster: str,
+ snapshot: str,
+ ) -> str:
+ """Returns a fully-qualified snapshot string."""
+ return "projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}".format(
+ project=project,
+ instance=instance,
+ cluster=cluster,
+ snapshot=snapshot,
+ )
+
+ @staticmethod
+ def parse_snapshot_path(path: str) -> Dict[str, str]:
+ """Parses a snapshot path into its component segments."""
+ m = re.match(
+ r"^projects/(?P.+?)/instances/(?P.+?)/clusters/(?P.+?)/snapshots/(?P.+?)$",
+ path,
+ )
+ return m.groupdict() if m else {}
+
+ @staticmethod
+ def table_path(
+ project: str,
+ instance: str,
+ table: str,
+ ) -> str:
+ """Returns a fully-qualified table string."""
+ return "projects/{project}/instances/{instance}/tables/{table}".format(
+ project=project,
+ instance=instance,
+ table=table,
+ )
+
+ @staticmethod
+ def parse_table_path(path: str) -> Dict[str, str]:
+ """Parses a table path into its component segments."""
+ m = re.match(
+ r"^projects/(?P.+?)/instances/(?P.+?)/tables/(?P.+?)$",
+ path,
+ )
+ return m.groupdict() if m else {}
+
+ @staticmethod
+ def common_billing_account_path(
+ billing_account: str,
+ ) -> str:
+ """Returns a fully-qualified billing_account string."""
+ return "billingAccounts/{billing_account}".format(
+ billing_account=billing_account,
+ )
+
+ @staticmethod
+ def parse_common_billing_account_path(path: str) -> Dict[str, str]:
+ """Parse a billing_account path into its component segments."""
+ m = re.match(r"^billingAccounts/(?P.+?)$", path)
+ return m.groupdict() if m else {}
+
+ @staticmethod
+ def common_folder_path(
+ folder: str,
+ ) -> str:
+ """Returns a fully-qualified folder string."""
+ return "folders/{folder}".format(
+ folder=folder,
+ )
+
+ @staticmethod
+ def parse_common_folder_path(path: str) -> Dict[str, str]:
+ """Parse a folder path into its component segments."""
+ m = re.match(r"^folders/(?P.+?)$", path)
+ return m.groupdict() if m else {}
+
+ @staticmethod
+ def common_organization_path(
+ organization: str,
+ ) -> str:
+ """Returns a fully-qualified organization string."""
+ return "organizations/{organization}".format(
+ organization=organization,
+ )
+
+ @staticmethod
+ def parse_common_organization_path(path: str) -> Dict[str, str]:
+ """Parse a organization path into its component segments."""
+ m = re.match(r"^organizations/(?P.+?)$", path)
+ return m.groupdict() if m else {}
+
+ @staticmethod
+ def common_project_path(
+ project: str,
+ ) -> str:
+ """Returns a fully-qualified project string."""
+ return "projects/{project}".format(
+ project=project,
+ )
+
+ @staticmethod
+ def parse_common_project_path(path: str) -> Dict[str, str]:
+ """Parse a project path into its component segments."""
+ m = re.match(r"^projects/(?P.+?)$", path)
+ return m.groupdict() if m else {}
+
+ @staticmethod
+ def common_location_path(
+ project: str,
+ location: str,
+ ) -> str:
+ """Returns a fully-qualified location string."""
+ return "projects/{project}/locations/{location}".format(
+ project=project,
+ location=location,
+ )
+
+ @staticmethod
+ def parse_common_location_path(path: str) -> Dict[str, str]:
+ """Parse a location path into its component segments."""
+ m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path)
+ return m.groupdict() if m else {}
+
+ @classmethod
+ def get_mtls_endpoint_and_cert_source(
+ cls, client_options: Optional[client_options_lib.ClientOptions] = None
+ ):
+ """Deprecated. Return the API endpoint and client cert source for mutual TLS.
+
+ The client cert source is determined in the following order:
+ (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the
+ client cert source is None.
+ (2) if `client_options.client_cert_source` is provided, use the provided one; if the
+ default client cert source exists, use the default one; otherwise the client cert
+ source is None.
+
+ The API endpoint is determined in the following order:
+ (1) if `client_options.api_endpoint` if provided, use the provided one.
+ (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the
+ default mTLS endpoint; if the environment variable is "never", use the default API
+ endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise
+ use the default API endpoint.
+
+ More details can be found at https://google.aip.dev/auth/4114.
+
+ Args:
+ client_options (google.api_core.client_options.ClientOptions): Custom options for the
+ client. Only the `api_endpoint` and `client_cert_source` properties may be used
+ in this method.
+
+ Returns:
+ Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the
+ client cert source to use.
+
+ Raises:
+ google.auth.exceptions.MutualTLSChannelError: If any errors happen.
+ """
+
+ warnings.warn(
+ "get_mtls_endpoint_and_cert_source is deprecated. Use the api_endpoint property instead.",
+ DeprecationWarning,
+ )
+ if client_options is None:
+ client_options = client_options_lib.ClientOptions()
+ use_client_cert = BaseBigtableTableAdminClient._use_client_cert_effective()
+ use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto")
+ if use_mtls_endpoint not in ("auto", "never", "always"):
+ raise MutualTLSChannelError(
+ "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`"
+ )
+
+ # Figure out the client cert source to use.
+ client_cert_source = None
+ if use_client_cert:
+ if client_options.client_cert_source:
+ client_cert_source = client_options.client_cert_source
+ elif mtls.has_default_client_cert_source():
+ client_cert_source = mtls.default_client_cert_source()
+
+ # Figure out which api endpoint to use.
+ if client_options.api_endpoint is not None:
+ api_endpoint = client_options.api_endpoint
+ elif use_mtls_endpoint == "always" or (
+ use_mtls_endpoint == "auto" and client_cert_source
+ ):
+ api_endpoint = cls.DEFAULT_MTLS_ENDPOINT
+ else:
+ api_endpoint = cls.DEFAULT_ENDPOINT
+
+ return api_endpoint, client_cert_source
+
+ @staticmethod
+ def _read_environment_variables():
+ """Returns the environment variables used by the client.
+
+ Returns:
+ Tuple[bool, str, str]: returns the GOOGLE_API_USE_CLIENT_CERTIFICATE,
+ GOOGLE_API_USE_MTLS_ENDPOINT, and GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variables.
+
+ Raises:
+ ValueError: If GOOGLE_API_USE_CLIENT_CERTIFICATE is not
+ any of ["true", "false"].
+ google.auth.exceptions.MutualTLSChannelError: If GOOGLE_API_USE_MTLS_ENDPOINT
+ is not any of ["auto", "never", "always"].
+ """
+ use_client_cert = BaseBigtableTableAdminClient._use_client_cert_effective()
+ use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto").lower()
+ universe_domain_env = os.getenv("GOOGLE_CLOUD_UNIVERSE_DOMAIN")
+ if use_mtls_endpoint not in ("auto", "never", "always"):
+ raise MutualTLSChannelError(
+ "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`"
+ )
+ return use_client_cert, use_mtls_endpoint, universe_domain_env
+
+ @staticmethod
+ def _get_client_cert_source(provided_cert_source, use_cert_flag):
+ """Return the client cert source to be used by the client.
+
+ Args:
+ provided_cert_source (bytes): The client certificate source provided.
+ use_cert_flag (bool): A flag indicating whether to use the client certificate.
+
+ Returns:
+ bytes or None: The client cert source to be used by the client.
+ """
+ client_cert_source = None
+ if use_cert_flag:
+ if provided_cert_source:
+ client_cert_source = provided_cert_source
+ elif mtls.has_default_client_cert_source():
+ client_cert_source = mtls.default_client_cert_source()
+ return client_cert_source
+
+ @staticmethod
+ def _get_api_endpoint(
+ api_override, client_cert_source, universe_domain, use_mtls_endpoint
+ ):
+ """Return the API endpoint used by the client.
+
+ Args:
+ api_override (str): The API endpoint override. If specified, this is always
+ the return value of this function and the other arguments are not used.
+ client_cert_source (bytes): The client certificate source used by the client.
+ universe_domain (str): The universe domain used by the client.
+ use_mtls_endpoint (str): How to use the mTLS endpoint, which depends also on the other parameters.
+ Possible values are "always", "auto", or "never".
+
+ Returns:
+ str: The API endpoint to be used by the client.
+ """
+ if api_override is not None:
+ api_endpoint = api_override
+ elif use_mtls_endpoint == "always" or (
+ use_mtls_endpoint == "auto" and client_cert_source
+ ):
+ _default_universe = BaseBigtableTableAdminClient._DEFAULT_UNIVERSE
+ if universe_domain != _default_universe:
+ raise MutualTLSChannelError(
+ f"mTLS is not supported in any universe other than {_default_universe}."
+ )
+ api_endpoint = BaseBigtableTableAdminClient.DEFAULT_MTLS_ENDPOINT
+ else:
+ api_endpoint = (
+ BaseBigtableTableAdminClient._DEFAULT_ENDPOINT_TEMPLATE.format(
+ UNIVERSE_DOMAIN=universe_domain
+ )
+ )
+ return api_endpoint
+
+ @staticmethod
+ def _get_universe_domain(
+ client_universe_domain: Optional[str], universe_domain_env: Optional[str]
+ ) -> str:
+ """Return the universe domain used by the client.
+
+ Args:
+ client_universe_domain (Optional[str]): The universe domain configured via the client options.
+ universe_domain_env (Optional[str]): The universe domain configured via the "GOOGLE_CLOUD_UNIVERSE_DOMAIN" environment variable.
+
+ Returns:
+ str: The universe domain to be used by the client.
+
+ Raises:
+ ValueError: If the universe domain is an empty string.
+ """
+ universe_domain = BaseBigtableTableAdminClient._DEFAULT_UNIVERSE
+ if client_universe_domain is not None:
+ universe_domain = client_universe_domain
+ elif universe_domain_env is not None:
+ universe_domain = universe_domain_env
+ if len(universe_domain.strip()) == 0:
+ raise ValueError("Universe Domain cannot be an empty string.")
+ return universe_domain
+
+ def _validate_universe_domain(self):
+ """Validates client's and credentials' universe domains are consistent.
+
+ Returns:
+ bool: True iff the configured universe domain is valid.
+
+ Raises:
+ ValueError: If the configured universe domain is not valid.
+ """
+
+ # NOTE (b/349488459): universe validation is disabled until further notice.
+ return True
+
+ def _add_cred_info_for_auth_errors(
+ self, error: core_exceptions.GoogleAPICallError
+ ) -> None:
+ """Adds credential info string to error details for 401/403/404 errors.
+
+ Args:
+ error (google.api_core.exceptions.GoogleAPICallError): The error to add the cred info.
+ """
+ if error.code not in [
+ HTTPStatus.UNAUTHORIZED,
+ HTTPStatus.FORBIDDEN,
+ HTTPStatus.NOT_FOUND,
+ ]:
+ return
+
+ cred = self._transport._credentials
+
+ # get_cred_info is only available in google-auth>=2.35.0
+ if not hasattr(cred, "get_cred_info"):
+ return
+
+ # ignore the type check since pypy test fails when get_cred_info
+ # is not available
+ cred_info = cred.get_cred_info() # type: ignore
+ if cred_info and hasattr(error._details, "append"):
+ error._details.append(json.dumps(cred_info))
+
+ @property
+ def api_endpoint(self):
+ """Return the API endpoint used by the client instance.
+
+ Returns:
+ str: The API endpoint used by the client instance.
+ """
+ return self._api_endpoint
+
+ @property
+ def universe_domain(self) -> str:
+ """Return the universe domain used by the client instance.
+
+ Returns:
+ str: The universe domain used by the client instance.
+ """
+ return self._universe_domain
+
+ def __init__(
+ self,
+ *,
+ credentials: Optional[ga_credentials.Credentials] = None,
+ transport: Optional[
+ Union[
+ str,
+ BigtableTableAdminTransport,
+ Callable[..., BigtableTableAdminTransport],
+ ]
+ ] = None,
+ client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None,
+ client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
+ ) -> None:
+ """Instantiates the base bigtable table admin client.
+
+ Args:
+ credentials (Optional[google.auth.credentials.Credentials]): The
+ authorization credentials to attach to requests. These
+ credentials identify the application to the service; if none
+ are specified, the client will attempt to ascertain the
+ credentials from the environment.
+ transport (Optional[Union[str,BigtableTableAdminTransport,Callable[..., BigtableTableAdminTransport]]]):
+ The transport to use, or a Callable that constructs and returns a new transport.
+ If a Callable is given, it will be called with the same set of initialization
+ arguments as used in the BigtableTableAdminTransport constructor.
+ If set to None, a transport is chosen automatically.
+ client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]):
+ Custom options for the client.
+
+ 1. The ``api_endpoint`` property can be used to override the
+ default endpoint provided by the client when ``transport`` is
+ not explicitly provided. Only if this property is not set and
+ ``transport`` was not explicitly provided, the endpoint is
+ determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment
+ variable, which have one of the following values:
+ "always" (always use the default mTLS endpoint), "never" (always
+ use the default regular endpoint) and "auto" (auto-switch to the
+ default mTLS endpoint if client certificate is present; this is
+ the default value).
+
+ 2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable
+ is "true", then the ``client_cert_source`` property can be used
+ to provide a client certificate for mTLS transport. If
+ not provided, the default SSL client certificate will be used if
+ present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not
+ set, no client certificate will be used.
+
+ 3. The ``universe_domain`` property can be used to override the
+ default "googleapis.com" universe. Note that the ``api_endpoint``
+ property still takes precedence; and ``universe_domain`` is
+ currently not supported for mTLS.
+
+ client_info (google.api_core.gapic_v1.client_info.ClientInfo):
+ The client info used to send a user-agent string along with
+ API requests. If ``None``, then default info will be used.
+ Generally, you only need to set this if you're developing
+ your own client library.
+
+ Raises:
+ google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport
+ creation failed for any reason.
+ """
+ self._client_options = client_options
+ if isinstance(self._client_options, dict):
+ self._client_options = client_options_lib.from_dict(self._client_options)
+ if self._client_options is None:
+ self._client_options = client_options_lib.ClientOptions()
+ self._client_options = cast(
+ client_options_lib.ClientOptions, self._client_options
+ )
+
+ universe_domain_opt = getattr(self._client_options, "universe_domain", None)
+
+ (
+ self._use_client_cert,
+ self._use_mtls_endpoint,
+ self._universe_domain_env,
+ ) = BaseBigtableTableAdminClient._read_environment_variables()
+ self._client_cert_source = BaseBigtableTableAdminClient._get_client_cert_source(
+ self._client_options.client_cert_source, self._use_client_cert
+ )
+ self._universe_domain = BaseBigtableTableAdminClient._get_universe_domain(
+ universe_domain_opt, self._universe_domain_env
+ )
+ self._api_endpoint = None # updated below, depending on `transport`
+
+ # Initialize the universe domain validation.
+ self._is_universe_domain_valid = False
+
+ if CLIENT_LOGGING_SUPPORTED: # pragma: NO COVER
+ # Setup logging.
+ client_logging.initialize_logging()
+
+ api_key_value = getattr(self._client_options, "api_key", None)
+ if api_key_value and credentials:
+ raise ValueError(
+ "client_options.api_key and credentials are mutually exclusive"
+ )
+
+ # Save or instantiate the transport.
+ # Ordinarily, we provide the transport, but allowing a custom transport
+ # instance provides an extensibility point for unusual situations.
+ transport_provided = isinstance(transport, BigtableTableAdminTransport)
+ if transport_provided:
+ # transport is a BigtableTableAdminTransport instance.
+ if credentials or self._client_options.credentials_file or api_key_value:
+ raise ValueError(
+ "When providing a transport instance, "
+ "provide its credentials directly."
+ )
+ if self._client_options.scopes:
+ raise ValueError(
+ "When providing a transport instance, provide its scopes "
+ "directly."
+ )
+ self._transport = cast(BigtableTableAdminTransport, transport)
+ self._api_endpoint = self._transport.host
+
+ self._api_endpoint = (
+ self._api_endpoint
+ or BaseBigtableTableAdminClient._get_api_endpoint(
+ self._client_options.api_endpoint,
+ self._client_cert_source,
+ self._universe_domain,
+ self._use_mtls_endpoint,
+ )
+ )
+
+ if not transport_provided:
+ import google.auth._default # type: ignore
+
+ if api_key_value and hasattr(
+ google.auth._default, "get_api_key_credentials"
+ ):
+ credentials = google.auth._default.get_api_key_credentials(
+ api_key_value
+ )
+
+ transport_init: Union[
+ Type[BigtableTableAdminTransport],
+ Callable[..., BigtableTableAdminTransport],
+ ] = (
+ BaseBigtableTableAdminClient.get_transport_class(transport)
+ if isinstance(transport, str) or transport is None
+ else cast(Callable[..., BigtableTableAdminTransport], transport)
+ )
+ # initialize with the provided callable or the passed in class
+ self._transport = transport_init(
+ credentials=credentials,
+ credentials_file=self._client_options.credentials_file,
+ host=self._api_endpoint,
+ scopes=self._client_options.scopes,
+ client_cert_source_for_mtls=self._client_cert_source,
+ quota_project_id=self._client_options.quota_project_id,
+ client_info=client_info,
+ always_use_jwt_access=True,
+ api_audience=self._client_options.api_audience,
+ )
+
+ if "async" not in str(self._transport):
+ if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(
+ std_logging.DEBUG
+ ): # pragma: NO COVER
+ _LOGGER.debug(
+ "Created client `google.bigtable.admin_v2.BaseBigtableTableAdminClient`.",
+ extra={
+ "serviceName": "google.bigtable.admin.v2.BigtableTableAdmin",
+ "universeDomain": getattr(
+ self._transport._credentials, "universe_domain", ""
+ ),
+ "credentialsType": f"{type(self._transport._credentials).__module__}.{type(self._transport._credentials).__qualname__}",
+ "credentialsInfo": getattr(
+ self.transport._credentials, "get_cred_info", lambda: None
+ )(),
+ }
+ if hasattr(self._transport, "_credentials")
+ else {
+ "serviceName": "google.bigtable.admin.v2.BigtableTableAdmin",
+ "credentialsType": None,
+ },
+ )
+
+ def create_table(
+ self,
+ request: Optional[Union[bigtable_table_admin.CreateTableRequest, dict]] = None,
+ *,
+ parent: Optional[str] = None,
+ table_id: Optional[str] = None,
+ table: Optional[gba_table.Table] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> gba_table.Table:
+ r"""Creates a new table in the specified instance.
+ The table can be created with a full set of initial
+ column families, specified in the request.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_create_table():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.CreateTableRequest(
+ parent="parent_value",
+ table_id="table_id_value",
+ )
+
+ # Make the request
+ response = client.create_table(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.CreateTableRequest, dict]):
+ The request object. Request message for
+ [google.bigtable.admin.v2.BigtableTableAdmin.CreateTable][google.bigtable.admin.v2.BigtableTableAdmin.CreateTable]
+ parent (str):
+ Required. The unique name of the instance in which to
+ create the table. Values are of the form
+ ``projects/{project}/instances/{instance}``.
+
+ This corresponds to the ``parent`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ table_id (str):
+ Required. The name by which the new table should be
+ referred to within the parent instance, e.g., ``foobar``
+ rather than ``{parent}/tables/foobar``. Maximum 50
+ characters.
+
+ This corresponds to the ``table_id`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ table (google.cloud.bigtable_admin_v2.types.Table):
+ Required. The Table to create.
+ This corresponds to the ``table`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.types.Table:
+ A collection of user data indexed by
+ row, column, and timestamp. Each table
+ is served using the resources of its
+ parent cluster.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [parent, table_id, table]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.CreateTableRequest):
+ request = bigtable_table_admin.CreateTableRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if parent is not None:
+ request.parent = parent
+ if table_id is not None:
+ request.table_id = table_id
+ if table is not None:
+ request.table = table
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.create_table]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def create_table_from_snapshot(
+ self,
+ request: Optional[
+ Union[bigtable_table_admin.CreateTableFromSnapshotRequest, dict]
+ ] = None,
+ *,
+ parent: Optional[str] = None,
+ table_id: Optional[str] = None,
+ source_snapshot: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operation.Operation:
+ r"""Creates a new table from the specified snapshot. The
+ target table must not exist. The snapshot and the table
+ must be in the same instance.
+
+ Note: This is a private alpha release of Cloud Bigtable
+ snapshots. This feature is not currently available to
+ most Cloud Bigtable customers. This feature might be
+ changed in backward-incompatible ways and is not
+ recommended for production use. It is not subject to any
+ SLA or deprecation policy.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_create_table_from_snapshot():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.CreateTableFromSnapshotRequest(
+ parent="parent_value",
+ table_id="table_id_value",
+ source_snapshot="source_snapshot_value",
+ )
+
+ # Make the request
+ operation = client.create_table_from_snapshot(request=request)
+
+ print("Waiting for operation to complete...")
+
+ response = operation.result()
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.CreateTableFromSnapshotRequest, dict]):
+ The request object. Request message for
+ [google.bigtable.admin.v2.BigtableTableAdmin.CreateTableFromSnapshot][google.bigtable.admin.v2.BigtableTableAdmin.CreateTableFromSnapshot]
+
+ Note: This is a private alpha release of Cloud Bigtable
+ snapshots. This feature is not currently available to
+ most Cloud Bigtable customers. This feature might be
+ changed in backward-incompatible ways and is not
+ recommended for production use. It is not subject to any
+ SLA or deprecation policy.
+ parent (str):
+ Required. The unique name of the instance in which to
+ create the table. Values are of the form
+ ``projects/{project}/instances/{instance}``.
+
+ This corresponds to the ``parent`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ table_id (str):
+ Required. The name by which the new table should be
+ referred to within the parent instance, e.g., ``foobar``
+ rather than ``{parent}/tables/foobar``.
+
+ This corresponds to the ``table_id`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ source_snapshot (str):
+ Required. The unique name of the snapshot from which to
+ restore the table. The snapshot and the table must be in
+ the same instance. Values are of the form
+ ``projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}``.
+
+ This corresponds to the ``source_snapshot`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.api_core.operation.Operation:
+ An object representing a long-running operation.
+
+ The result type for the operation will be :class:`google.cloud.bigtable_admin_v2.types.Table` A collection of user data indexed by row, column, and timestamp.
+ Each table is served using the resources of its
+ parent cluster.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [parent, table_id, source_snapshot]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.CreateTableFromSnapshotRequest):
+ request = bigtable_table_admin.CreateTableFromSnapshotRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if parent is not None:
+ request.parent = parent
+ if table_id is not None:
+ request.table_id = table_id
+ if source_snapshot is not None:
+ request.source_snapshot = source_snapshot
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[
+ self._transport.create_table_from_snapshot
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Wrap the response in an operation future.
+ response = operation.from_gapic(
+ response,
+ self._transport.operations_client,
+ table.Table,
+ metadata_type=bigtable_table_admin.CreateTableFromSnapshotMetadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def list_tables(
+ self,
+ request: Optional[Union[bigtable_table_admin.ListTablesRequest, dict]] = None,
+ *,
+ parent: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> pagers.ListTablesPager:
+ r"""Lists all tables served from a specified instance.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_list_tables():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.ListTablesRequest(
+ parent="parent_value",
+ )
+
+ # Make the request
+ page_result = client.list_tables(request=request)
+
+ # Handle the response
+ for response in page_result:
+ print(response)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.ListTablesRequest, dict]):
+ The request object. Request message for
+ [google.bigtable.admin.v2.BigtableTableAdmin.ListTables][google.bigtable.admin.v2.BigtableTableAdmin.ListTables]
+ parent (str):
+ Required. The unique name of the instance for which
+ tables should be listed. Values are of the form
+ ``projects/{project}/instances/{instance}``.
+
+ This corresponds to the ``parent`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.services.bigtable_table_admin.pagers.ListTablesPager:
+ Response message for
+ [google.bigtable.admin.v2.BigtableTableAdmin.ListTables][google.bigtable.admin.v2.BigtableTableAdmin.ListTables]
+
+ Iterating over this object will yield results and
+ resolve additional pages automatically.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [parent]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.ListTablesRequest):
+ request = bigtable_table_admin.ListTablesRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if parent is not None:
+ request.parent = parent
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.list_tables]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # This method is paged; wrap the response in a pager, which provides
+ # an `__iter__` convenience method.
+ response = pagers.ListTablesPager(
+ method=rpc,
+ request=request,
+ response=response,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def get_table(
+ self,
+ request: Optional[Union[bigtable_table_admin.GetTableRequest, dict]] = None,
+ *,
+ name: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> table.Table:
+ r"""Gets metadata information about the specified table.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_get_table():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.GetTableRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = client.get_table(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.GetTableRequest, dict]):
+ The request object. Request message for
+ [google.bigtable.admin.v2.BigtableTableAdmin.GetTable][google.bigtable.admin.v2.BigtableTableAdmin.GetTable]
+ name (str):
+ Required. The unique name of the requested table. Values
+ are of the form
+ ``projects/{project}/instances/{instance}/tables/{table}``.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.types.Table:
+ A collection of user data indexed by
+ row, column, and timestamp. Each table
+ is served using the resources of its
+ parent cluster.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.GetTableRequest):
+ request = bigtable_table_admin.GetTableRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.get_table]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def update_table(
+ self,
+ request: Optional[Union[bigtable_table_admin.UpdateTableRequest, dict]] = None,
+ *,
+ table: Optional[gba_table.Table] = None,
+ update_mask: Optional[field_mask_pb2.FieldMask] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operation.Operation:
+ r"""Updates a specified table.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_update_table():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.UpdateTableRequest(
+ )
+
+ # Make the request
+ operation = client.update_table(request=request)
+
+ print("Waiting for operation to complete...")
+
+ response = operation.result()
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.UpdateTableRequest, dict]):
+ The request object. The request for
+ [UpdateTable][google.bigtable.admin.v2.BigtableTableAdmin.UpdateTable].
+ table (google.cloud.bigtable_admin_v2.types.Table):
+ Required. The table to update. The table's ``name``
+ field is used to identify the table to update.
+
+ This corresponds to the ``table`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ update_mask (google.protobuf.field_mask_pb2.FieldMask):
+ Required. The list of fields to update. A mask
+ specifying which fields (e.g. ``change_stream_config``)
+ in the ``table`` field should be updated. This mask is
+ relative to the ``table`` field, not to the request
+ message. The wildcard (\*) path is currently not
+ supported. Currently UpdateTable is only supported for
+ the following fields:
+
+ - ``change_stream_config``
+ - ``change_stream_config.retention_period``
+ - ``deletion_protection``
+ - ``row_key_schema``
+
+ If ``column_families`` is set in ``update_mask``, it
+ will return an UNIMPLEMENTED error.
+
+ This corresponds to the ``update_mask`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.api_core.operation.Operation:
+ An object representing a long-running operation.
+
+ The result type for the operation will be :class:`google.cloud.bigtable_admin_v2.types.Table` A collection of user data indexed by row, column, and timestamp.
+ Each table is served using the resources of its
+ parent cluster.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [table, update_mask]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.UpdateTableRequest):
+ request = bigtable_table_admin.UpdateTableRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if table is not None:
+ request.table = table
+ if update_mask is not None:
+ request.update_mask = update_mask
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.update_table]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata(
+ (("table.name", request.table.name),)
+ ),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Wrap the response in an operation future.
+ response = operation.from_gapic(
+ response,
+ self._transport.operations_client,
+ gba_table.Table,
+ metadata_type=bigtable_table_admin.UpdateTableMetadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def delete_table(
+ self,
+ request: Optional[Union[bigtable_table_admin.DeleteTableRequest, dict]] = None,
+ *,
+ name: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> None:
+ r"""Permanently deletes a specified table and all of its
+ data.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_delete_table():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.DeleteTableRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ client.delete_table(request=request)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.DeleteTableRequest, dict]):
+ The request object. Request message for
+ [google.bigtable.admin.v2.BigtableTableAdmin.DeleteTable][google.bigtable.admin.v2.BigtableTableAdmin.DeleteTable]
+ name (str):
+ Required. The unique name of the table to be deleted.
+ Values are of the form
+ ``projects/{project}/instances/{instance}/tables/{table}``.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.DeleteTableRequest):
+ request = bigtable_table_admin.DeleteTableRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.delete_table]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ def undelete_table(
+ self,
+ request: Optional[
+ Union[bigtable_table_admin.UndeleteTableRequest, dict]
+ ] = None,
+ *,
+ name: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operation.Operation:
+ r"""Restores a specified table which was accidentally
+ deleted.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_undelete_table():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.UndeleteTableRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ operation = client.undelete_table(request=request)
+
+ print("Waiting for operation to complete...")
+
+ response = operation.result()
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.UndeleteTableRequest, dict]):
+ The request object. Request message for
+ [google.bigtable.admin.v2.BigtableTableAdmin.UndeleteTable][google.bigtable.admin.v2.BigtableTableAdmin.UndeleteTable]
+ name (str):
+ Required. The unique name of the table to be restored.
+ Values are of the form
+ ``projects/{project}/instances/{instance}/tables/{table}``.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.api_core.operation.Operation:
+ An object representing a long-running operation.
+
+ The result type for the operation will be :class:`google.cloud.bigtable_admin_v2.types.Table` A collection of user data indexed by row, column, and timestamp.
+ Each table is served using the resources of its
+ parent cluster.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.UndeleteTableRequest):
+ request = bigtable_table_admin.UndeleteTableRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.undelete_table]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Wrap the response in an operation future.
+ response = operation.from_gapic(
+ response,
+ self._transport.operations_client,
+ table.Table,
+ metadata_type=bigtable_table_admin.UndeleteTableMetadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def create_authorized_view(
+ self,
+ request: Optional[
+ Union[bigtable_table_admin.CreateAuthorizedViewRequest, dict]
+ ] = None,
+ *,
+ parent: Optional[str] = None,
+ authorized_view: Optional[table.AuthorizedView] = None,
+ authorized_view_id: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operation.Operation:
+ r"""Creates a new AuthorizedView in a table.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_create_authorized_view():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.CreateAuthorizedViewRequest(
+ parent="parent_value",
+ authorized_view_id="authorized_view_id_value",
+ )
+
+ # Make the request
+ operation = client.create_authorized_view(request=request)
+
+ print("Waiting for operation to complete...")
+
+ response = operation.result()
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.CreateAuthorizedViewRequest, dict]):
+ The request object. The request for
+ [CreateAuthorizedView][google.bigtable.admin.v2.BigtableTableAdmin.CreateAuthorizedView]
+ parent (str):
+ Required. This is the name of the table the
+ AuthorizedView belongs to. Values are of the form
+ ``projects/{project}/instances/{instance}/tables/{table}``.
+
+ This corresponds to the ``parent`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ authorized_view (google.cloud.bigtable_admin_v2.types.AuthorizedView):
+ Required. The AuthorizedView to
+ create.
+
+ This corresponds to the ``authorized_view`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ authorized_view_id (str):
+ Required. The id of the AuthorizedView to create. This
+ AuthorizedView must not already exist. The
+ ``authorized_view_id`` appended to ``parent`` forms the
+ full AuthorizedView name of the form
+ ``projects/{project}/instances/{instance}/tables/{table}/authorizedView/{authorized_view}``.
+
+ This corresponds to the ``authorized_view_id`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.api_core.operation.Operation:
+ An object representing a long-running operation.
+
+ The result type for the operation will be :class:`google.cloud.bigtable_admin_v2.types.AuthorizedView` AuthorizedViews represent subsets of a particular Cloud Bigtable table. Users
+ can configure access to each Authorized View
+ independently from the table and use the existing
+ Data APIs to access the subset of data.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [parent, authorized_view, authorized_view_id]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.CreateAuthorizedViewRequest):
+ request = bigtable_table_admin.CreateAuthorizedViewRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if parent is not None:
+ request.parent = parent
+ if authorized_view is not None:
+ request.authorized_view = authorized_view
+ if authorized_view_id is not None:
+ request.authorized_view_id = authorized_view_id
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.create_authorized_view]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Wrap the response in an operation future.
+ response = operation.from_gapic(
+ response,
+ self._transport.operations_client,
+ table.AuthorizedView,
+ metadata_type=bigtable_table_admin.CreateAuthorizedViewMetadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def list_authorized_views(
+ self,
+ request: Optional[
+ Union[bigtable_table_admin.ListAuthorizedViewsRequest, dict]
+ ] = None,
+ *,
+ parent: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> pagers.ListAuthorizedViewsPager:
+ r"""Lists all AuthorizedViews from a specific table.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_list_authorized_views():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.ListAuthorizedViewsRequest(
+ parent="parent_value",
+ )
+
+ # Make the request
+ page_result = client.list_authorized_views(request=request)
+
+ # Handle the response
+ for response in page_result:
+ print(response)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.ListAuthorizedViewsRequest, dict]):
+ The request object. Request message for
+ [google.bigtable.admin.v2.BigtableTableAdmin.ListAuthorizedViews][google.bigtable.admin.v2.BigtableTableAdmin.ListAuthorizedViews]
+ parent (str):
+ Required. The unique name of the table for which
+ AuthorizedViews should be listed. Values are of the form
+ ``projects/{project}/instances/{instance}/tables/{table}``.
+
+ This corresponds to the ``parent`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.services.bigtable_table_admin.pagers.ListAuthorizedViewsPager:
+ Response message for
+ [google.bigtable.admin.v2.BigtableTableAdmin.ListAuthorizedViews][google.bigtable.admin.v2.BigtableTableAdmin.ListAuthorizedViews]
+
+ Iterating over this object will yield results and
+ resolve additional pages automatically.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [parent]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.ListAuthorizedViewsRequest):
+ request = bigtable_table_admin.ListAuthorizedViewsRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if parent is not None:
+ request.parent = parent
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.list_authorized_views]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # This method is paged; wrap the response in a pager, which provides
+ # an `__iter__` convenience method.
+ response = pagers.ListAuthorizedViewsPager(
+ method=rpc,
+ request=request,
+ response=response,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def get_authorized_view(
+ self,
+ request: Optional[
+ Union[bigtable_table_admin.GetAuthorizedViewRequest, dict]
+ ] = None,
+ *,
+ name: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> table.AuthorizedView:
+ r"""Gets information from a specified AuthorizedView.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_get_authorized_view():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.GetAuthorizedViewRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = client.get_authorized_view(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.GetAuthorizedViewRequest, dict]):
+ The request object. Request message for
+ [google.bigtable.admin.v2.BigtableTableAdmin.GetAuthorizedView][google.bigtable.admin.v2.BigtableTableAdmin.GetAuthorizedView]
+ name (str):
+ Required. The unique name of the requested
+ AuthorizedView. Values are of the form
+ ``projects/{project}/instances/{instance}/tables/{table}/authorizedViews/{authorized_view}``.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.types.AuthorizedView:
+ AuthorizedViews represent subsets of
+ a particular Cloud Bigtable table. Users
+ can configure access to each Authorized
+ View independently from the table and
+ use the existing Data APIs to access the
+ subset of data.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.GetAuthorizedViewRequest):
+ request = bigtable_table_admin.GetAuthorizedViewRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.get_authorized_view]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def update_authorized_view(
+ self,
+ request: Optional[
+ Union[bigtable_table_admin.UpdateAuthorizedViewRequest, dict]
+ ] = None,
+ *,
+ authorized_view: Optional[table.AuthorizedView] = None,
+ update_mask: Optional[field_mask_pb2.FieldMask] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operation.Operation:
+ r"""Updates an AuthorizedView in a table.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_update_authorized_view():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.UpdateAuthorizedViewRequest(
+ )
+
+ # Make the request
+ operation = client.update_authorized_view(request=request)
+
+ print("Waiting for operation to complete...")
+
+ response = operation.result()
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.UpdateAuthorizedViewRequest, dict]):
+ The request object. The request for
+ [UpdateAuthorizedView][google.bigtable.admin.v2.BigtableTableAdmin.UpdateAuthorizedView].
+ authorized_view (google.cloud.bigtable_admin_v2.types.AuthorizedView):
+ Required. The AuthorizedView to update. The ``name`` in
+ ``authorized_view`` is used to identify the
+ AuthorizedView. AuthorizedView name must in this format:
+ ``projects/{project}/instances/{instance}/tables/{table}/authorizedViews/{authorized_view}``.
+
+ This corresponds to the ``authorized_view`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ update_mask (google.protobuf.field_mask_pb2.FieldMask):
+ Optional. The list of fields to update. A mask
+ specifying which fields in the AuthorizedView resource
+ should be updated. This mask is relative to the
+ AuthorizedView resource, not to the request message. A
+ field will be overwritten if it is in the mask. If
+ empty, all fields set in the request will be
+ overwritten. A special value ``*`` means to overwrite
+ all fields (including fields not set in the request).
+
+ This corresponds to the ``update_mask`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.api_core.operation.Operation:
+ An object representing a long-running operation.
+
+ The result type for the operation will be :class:`google.cloud.bigtable_admin_v2.types.AuthorizedView` AuthorizedViews represent subsets of a particular Cloud Bigtable table. Users
+ can configure access to each Authorized View
+ independently from the table and use the existing
+ Data APIs to access the subset of data.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [authorized_view, update_mask]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.UpdateAuthorizedViewRequest):
+ request = bigtable_table_admin.UpdateAuthorizedViewRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if authorized_view is not None:
+ request.authorized_view = authorized_view
+ if update_mask is not None:
+ request.update_mask = update_mask
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.update_authorized_view]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata(
+ (("authorized_view.name", request.authorized_view.name),)
+ ),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Wrap the response in an operation future.
+ response = operation.from_gapic(
+ response,
+ self._transport.operations_client,
+ table.AuthorizedView,
+ metadata_type=bigtable_table_admin.UpdateAuthorizedViewMetadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def delete_authorized_view(
+ self,
+ request: Optional[
+ Union[bigtable_table_admin.DeleteAuthorizedViewRequest, dict]
+ ] = None,
+ *,
+ name: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> None:
+ r"""Permanently deletes a specified AuthorizedView.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_delete_authorized_view():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.DeleteAuthorizedViewRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ client.delete_authorized_view(request=request)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.DeleteAuthorizedViewRequest, dict]):
+ The request object. Request message for
+ [google.bigtable.admin.v2.BigtableTableAdmin.DeleteAuthorizedView][google.bigtable.admin.v2.BigtableTableAdmin.DeleteAuthorizedView]
+ name (str):
+ Required. The unique name of the AuthorizedView to be
+ deleted. Values are of the form
+ ``projects/{project}/instances/{instance}/tables/{table}/authorizedViews/{authorized_view}``.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.DeleteAuthorizedViewRequest):
+ request = bigtable_table_admin.DeleteAuthorizedViewRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.delete_authorized_view]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ def modify_column_families(
+ self,
+ request: Optional[
+ Union[bigtable_table_admin.ModifyColumnFamiliesRequest, dict]
+ ] = None,
+ *,
+ name: Optional[str] = None,
+ modifications: Optional[
+ MutableSequence[
+ bigtable_table_admin.ModifyColumnFamiliesRequest.Modification
+ ]
+ ] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> table.Table:
+ r"""Performs a series of column family modifications on
+ the specified table. Either all or none of the
+ modifications will occur before this method returns, but
+ data requests received prior to that point may see a
+ table where only some modifications have taken effect.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_modify_column_families():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.ModifyColumnFamiliesRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = client.modify_column_families(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.ModifyColumnFamiliesRequest, dict]):
+ The request object. Request message for
+ [google.bigtable.admin.v2.BigtableTableAdmin.ModifyColumnFamilies][google.bigtable.admin.v2.BigtableTableAdmin.ModifyColumnFamilies]
+ name (str):
+ Required. The unique name of the table whose families
+ should be modified. Values are of the form
+ ``projects/{project}/instances/{instance}/tables/{table}``.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ modifications (MutableSequence[google.cloud.bigtable_admin_v2.types.ModifyColumnFamiliesRequest.Modification]):
+ Required. Modifications to be
+ atomically applied to the specified
+ table's families. Entries are applied in
+ order, meaning that earlier
+ modifications can be masked by later
+ ones (in the case of repeated updates to
+ the same family, for example).
+
+ This corresponds to the ``modifications`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.types.Table:
+ A collection of user data indexed by
+ row, column, and timestamp. Each table
+ is served using the resources of its
+ parent cluster.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name, modifications]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.ModifyColumnFamiliesRequest):
+ request = bigtable_table_admin.ModifyColumnFamiliesRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+ if modifications is not None:
+ request.modifications = modifications
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.modify_column_families]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def drop_row_range(
+ self,
+ request: Optional[Union[bigtable_table_admin.DropRowRangeRequest, dict]] = None,
+ *,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> None:
+ r"""Permanently drop/delete a row range from a specified
+ table. The request can specify whether to delete all
+ rows in a table, or only those that match a particular
+ prefix.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_drop_row_range():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.DropRowRangeRequest(
+ row_key_prefix=b'row_key_prefix_blob',
+ name="name_value",
+ )
+
+ # Make the request
+ client.drop_row_range(request=request)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.DropRowRangeRequest, dict]):
+ The request object. Request message for
+ [google.bigtable.admin.v2.BigtableTableAdmin.DropRowRange][google.bigtable.admin.v2.BigtableTableAdmin.DropRowRange]
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+ """
+ # Create or coerce a protobuf request object.
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.DropRowRangeRequest):
+ request = bigtable_table_admin.DropRowRangeRequest(request)
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.drop_row_range]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ def generate_consistency_token(
+ self,
+ request: Optional[
+ Union[bigtable_table_admin.GenerateConsistencyTokenRequest, dict]
+ ] = None,
+ *,
+ name: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> bigtable_table_admin.GenerateConsistencyTokenResponse:
+ r"""Generates a consistency token for a Table, which can
+ be used in CheckConsistency to check whether mutations
+ to the table that finished before this call started have
+ been replicated. The tokens will be available for 90
+ days.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_generate_consistency_token():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.GenerateConsistencyTokenRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = client.generate_consistency_token(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.GenerateConsistencyTokenRequest, dict]):
+ The request object. Request message for
+ [google.bigtable.admin.v2.BigtableTableAdmin.GenerateConsistencyToken][google.bigtable.admin.v2.BigtableTableAdmin.GenerateConsistencyToken]
+ name (str):
+ Required. The unique name of the Table for which to
+ create a consistency token. Values are of the form
+ ``projects/{project}/instances/{instance}/tables/{table}``.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.types.GenerateConsistencyTokenResponse:
+ Response message for
+ [google.bigtable.admin.v2.BigtableTableAdmin.GenerateConsistencyToken][google.bigtable.admin.v2.BigtableTableAdmin.GenerateConsistencyToken]
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(
+ request, bigtable_table_admin.GenerateConsistencyTokenRequest
+ ):
+ request = bigtable_table_admin.GenerateConsistencyTokenRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[
+ self._transport.generate_consistency_token
+ ]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def check_consistency(
+ self,
+ request: Optional[
+ Union[bigtable_table_admin.CheckConsistencyRequest, dict]
+ ] = None,
+ *,
+ name: Optional[str] = None,
+ consistency_token: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> bigtable_table_admin.CheckConsistencyResponse:
+ r"""Checks replication consistency based on a consistency
+ token, that is, if replication has caught up based on
+ the conditions specified in the token and the check
+ request.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_check_consistency():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.CheckConsistencyRequest(
+ name="name_value",
+ consistency_token="consistency_token_value",
+ )
+
+ # Make the request
+ response = client.check_consistency(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.CheckConsistencyRequest, dict]):
+ The request object. Request message for
+ [google.bigtable.admin.v2.BigtableTableAdmin.CheckConsistency][google.bigtable.admin.v2.BigtableTableAdmin.CheckConsistency]
+ name (str):
+ Required. The unique name of the Table for which to
+ check replication consistency. Values are of the form
+ ``projects/{project}/instances/{instance}/tables/{table}``.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ consistency_token (str):
+ Required. The token created using
+ GenerateConsistencyToken for the Table.
+
+ This corresponds to the ``consistency_token`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.types.CheckConsistencyResponse:
+ Response message for
+ [google.bigtable.admin.v2.BigtableTableAdmin.CheckConsistency][google.bigtable.admin.v2.BigtableTableAdmin.CheckConsistency]
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name, consistency_token]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.CheckConsistencyRequest):
+ request = bigtable_table_admin.CheckConsistencyRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+ if consistency_token is not None:
+ request.consistency_token = consistency_token
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.check_consistency]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def snapshot_table(
+ self,
+ request: Optional[
+ Union[bigtable_table_admin.SnapshotTableRequest, dict]
+ ] = None,
+ *,
+ name: Optional[str] = None,
+ cluster: Optional[str] = None,
+ snapshot_id: Optional[str] = None,
+ description: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operation.Operation:
+ r"""Creates a new snapshot in the specified cluster from
+ the specified source table. The cluster and the table
+ must be in the same instance.
+
+ Note: This is a private alpha release of Cloud Bigtable
+ snapshots. This feature is not currently available to
+ most Cloud Bigtable customers. This feature might be
+ changed in backward-incompatible ways and is not
+ recommended for production use. It is not subject to any
+ SLA or deprecation policy.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_snapshot_table():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.SnapshotTableRequest(
+ name="name_value",
+ cluster="cluster_value",
+ snapshot_id="snapshot_id_value",
+ )
+
+ # Make the request
+ operation = client.snapshot_table(request=request)
+
+ print("Waiting for operation to complete...")
+
+ response = operation.result()
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.SnapshotTableRequest, dict]):
+ The request object. Request message for
+ [google.bigtable.admin.v2.BigtableTableAdmin.SnapshotTable][google.bigtable.admin.v2.BigtableTableAdmin.SnapshotTable]
+
+ Note: This is a private alpha release of Cloud Bigtable
+ snapshots. This feature is not currently available to
+ most Cloud Bigtable customers. This feature might be
+ changed in backward-incompatible ways and is not
+ recommended for production use. It is not subject to any
+ SLA or deprecation policy.
+ name (str):
+ Required. The unique name of the table to have the
+ snapshot taken. Values are of the form
+ ``projects/{project}/instances/{instance}/tables/{table}``.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ cluster (str):
+ Required. The name of the cluster where the snapshot
+ will be created in. Values are of the form
+ ``projects/{project}/instances/{instance}/clusters/{cluster}``.
+
+ This corresponds to the ``cluster`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ snapshot_id (str):
+ Required. The ID by which the new snapshot should be
+ referred to within the parent cluster, e.g.,
+ ``mysnapshot`` of the form:
+ ``[_a-zA-Z0-9][-_.a-zA-Z0-9]*`` rather than
+ ``projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/mysnapshot``.
+
+ This corresponds to the ``snapshot_id`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ description (str):
+ Description of the snapshot.
+ This corresponds to the ``description`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.api_core.operation.Operation:
+ An object representing a long-running operation.
+
+ The result type for the operation will be :class:`google.cloud.bigtable_admin_v2.types.Snapshot` A snapshot of a table at a particular time. A snapshot can be used as a
+ checkpoint for data restoration or a data source for
+ a new table.
+
+ Note: This is a private alpha release of Cloud
+ Bigtable snapshots. This feature is not currently
+ available to most Cloud Bigtable customers. This
+ feature might be changed in backward-incompatible
+ ways and is not recommended for production use. It is
+ not subject to any SLA or deprecation policy.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name, cluster, snapshot_id, description]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.SnapshotTableRequest):
+ request = bigtable_table_admin.SnapshotTableRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+ if cluster is not None:
+ request.cluster = cluster
+ if snapshot_id is not None:
+ request.snapshot_id = snapshot_id
+ if description is not None:
+ request.description = description
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.snapshot_table]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Wrap the response in an operation future.
+ response = operation.from_gapic(
+ response,
+ self._transport.operations_client,
+ table.Snapshot,
+ metadata_type=bigtable_table_admin.SnapshotTableMetadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def get_snapshot(
+ self,
+ request: Optional[Union[bigtable_table_admin.GetSnapshotRequest, dict]] = None,
+ *,
+ name: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> table.Snapshot:
+ r"""Gets metadata information about the specified
+ snapshot.
+ Note: This is a private alpha release of Cloud Bigtable
+ snapshots. This feature is not currently available to
+ most Cloud Bigtable customers. This feature might be
+ changed in backward-incompatible ways and is not
+ recommended for production use. It is not subject to any
+ SLA or deprecation policy.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_get_snapshot():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.GetSnapshotRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = client.get_snapshot(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.GetSnapshotRequest, dict]):
+ The request object. Request message for
+ [google.bigtable.admin.v2.BigtableTableAdmin.GetSnapshot][google.bigtable.admin.v2.BigtableTableAdmin.GetSnapshot]
+
+ Note: This is a private alpha release of Cloud Bigtable
+ snapshots. This feature is not currently available to
+ most Cloud Bigtable customers. This feature might be
+ changed in backward-incompatible ways and is not
+ recommended for production use. It is not subject to any
+ SLA or deprecation policy.
+ name (str):
+ Required. The unique name of the requested snapshot.
+ Values are of the form
+ ``projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}``.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.types.Snapshot:
+ A snapshot of a table at a particular
+ time. A snapshot can be used as a
+ checkpoint for data restoration or a
+ data source for a new table.
+
+ Note: This is a private alpha release of
+ Cloud Bigtable snapshots. This feature
+ is not currently available to most Cloud
+ Bigtable customers. This feature might
+ be changed in backward-incompatible ways
+ and is not recommended for production
+ use. It is not subject to any SLA or
+ deprecation policy.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.GetSnapshotRequest):
+ request = bigtable_table_admin.GetSnapshotRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.get_snapshot]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def list_snapshots(
+ self,
+ request: Optional[
+ Union[bigtable_table_admin.ListSnapshotsRequest, dict]
+ ] = None,
+ *,
+ parent: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> pagers.ListSnapshotsPager:
+ r"""Lists all snapshots associated with the specified
+ cluster.
+ Note: This is a private alpha release of Cloud Bigtable
+ snapshots. This feature is not currently available to
+ most Cloud Bigtable customers. This feature might be
+ changed in backward-incompatible ways and is not
+ recommended for production use. It is not subject to any
+ SLA or deprecation policy.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_list_snapshots():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.ListSnapshotsRequest(
+ parent="parent_value",
+ )
+
+ # Make the request
+ page_result = client.list_snapshots(request=request)
+
+ # Handle the response
+ for response in page_result:
+ print(response)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.ListSnapshotsRequest, dict]):
+ The request object. Request message for
+ [google.bigtable.admin.v2.BigtableTableAdmin.ListSnapshots][google.bigtable.admin.v2.BigtableTableAdmin.ListSnapshots]
+
+ Note: This is a private alpha release of Cloud Bigtable
+ snapshots. This feature is not currently available to
+ most Cloud Bigtable customers. This feature might be
+ changed in backward-incompatible ways and is not
+ recommended for production use. It is not subject to any
+ SLA or deprecation policy.
+ parent (str):
+ Required. The unique name of the cluster for which
+ snapshots should be listed. Values are of the form
+ ``projects/{project}/instances/{instance}/clusters/{cluster}``.
+ Use ``{cluster} = '-'`` to list snapshots for all
+ clusters in an instance, e.g.,
+ ``projects/{project}/instances/{instance}/clusters/-``.
+
+ This corresponds to the ``parent`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.services.bigtable_table_admin.pagers.ListSnapshotsPager:
+ Response message for
+ [google.bigtable.admin.v2.BigtableTableAdmin.ListSnapshots][google.bigtable.admin.v2.BigtableTableAdmin.ListSnapshots]
+
+ Note: This is a private alpha release of Cloud
+ Bigtable snapshots. This feature is not currently
+ available to most Cloud Bigtable customers. This
+ feature might be changed in backward-incompatible
+ ways and is not recommended for production use. It is
+ not subject to any SLA or deprecation policy.
+
+ Iterating over this object will yield results and
+ resolve additional pages automatically.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [parent]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.ListSnapshotsRequest):
+ request = bigtable_table_admin.ListSnapshotsRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if parent is not None:
+ request.parent = parent
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.list_snapshots]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # This method is paged; wrap the response in a pager, which provides
+ # an `__iter__` convenience method.
+ response = pagers.ListSnapshotsPager(
+ method=rpc,
+ request=request,
+ response=response,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def delete_snapshot(
+ self,
+ request: Optional[
+ Union[bigtable_table_admin.DeleteSnapshotRequest, dict]
+ ] = None,
+ *,
+ name: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> None:
+ r"""Permanently deletes the specified snapshot.
+
+ Note: This is a private alpha release of Cloud Bigtable
+ snapshots. This feature is not currently available to
+ most Cloud Bigtable customers. This feature might be
+ changed in backward-incompatible ways and is not
+ recommended for production use. It is not subject to any
+ SLA or deprecation policy.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_delete_snapshot():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.DeleteSnapshotRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ client.delete_snapshot(request=request)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.DeleteSnapshotRequest, dict]):
+ The request object. Request message for
+ [google.bigtable.admin.v2.BigtableTableAdmin.DeleteSnapshot][google.bigtable.admin.v2.BigtableTableAdmin.DeleteSnapshot]
+
+ Note: This is a private alpha release of Cloud Bigtable
+ snapshots. This feature is not currently available to
+ most Cloud Bigtable customers. This feature might be
+ changed in backward-incompatible ways and is not
+ recommended for production use. It is not subject to any
+ SLA or deprecation policy.
+ name (str):
+ Required. The unique name of the snapshot to be deleted.
+ Values are of the form
+ ``projects/{project}/instances/{instance}/clusters/{cluster}/snapshots/{snapshot}``.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.DeleteSnapshotRequest):
+ request = bigtable_table_admin.DeleteSnapshotRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.delete_snapshot]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ def create_backup(
+ self,
+ request: Optional[Union[bigtable_table_admin.CreateBackupRequest, dict]] = None,
+ *,
+ parent: Optional[str] = None,
+ backup_id: Optional[str] = None,
+ backup: Optional[table.Backup] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operation.Operation:
+ r"""Starts creating a new Cloud Bigtable Backup. The returned backup
+ [long-running operation][google.longrunning.Operation] can be
+ used to track creation of the backup. The
+ [metadata][google.longrunning.Operation.metadata] field type is
+ [CreateBackupMetadata][google.bigtable.admin.v2.CreateBackupMetadata].
+ The [response][google.longrunning.Operation.response] field type
+ is [Backup][google.bigtable.admin.v2.Backup], if successful.
+ Cancelling the returned operation will stop the creation and
+ delete the backup.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_create_backup():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminClient()
+
+ # Initialize request argument(s)
+ backup = bigtable_admin_v2.Backup()
+ backup.source_table = "source_table_value"
+
+ request = bigtable_admin_v2.CreateBackupRequest(
+ parent="parent_value",
+ backup_id="backup_id_value",
+ backup=backup,
+ )
+
+ # Make the request
+ operation = client.create_backup(request=request)
+
+ print("Waiting for operation to complete...")
+
+ response = operation.result()
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.CreateBackupRequest, dict]):
+ The request object. The request for
+ [CreateBackup][google.bigtable.admin.v2.BigtableTableAdmin.CreateBackup].
+ parent (str):
+ Required. This must be one of the clusters in the
+ instance in which this table is located. The backup will
+ be stored in this cluster. Values are of the form
+ ``projects/{project}/instances/{instance}/clusters/{cluster}``.
+
+ This corresponds to the ``parent`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ backup_id (str):
+ Required. The id of the backup to be created. The
+ ``backup_id`` along with the parent ``parent`` are
+ combined as {parent}/backups/{backup_id} to create the
+ full backup name, of the form:
+ ``projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup_id}``.
+ This string must be between 1 and 50 characters in
+ length and match the regex [*a-zA-Z0-9][-*.a-zA-Z0-9]\*.
+
+ This corresponds to the ``backup_id`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ backup (google.cloud.bigtable_admin_v2.types.Backup):
+ Required. The backup to create.
+ This corresponds to the ``backup`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.api_core.operation.Operation:
+ An object representing a long-running operation.
+
+ The result type for the operation will be
+ :class:`google.cloud.bigtable_admin_v2.types.Backup` A
+ backup of a Cloud Bigtable table.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [parent, backup_id, backup]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.CreateBackupRequest):
+ request = bigtable_table_admin.CreateBackupRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if parent is not None:
+ request.parent = parent
+ if backup_id is not None:
+ request.backup_id = backup_id
+ if backup is not None:
+ request.backup = backup
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.create_backup]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Wrap the response in an operation future.
+ response = operation.from_gapic(
+ response,
+ self._transport.operations_client,
+ table.Backup,
+ metadata_type=bigtable_table_admin.CreateBackupMetadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def get_backup(
+ self,
+ request: Optional[Union[bigtable_table_admin.GetBackupRequest, dict]] = None,
+ *,
+ name: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> table.Backup:
+ r"""Gets metadata on a pending or completed Cloud
+ Bigtable Backup.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_get_backup():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.GetBackupRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ response = client.get_backup(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.GetBackupRequest, dict]):
+ The request object. The request for
+ [GetBackup][google.bigtable.admin.v2.BigtableTableAdmin.GetBackup].
+ name (str):
+ Required. Name of the backup. Values are of the form
+ ``projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}``.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.types.Backup:
+ A backup of a Cloud Bigtable table.
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.GetBackupRequest):
+ request = bigtable_table_admin.GetBackupRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.get_backup]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def update_backup(
+ self,
+ request: Optional[Union[bigtable_table_admin.UpdateBackupRequest, dict]] = None,
+ *,
+ backup: Optional[table.Backup] = None,
+ update_mask: Optional[field_mask_pb2.FieldMask] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> table.Backup:
+ r"""Updates a pending or completed Cloud Bigtable Backup.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_update_backup():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminClient()
+
+ # Initialize request argument(s)
+ backup = bigtable_admin_v2.Backup()
+ backup.source_table = "source_table_value"
+
+ request = bigtable_admin_v2.UpdateBackupRequest(
+ backup=backup,
+ )
+
+ # Make the request
+ response = client.update_backup(request=request)
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.UpdateBackupRequest, dict]):
+ The request object. The request for
+ [UpdateBackup][google.bigtable.admin.v2.BigtableTableAdmin.UpdateBackup].
+ backup (google.cloud.bigtable_admin_v2.types.Backup):
+ Required. The backup to update. ``backup.name``, and the
+ fields to be updated as specified by ``update_mask`` are
+ required. Other fields are ignored. Update is only
+ supported for the following fields:
+
+ - ``backup.expire_time``.
+
+ This corresponds to the ``backup`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ update_mask (google.protobuf.field_mask_pb2.FieldMask):
+ Required. A mask specifying which fields (e.g.
+ ``expire_time``) in the Backup resource should be
+ updated. This mask is relative to the Backup resource,
+ not to the request message. The field mask must always
+ be specified; this prevents any future fields from being
+ erased accidentally by clients that do not know about
+ them.
+
+ This corresponds to the ``update_mask`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.types.Backup:
+ A backup of a Cloud Bigtable table.
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [backup, update_mask]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.UpdateBackupRequest):
+ request = bigtable_table_admin.UpdateBackupRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if backup is not None:
+ request.backup = backup
+ if update_mask is not None:
+ request.update_mask = update_mask
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.update_backup]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata(
+ (("backup.name", request.backup.name),)
+ ),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def delete_backup(
+ self,
+ request: Optional[Union[bigtable_table_admin.DeleteBackupRequest, dict]] = None,
+ *,
+ name: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> None:
+ r"""Deletes a pending or completed Cloud Bigtable backup.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_delete_backup():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.DeleteBackupRequest(
+ name="name_value",
+ )
+
+ # Make the request
+ client.delete_backup(request=request)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.DeleteBackupRequest, dict]):
+ The request object. The request for
+ [DeleteBackup][google.bigtable.admin.v2.BigtableTableAdmin.DeleteBackup].
+ name (str):
+ Required. Name of the backup to delete. Values are of
+ the form
+ ``projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup}``.
+
+ This corresponds to the ``name`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [name]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.DeleteBackupRequest):
+ request = bigtable_table_admin.DeleteBackupRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if name is not None:
+ request.name = name
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.delete_backup]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ def list_backups(
+ self,
+ request: Optional[Union[bigtable_table_admin.ListBackupsRequest, dict]] = None,
+ *,
+ parent: Optional[str] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> pagers.ListBackupsPager:
+ r"""Lists Cloud Bigtable backups. Returns both completed
+ and pending backups.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_list_backups():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.ListBackupsRequest(
+ parent="parent_value",
+ )
+
+ # Make the request
+ page_result = client.list_backups(request=request)
+
+ # Handle the response
+ for response in page_result:
+ print(response)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.ListBackupsRequest, dict]):
+ The request object. The request for
+ [ListBackups][google.bigtable.admin.v2.BigtableTableAdmin.ListBackups].
+ parent (str):
+ Required. The cluster to list backups from. Values are
+ of the form
+ ``projects/{project}/instances/{instance}/clusters/{cluster}``.
+ Use ``{cluster} = '-'`` to list backups for all clusters
+ in an instance, e.g.,
+ ``projects/{project}/instances/{instance}/clusters/-``.
+
+ This corresponds to the ``parent`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.cloud.bigtable_admin_v2.services.bigtable_table_admin.pagers.ListBackupsPager:
+ The response for
+ [ListBackups][google.bigtable.admin.v2.BigtableTableAdmin.ListBackups].
+
+ Iterating over this object will yield results and
+ resolve additional pages automatically.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Quick check: If we got a request object, we should *not* have
+ # gotten any keyword arguments that map to the request.
+ flattened_params = [parent]
+ has_flattened_params = (
+ len([param for param in flattened_params if param is not None]) > 0
+ )
+ if request is not None and has_flattened_params:
+ raise ValueError(
+ "If the `request` argument is set, then none of "
+ "the individual field arguments should be set."
+ )
+
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.ListBackupsRequest):
+ request = bigtable_table_admin.ListBackupsRequest(request)
+ # If we have keyword arguments corresponding to fields on the
+ # request, apply these.
+ if parent is not None:
+ request.parent = parent
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.list_backups]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # This method is paged; wrap the response in a pager, which provides
+ # an `__iter__` convenience method.
+ response = pagers.ListBackupsPager(
+ method=rpc,
+ request=request,
+ response=response,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def _restore_table(
+ self,
+ request: Optional[Union[bigtable_table_admin.RestoreTableRequest, dict]] = None,
+ *,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operation.Operation:
+ r"""Create a new table by restoring from a completed backup. The
+ returned table [long-running
+ operation][google.longrunning.Operation] can be used to track
+ the progress of the operation, and to cancel it. The
+ [metadata][google.longrunning.Operation.metadata] field type is
+ [RestoreTableMetadata][google.bigtable.admin.v2.RestoreTableMetadata].
+ The [response][google.longrunning.Operation.response] type is
+ [Table][google.bigtable.admin.v2.Table], if successful.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_restore_table():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.RestoreTableRequest(
+ backup="backup_value",
+ parent="parent_value",
+ table_id="table_id_value",
+ )
+
+ # Make the request
+ operation = client._restore_table(request=request)
+
+ print("Waiting for operation to complete...")
+
+ response = operation.result()
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.RestoreTableRequest, dict]):
+ The request object. The request for
+ [RestoreTable][google.bigtable.admin.v2.BigtableTableAdmin.RestoreTable].
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
+ should be retried.
+ timeout (float): The timeout for this request.
+ metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
+ sent along with the request as metadata. Normally, each value must be of type `str`,
+ but for metadata keys ending with the suffix `-bin`, the corresponding values must
+ be of type `bytes`.
+
+ Returns:
+ google.api_core.operation.Operation:
+ An object representing a long-running operation.
+
+ The result type for the operation will be :class:`google.cloud.bigtable_admin_v2.types.Table` A collection of user data indexed by row, column, and timestamp.
+ Each table is served using the resources of its
+ parent cluster.
+
+ """
+ # Create or coerce a protobuf request object.
+ # - Use the request object if provided (there's no risk of modifying the input as
+ # there are no flattened fields), or create one.
+ if not isinstance(request, bigtable_table_admin.RestoreTableRequest):
+ request = bigtable_table_admin.RestoreTableRequest(request)
+
+ # Wrap the RPC method; this adds retry and timeout information,
+ # and friendly error handling.
+ rpc = self._transport._wrapped_methods[self._transport.restore_table]
+
+ # Certain fields should be provided within the metadata header;
+ # add these here.
+ metadata = tuple(metadata) + (
+ gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
+ )
+
+ # Validate the universe domain.
+ self._validate_universe_domain()
+
+ # Send the request.
+ response = rpc(
+ request,
+ retry=retry,
+ timeout=timeout,
+ metadata=metadata,
+ )
+
+ # Wrap the response in an operation future.
+ response = operation.from_gapic(
+ response,
+ self._transport.operations_client,
+ table.Table,
+ metadata_type=bigtable_table_admin.RestoreTableMetadata,
+ )
+
+ # Done; return the response.
+ return response
+
+ def copy_backup(
+ self,
+ request: Optional[Union[bigtable_table_admin.CopyBackupRequest, dict]] = None,
+ *,
+ parent: Optional[str] = None,
+ backup_id: Optional[str] = None,
+ source_backup: Optional[str] = None,
+ expire_time: Optional[timestamp_pb2.Timestamp] = None,
+ retry: OptionalRetry = gapic_v1.method.DEFAULT,
+ timeout: Union[float, object] = gapic_v1.method.DEFAULT,
+ metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
+ ) -> operation.Operation:
+ r"""Copy a Cloud Bigtable backup to a new backup in the
+ destination cluster located in the destination instance
+ and project.
+
+ .. code-block:: python
+
+ # This snippet has been automatically generated and should be regarded as a
+ # code template only.
+ # It will require modifications to work:
+ # - It may require correct/in-range values for request initialization.
+ # - It may require specifying regional endpoints when creating the service
+ # client as shown in:
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
+ from google.cloud import bigtable_admin_v2
+
+ def sample_copy_backup():
+ # Create a client
+ client = bigtable_admin_v2.BigtableTableAdminClient()
+
+ # Initialize request argument(s)
+ request = bigtable_admin_v2.CopyBackupRequest(
+ parent="parent_value",
+ backup_id="backup_id_value",
+ source_backup="source_backup_value",
+ )
+
+ # Make the request
+ operation = client.copy_backup(request=request)
+
+ print("Waiting for operation to complete...")
+
+ response = operation.result()
+
+ # Handle the response
+ print(response)
+
+ Args:
+ request (Union[google.cloud.bigtable_admin_v2.types.CopyBackupRequest, dict]):
+ The request object. The request for
+ [CopyBackup][google.bigtable.admin.v2.BigtableTableAdmin.CopyBackup].
+ parent (str):
+ Required. The name of the destination cluster that will
+ contain the backup copy. The cluster must already exist.
+ Values are of the form:
+ ``projects/{project}/instances/{instance}/clusters/{cluster}``.
+
+ This corresponds to the ``parent`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ backup_id (str):
+ Required. The id of the new backup. The ``backup_id``
+ along with ``parent`` are combined as
+ {parent}/backups/{backup_id} to create the full backup
+ name, of the form:
+ ``projects/{project}/instances/{instance}/clusters/{cluster}/backups/{backup_id}``.
+ This string must be between 1 and 50 characters in
+ length and match the regex [*a-zA-Z0-9][-*.a-zA-Z0-9]\*.
+
+ This corresponds to the ``backup_id`` field
+ on the ``request`` instance; if ``request`` is provided, this
+ should not be set.
+ source_backup (str):
+ Required. The source backup to be copied from. The
+ source backup needs to be in READY state for it to be
+ copied. Copying a copied backup is not allowed. Once
+ CopyBackup is in progress, the source backup cannot be
+ deleted or cleaned up on expiration until CopyBackup is
+ finished. Values are of the form:
+ ``projects//instances//clusters//backups/