mirror of
https://github.com/ansible-collections/google.cloud.git
synced 2025-04-27 05:11:24 -07:00
examples showing an improper auth value (#87)
<!-- This change is generated by MagicModules. --> /cc @rambleraptor
This commit is contained in:
parent
9782d6906b
commit
0a18332815
98 changed files with 2171 additions and 1727 deletions
|
@ -59,14 +59,10 @@ options:
|
|||
description:
|
||||
- The name of the database in the Cloud SQL instance.
|
||||
- This does not include the project ID or instance name.
|
||||
required: false
|
||||
required: true
|
||||
instance:
|
||||
description:
|
||||
- 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 in the name of the resource here as a string
|
||||
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
|
||||
extends_documentation_fragment: gcp
|
||||
'''
|
||||
|
@ -74,18 +70,18 @@ extends_documentation_fragment: gcp
|
|||
EXAMPLES = '''
|
||||
- name: create a instance
|
||||
gcp_sql_instance:
|
||||
name: "{{resource_name}}-3"
|
||||
settings:
|
||||
ip_configuration:
|
||||
authorized_networks:
|
||||
- name: google dns server
|
||||
value: 8.8.8.8/32
|
||||
tier: db-n1-standard-1
|
||||
region: us-central1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
name: "{{resource_name}}-3"
|
||||
settings:
|
||||
ip_configuration:
|
||||
authorized_networks:
|
||||
- name: google dns server
|
||||
value: 8.8.8.8/32
|
||||
tier: db-n1-standard-1
|
||||
region: us-central1
|
||||
project: "{{ gcp_project }}"
|
||||
auth_kind: "{{ gcp_cred_kind }}"
|
||||
service_account_file: "{{ gcp_cred_file }}"
|
||||
state: present
|
||||
register: instance
|
||||
|
||||
- name: create a database
|
||||
|
@ -144,8 +140,8 @@ def main():
|
|||
state=dict(default='present', choices=['present', 'absent'], type='str'),
|
||||
charset=dict(type='str'),
|
||||
collation=dict(type='str'),
|
||||
name=dict(type='str'),
|
||||
instance=dict(required=True),
|
||||
name=dict(required=True, type='str'),
|
||||
instance=dict(required=True, type='str'),
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -198,6 +194,7 @@ def delete(module, link, kind):
|
|||
def resource_to_request(module):
|
||||
request = {
|
||||
u'kind': 'sql#database',
|
||||
u'instance': module.params.get('instance'),
|
||||
u'charset': module.params.get('charset'),
|
||||
u'collation': module.params.get('collation'),
|
||||
u'name': module.params.get('name'),
|
||||
|
@ -216,13 +213,11 @@ def fetch_resource(module, link, kind, allow_not_found=True):
|
|||
|
||||
|
||||
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(**res)
|
||||
return "https://www.googleapis.com/sql/v1beta4/projects/{project}/instances/{instance}/databases/{name}".format(**module.params)
|
||||
|
||||
|
||||
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(**res)
|
||||
return "https://www.googleapis.com/sql/v1beta4/projects/{project}/instances/{instance}/databases".format(**module.params)
|
||||
|
||||
|
||||
def return_if_object(module, response, kind, allow_not_found=False):
|
||||
|
@ -270,7 +265,7 @@ def is_different(module, response):
|
|||
# Remove unnecessary properties from the response.
|
||||
# This is for doing comparisons with Ansible's current parameters.
|
||||
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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue