Skip to content

Commit dd9c9fc

Browse files
feat: [google-cloud-bigquery-datatransfer] Add UnenrollDataSources API which gives users a programmatic way to unenroll data sources (#12296)
- [ ] Regenerate this pull request now. PiperOrigin-RevId: 606248188 Source-Link: googleapis/googleapis@fa4f91a Source-Link: googleapis/googleapis-gen@05afb31 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWJpZ3F1ZXJ5LWRhdGF0cmFuc2Zlci8uT3dsQm90LnlhbWwiLCJoIjoiMDVhZmIzMTMzMmZiODk1ZGMwZmQxYjgyMmJhNTBkNDllZWJkMzQwNiJ9 --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 0815e3d commit dd9c9fc

18 files changed

Lines changed: 887 additions & 3 deletions

packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
ScheduleTransferRunsResponse,
4949
StartManualTransferRunsRequest,
5050
StartManualTransferRunsResponse,
51+
UnenrollDataSourcesRequest,
5152
UpdateTransferConfigRequest,
5253
)
5354
from google.cloud.bigquery_datatransfer_v1.types.transfer import (
@@ -88,6 +89,7 @@
8889
"ScheduleTransferRunsResponse",
8990
"StartManualTransferRunsRequest",
9091
"StartManualTransferRunsResponse",
92+
"UnenrollDataSourcesRequest",
9193
"UpdateTransferConfigRequest",
9294
"EmailPreferences",
9395
"EncryptionConfiguration",

packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "3.14.1" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer_v1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
ScheduleTransferRunsResponse,
4747
StartManualTransferRunsRequest,
4848
StartManualTransferRunsResponse,
49+
UnenrollDataSourcesRequest,
4950
UpdateTransferConfigRequest,
5051
)
5152
from .types.transfer import (
@@ -94,6 +95,7 @@
9495
"TransferRun",
9596
"TransferState",
9697
"TransferType",
98+
"UnenrollDataSourcesRequest",
9799
"UpdateTransferConfigRequest",
98100
"UserInfo",
99101
)

packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer_v1/gapic_metadata.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@
8080
"start_manual_transfer_runs"
8181
]
8282
},
83+
"UnenrollDataSources": {
84+
"methods": [
85+
"unenroll_data_sources"
86+
]
87+
},
8388
"UpdateTransferConfig": {
8489
"methods": [
8590
"update_transfer_config"
@@ -160,6 +165,11 @@
160165
"start_manual_transfer_runs"
161166
]
162167
},
168+
"UnenrollDataSources": {
169+
"methods": [
170+
"unenroll_data_sources"
171+
]
172+
},
163173
"UpdateTransferConfig": {
164174
"methods": [
165175
"update_transfer_config"
@@ -240,6 +250,11 @@
240250
"start_manual_transfer_runs"
241251
]
242252
},
253+
"UnenrollDataSources": {
254+
"methods": [
255+
"unenroll_data_sources"
256+
]
257+
},
243258
"UpdateTransferConfig": {
244259
"methods": [
245260
"update_transfer_config"

packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer_v1/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "3.14.1" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer_v1/services/data_transfer_service/async_client.py

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2061,6 +2061,80 @@ async def sample_enroll_data_sources():
20612061
metadata=metadata,
20622062
)
20632063

2064+
async def unenroll_data_sources(
2065+
self,
2066+
request: Optional[Union[datatransfer.UnenrollDataSourcesRequest, dict]] = None,
2067+
*,
2068+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2069+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
2070+
metadata: Sequence[Tuple[str, str]] = (),
2071+
) -> None:
2072+
r"""Unenroll data sources in a user project. This allows users to
2073+
remove transfer configurations for these data sources. They will
2074+
no longer appear in the ListDataSources RPC and will also no
2075+
longer appear in the `BigQuery
2076+
UI <https://console.cloud.google.com/bigquery>`__.
2077+
2078+
.. code-block:: python
2079+
2080+
# This snippet has been automatically generated and should be regarded as a
2081+
# code template only.
2082+
# It will require modifications to work:
2083+
# - It may require correct/in-range values for request initialization.
2084+
# - It may require specifying regional endpoints when creating the service
2085+
# client as shown in:
2086+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
2087+
from google.cloud import bigquery_datatransfer_v1
2088+
2089+
async def sample_unenroll_data_sources():
2090+
# Create a client
2091+
client = bigquery_datatransfer_v1.DataTransferServiceAsyncClient()
2092+
2093+
# Initialize request argument(s)
2094+
request = bigquery_datatransfer_v1.UnenrollDataSourcesRequest(
2095+
)
2096+
2097+
# Make the request
2098+
await client.unenroll_data_sources(request=request)
2099+
2100+
Args:
2101+
request (Optional[Union[google.cloud.bigquery_datatransfer_v1.types.UnenrollDataSourcesRequest, dict]]):
2102+
The request object. A request to unenroll a set of data sources so they are
2103+
no longer visible in the BigQuery UI's ``Transfer`` tab.
2104+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
2105+
should be retried.
2106+
timeout (float): The timeout for this request.
2107+
metadata (Sequence[Tuple[str, str]]): Strings which should be
2108+
sent along with the request as metadata.
2109+
"""
2110+
# Create or coerce a protobuf request object.
2111+
request = datatransfer.UnenrollDataSourcesRequest(request)
2112+
2113+
# Wrap the RPC method; this adds retry and timeout information,
2114+
# and friendly error handling.
2115+
rpc = gapic_v1.method_async.wrap_method(
2116+
self._client._transport.unenroll_data_sources,
2117+
default_timeout=None,
2118+
client_info=DEFAULT_CLIENT_INFO,
2119+
)
2120+
2121+
# Certain fields should be provided within the metadata header;
2122+
# add these here.
2123+
metadata = tuple(metadata) + (
2124+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
2125+
)
2126+
2127+
# Validate the universe domain.
2128+
self._client._validate_universe_domain()
2129+
2130+
# Send the request.
2131+
await rpc(
2132+
request,
2133+
retry=retry,
2134+
timeout=timeout,
2135+
metadata=metadata,
2136+
)
2137+
20642138
async def get_location(
20652139
self,
20662140
request: Optional[locations_pb2.GetLocationRequest] = None,

packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer_v1/services/data_transfer_service/client.py

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2407,6 +2407,81 @@ def sample_enroll_data_sources():
24072407
metadata=metadata,
24082408
)
24092409

2410+
def unenroll_data_sources(
2411+
self,
2412+
request: Optional[Union[datatransfer.UnenrollDataSourcesRequest, dict]] = None,
2413+
*,
2414+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2415+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
2416+
metadata: Sequence[Tuple[str, str]] = (),
2417+
) -> None:
2418+
r"""Unenroll data sources in a user project. This allows users to
2419+
remove transfer configurations for these data sources. They will
2420+
no longer appear in the ListDataSources RPC and will also no
2421+
longer appear in the `BigQuery
2422+
UI <https://console.cloud.google.com/bigquery>`__.
2423+
2424+
.. code-block:: python
2425+
2426+
# This snippet has been automatically generated and should be regarded as a
2427+
# code template only.
2428+
# It will require modifications to work:
2429+
# - It may require correct/in-range values for request initialization.
2430+
# - It may require specifying regional endpoints when creating the service
2431+
# client as shown in:
2432+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
2433+
from google.cloud import bigquery_datatransfer_v1
2434+
2435+
def sample_unenroll_data_sources():
2436+
# Create a client
2437+
client = bigquery_datatransfer_v1.DataTransferServiceClient()
2438+
2439+
# Initialize request argument(s)
2440+
request = bigquery_datatransfer_v1.UnenrollDataSourcesRequest(
2441+
)
2442+
2443+
# Make the request
2444+
client.unenroll_data_sources(request=request)
2445+
2446+
Args:
2447+
request (Union[google.cloud.bigquery_datatransfer_v1.types.UnenrollDataSourcesRequest, dict]):
2448+
The request object. A request to unenroll a set of data sources so they are
2449+
no longer visible in the BigQuery UI's ``Transfer`` tab.
2450+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
2451+
should be retried.
2452+
timeout (float): The timeout for this request.
2453+
metadata (Sequence[Tuple[str, str]]): Strings which should be
2454+
sent along with the request as metadata.
2455+
"""
2456+
# Create or coerce a protobuf request object.
2457+
# Minor optimization to avoid making a copy if the user passes
2458+
# in a datatransfer.UnenrollDataSourcesRequest.
2459+
# There's no risk of modifying the input as we've already verified
2460+
# there are no flattened fields.
2461+
if not isinstance(request, datatransfer.UnenrollDataSourcesRequest):
2462+
request = datatransfer.UnenrollDataSourcesRequest(request)
2463+
2464+
# Wrap the RPC method; this adds retry and timeout information,
2465+
# and friendly error handling.
2466+
rpc = self._transport._wrapped_methods[self._transport.unenroll_data_sources]
2467+
2468+
# Certain fields should be provided within the metadata header;
2469+
# add these here.
2470+
metadata = tuple(metadata) + (
2471+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
2472+
)
2473+
2474+
# Validate the universe domain.
2475+
self._validate_universe_domain()
2476+
2477+
# Send the request.
2478+
rpc(
2479+
request,
2480+
retry=retry,
2481+
timeout=timeout,
2482+
metadata=metadata,
2483+
)
2484+
24102485
def __enter__(self) -> "DataTransferServiceClient":
24112486
return self
24122487

packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer_v1/services/data_transfer_service/transports/base.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,11 @@ def _prep_wrapped_messages(self, client_info):
303303
default_timeout=None,
304304
client_info=client_info,
305305
),
306+
self.unenroll_data_sources: gapic_v1.method.wrap_method(
307+
self.unenroll_data_sources,
308+
default_timeout=None,
309+
client_info=client_info,
310+
),
306311
}
307312

