mirror of
https://github.com/ansible-collections/google.cloud.git
synced 2025-07-27 15:11:33 -07:00
Sql database port (#244)
Signed-off-by: Modular Magician <magic-modules@google.com>
This commit is contained in:
parent
9f2e658ec6
commit
a075750f3b
2 changed files with 11 additions and 24 deletions
|
@ -59,15 +59,10 @@ options:
|
||||||
description:
|
description:
|
||||||
- The name of the database in the Cloud SQL instance.
|
- The name of the database in the Cloud SQL instance.
|
||||||
- This does not include the project ID or instance name.
|
- This does not include the project ID or instance name.
|
||||||
required: false
|
required: true
|
||||||
instance:
|
instance:
|
||||||
description:
|
description:
|
||||||
- The name of the Cloud SQL instance. This does not include the project ID.
|
- The name of the Cloud SQL instance. This does not include the project ID.
|
||||||
- 'This field represents a link to a Instance resource in GCP. It can be specified
|
|
||||||
in two ways. First, you can place a dictionary with key ''name'' and value of
|
|
||||||
your resource''s name Alternatively, you can add `register: name-of-resource`
|
|
||||||
to a gcp_sql_instance task and then set this instance field to "{{ name-of-resource
|
|
||||||
}}"'
|
|
||||||
required: true
|
required: true
|
||||||
extends_documentation_fragment: gcp
|
extends_documentation_fragment: gcp
|
||||||
'''
|
'''
|
||||||
|
@ -121,7 +116,7 @@ instance:
|
||||||
description:
|
description:
|
||||||
- The name of the Cloud SQL instance. This does not include the project ID.
|
- The name of the Cloud SQL instance. This does not include the project ID.
|
||||||
returned: success
|
returned: success
|
||||||
type: dict
|
type: str
|
||||||
'''
|
'''
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
@ -145,8 +140,8 @@ def main():
|
||||||
state=dict(default='present', choices=['present', 'absent'], type='str'),
|
state=dict(default='present', choices=['present', 'absent'], type='str'),
|
||||||
charset=dict(type='str'),
|
charset=dict(type='str'),
|
||||||
collation=dict(type='str'),
|
collation=dict(type='str'),
|
||||||
name=dict(type='str'),
|
name=dict(required=True, type='str'),
|
||||||
instance=dict(required=True, type='dict'),
|
instance=dict(required=True, type='str'),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -218,13 +213,11 @@ def fetch_resource(module, link, kind, allow_not_found=True):
|
||||||
|
|
||||||
|
|
||||||
def self_link(module):
|
def self_link(module):
|
||||||
res = {'project': module.params['project'], 'instance': replace_resource_dict(module.params['instance'], 'name'), 'name': module.params['name']}
|
return "https://www.googleapis.com/sql/v1beta4/projects/{project}/instances/{instance}/databases/{name}".format(**module.params)
|
||||||
return "https://www.googleapis.com/sql/v1beta4/projects/{project}/instances/{instance}/databases/{name}".format(**res)
|
|
||||||
|
|
||||||
|
|
||||||
def collection(module):
|
def collection(module):
|
||||||
res = {'project': module.params['project'], 'instance': replace_resource_dict(module.params['instance'], 'name')}
|
return "https://www.googleapis.com/sql/v1beta4/projects/{project}/instances/{instance}/databases".format(**module.params)
|
||||||
return "https://www.googleapis.com/sql/v1beta4/projects/{project}/instances/{instance}/databases".format(**res)
|
|
||||||
|
|
||||||
|
|
||||||
def return_if_object(module, response, kind, allow_not_found=False):
|
def return_if_object(module, response, kind, allow_not_found=False):
|
||||||
|
@ -272,7 +265,7 @@ def is_different(module, response):
|
||||||
# Remove unnecessary properties from the response.
|
# Remove unnecessary properties from the response.
|
||||||
# This is for doing comparisons with Ansible's current parameters.
|
# This is for doing comparisons with Ansible's current parameters.
|
||||||
def response_to_hash(module, response):
|
def response_to_hash(module, response):
|
||||||
return {u'charset': response.get(u'charset'), u'collation': response.get(u'collation'), u'name': response.get(u'name')}
|
return {u'charset': response.get(u'charset'), u'collation': response.get(u'collation'), u'name': module.params.get('name')}
|
||||||
|
|
||||||
|
|
||||||
def async_op_url(module, extra_data=None):
|
def async_op_url(module, extra_data=None):
|
||||||
|
|
|
@ -43,11 +43,6 @@ options:
|
||||||
instance:
|
instance:
|
||||||
description:
|
description:
|
||||||
- The name of the Cloud SQL instance. This does not include the project ID.
|
- The name of the Cloud SQL instance. This does not include the project ID.
|
||||||
- 'This field represents a link to a Instance resource in GCP. It can be specified
|
|
||||||
in two ways. First, you can place a dictionary with key ''name'' and value of
|
|
||||||
your resource''s name Alternatively, you can add `register: name-of-resource`
|
|
||||||
to a gcp_sql_instance task and then set this instance field to "{{ name-of-resource
|
|
||||||
}}"'
|
|
||||||
required: true
|
required: true
|
||||||
extends_documentation_fragment: gcp
|
extends_documentation_fragment: gcp
|
||||||
'''
|
'''
|
||||||
|
@ -88,13 +83,13 @@ resources:
|
||||||
description:
|
description:
|
||||||
- The name of the Cloud SQL instance. This does not include the project ID.
|
- The name of the Cloud SQL instance. This does not include the project ID.
|
||||||
returned: success
|
returned: success
|
||||||
type: dict
|
type: str
|
||||||
'''
|
'''
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Imports
|
# Imports
|
||||||
################################################################################
|
################################################################################
|
||||||
from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest, replace_resource_dict
|
from ansible.module_utils.gcp_utils import navigate_hash, GcpSession, GcpModule, GcpRequest
|
||||||
import json
|
import json
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
@ -103,7 +98,7 @@ import json
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = GcpModule(argument_spec=dict(instance=dict(required=True, type='dict')))
|
module = GcpModule(argument_spec=dict(instance=dict(required=True, type='str')))
|
||||||
|
|
||||||
if not module.params['scopes']:
|
if not module.params['scopes']:
|
||||||
module.params['scopes'] = ['https://www.googleapis.com/auth/sqlservice.admin']
|
module.params['scopes'] = ['https://www.googleapis.com/auth/sqlservice.admin']
|
||||||
|
@ -118,8 +113,7 @@ def main():
|
||||||
|
|
||||||
|
|
||||||
def collection(module):
|
def collection(module):
|
||||||
res = {'project': module.params['project'], 'instance': replace_resource_dict(module.params['instance'], 'name')}
|
return "https://www.googleapis.com/sql/v1beta4/projects/{project}/instances/{instance}/databases".format(**module.params)
|
||||||
return "https://www.googleapis.com/sql/v1beta4/projects/{project}/instances/{instance}/databases".format(**res)
|
|
||||||
|
|
||||||
|
|
||||||
def fetch_list(module, link):
|
def fetch_list(module, link):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue