Skip to main content

ssl_certs

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

Overview

Namessl_certs
TypeResource
Idgoogle.sqladmin.ssl_certs

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
certstringPEM representation.
certSerialNumberstringSerial number, as extracted from the certificate.
commonNamestringUser supplied name. Constrained to [a-zA-Z.-_ ]+.
createTimestring (google-datetime)The time when the certificate was created in RFC 3339 format, for example 2012-11-15T16:19:00.094Z
expirationTimestring (google-datetime)The time when the certificate expires in RFC 3339 format, for example 2012-11-15T16:19:00.094Z.
instancestringName of the database instance.
kindstringThis is always sql#sslCert.
selfLinkstringThe URI of this resource.
sha1FingerprintstringSha1 Fingerprint.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectproject, instance, sha1FingerprintRetrieves a particular SSL certificate. Does not include the private key (required for usage). The private key must be saved from the response to initial creation.
listselectproject, instanceLists all of the current SSL certificates for the instance.
insertinsertproject, instanceCreates an SSL certificate and returns it along with the private key and server certificate authority. The new certificate will not be usable until the instance is restarted.
deletedeleteproject, instance, sha1FingerprintDeletes the SSL certificate. For First Generation instances, the certificate remains valid until the instance is restarted.

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
instancestring
projectstring
sha1Fingerprintstring

SELECT examples

Retrieves a particular SSL certificate. Does not include the private key (required for usage). The private key must be saved from the response to initial creation.

SELECT
cert,
certSerialNumber,
commonName,
createTime,
expirationTime,
instance,
kind,
selfLink,
sha1Fingerprint
FROM google.sqladmin.ssl_certs
WHERE project = '{{ project }}' -- required
AND instance = '{{ instance }}' -- required
AND sha1Fingerprint = '{{ sha1Fingerprint }}' -- required;

INSERT examples

Creates an SSL certificate and returns it along with the private key and server certificate authority. The new certificate will not be usable until the instance is restarted.

INSERT INTO google.sqladmin.ssl_certs (
data__commonName,
project,
instance
)
SELECT
'{{ commonName }}',
'{{ project }}',
'{{ instance }}'
RETURNING
clientCert,
kind,
operation,
serverCaCert
;

DELETE examples

Deletes the SSL certificate. For First Generation instances, the certificate remains valid until the instance is restarted.

DELETE FROM google.sqladmin.ssl_certs
WHERE project = '{{ project }}' --required
AND instance = '{{ instance }}' --required
AND sha1Fingerprint = '{{ sha1Fingerprint }}' --required;