Skip to main content

db_credentials

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

Overview​

Namedb_credentials
TypeResource
Idoci.identity.db_credentials

Fields​

The following fields are returned by SELECT queries:

As the name suggests, an DbCredentialSummary object contains information about an DbCredential.<br />The DB credential is used for DB authentication with<br />the [DB Service].<br />

NameDatatypeDescription
idstringThe OCID of the DB credential.
descriptionstringThe description you assign to the DB credential. Does not have to be unique, and it's changeable. (For tenancies that support identity domains) You can have an empty description.
lifecycleStatestringThe credential's current state. After creating a DB credential, make sure its lifecycleState changes from CREATING to ACTIVE before using it. (x-obmcs-enumref: #/definitions/DbCredential/lifecycleState)
timeCreatedstring (date-time)Date and time the DbCredential object was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
timeExpiresstring (date-time)Date and time when this credential will expire, in the format defined by RFC3339. Null if it never expires. Example: 2016-08-25T21:10:29.600Z
userIdstringThe OCID of the user the DB credential belongs to.

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listselectuserId, regionopc-request-id, page, limit, name, sortBy, sortOrder, lifecycleStateLists the DB credentials for the specified user. The returned object contains the credential's OCID<br />
createinsertuserId, region, password, descriptionopc-request-id, opc-retry-tokenCreates a new DB credential for the specified user.<br />
deletedeleteuserId, dbCredentialId, regionopc-request-id, if-matchDeletes the specified DB credential for the specified user.<br />

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
dbCredentialIdstringThe OCID of the DB credential.
regionstringOCI region identifier (e.g. us-ashburn-1, ap-sydney-1); resolves from OCI_REGION when not supplied in the query. (default: us-ashburn-1, x-stackQL-envVar: OCI_REGION)
userIdstringThe OCID of the user.
if-matchstringFor optimistic concurrency control. In the PUT or DELETE call for a resource, set the if-match parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value.
lifecycleStatestringA filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
limitintegerThe maximum number of items to return in a paginated "List" call.
namestringA filter to only return resources that match the given name exactly.
opc-request-idstringUnique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.
opc-retry-tokenstringA token that uniquely identifies a request so it can be retried in case of a timeout or server error without risk of executing that same action again. Retry tokens expire after 24 hours, but can be invalidated before then due to conflicting operations (e.g., if a resource has been deleted and purged from the system, then a retry of the original creation request may be rejected).
pagestringThe value of the opc-next-page response header from the previous "List" call.
sortBystringThe field to sort by. You can provide one sort order (sortOrder). Default order for TIMECREATED is descending. Default order for NAME is ascending. The NAME sort order is case sensitive. Note: In general, some "List" operations (for example, ListInstances) let you optionally filter by Availability Domain if the scope of the resource type is within a single Availability Domain. If you call one of these "List" operations without specifying an Availability Domain, the resources are grouped by Availability Domain, then sorted.
sortOrderstringThe sort order to use, either ascending (ASC) or descending (DESC). The NAME sort order is case sensitive.

SELECT examples​

Lists the DB credentials for the specified user. The returned object contains the credential's OCID<br />

SELECT
id,
description,
lifecycleState,
timeCreated,
timeExpires,
userId
FROM oci.identity.db_credentials
WHERE userId = '{{ userId }}' -- required
AND region = '{{ region }}' -- required
AND opc-request-id = '{{ opc-request-id }}'
AND page = '{{ page }}'
AND limit = '{{ limit }}'
AND name = '{{ name }}'
AND sortBy = '{{ sortBy }}'
AND sortOrder = '{{ sortOrder }}'
AND lifecycleState = '{{ lifecycleState }}'
;

INSERT examples​

Creates a new DB credential for the specified user.<br />

INSERT INTO oci.identity.db_credentials (
description,
password,
userId,
region,
opc-request-id,
opc-retry-token
)
SELECT
'{{ description }}' /* required */,
'{{ password }}' /* required */,
'{{ userId }}',
'{{ region }}',
'{{ opc-request-id }}',
'{{ opc-retry-token }}'
RETURNING
id,
lifecycleDetails,
lifecycleState,
timeCreated,
timeExpires,
userId
;

DELETE examples​

Deletes the specified DB credential for the specified user.<br />

DELETE FROM oci.identity.db_credentials
WHERE userId = '{{ userId }}' --required
AND dbCredentialId = '{{ dbCredentialId }}' --required
AND region = '{{ region }}' --required
AND opc-request-id = '{{ opc-request-id }}'
AND if-match = '{{ if-match }}'
;