Skip to content

Commit eb9d734

Browse files
committed
Merge branch 'refs/heads/main' into consistency-group-stop-replication
# Conflicts: # compute/client_library/snippets/tests/test_disks.py
2 parents acba234 + f9fddc3 commit eb9d734

File tree

44 files changed

+533
-47
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+533
-47
lines changed

.github/blunderbuss.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ assign_prs_by:
172172
- labels:
173173
- "api: cloudsql"
174174
to:
175-
- GoogleCloudPlatform/infra-db-sdk
175+
- GoogleCloudPlatform/cloud-sql-connectors
176176
- labels:
177177
- "api: bigtable"
178178
- "api: datastore"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
# pin pytest to 4.6.11 for Python2.
22
pytest==4.6.11; python_version < '3.0'
3+
pytest==8.3.4; python_version >= '3.0'
4+
six==1.17.0
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
Flask==1.1.4; python_version < '3.0'
22
Flask==3.0.0; python_version > '3.0'
33
Werkzeug==1.0.1; python_version < '3.0'
4-
Werkzeug==3.0.3; python_version > '3.0'
4+
Werkzeug==3.0.6; python_version > '3.0'

asset/snippets/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ google-cloud-storage==2.9.0
22
google-cloud-asset==3.19.0
33
google-cloud-resource-manager==1.10.1
44
google-cloud-pubsub==2.21.5
5-
google-cloud-bigquery==3.25.0
5+
google-cloud-bigquery==3.27.0
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
google-cloud-bigquery==3.25.0
1+
google-cloud-bigquery==3.27.0
22
google-cloud-pubsub==2.21.5
33
pytest==8.2.0
44
mock==5.1.0
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
google-cloud-bigquery-migration==0.11.9
1+
google-cloud-bigquery-migration==0.11.11

bigquery/bqml/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
google-cloud-bigquery[pandas,bqstorage]==3.25.0
1+
google-cloud-bigquery[pandas,bqstorage]==3.27.0
22
google-cloud-bigquery-storage==2.27.0
33
pandas==1.3.5; python_version == '3.7'
44
pandas==2.0.3; python_version == '3.8'

bigquery/pandas-gbq-migration/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
google-cloud-bigquery==3.25.0
1+
google-cloud-bigquery==3.27.0
22
google-cloud-bigquery-storage==2.27.0
33
pandas==2.0.3; python_version == '3.8'
44
pandas==2.2.2; python_version > '3.8'
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
google-cloud-build==3.16.0
1+
google-cloud-build==3.27.1
22
google-auth==2.19.1
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Copyright 2024 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# This is an ingredient file. It is not meant to be run directly. Check the samples/snippets
16+
# folder for complete code samples that are ready to be used.
17+
# Disabling flake8 for the ingredients file, as it would fail F821 - undefined name check.
18+
# flake8: noqa
19+
20+
from google.cloud import compute_v1
21+
22+
23+
# <INGREDIENT create_replicated_disk>
24+
def create_regional_replicated_disk(
25+
project_id,
26+
region,
27+
disk_name,
28+
size_gb,
29+
disk_type: str = "pd-ssd",
30+
) -> compute_v1.Disk:
31+
"""Creates a synchronously replicated disk in a region across two zones.
32+
Args:
33+
project_id (str): The ID of the Google Cloud project.
34+
region (str): The region where the disk will be created.
35+
disk_name (str): The name of the disk.
36+
size_gb (int): The size of the disk in gigabytes.
37+
disk_type (str): The type of the disk. Default is 'pd-ssd'.
38+
Returns:
39+
compute_v1.Disk: The created disk object.
40+
"""
41+
disk = compute_v1.Disk()
42+
disk.name = disk_name
43+
44+
# You can specify the zones where the disk will be replicated.
45+
disk.replica_zones = [
46+
f"zones/{region}-a",
47+
f"zones/{region}-b",
48+
]
49+
disk.size_gb = size_gb
50+
disk.type = f"regions/{region}/diskTypes/{disk_type}"
51+
52+
client = compute_v1.RegionDisksClient()
53+
operation = client.insert(project=project_id, region=region, disk_resource=disk)
54+
55+
wait_for_extended_operation(operation, "Replicated disk creation")
56+
57+
return client.get(project=project_id, region=region, disk=disk_name)
58+
59+
60+
# </INGREDIENT>

0 commit comments

Comments
 (0)