Add settingsVersion property to Cloud SQL instance settings (#84)

<!-- This change is generated by MagicModules. -->
/cc @slevenick
This commit is contained in:
The Magician 2018-09-05 10:56:56 -07:00 committed by Alex Stephen
parent be863bd64e
commit 94c0e91a5a

View file

@ -82,13 +82,6 @@ options:
to Second Generation instances. to Second Generation instances.
required: false required: false
suboptions: suboptions:
available:
description:
- The availability status of the failover replica. A false status indicates
that the failover replica is out of sync. The master can only failover to
the failover replica when the status is true.
required: false
type: bool
name: name:
description: description:
- The name of the failover replica. If specified at instance creation, a failover - The name of the failover replica. If specified at instance creation, a failover
@ -259,31 +252,86 @@ options:
For MySQL instances, this field determines whether the instance is Second For MySQL instances, this field determines whether the instance is Second
Generation (recommended) or First Generation. Generation (recommended) or First Generation.
required: false required: false
settings_version: availability_type:
description: description:
- The version of instance settings. This is a required field for update method - The availabilityType define if your postgres instance is run zonal or regional.
to make sure concurrent updates are handled properly. During update, use
the most recent settingsVersion value for this instance and do not try to
update this value.
required: false required: false
choices:
- ZONAL
- REGIONAL
backup_configuration:
description:
- The daily backup configuration for the instance.
required: false
suboptions:
ip_configuration:
description:
- The settings for IP Management. This allows to enable or disable the instance IP
and manage which external networks can connect to the instance. The IPv4 address
cannot be disabled for Second Generation instances.
required: false
suboptions:
ipv4_enabled:
description:
- Whether the instance should be assigned an IP address or not.
required: false
type: bool
authorized_networks:
description:
- The list of external networks that are allowed to connect to the instance using
the IP. In CIDR notation, also known as 'slash' notation (e.g. 192.168.100.0/24).
required: false
suboptions:
expiration_time:
description:
- The time when this access control entry expires in RFC 3339 format, for example
2012-11-15T16:19:00.094Z.
required: false
name:
description:
- An optional label to identify this entry.
required: false
value:
description:
- The whitelisted value for the access control list. For example, to grant access
to a client from an external IP (IPv4 or IPv6) address or subnet, use that address
or subnet here.
required: false
require_ssl:
description:
- Whether the mysqld should default to 'REQUIRE X509' for users connecting over IP.
required: false
type: bool
tier:
description:
- The tier or machine type for this instance, for example db-n1-standard-1. For MySQL
instances, this field determines whether the instance is Second Generation (recommended)
or First Generation.
required: false
settings_version:
description:
- The version of instance settings. This is a required field for update method to
make sure concurrent updates are handled properly. During update, use the most
recent settingsVersion value for this instance and do not try to update this value.
required: false
extends_documentation_fragment: gcp extends_documentation_fragment: gcp
''' '''
EXAMPLES = ''' EXAMPLES = '''
- name: create a instance - name: create a instance
gcp_sql_instance: gcp_sql_instance:
name: "{{resource_name}}-2" name: "{{resource_name}}-2"
settings: settings:
ip_configuration: ip_configuration:
authorized_networks: authorized_networks:
- name: google dns server - name: google dns server
value: 8.8.8.8/32 value: 8.8.8.8/32
tier: db-n1-standard-1 tier: db-n1-standard-1
region: us-central1 region: us-central1
project: "test_project" project: test_project
auth_kind: "serviceaccount" auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem" service_account_file: "/tmp/auth.pem"
state: present state: present
''' '''
RETURN = ''' RETURN = '''
@ -323,229 +371,172 @@ failoverReplica:
returned: success returned: success
type: bool type: bool
name: name:
description: description:
- The name of the failover replica. If specified at instance creation, a failover - Name of the Cloud SQL instance. This does not include the project ID.
replica is created for the instance. The name doesn't include the project returned: success
ID. This property is applicable only to Second Generation instances. type: str
returned: success region:
type: str description:
instanceType: - The geographical region. Defaults to us-central or us-central1 depending on the
description: instance type (First Generation or Second Generation/PostgreSQL).
- The instance type. This can be one of the following. returned: success
- "* CLOUD_SQL_INSTANCE: A Cloud SQL instance that is not replicating from a master." type: str
- "* ON_PREMISES_INSTANCE: An instance running on the customer's premises." replica_configuration:
- "* READ_REPLICA_INSTANCE: A Cloud SQL instance configured as a read-replica." description:
returned: success - Configuration specific to failover replicas and read replicas.
type: str returned: success
ipAddresses: type: complex
description: contains:
- The assigned IP addresses for the instance. failover_target:
returned: success description:
type: complex - Specifies if the replica is the failover target. If the field is set to true the
contains: replica will be designated as a failover replica.
ipAddress: - In case the master instance fails, the replica instance will be promoted as the
description: new master instance.
- The IP address assigned. - Only one replica can be specified as failover target, and the replica has to be
returned: success in different zone with the master instance.
type: str returned: success
timeToRetire: type: bool
description: mysql_replica_configuration:
- The due time for this IP to be retired in RFC 3339 format, for example 2012-11-15T16:19:00.094Z. description:
This field is only available when the IP is scheduled to be retired. - MySQL specific configuration when replicating from a MySQL on-premises master. Replication
returned: success configuration information such as the username, password, certificates, and keys
type: str are not stored in the instance metadata. The configuration information is used
type: only to set up the replication connection and is stored by MySQL in a file named
description: master.info in the data directory.
- The type of this IP address. A PRIMARY address is an address that can accept returned: success
incoming connections. An OUTGOING address is the source address of connections type: complex
originating from the instance, if supported. contains:
returned: success ca_certificate:
type: str description:
ipv6Address: - PEM representation of the trusted CA's x509 certificate.
description: returned: success
- The IPv6 address assigned to the instance. This property is applicable only to type: str
First Generation instances. client_certificate:
returned: success description:
type: str - PEM representation of the slave's x509 certificate .
masterInstanceName: returned: success
description: type: str
- The name of the instance which will act as master in the replication setup. client_key:
returned: success description:
type: str - PEM representation of the slave's private key. The corresponsing public key is encoded
maxDiskSize: in the client's asf asd certificate.
description: returned: success
- The maximum disk size of the instance in bytes. type: str
returned: success connect_retry_interval:
type: int description:
name: - Seconds to wait between connect retries. MySQL's default is 60 seconds.
description: returned: success
- Name of the Cloud SQL instance. This does not include the project ID. type: int
returned: success dump_file_path:
type: str description:
region: - Path to a SQL dump file in Google Cloud Storage from which the slave instance is
description: to be created. The URI is in the form gs://bucketName/fileName. Compressed gzip
- The geographical region. Defaults to us-central or us-central1 depending on the files (.gz) are also supported. Dumps should have the binlog co-ordinates from which
instance type (First Generation or Second Generation/PostgreSQL). replication should begin. This can be accomplished by setting --master-data to 1
returned: success when using mysqldump.
type: str returned: success
replicaConfiguration: type: str
description: master_heartbeat_period:
- Configuration specific to failover replicas and read replicas. description:
returned: success - Interval in milliseconds between replication heartbeats.
type: complex returned: success
contains: type: int
failoverTarget: password:
description: description:
- Specifies if the replica is the failover target. If the field is set to true - The password for the replication connection.
the replica will be designated as a failover replica. returned: success
- In case the master instance fails, the replica instance will be promoted as type: str
the new master instance. ssl_cipher:
- Only one replica can be specified as failover target, and the replica has description:
to be in different zone with the master instance. - A list of permissible ciphers to use for SSL encryption.
returned: success returned: success
type: bool type: str
mysqlReplicaConfiguration: username:
description: description:
- MySQL specific configuration when replicating from a MySQL on-premises master. - The username for the replication connection.
Replication configuration information such as the username, password, certificates, returned: success
and keys are not stored in the instance metadata. The configuration information type: str
is used only to set up the replication connection and is stored by MySQL in verify_server_certificate:
a file named master.info in the data directory. description:
returned: success - Whether or not to check the master's Common Name value in the certificate that it
type: complex sends during the SSL handshake.
contains: returned: success
caCertificate: type: bool
description: replica_names:
- PEM representation of the trusted CA's x509 certificate. description:
returned: success - The replicas of the instance.
type: str returned: success
clientCertificate: type: list
description: service_account_email_address:
- PEM representation of the slave's x509 certificate . description:
returned: success - The service account email address assigned to the instance. This property is applicable
type: str only to Second Generation instances.
clientKey: returned: success
description: type: str
- PEM representation of the slave's private key. The corresponding public settings:
key is encoded in the client's certificate. description:
returned: success - The user settings.
type: str returned: success
connectRetryInterval: type: complex
description: contains:
- Seconds to wait between connect retries. MySQL's default is 60 seconds. ip_configuration:
returned: success description:
type: int - The settings for IP Management. This allows to enable or disable the instance IP
dumpFilePath: and manage which external networks can connect to the instance. The IPv4 address
description: cannot be disabled for Second Generation instances.
- Path to a SQL dump file in Google Cloud Storage from which the slave instance returned: success
is to be created. The URI is in the form gs://bucketName/fileName. Compressed type: complex
gzip files (.gz) are also supported. Dumps should have the binlog co-ordinates contains:
from which replication should begin. This can be accomplished by setting ipv4_enabled:
--master-data to 1 when using mysqldump. description:
returned: success - Whether the instance should be assigned an IP address or not.
type: str returned: success
masterHeartbeatPeriod: type: bool
description: authorized_networks:
- Interval in milliseconds between replication heartbeats. description:
returned: success - The list of external networks that are allowed to connect to the instance using
type: int the IP. In CIDR notation, also known as 'slash' notation (e.g. 192.168.100.0/24).
password: returned: success
description: type: complex
- The password for the replication connection. contains:
returned: success expiration_time:
type: str description:
sslCipher: - The time when this access control entry expires in RFC 3339 format, for example
description: 2012-11-15T16:19:00.094Z.
- A list of permissible ciphers to use for SSL encryption. returned: success
returned: success type: str
type: str name:
username: description:
description: - An optional label to identify this entry.
- The username for the replication connection. returned: success
returned: success type: str
type: str value:
verifyServerCertificate: description:
description: - The whitelisted value for the access control list. For example, to grant access
- Whether or not to check the master's Common Name value in the certificate to a client from an external IP (IPv4 or IPv6) address or subnet, use that address
that it sends during the SSL handshake. or subnet here.
returned: success returned: success
type: bool type: str
replicaNames: require_ssl:
description: description:
- The replicas of the instance. - Whether the mysqld should default to 'REQUIRE X509' for users connecting over IP.
returned: success returned: success
type: list type: bool
serviceAccountEmailAddress: tier:
description: description:
- The service account email address assigned to the instance. This property - The tier or machine type for this instance, for example db-n1-standard-1. For MySQL
is applicable only to Second Generation instances. instances, this field determines whether the instance is Second Generation (recommended)
returned: success or First Generation.
type: str returned: success
settings: type: str
description: settings_version:
- The user settings. description:
returned: success - The version of instance settings. This is a required field for update method to
type: complex make sure concurrent updates are handled properly. During update, use the most
contains: recent settingsVersion value for this instance and do not try to update this value.
ipConfiguration: returned: success
description: type: int
- The settings for IP Management. This allows to enable or disable the instance
IP and manage which external networks can connect to the instance. The IPv4
address cannot be disabled for Second Generation instances.
returned: success
type: complex
contains:
ipv4Enabled:
description:
- Whether the instance should be assigned an IP address or not.
returned: success
type: bool
authorizedNetworks:
description:
- The list of external networks that are allowed to connect to the instance
using the IP. In CIDR notation, also known as 'slash' notation (e.g. 192.168.100.0/24).
returned: success
type: complex
contains:
expirationTime:
description:
- The time when this access control entry expires in RFC 3339 format,
for example 2012-11-15T16:19:00.094Z.
returned: success
type: str
name:
description:
- An optional label to identify this entry.
returned: success
type: str
value:
description:
- The whitelisted value for the access control list. For example, to
grant access to a client from an external IP (IPv4 or IPv6) address
or subnet, use that address or subnet here.
returned: success
type: str
requireSsl:
description:
- Whether the mysqld should default to 'REQUIRE X509' for users connecting
over IP.
returned: success
type: bool
tier:
description:
- The tier or machine type for this instance, for example db-n1-standard-1.
For MySQL instances, this field determines whether the instance is Second
Generation (recommended) or First Generation.
returned: success
type: str
settingsVersion:
description:
- The version of instance settings. This is a required field for update method
to make sure concurrent updates are handled properly. During update, use the
most recent settingsVersion value for this instance and do not try to update
this value.
returned: success
type: int
''' '''
################################################################################ ################################################################################
@ -570,53 +561,43 @@ def main():
backend_type=dict(type='str', choices=['FIRST_GEN', 'SECOND_GEN', 'EXTERNAL']), backend_type=dict(type='str', choices=['FIRST_GEN', 'SECOND_GEN', 'EXTERNAL']),
connection_name=dict(type='str'), connection_name=dict(type='str'),
database_version=dict(type='str', choices=['MYSQL_5_5', 'MYSQL_5_6', 'MYSQL_5_7', 'POSTGRES_9_6']), database_version=dict(type='str', choices=['MYSQL_5_5', 'MYSQL_5_6', 'MYSQL_5_7', 'POSTGRES_9_6']),
failover_replica=dict(type='dict', options=dict(available=dict(type='bool'), name=dict(type='str'))), failover_replica=dict(type='dict', options=dict(name=dict(type='str'))),
instance_type=dict(type='str', choices=['CLOUD_SQL_INSTANCE', 'ON_PREMISES_INSTANCE', 'READ_REPLICA_INSTANCE']), instance_type=dict(type='str', choices=['CLOUD_SQL_INSTANCE', 'ON_PREMISES_INSTANCE', 'READ_REPLICA_INSTANCE']),
ipv6_address=dict(type='str'), ipv6_address=dict(type='str'),
master_instance_name=dict(type='str'), master_instance_name=dict(type='str'),
max_disk_size=dict(type='int'), max_disk_size=dict(type='int'),
name=dict(required=True, type='str'), name=dict(required=True, type='str'),
region=dict(type='str'), region=dict(type='str'),
replica_configuration=dict( replica_configuration=dict(type='dict', options=dict(
type='dict', failover_target=dict(type='bool'),
options=dict( mysql_replica_configuration=dict(type='dict', options=dict(
failover_target=dict(type='bool'), ca_certificate=dict(type='str'),
mysql_replica_configuration=dict( client_certificate=dict(type='str'),
type='dict', client_key=dict(type='str'),
options=dict( connect_retry_interval=dict(type='int'),
ca_certificate=dict(type='str'), dump_file_path=dict(type='str'),
client_certificate=dict(type='str'), master_heartbeat_period=dict(type='int'),
client_key=dict(type='str'), password=dict(type='str'),
connect_retry_interval=dict(type='int'), ssl_cipher=dict(type='str'),
dump_file_path=dict(type='str'), username=dict(type='str'),
master_heartbeat_period=dict(type='int'), verify_server_certificate=dict(type='bool')
password=dict(type='str'), )),
ssl_cipher=dict(type='str'), replica_names=dict(type='list', elements='str'),
username=dict(type='str'), service_account_email_address=dict(type='str')
verify_server_certificate=dict(type='bool'), )),
), settings=dict(type='dict', options=dict(
), ip_configuration=dict(type='dict', options=dict(
replica_names=dict(type='list', elements='str'), ipv4_enabled=dict(type='bool'),
service_account_email_address=dict(type='str'), authorized_networks=dict(type='list', elements='dict', options=dict(
), expiration_time=dict(type='str'),
), name=dict(type='str'),
settings=dict( value=dict(type='str')
type='dict', )),
options=dict( require_ssl=dict(type='bool')
ip_configuration=dict( )),
type='dict', tier=dict(type='str'),
options=dict( settings_version=dict(type='int')
ipv4_enabled=dict(type='bool'), ))
authorized_networks=dict(
type='list', elements='dict', options=dict(expiration_time=dict(type='str'), name=dict(type='str'), value=dict(type='str'))
),
require_ssl=dict(type='bool'),
),
),
tier=dict(type='str'),
settings_version=dict(type='int'),
),
),
) )
) )
@ -808,10 +789,10 @@ class InstanceFailoverreplica(object):
self.request = {} self.request = {}
def to_request(self): def to_request(self):
return remove_nones_from_dict({u'available': self.request.get('available'), u'name': self.request.get('name')}) return remove_nones_from_dict({u'name': self.request.get('name')})
def from_response(self): def from_response(self):
return remove_nones_from_dict({u'available': self.request.get(u'available'), u'name': self.request.get(u'name')}) return remove_nones_from_dict({u'name': self.request.get(u'name')})
class InstanceIpaddressesArray(object): class InstanceIpaddressesArray(object):
@ -922,22 +903,18 @@ class InstanceSettings(object):
self.request = {} self.request = {}
def to_request(self): def to_request(self):
return remove_nones_from_dict( return remove_nones_from_dict({
{ u'ipConfiguration': InstanceIpConfiguration(self.request.get('ip_configuration', {}), self.module).to_request(),
u'ipConfiguration': InstanceIpconfiguration(self.request.get('ip_configuration', {}), self.module).to_request(), u'tier': self.request.get('tier'),
u'tier': self.request.get('tier'), u'settingsVersion': self.request.get('settings_version')
u'settingsVersion': self.request.get('settings_version'), })
}
)
def from_response(self): def from_response(self):
return remove_nones_from_dict( return remove_nones_from_dict({
{ u'ipConfiguration': InstanceIpConfiguration(self.request.get(u'ipConfiguration', {}), self.module).from_response(),
u'ipConfiguration': InstanceIpconfiguration(self.request.get(u'ipConfiguration', {}), self.module).from_response(), u'tier': self.request.get(u'tier'),
u'tier': self.request.get(u'tier'), u'settingsVersion': self.request.get(u'settingsVersion')
u'settingsVersion': self.request.get(u'settingsVersion'), })
}
)
class InstanceIpconfiguration(object): class InstanceIpconfiguration(object):
@ -994,5 +971,24 @@ class InstanceAuthorizednetworksArray(object):
return remove_nones_from_dict({u'expirationTime': item.get(u'expirationTime'), u'name': item.get(u'name'), u'value': item.get(u'value')}) return remove_nones_from_dict({u'expirationTime': item.get(u'expirationTime'), u'name': item.get(u'name'), u'value': item.get(u'value')})
class InstanceBackupconfiguration(object):
def __init__(self, request, module):
self.module = module
if request:
self.request = request
else:
self.request = {}
def to_request(self):
return remove_nones_from_dict(
{u'enabled': self.request.get('enabled'), u'binaryLogEnabled': self.request.get('binary_log_enabled'), u'startTime': self.request.get('start_time')}
)
def from_response(self):
return remove_nones_from_dict(
{u'enabled': self.request.get(u'enabled'), u'binaryLogEnabled': self.request.get(u'binaryLogEnabled'), u'startTime': self.request.get(u'startTime')}
)
if __name__ == '__main__': if __name__ == '__main__':
main() main()