308313
def close(self):
@@ -470,6 +475,15 @@ def enroll_data_sources(
470475
]:
471476
raise NotImplementedError()
472477

478+
@property
479+
def unenroll_data_sources(
480+
self,
481+
) -> Callable[
482+
[datatransfer.UnenrollDataSourcesRequest],
483+
Union[empty_pb2.Empty, Awaitable[empty_pb2.Empty]],
484+
]:
485+
raise NotImplementedError()
486+
473487
@property
474488
def get_location(
475489
self,

packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer_v1/services/data_transfer_service/transports/grpc.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,36 @@ def enroll_data_sources(
661661
)
662662
return self._stubs["enroll_data_sources"]
663663

664+
@property
665+
def unenroll_data_sources(
666+
self,
667+
) -> Callable[[datatransfer.UnenrollDataSourcesRequest], empty_pb2.Empty]:
668+
r"""Return a callable for the unenroll data sources method over gRPC.
669+
670+
Unenroll data sources in a user project. This allows users to
671+
remove transfer configurations for these data sources. They will
672+
no longer appear in the ListDataSources RPC and will also no
673+
longer appear in the `BigQuery
674+
UI <https://console.cloud.google.com/bigquery>`__.
675+
676+
Returns:
677+
Callable[[~.UnenrollDataSourcesRequest],
678+
~.Empty]:
679+
A function that, when called, will call the underlying RPC
680+
on the server.
681+
"""
682+
# Generate a "stub function" on-the-fly which will actually make
683+
# the request.
684+
# gRPC handles serialization and deserialization, so we just need
685+
# to pass in the functions for each.
686+
if "unenroll_data_sources" not in self._stubs:
687+
self._stubs["unenroll_data_sources"] = self.grpc_channel.unary_unary(
688+
"/google.cloud.bigquery.datatransfer.v1.DataTransferService/UnenrollDataSources",
689+
request_serializer=datatransfer.UnenrollDataSourcesRequest.serialize,
690+
response_deserializer=empty_pb2.Empty.FromString,
691+
)
692+
return self._stubs["unenroll_data_sources"]
693+
664694
def close(self):
665695
self.grpc_channel.close()
666696

packages/google-cloud-bigquery-datatransfer/google/cloud/bigquery_datatransfer_v1/services/data_transfer_service/transports/grpc_asyncio.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,38 @@ def enroll_data_sources(
680680
)
681681
return self._stubs["enroll_data_sources"]
682682

683+
@property
684+
def unenroll_data_sources(
685+
self,
686+
) -> Callable[
687+
[datatransfer.UnenrollDataSourcesRequest], Awaitable[empty_pb2.Empty]
688+
]:
689+
r"""Return a callable for the unenroll data sources method over gRPC.
690+
691+
Unenroll data sources in a user project. This allows users to
692+
remove transfer configurations for these data sources. They will
693+
no longer appear in the ListDataSources RPC and will also no
694+
longer appear in the `BigQuery
695+
UI <https://console.cloud.google.com/bigquery>`__.
696+
697+
Returns:
698+
Callable[[~.UnenrollDataSourcesRequest],
699+
Awaitable[~.Empty]]:
700+
A function that, when called, will call the underlying RPC
701+
on the server.
702+
"""
703+
# Generate a "stub function" on-the-fly which will actually make
704+
# the request.
705+
# gRPC handles serialization and deserialization, so we just need
706+
# to pass in the functions for each.
707+
if "unenroll_data_sources" not in self._stubs:
708+
self._stubs["unenroll_data_sources"] = self.grpc_channel.unary_unary(
709+
"/google.cloud.bigquery.datatransfer.v1.DataTransferService/UnenrollDataSources",
710+
request_serializer=datatransfer.UnenrollDataSourcesRequest.serialize,
711+
response_deserializer=empty_pb2.Empty.FromString,
712+
)
713+
return self._stubs["unenroll_data_sources"]
714+
683715
def close(self):
684716
return self.grpc_channel.close()
685717

0 commit comments

Comments
 (0)