MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / deploy_on_google

Function deploy_on_google

web/pgadmin/misc/cloud/google/__init__.py:283–355  ·  view source on GitHub ↗

Deploy the Postgres instance on RDS.

(data)

Source from the content-addressed store, hash-verified

281
282
283def deploy_on_google(data):
284 """Deploy the Postgres instance on RDS."""
285 _cmd = 'python'
286 _cmd_script = '{0}/pgacloud/pgacloud.py'.format(root)
287 _label = data['instance_details']['name']
288
289 # Supported arguments for google cloud sql deployment
290 args = [_cmd_script,
291 data['cloud'],
292 'create-instance',
293
294 '--project', data['instance_details']['project'],
295
296 '--region', data['instance_details']['region'],
297
298 '--name', data['instance_details']['name'],
299
300 '--db-version', data['instance_details']['db_version'],
301
302 '--instance-type', data['instance_details']['instance_type'],
303
304 '--storage-type', data['instance_details']['storage_type'],
305
306 '--storage-size', str(data['instance_details']['storage_size']),
307
308 '--public-ip', str(data['instance_details']['public_ips']),
309
310 '--availability-zone',
311 data['instance_details']['availability_zone'],
312
313 '--high-availability',
314 str(data['instance_details']['high_availability']),
315
316 '--secondary-availability-zone',
317 data['instance_details']['secondary_availability_zone'],
318 ]
319
320 _cmd_msg = '{0} {1} {2}'.format(_cmd, _cmd_script, ' '.join(args))
321 try:
322 sid = _create_server({
323 'gid': data['db_details']['gid'],
324 'name': data['instance_details']['name'],
325 'db': 'postgres',
326 'username': 'postgres',
327 'port': 5432,
328 'cloud_status': -1
329 })
330
331 p = BatchProcess(
332 desc=CloudProcessDesc(sid, _cmd_msg, data['cloud'],
333 data['instance_details']['name']),
334 cmd=_cmd,
335 args=args
336 )
337
338 # Set env variables for background process of deployment
339 env = dict()
340 google_obj = _get_google_from_session()

Callers 1

deploy_on_cloudFunction · 0.90

Calls 8

set_env_variablesMethod · 0.95
update_server_idMethod · 0.95
startMethod · 0.95
_create_serverFunction · 0.90
BatchProcessClass · 0.90
CloudProcessDescClass · 0.90
_get_google_from_sessionFunction · 0.85
joinMethod · 0.80

Tested by

no test coverage detected