Hi
Is it possible to provision a DB via the API
/resources/json/delphix/database/provision
and also set up the new VDB to have a post script automatically?
What I'm trying to do is get all developer created VDBs to be done via the API and each one automatically has a post script that runs against their newly created DB. I don't want this to be optional to the devs, all the VDBs must run this script on creation/refresh.
We have created a powershell module which provisions the VDBs via the API and I'm not sure if we can add post script at provision time.
Our code is something like this
private dynamic ProvisionDatabase() {
var targetEnvironment = new Environment(this.Session).GetEnvironment(this.TargetServerName);
var targetRepository = new Repository(this.Session).GetRepository(targetEnvironment.reference.Value);
var snapshot = new Snapshot(this.Session);
this.Log.Info(targetRepository.reference.Value);
dynamic json = new ExpandoObject();
json.type = "MSSqlProvisionParameters";
json.container = new ExpandoObject();
json.container.type = "MSSqlDatabaseContainer";
json.container.name = this.TargetVirtualSourceName;
json.container.group = this.TargetGroup;
json.source = new ExpandoObject();
json.source.type = "MSSqlVirtualSource";
json.sourceConfig = new ExpandoObject();
json.sourceConfig.type = "MSSqlSIConfig";
json.sourceConfig.repository = targetRepository.reference.Value;
json.sourceConfig.databaseName = this.TargetPhysicalDatabaseName;
json.sourceConfig.instance = new ExpandoObject();
json.sourceConfig.instance.type = "MSSqlInstanceConfig";
json.sourceConfig.instance.host = targetEnvironment.host;
json.timeflowPointParameters = new ExpandoObject();
json.timeflowPointParameters.type = "TimeflowPointSemantic";
json.timeflowPointParameters.container = this.DatabaseResult.reference.Value;
json.timeflowPointParameters.location = "LATEST_SNAPSHOT";
var result = this.DoPost(json, "/resources/json/delphix/database/provision");
this.Log.Debug(result);
return result;
}