Skip to content

Commit 58202a1

Browse files
partheagcf-owl-bot[bot]
authored andcommitted
chore: update to the latest version of the generator (#170)
* chore: update to the latest version of the generator * update integration tests to reflect changes in the code * update integration tests to reflect changes in the code * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * update samples to reflect changes in the code * update samples to reflect changes in the code * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 2b1b8db commit 58202a1

11 files changed

+51
-29
lines changed

compute/compute/snippets/quickstart.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def create_instance(
161161

162162
# Wait for the create operation to complete.
163163
print(f"Creating the {instance_name} instance in {zone}...")
164-
operation = instance_client.insert(request=request)
164+
operation = instance_client.insert_unary(request=request)
165165
while operation.status != compute_v1.Operation.Status.DONE:
166166
operation = operation_client.wait(
167167
operation=operation.name, zone=zone, project=project_id
@@ -191,7 +191,7 @@ def delete_instance(project_id: str, zone: str, machine_name: str) -> None:
191191
operation_client = compute_v1.ZoneOperationsClient()
192192

193193
print(f"Deleting {machine_name} from {zone}...")
194-
operation = instance_client.delete(
194+
operation = instance_client.delete_unary(
195195
project=project_id, zone=zone, instance=machine_name
196196
)
197197
while operation.status != compute_v1.Operation.Status.DONE:

compute/compute/snippets/sample_create_vm.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ def create_with_disks(
214214
# Wait for the create operation to complete.
215215
print(f"Creating the {instance_name} instance in {zone}...")
216216

217-
operation = instance_client.insert(request=request)
217+
operation = instance_client.insert_unary(request=request)
218218
while operation.status != compute_v1.Operation.Status.DONE:
219219
operation = operation_client.wait(
220220
operation=operation.name, zone=zone, project=project_id

compute/compute/snippets/sample_default_values.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def set_usage_export_bucket(
5858
)
5959

6060
projects_client = compute_v1.ProjectsClient()
61-
operation = projects_client.set_usage_export_bucket(
61+
operation = projects_client.set_usage_export_bucket_unary(
6262
project=project_id, usage_export_location_resource=usage_export_location
6363
)
6464

@@ -121,7 +121,7 @@ def disable_usage_export(project_id: str) -> None:
121121

122122
# Setting `usage_export_location_resource` to an
123123
# empty object will disable the usage report generation.
124-
operation = projects_client.set_usage_export_bucket(
124+
operation = projects_client.set_usage_export_bucket_unary(
125125
project=project_id, usage_export_location_resource={}
126126
)
127127

compute/compute/snippets/sample_firewall.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,9 @@ def create_firewall_rule(
9595
# firewall_rule.priority = 0
9696

9797
firewall_client = compute_v1.FirewallsClient()
98-
op = firewall_client.insert(project=project_id, firewall_resource=firewall_rule)
98+
op = firewall_client.insert_unary(
99+
project=project_id, firewall_resource=firewall_rule
100+
)
99101

100102
op_client = compute_v1.GlobalOperationsClient()
101103
op_client.wait(project=project_id, operation=op.name)
@@ -122,7 +124,7 @@ def patch_firewall_priority(project_id: str, firewall_rule_name: str, priority:
122124
# The patch operation doesn't require the full definition of a Firewall object. It will only update
123125
# the values that were set in it, in this case it will only change the priority.
124126
firewall_client = compute_v1.FirewallsClient()
125-
operation = firewall_client.patch(
127+
operation = firewall_client.patch_unary(
126128
project=project_id, firewall=firewall_rule_name, firewall_resource=firewall_rule
127129
)
128130

@@ -144,7 +146,9 @@ def delete_firewall_rule(project_id: str, firewall_rule_name: str):
144146
firewall_rule_name: name of the firewall rule you want to delete.
145147
"""
146148
firewall_client = compute_v1.FirewallsClient()
147-
operation = firewall_client.delete(project=project_id, firewall=firewall_rule_name)
149+
operation = firewall_client.delete_unary(
150+
project=project_id, firewall=firewall_rule_name
151+
)
148152

149153
operation_client = compute_v1.GlobalOperationsClient()
150154
operation_client.wait(project=project_id, operation=operation.name)

compute/compute/snippets/sample_instance_from_template.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def create_instance_from_template(
4848
instance_insert_request.source_instance_template = instance_template_url
4949
instance_insert_request.instance_resource.name = instance_name
5050

51-
op = instance_client.insert(instance_insert_request)
51+
op = instance_client.insert_unary(instance_insert_request)
5252
operation_client.wait(project=project_id, zone=zone, operation=op.name)
5353

5454
return instance_client.get(project=project_id, zone=zone, instance=instance_name)
@@ -127,7 +127,7 @@ def create_instance_from_template_with_overrides(
127127
instance_insert_request.instance_resource = instance
128128
instance_insert_request.source_instance_template = instance_template.self_link
129129

130-
op = instance_client.insert(instance_insert_request)
130+
op = instance_client.insert_unary(instance_insert_request)
131131
operation_client.wait(project=project_id, zone=zone, operation=op.name)
132132

133133
return instance_client.get(project=project_id, zone=zone, instance=instance_name)

compute/compute/snippets/sample_start_stop.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def start_instance_with_encryption_key(
8585
enc_data = compute_v1.InstancesStartWithEncryptionKeyRequest()
8686
enc_data.disks = [disk_data]
8787

88-
op = instance_client.start_with_encryption_key(
88+
op = instance_client.start_with_encryption_key_unary(
8989
project=project_id,
9090
zone=zone,
9191
instance=instance_name,
@@ -113,7 +113,9 @@ def stop_instance(project_id: str, zone: str, instance_name: str):
113113
instance_client = compute_v1.InstancesClient()
114114
op_client = compute_v1.ZoneOperationsClient()
115115

116-
op = instance_client.stop(project=project_id, zone=zone, instance=instance_name)
116+
op = instance_client.stop_unary(
117+
project=project_id, zone=zone, instance=instance_name
118+
)
117119

118120
while op.status != compute_v1.Operation.Status.DONE:
119121
op = op_client.wait(operation=op.name, zone=zone, project=project_id)
@@ -136,7 +138,9 @@ def reset_instance(project_id: str, zone: str, instance_name: str):
136138
instance_client = compute_v1.InstancesClient()
137139
op_client = compute_v1.ZoneOperationsClient()
138140

139-
op = instance_client.reset(project=project_id, zone=zone, instance=instance_name)
141+
op = instance_client.reset_unary(
142+
project=project_id, zone=zone, instance=instance_name
143+
)
140144

141145
while op.status != compute_v1.Operation.Status.DONE:
142146
op = op_client.wait(operation=op.name, zone=zone, project=project_id)

compute/compute/snippets/sample_templates.py

+12-4
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ def create_template(project_id: str, template_name: str) -> compute_v1.InstanceT
118118

119119
template_client = compute_v1.InstanceTemplatesClient()
120120
operation_client = compute_v1.GlobalOperationsClient()
121-
op = template_client.insert(project=project_id, instance_template_resource=template)
121+
op = template_client.insert_unary(
122+
project=project_id, instance_template_resource=template
123+
)
122124
operation_client.wait(project=project_id, operation=op.name)
123125

124126
return template_client.get(project=project_id, instance_template=template_name)
@@ -162,7 +164,9 @@ def create_template_from_instance(
162164

163165
template_client = compute_v1.InstanceTemplatesClient()
164166
operation_client = compute_v1.GlobalOperationsClient()
165-
op = template_client.insert(project=project_id, instance_template_resource=template)
167+
op = template_client.insert_unary(
168+
project=project_id, instance_template_resource=template
169+
)
166170
operation_client.wait(project=project_id, operation=op.name)
167171

168172
return template_client.get(project=project_id, instance_template=template_name)
@@ -215,7 +219,9 @@ def create_template_with_subnet(
215219

216220
template_client = compute_v1.InstanceTemplatesClient()
217221
operation_client = compute_v1.GlobalOperationsClient()
218-
op = template_client.insert(project=project_id, instance_template_resource=template)
222+
op = template_client.insert_unary(
223+
project=project_id, instance_template_resource=template
224+
)
219225
operation_client.wait(project=project_id, operation=op.name)
220226

221227
return template_client.get(project=project_id, instance_template=template_name)
@@ -235,7 +241,9 @@ def delete_instance_template(project_id: str, template_name: str):
235241
"""
236242
template_client = compute_v1.InstanceTemplatesClient()
237243
operation_client = compute_v1.GlobalOperationsClient()
238-
op = template_client.delete(project=project_id, instance_template=template_name)
244+
op = template_client.delete_unary(
245+
project=project_id, instance_template=template_name
246+
)
239247
operation_client.wait(project=project_id, operation=op.name)
240248
return
241249

compute/compute/snippets/test_sample_create_vm.py

+10-6
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,19 @@ def src_disk(request):
4646
disk = compute_v1.Disk()
4747
disk.source_image = get_active_debian().self_link
4848
disk.name = "test-disk-" + uuid.uuid4().hex[:10]
49-
op = disk_client.insert(project=PROJECT, zone=INSTANCE_ZONE, disk_resource=disk)
49+
op = disk_client.insert_unary(
50+
project=PROJECT, zone=INSTANCE_ZONE, disk_resource=disk
51+
)
5052

5153
wait_for_operation(op, PROJECT)
5254
try:
5355
disk = disk_client.get(project=PROJECT, zone=INSTANCE_ZONE, disk=disk.name)
5456
request.cls.disk = disk
5557
yield disk
5658
finally:
57-
op = disk_client.delete(project=PROJECT, zone=INSTANCE_ZONE, disk=disk.name)
59+
op = disk_client.delete_unary(
60+
project=PROJECT, zone=INSTANCE_ZONE, disk=disk.name
61+
)
5862
wait_for_operation(op, PROJECT)
5963

6064

@@ -64,7 +68,7 @@ def snapshot(request, src_disk):
6468
snapshot = compute_v1.Snapshot()
6569
snapshot.name = "test-snap-" + uuid.uuid4().hex[:10]
6670
disk_client = compute_v1.DisksClient()
67-
op = disk_client.create_snapshot(
71+
op = disk_client.create_snapshot_unary(
6872
project=PROJECT,
6973
zone=INSTANCE_ZONE,
7074
disk=src_disk.name,
@@ -79,7 +83,7 @@ def snapshot(request, src_disk):
7983

8084
yield snapshot
8185
finally:
82-
op = snapshot_client.delete(project=PROJECT, snapshot=snapshot.name)
86+
op = snapshot_client.delete_unary(project=PROJECT, snapshot=snapshot.name)
8387
wait_for_operation(op, PROJECT)
8488

8589

@@ -89,15 +93,15 @@ def image(request, src_disk):
8993
image = compute_v1.Image()
9094
image.source_disk = src_disk.self_link
9195
image.name = "test-image-" + uuid.uuid4().hex[:10]
92-
op = image_client.insert(project=PROJECT, image_resource=image)
96+
op = image_client.insert_unary(project=PROJECT, image_resource=image)
9397

9498
wait_for_operation(op, PROJECT)
9599
try:
96100
image = image_client.get(project=PROJECT, image=image.name)
97101
request.cls.image = image
98102
yield image
99103
finally:
100-
op = image_client.delete(project=PROJECT, image=image.name)
104+
op = image_client.delete_unary(project=PROJECT, image=image.name)
101105
wait_for_operation(op, PROJECT)
102106

103107

compute/compute/snippets/test_sample_firewall.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ def firewall_rule():
4646
firewall_rule.target_tags = ["web"]
4747

4848
firewall_client = compute_v1.FirewallsClient()
49-
op = firewall_client.insert(project=PROJECT, firewall_resource=firewall_rule)
49+
op = firewall_client.insert_unary(project=PROJECT, firewall_resource=firewall_rule)
5050

5151
op_client = compute_v1.GlobalOperationsClient()
5252
op_client.wait(project=PROJECT, operation=op.name)
5353

5454
yield firewall_client.get(project=PROJECT, firewall=firewall_rule.name)
5555

5656
try:
57-
op = firewall_client.delete(project=PROJECT, firewall=firewall_rule.name)
57+
op = firewall_client.delete_unary(project=PROJECT, firewall=firewall_rule.name)
5858
op_client.wait(project=PROJECT, operation=op.name)
5959
except google.api_core.exceptions.BadRequest as err:
6060
if err.code == 400 and "is not ready" in err.message:

compute/compute/snippets/test_sample_instance_from_template.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,16 @@ def instance_template():
5151

5252
template_client = compute_v1.InstanceTemplatesClient()
5353
operation_client = compute_v1.GlobalOperationsClient()
54-
op = template_client.insert(project=PROJECT, instance_template_resource=template)
54+
op = template_client.insert_unary(
55+
project=PROJECT, instance_template_resource=template
56+
)
5557
operation_client.wait(project=PROJECT, operation=op.name)
5658

5759
template = template_client.get(project=PROJECT, instance_template=template.name)
5860

5961
yield template
6062

61-
op = template_client.delete(project=PROJECT, instance_template=template.name)
63+
op = template_client.delete_unary(project=PROJECT, instance_template=template.name)
6264
operation_client.wait(project=PROJECT, operation=op.name)
6365

6466

compute/compute/snippets/test_sample_start_stop.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def _create_instance(request: compute_v1.InsertInstanceRequest):
8383
instance_client = compute_v1.InstancesClient()
8484
operation_client = compute_v1.ZoneOperationsClient()
8585

86-
operation = instance_client.insert(request=request)
86+
operation = instance_client.insert_unary(request=request)
8787
while operation.status != compute_v1.Operation.Status.DONE:
8888
operation = operation_client.wait(
8989
operation=operation.name, zone=INSTANCE_ZONE, project=PROJECT
@@ -98,7 +98,7 @@ def _delete_instance(instance: compute_v1.Instance):
9898
instance_client = compute_v1.InstancesClient()
9999
operation_client = compute_v1.ZoneOperationsClient()
100100

101-
operation = instance_client.delete(
101+
operation = instance_client.delete_unary(
102102
project=PROJECT, zone=INSTANCE_ZONE, instance=instance.name
103103
)
104104
while operation.status != compute_v1.Operation.Status.DONE:

0 commit comments

Comments
 (0)