Using Validations
Basic Syntax
Define template validations within the validations
node of your template file. For each validation, specify a validationType
and add a parameters
node.
validations:
myFirstValidation:
validationType: DB_CONNECT
parameters:
...
mySecondValidation:
validationType: STORAGE_CONNECT
parameters:
...
The available parameters depend on the type of validation. You can assign static values to these validation parameters, or assign the value of a template parameter by using the GetParam
function.
You can optionally assign the name of an existing condition. The validation will not execute unless the specified condition evaluates to true:
validations:
myValidation:
condition: connectToDB
validationType: DB_CONNECT
parameters:
...
Database Connectivity
Check the connectivity to an existing Oracle Database Cloud Service deployment prior to creating a stack. Provide the connection details for the database deployment in the validation definition. For example:
dbConnectivityValidation:
validationType: DB_CONNECT
parameters:
serviceName: MyDBInstance
userName: SYS
password: password
requiredSize: 10GB
constraintDescription: Failed to connect to the MyDBInstance database
Parameter | Description |
---|---|
|
Enter the name of an existing Oracle Database Cloud Service deployment. You must specify either |
|
Enter a Java Database Connectivity (JDBC) URL for an existing Oracle Database Cloud
Service deployment. For example: You must specify either |
|
The database user with which to make a connection |
|
The database user’s password |
|
The validation fails if the database’s available capacity is less than this size. |
|
The validation fails if the specified pluggable database (PDB) does not exist in the database. |
|
The validation fails if the specified schema already exists in the database. |
|
The error message to display to the user if this validation fails |
Storage Connectivity
This topic does not apply to Oracle Cloud at Customer.
Check the connectivity to Oracle Cloud Infrastructure Container Service Classic prior to creating a stack. Provide the storage connection details in the validation definition.
You can connect to cloud storage with a username and password, as shown in the example below:
storageConnectivityValidation:
validationType: STORAGE_CONNECT
parameters:
cloudStorageContainer: https://foo.storage.oraclecloud.com/v1/MyService-bar/MyContainer
cloudStorageUser: john@example.com
cloudStoragePassword: your_password
checkIfContainerExists: false
constraintDescription: Failed to connect to cloud storage as john
If you do not provide storage credentials, Oracle Cloud Stack will attempt to connect to cloud storage by using the OAuth protocol. You can optionally specify the name of an Oracle Cloud service that has been previously configured for OAuth authentication to cloud storage. For example:
storageConnectivityValidation:
validationType: STORAGE_CONNECT
parameters:
cloudStorageContainer: https://foo.storage.oraclecloud.com/v1/MyService-bar/MyContainer
serviceType: jaas
checkIfContainerExists: false
constraintDescription: Failed to connect to cloud storage using jaas OAuth configuration
Alternatively, you can specify an Oracle Cloud entitlement ID that has been previously configured for authentication to cloud storage by using the OAuth protocol. For example:
storageConnectivityValidation:
validationType: STORAGE_CONNECT
parameters:
cloudStorageContainer: https://foo.storage.oraclecloud.com/v1/MyService-bar/MyContainer
serviceEntitlementId: 123456
checkIfContainerExists: false
constraintDescription: Failed to connect to cloud storage using entitlement 123456
Parameter | Description |
---|---|
|
The URL for a cloud storage container If |
|
The Oracle Cloud user with which to make a connection If you do not provide a value for this parameter, Oracle Cloud Stack attempts to connect to cloud storage by using the OAuth protocol. |
|
The password for the specified cloud user If you do not provide a value for this parameter, Oracle Cloud Stack will attempt to connect to cloud storage by using the OAuth protocol. |
|
If set to true, then the validation will succeed only if the specified storage container exists. If set to false, then the validation simply checks for connectivity to the storage cloud service. |
|
The name of an Oracle Cloud service that has been previously configured for authentication to cloud storage by using the OAuth protocol. Oracle Cloud Stack uses this service’s OAuth configuration to validate connectivity to cloud storage. See List of Resource Types. If not specified, Oracle Cloud Stack automatically selects a service that is configured for OAuth. |
|
An Oracle Cloud entitlement ID that has been previously configured for authentication to cloud storage by using the OAuth protocol. Oracle Cloud Stack uses this account’s OAuth configuration to validate connectivity to cloud storage. If not specified, Oracle Cloud Stack automatically selects an account that is configured for OAuth. If both |
|
The error message to display to the user if this validation fails |
Generic Constraint
This topic does not apply to Oracle Cloud at Customer.
Evaluate a conditional expression that uses standard template functions. Validation fails if the expression evaluates to false
. For example:
passwordValidation:
validationType: CONSTRAINT
parameters:
constraint: {"Fn::Equals": [{"Fn::GetParam": "password"}, "oracle"]}
constraintDescription: The password oracle is not permitted. Enter a different password.
To learn more about conditional expressions, see Using Conditions and List of Functions.
Parameter | Description |
---|---|
|
A YAML expression that evaluates to either |
|
The error message to display to the user if this validation fails |