Skip to main content

mysqls

Creates, updates, deletes, gets or lists a mysqls resource.

Overview​

Namemysqls
TypeResource
Idovh.cloud_database.mysqls

Fields​

The following fields are returned by SELECT queries:

successful operation

NameDatatypeDescription
idstring (uuid)Service ID
network_idstring (uuid)Private network ID in which the cluster is (wire: networkId)
subnet_idstring (uuid)Private subnet ID in which the cluster is (wire: subnetId)
backup_timestring (time)Time on which backups start every day. DEPRECATED: use backups.time (example: 15:04:05) (wire: backupTime)
backupsobjectInformation related to the backups, null if the engine does not support backups
capabilitiesobjectCapabilities of the services
categorystringCategory of the engine (analysis, operational, streaming)
created_atstring (date-time)Date of the creation of the cluster (wire: createdAt)
deletion_protectionbooleanEnable deletion protection (wire: deletionProtection)
descriptionstringDescription of the cluster
diskobjectDisk attributes of the cluster. DEPRECATED: use storage
enable_prometheusbooleanEnable Prometheus (wire: enablePrometheus)
endpointsarrayList of all endpoints of the service
enginestringName of the engine of the service (clickhouse, grafana, kafka, kafkaConnect, kafkaMirrorMaker, mongodb, mysql, opensearch, postgresql, valkey)
flavorstringThe VM flavor used for this cluster
ip_restrictionsarrayIP Blocks authorized to access to the cluster (wire: ipRestrictions)
maintenance_timestring (time)Time on which maintenances can start every day (example: 15:04:05) (wire: maintenanceTime)
network_typestringType of network of the cluster (private, public) (wire: networkType)
node_numberintegerNumber of nodes in the cluster. DEPRECATED: use nodes (wire: nodeNumber)
nodesarrayNodes of the cluster
openstack_regionstringOpenStack region of the cluster (wire: openstackRegion)
planstringPlan of the cluster
statusstringCurrent status of the cluster (CREATING, DELETING, DRAINED, ERROR, LOCKED, LOCKED_PENDING, LOCKED_UPDATING, PENDING, READY, SHELVED, TO_DRAIN, UPDATING)
storageobjectStorage attributes of the cluster
versionstringVersion of the engine deployed on the cluster

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectcluster_id, service_nameGet MySQL cluster properties
listselectservice_namex_pagination_modeList all the MySQL of the project
createinsertservice_nameCreate a new MySQL cluster
updateupdatecluster_id, service_nameUpdate an existing mysql cluster
deletedeletecluster_id, service_nameDelete a MySQL cluster
enable_writesexecclusterId, service_nameEnable temporary write permission on readonly lock MySQL service
log_urlexecclusterId, service_name, kindGenerates a temporary URL to read the logs of one kind. The URL expires.

Parameters​

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
api_hoststringThe OVHcloud API host. Selected by OVH_ENDPOINT (ovh-eu, ovh-ca or ovh-us; default ovh-eu). (default: api.eu.ovhcloud.com, x-stackQL-envVarSelector: {"envVar":"OVH_ENDPOINT","default":"ovh-eu","values":{"ovh-eu":"api.eu.ovhcloud.com","ovh-ca":"api.ca.ovhcloud.com","ovh-us":"api.us.ovhcloud.com"}})
clusterIdstring (uuid)Cluster ID
cluster_idstring (uuid)Cluster ID (wire: clusterId)
service_namestringThe Public Cloud project ID. Resolved from OVH_CLOUD_PROJECT_SERVICE when set.
x_pagination_modestringSent as CachedObjectList-Pages by default so the list returns the full objects rather than their identifiers. (wire: X-Pagination-Mode)

SELECT examples​

Get MySQL cluster properties

SELECT
id,
network_id,
subnet_id,
backup_time,
backups,
capabilities,
category,
created_at,
deletion_protection,
description,
disk,
enable_prometheus,
endpoints,
engine,
flavor,
ip_restrictions,
maintenance_time,
network_type,
node_number,
nodes,
openstack_region,
plan,
status,
storage,
version
FROM ovh.cloud_database.mysqls
WHERE cluster_id = '{{ cluster_id }}' -- required
AND service_name = '{{ service_name }}' -- required unless OVH_CLOUD_PROJECT_SERVICE is set
;

INSERT examples​

Create a new MySQL cluster

INSERT INTO ovh.cloud_database.mysqls (
backup,
backup_time,
backups,
description,
disk,
fork_from,
ip_restrictions,
maintenance_time,
network_id,
nodes_list,
nodes_pattern,
plan,
subnet_id,
version,
service_name
)
SELECT
'{{ backup }}',
'{{ backup_time }}',
'{{ backups }}',
'{{ description }}',
'{{ disk }}',
'{{ fork_from }}',
'{{ ip_restrictions }}',
'{{ maintenance_time }}',
'{{ network_id }}',
'{{ nodes_list }}',
'{{ nodes_pattern }}',
'{{ plan }}',
'{{ subnet_id }}',
'{{ version }}',
'{{ service_name }}'
RETURNING
id,
network_id,
subnet_id,
backup_time,
backups,
capabilities,
category,
created_at,
deletion_protection,
description,
disk,
enable_prometheus,
endpoints,
engine,
flavor,
ip_restrictions,
maintenance_time,
network_type,
node_number,
nodes,
openstack_region,
plan,
status,
storage,
version
;

UPDATE examples​

Update an existing mysql cluster

UPDATE ovh.cloud_database.mysqls
SET
backup_time = '{{ backup_time }}',
backups = '{{ backups }}',
deletion_protection = {{ deletion_protection }},
description = '{{ description }}',
disk = '{{ disk }}',
enable_prometheus = {{ enable_prometheus }},
flavor = '{{ flavor }}',
ip_restrictions = '{{ ip_restrictions }}',
maintenance_time = '{{ maintenance_time }}',
network_id = '{{ network_id }}',
node_number = {{ node_number }},
plan = '{{ plan }}',
storage = '{{ storage }}',
subnet_id = '{{ subnet_id }}',
version = '{{ version }}'
WHERE
cluster_id = '{{ cluster_id }}' --required
AND service_name = '{{ service_name }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
RETURNING
id,
network_id,
subnet_id,
backup_time,
backups,
capabilities,
category,
created_at,
deletion_protection,
description,
disk,
enable_prometheus,
endpoints,
engine,
flavor,
ip_restrictions,
maintenance_time,
network_type,
node_number,
nodes,
openstack_region,
plan,
status,
storage,
version;

DELETE examples​

Delete a MySQL cluster

DELETE FROM ovh.cloud_database.mysqls
WHERE cluster_id = '{{ cluster_id }}' --required
AND service_name = '{{ service_name }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
;

Lifecycle Methods​

EXEC variables use wire (API) names.

Enable temporary write permission on readonly lock MySQL service

EXEC ovh.cloud_database.mysqls.enable_writes
@clusterId='{{ clusterId }}' --required,
@service_name='{{ service_name }}' --required unless OVH_CLOUD_PROJECT_SERVICE is set
;