MCPcopy Index your code
hub / github.com/googleapis/google-api-python-client / main

Function main

samples/compute/create_instance.py:146–177  ·  view source on GitHub ↗
(project, bucket, zone, instance_name, wait=True)

Source from the content-addressed store, hash-verified

144
145# [START compute_apiary_run]
146def main(project, bucket, zone, instance_name, wait=True):
147 compute = googleapiclient.discovery.build("compute", "v1")
148
149 print("Creating instance.")
150
151 operation = create_instance(compute, project, zone, instance_name, bucket)
152 wait_for_operation(compute, project, zone, operation["name"])
153
154 instances = list_instances(compute, project, zone)
155
156 print("Instances in project %s and zone %s:" % (project, zone))
157 for instance in instances:
158 print(" - " + instance["name"])
159
160 print(
161 """
162Instance created.
163It will take a minute or two for the instance to complete work.
164Check this URL: http://storage.googleapis.com/{}/output.png
165Once the image is uploaded press enter to delete the instance.
166""".format(
167 bucket
168 )
169 )
170
171 if wait:
172 input()
173
174 print("Deleting instance.")
175
176 operation = delete_instance(compute, project, zone, instance_name)
177 wait_for_operation(compute, project, zone, operation["name"])
178
179
180if __name__ == "__main__":

Callers 2

test_mainFunction · 0.90
create_instance.pyFile · 0.70

Calls 4

create_instanceFunction · 0.85
wait_for_operationFunction · 0.85
list_instancesFunction · 0.85
delete_instanceFunction · 0.85

Tested by 1

test_mainFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…