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.
required: false
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:
description:
- 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
Generation (recommended) or First Generation.
required: false
settings_version:
availability_type:
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.
- The availabilityType define if your postgres instance is run zonal or regional.
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
'''
EXAMPLES = '''
- name: create a instance
gcp_sql_instance:
name: "{{resource_name}}-2"
settings:
ip_configuration:
authorized_networks:
- name: google dns server
value: 8.8.8.8/32
tier: db-n1-standard-1
region: us-central1
project: "test_project"
auth_kind: "serviceaccount"
service_account_file: "/tmp/auth.pem"
state: present
name: "{{resource_name}}-2"
settings:
ip_configuration:
authorized_networks:
- name: google dns server
value: 8.8.8.8/32
tier: db-n1-standard-1
region: us-central1
project: test_project
auth_kind: serviceaccount
service_account_file: "/tmp/auth.pem"
state: present
'''
RETURN = '''
@ -323,229 +371,172 @@ failoverReplica:
returned: success
type: bool
name:
description:
- The name of the failover replica. If specified at instance creation, a failover
replica is created for the instance. The name doesn't include the project
ID. This property is applicable only to Second Generation instances.
returned: success
type: str
instanceType:
description:
- The instance type. This can be one of the following.
- "* CLOUD_SQL_INSTANCE: A Cloud SQL instance that is not replicating from a master."
- "* ON_PREMISES_INSTANCE: An instance running on the customer's premises."
- "* READ_REPLICA_INSTANCE: A Cloud SQL instance configured as a read-replica."
returned: success
type: str
ipAddresses:
description:
- The assigned IP addresses for the instance.
returned: success
type: complex
contains:
ipAddress:
description:
- The IP address assigned.
returned: success
type: str
timeToRetire:
description:
- The due time for this IP to be retired in RFC 3339 format, for example 2012-11-15T16:19:00.094Z.
This field is only available when the IP is scheduled to be retired.
returned: success
type: str
type:
description:
- The type of this IP address. A PRIMARY address is an address that can accept
incoming connections. An OUTGOING address is the source address of connections
originating from the instance, if supported.
returned: success
type: str
ipv6Address:
description:
- The IPv6 address assigned to the instance. This property is applicable only to
First Generation instances.
returned: success
type: str
masterInstanceName:
description:
- The name of the instance which will act as master in the replication setup.
returned: success
type: str
maxDiskSize:
description:
- The maximum disk size of the instance in bytes.
returned: success
type: int
name:
description:
- Name of the Cloud SQL instance. This does not include the project ID.
returned: success
type: str
region:
description:
- The geographical region. Defaults to us-central or us-central1 depending on the
instance type (First Generation or Second Generation/PostgreSQL).
returned: success
type: str
replicaConfiguration:
description:
- Configuration specific to failover replicas and read replicas.
returned: success
type: complex
contains:
failoverTarget:
description:
- Specifies if the replica is the failover target. If the field is set to true
the replica will be designated as a failover replica.
- In case the master instance fails, the replica instance will be promoted as
the new master instance.
- Only one replica can be specified as failover target, and the replica has
to be in different zone with the master instance.
returned: success
type: bool
mysqlReplicaConfiguration:
description:
- MySQL specific configuration when replicating from a MySQL on-premises master.
Replication configuration information such as the username, password, certificates,
and keys are not stored in the instance metadata. The configuration information
is used only to set up the replication connection and is stored by MySQL in
a file named master.info in the data directory.
returned: success
type: complex
contains:
caCertificate:
description:
- PEM representation of the trusted CA's x509 certificate.
returned: success
type: str
clientCertificate:
description:
- PEM representation of the slave's x509 certificate .
returned: success
type: str
clientKey:
description:
- PEM representation of the slave's private key. The corresponding public
key is encoded in the client's certificate.
returned: success
type: str
connectRetryInterval:
description:
- Seconds to wait between connect retries. MySQL's default is 60 seconds.
returned: success
type: int
dumpFilePath:
description:
- Path to a SQL dump file in Google Cloud Storage from which the slave instance
is to be created. The URI is in the form gs://bucketName/fileName. Compressed
gzip files (.gz) are also supported. Dumps should have the binlog co-ordinates
from which replication should begin. This can be accomplished by setting
--master-data to 1 when using mysqldump.
returned: success
type: str
masterHeartbeatPeriod:
description:
- Interval in milliseconds between replication heartbeats.
returned: success
type: int
password:
description:
- The password for the replication connection.
returned: success
type: str
sslCipher:
description:
- A list of permissible ciphers to use for SSL encryption.
returned: success
type: str
username:
description:
- The username for the replication connection.
returned: success
type: str
verifyServerCertificate:
description:
- Whether or not to check the master's Common Name value in the certificate
that it sends during the SSL handshake.
returned: success
type: bool
replicaNames:
description:
- The replicas of the instance.
returned: success
type: list
serviceAccountEmailAddress:
description:
- The service account email address assigned to the instance. This property
is applicable only to Second Generation instances.
returned: success
type: str
settings:
description:
- The user settings.
returned: success
type: complex
contains:
ipConfiguration:
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.
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
description:
- Name of the Cloud SQL instance. This does not include the project ID.
returned: success
type: str
region:
description:
- The geographical region. Defaults to us-central or us-central1 depending on the
instance type (First Generation or Second Generation/PostgreSQL).
returned: success
type: str
replica_configuration:
description:
- Configuration specific to failover replicas and read replicas.
returned: success
type: complex
contains:
failover_target:
description:
- Specifies if the replica is the failover target. If the field is set to true the
replica will be designated as a failover replica.
- In case the master instance fails, the replica instance will be promoted as the
new master instance.
- Only one replica can be specified as failover target, and the replica has to be
in different zone with the master instance.
returned: success
type: bool
mysql_replica_configuration:
description:
- MySQL specific configuration when replicating from a MySQL on-premises master. Replication
configuration information such as the username, password, certificates, and keys
are not stored in the instance metadata. The configuration information is used
only to set up the replication connection and is stored by MySQL in a file named
master.info in the data directory.
returned: success
type: complex
contains:
ca_certificate:
description:
- PEM representation of the trusted CA's x509 certificate.
returned: success
type: str
client_certificate:
description:
- PEM representation of the slave's x509 certificate .
returned: success
type: str
client_key:
description:
- PEM representation of the slave's private key. The corresponsing public key is encoded
in the client's asf asd certificate.
returned: success
type: str
connect_retry_interval:
description:
- Seconds to wait between connect retries. MySQL's default is 60 seconds.
returned: success
type: int
dump_file_path:
description:
- Path to a SQL dump file in Google Cloud Storage from which the slave instance is
to be created. The URI is in the form gs://bucketName/fileName. Compressed gzip
files (.gz) are also supported. Dumps should have the binlog co-ordinates from which
replication should begin. This can be accomplished by setting --master-data to 1
when using mysqldump.
returned: success
type: str
master_heartbeat_period:
description:
- Interval in milliseconds between replication heartbeats.
returned: success
type: int
password:
description:
- The password for the replication connection.
returned: success
type: str
ssl_cipher:
description:
- A list of permissible ciphers to use for SSL encryption.
returned: success
type: str
username:
description:
- The username for the replication connection.
returned: success
type: str
verify_server_certificate:
description:
- Whether or not to check the master's Common Name value in the certificate that it
sends during the SSL handshake.
returned: success
type: bool
replica_names:
description:
- The replicas of the instance.
returned: success
type: list
service_account_email_address:
description:
- The service account email address assigned to the instance. This property is applicable
only to Second Generation instances.
returned: success
type: str
settings:
description:
- The user settings.
returned: success
type: complex
contains:
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.
returned: success
type: complex
contains:
ipv4_enabled:
description:
- Whether the instance should be assigned an IP address or not.
returned: success
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).
returned: success
type: complex
contains:
expiration_time:
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
require_ssl:
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
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.
returned: success
type: int
'''
################################################################################
@ -570,53 +561,43 @@ def main():
backend_type=dict(type='str', choices=['FIRST_GEN', 'SECOND_GEN', 'EXTERNAL']),
connection_name=dict(type='str'),
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']),
ipv6_address=dict(type='str'),
master_instance_name=dict(type='str'),
max_disk_size=dict(type='int'),
name=dict(required=True, type='str'),
region=dict(type='str'),
replica_configuration=dict(
type='dict',
options=dict(
failover_target=dict(type='bool'),
mysql_replica_configuration=dict(
type='dict',
options=dict(
ca_certificate=dict(type='str'),
client_certificate=dict(type='str'),
client_key=dict(type='str'),
connect_retry_interval=dict(type='int'),
dump_file_path=dict(type='str'),
master_heartbeat_period=dict(type='int'),
password=dict(type='str'),
ssl_cipher=dict(type='str'),
username=dict(type='str'),
verify_server_certificate=dict(type='bool'),
),
),
replica_names=dict(type='list', elements='str'),
service_account_email_address=dict(type='str'),
),
),
settings=dict(
type='dict',
options=dict(
ip_configuration=dict(
type='dict',
options=dict(
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'),
),
),
replica_configuration=dict(type='dict', options=dict(
failover_target=dict(type='bool'),
mysql_replica_configuration=dict(type='dict', options=dict(
ca_certificate=dict(type='str'),
client_certificate=dict(type='str'),
client_key=dict(type='str'),
connect_retry_interval=dict(type='int'),
dump_file_path=dict(type='str'),
master_heartbeat_period=dict(type='int'),
password=dict(type='str'),
ssl_cipher=dict(type='str'),
username=dict(type='str'),
verify_server_certificate=dict(type='bool')
)),
replica_names=dict(type='list', elements='str'),
service_account_email_address=dict(type='str')
)),
settings=dict(type='dict', options=dict(
ip_configuration=dict(type='dict', options=dict(
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 = {}
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):
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):
@ -922,22 +903,18 @@ class InstanceSettings(object):
self.request = {}
def to_request(self):
return remove_nones_from_dict(
{
u'ipConfiguration': InstanceIpconfiguration(self.request.get('ip_configuration', {}), self.module).to_request(),
u'tier': self.request.get('tier'),
u'settingsVersion': self.request.get('settings_version'),
}
)
return remove_nones_from_dict({
u'ipConfiguration': InstanceIpConfiguration(self.request.get('ip_configuration', {}), self.module).to_request(),
u'tier': self.request.get('tier'),
u'settingsVersion': self.request.get('settings_version')
})
def from_response(self):
return remove_nones_from_dict(
{
u'ipConfiguration': InstanceIpconfiguration(self.request.get(u'ipConfiguration', {}), self.module).from_response(),
u'tier': self.request.get(u'tier'),
u'settingsVersion': self.request.get(u'settingsVersion'),
}
)
return remove_nones_from_dict({
u'ipConfiguration': InstanceIpConfiguration(self.request.get(u'ipConfiguration', {}), self.module).from_response(),
u'tier': self.request.get(u'tier'),
u'settingsVersion': self.request.get(u'settingsVersion')
})
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')})
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__':
main()