Skip to content

Commit

Permalink
[DM] Source representation instance support (#587)
Browse files Browse the repository at this point in the history
* Removed settings as required for source representation instances

* Disable output of gceZone for source representation instance

* Others changes for source representation instances

* Update cloud_sql.py.schema
  • Loading branch information
davidebelloni authored Feb 29, 2020
1 parent a3f0b3b commit c434f1f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
15 changes: 8 additions & 7 deletions dm/templates/cloud_sql/cloud_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ def get_instance(res_name, project_id, properties):
output_fields = [
'name',
'selfLink',
'gceZone',
'connectionName',
'backendType',
'serviceAccountEmailAddress',
]

if 'onPremisesConfiguration' not in properties:
output_fields.extend(['gceZone','connectionName','serviceAccountEmailAddress'])

outputs = [{
'name': i,
'value': '$(ref.{}.{})'.format(name, i)
Expand All @@ -81,10 +81,11 @@ def get_instance(res_name, project_id, properties):
# outputs of imported templates. If we want to use the actual IP address of
# the instantiated database in a template that uses this template, we need
# to navigate to the relevant child value here.
outputs += [{
'name': 'ipAddress',
'value': '$(ref.{}.ipAddresses[0].ipAddress)'.format(name),
}]
if 'onPremisesConfiguration' not in properties:
outputs += [{
'name': 'ipAddress',
'value': '$(ref.{}.ipAddresses[0].ipAddress)'.format(name),
}]

return DMBundle(instance, outputs)

Expand Down
3 changes: 1 addition & 2 deletions dm/templates/cloud_sql/cloud_sql.py.schema
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
info:
title: Cloud SQL
author: Sourced Group Inc.
version: 1.1.0
version: 1.1.1
description: |
Supports creation of a Cloud SQL instance with database and user resources.
For more information, see https://cloud.google.com/sql/docs/.
Expand All @@ -24,7 +24,6 @@ additionalProperties: false

required:
- region
- settings

properties:
name:
Expand Down

0 comments on commit c434f1f

Please sign in to comment.