Skip to main content

certificates

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

Overview

Namecertificates
TypeResource
Idgoogle.privateca.certificates

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
namestringIdentifier. The resource name for this Certificate in the format projects/*/locations/*/caPools/*/certificates/*.
certificateDescriptionobjectOutput only. A structured description of the issued X.509 certificate. (id: CertificateDescription)
certificateTemplatestringImmutable. The resource name for a CertificateTemplate used to issue this certificate, in the format projects/*/locations/*/certificateTemplates/*. If this is specified, the caller must have the necessary permission to use this template. If this is omitted, no template will be used. This template must be in the same location as the Certificate.
configobjectImmutable. A description of the certificate and key that does not require X.509 or ASN.1. (id: CertificateConfig)
createTimestring (google-datetime)Output only. The time at which this Certificate was created.
issuerCertificateAuthoritystringOutput only. The resource name of the issuing CertificateAuthority in the format projects/*/locations/*/caPools/*/certificateAuthorities/*.
labelsobjectOptional. Labels with user-defined metadata.
lifetimestring (google-duration)Required. Immutable. The desired lifetime of a certificate. Used to create the "not_before_time" and "not_after_time" fields inside an X.509 certificate. Note that the lifetime may be truncated if it would extend past the life of any certificate authority in the issuing chain.
pemCertificatestringOutput only. The pem-encoded, signed X.509 certificate.
pemCertificateChainarrayOutput only. The chain that may be used to verify the X.509 certificate. Expected to be in issuer-to-root order according to RFC 5246.
pemCsrstringImmutable. A pem-encoded X.509 certificate signing request (CSR).
revocationDetailsobjectOutput only. Details regarding the revocation of this Certificate. This Certificate is considered revoked if and only if this field is present. (id: RevocationDetails)
subjectModestringImmutable. Specifies how the Certificate's identity fields are to be decided. If this is omitted, the DEFAULT subject mode will be used.
updateTimestring (google-datetime)Output only. The time at which this Certificate was updated.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectprojectsId, locationsId, caPoolsId, certificatesIdReturns a Certificate.
listselectprojectsId, locationsId, caPoolsIdpageSize, pageToken, filter, orderByLists Certificates.
createinsertprojectsId, locationsId, caPoolsIdcertificateId, requestId, validateOnly, issuingCertificateAuthorityIdCreate a new Certificate in a given Project, Location from a particular CaPool.
patchupdateprojectsId, locationsId, caPoolsId, certificatesIdupdateMask, requestIdUpdate a Certificate. Currently, the only field you can update is the labels field.
revokeexecprojectsId, locationsId, caPoolsId, certificatesIdRevoke a Certificate.

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
caPoolsIdstring
certificatesIdstring
locationsIdstring
projectsIdstring
certificateIdstring
filterstring
issuingCertificateAuthorityIdstring
orderBystring
pageSizeinteger (int32)
pageTokenstring
requestIdstring
updateMaskstring (google-fieldmask)
validateOnlyboolean

SELECT examples

Returns a Certificate.

SELECT
name,
certificateDescription,
certificateTemplate,
config,
createTime,
issuerCertificateAuthority,
labels,
lifetime,
pemCertificate,
pemCertificateChain,
pemCsr,
revocationDetails,
subjectMode,
updateTime
FROM google.privateca.certificates
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND caPoolsId = '{{ caPoolsId }}' -- required
AND certificatesId = '{{ certificatesId }}' -- required;

INSERT examples

Create a new Certificate in a given Project, Location from a particular CaPool.

INSERT INTO google.privateca.certificates (
data__name,
data__pemCsr,
data__config,
data__lifetime,
data__certificateTemplate,
data__subjectMode,
data__labels,
projectsId,
locationsId,
caPoolsId,
certificateId,
requestId,
validateOnly,
issuingCertificateAuthorityId
)
SELECT
'{{ name }}',
'{{ pemCsr }}',
'{{ config }}',
'{{ lifetime }}',
'{{ certificateTemplate }}',
'{{ subjectMode }}',
'{{ labels }}',
'{{ projectsId }}',
'{{ locationsId }}',
'{{ caPoolsId }}',
'{{ certificateId }}',
'{{ requestId }}',
'{{ validateOnly }}',
'{{ issuingCertificateAuthorityId }}'
RETURNING
name,
certificateDescription,
certificateTemplate,
config,
createTime,
issuerCertificateAuthority,
labels,
lifetime,
pemCertificate,
pemCertificateChain,
pemCsr,
revocationDetails,
subjectMode,
updateTime
;

UPDATE examples

Update a Certificate. Currently, the only field you can update is the labels field.

UPDATE google.privateca.certificates
SET
data__name = '{{ name }}',
data__pemCsr = '{{ pemCsr }}',
data__config = '{{ config }}',
data__lifetime = '{{ lifetime }}',
data__certificateTemplate = '{{ certificateTemplate }}',
data__subjectMode = '{{ subjectMode }}',
data__labels = '{{ labels }}'
WHERE
projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND caPoolsId = '{{ caPoolsId }}' --required
AND certificatesId = '{{ certificatesId }}' --required
AND updateMask = '{{ updateMask}}'
AND requestId = '{{ requestId}}'
RETURNING
name,
certificateDescription,
certificateTemplate,
config,
createTime,
issuerCertificateAuthority,
labels,
lifetime,
pemCertificate,
pemCertificateChain,
pemCsr,
revocationDetails,
subjectMode,
updateTime;

Lifecycle Methods

Revoke a Certificate.

EXEC google.privateca.certificates.revoke 
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@caPoolsId='{{ caPoolsId }}' --required,
@certificatesId='{{ certificatesId }}' --required
@@json=
'{
"reason": "{{ reason }}",
"requestId": "{{ requestId }}"
}';