Getting most out of vCAC without a CDK license

Did you ever get the response from VMware support or anyone else ‘for this you need a CDK license to make it work’? As it turns out this is a costly thing to have and in most cases you will not need it anyway. In addition, if you really come across something the ‘CloudUtil.exe’ does not let you do, you might be better off to stick to a proper API call to get things rolling.
So whenever you read this …

C:\Program Files (x86)\VMware\vCAC>
  "C:\Program Files (x86)\VMware\vCAC\Design Center\CloudUtil.exe" 
    Workflow-install
Your license is not valid for Development Kit. You can only use Design Center.

Command Not Found.

… you just make a call to the underlying ‘MetaModel.svc’ ODATA REST service – the same service ‘CloudUtil.exe’ is actually using as well.

For example when you want to install a scheduled workflow you just make a call to the metamodel via ODATA or the corresponding .NET assembly. Here is an example on how to list workflows, get information about an existing workflow, create a new workflow and create a new schedule for that workflow. It is pretty much self explanatory – and works without a CDK license …

PS > $MetaModel.BaseUri
AbsolutePath  : /Repository/Data/MetaModel.svc
AbsoluteUri  : https://vcac52.sharedop.org/Repository/Data/MetaModel.svc
LocalPath   : /Repository/Data/MetaModel.svc
Authority   : vcac52.sharedop.org
HostNameType  : Dns
IsDefaultPort : True
IsFile     : False
IsLoopback   : False
PathAndQuery  : /Repository/Data/MetaModel.svc
Segments    : {/, Repository/, Data/, MetaModel.svc}
IsUnc     : False
Host      : vcac52.sharedop.org
Port      : 443
Query     :
Fragment    :
Scheme     : https
OriginalString : https://vcac52.sharedop.org/Repository/Data/MetaModel.svc
DnsSafeHost  : vcac52.sharedop.org
IsAbsoluteUri : True
UserEscaped  : False
UserInfo    :

PS > $MetaModel.WorkflowSchedules.Name;
AppServiceState
AppServiceWaitState
CiscoUcsStateDataCollection
LaunchEndpointDataCollection
ReclaimDestroyedStaticIPAddresses
CollectMachinesUsage
SendAlertEmail
CollectEndpointUsage
CheckUsersExist
HpIloStateDataCollection
DellIdracStateDataCollection
PS > $wfs = $MetaModel.WorkflowSchedules |? Name -eq 'ReclaimDestroyedStaticIPAddresses'
PS > ($wfs | gm -Type Properties).Name |% { $null = $MetaModel.LoadProperty($wfs, $_); };
PS > $wfs
Id                        : 5
Name                      : ReclaimDestroyedStaticIPAddresses
Description               :
NextRunDatetime           : 2/18/2014 6:17:38 AM
LastRunDatetime           : 2/18/2014 6:12:50 AM
LastSuccessfulRunDatetime : 2/18/2014 6:12:50 AM
StartDatetime             :
TimeOfDay                 :
DayOfWeek                 :
OccurrenceOfMonth         :
IntervalMinutes           : 5
IsActive                  : True
IsSystemGenerated         : False
TriggeringUser            :
WorkflowInstance          :
WorkflowDefinition        : DynamicOps.Repository.RepositoryModel.WorkflowDefinition
WorkflowScheduleArguments : {}
PS > $wfNew = New-Object DynamicOps.Repository.RepositoryModel.WorkflowDefinition
PS > $wfNew.Name = 'Custom New Workflow'
PS > $wfNew.Description = 'Custom New Workflow without SDK'
PS > $wfNew.XamlDefinition = Get-Content .\New-VcacWorkflow.xaml -Raw
PS > $wfNew.Revision = 0
PS > $wfNew.CreatedDatetime = [datetime]::UtcNow;
PS > $MetaModel.AddToWorkflowDefinitions($wfNew)
PS > $MetaModel.UpdateObject($wfNew)
PS > $MetaModel.SaveChanges()
Descriptor                        Headers                           StatusCode Error
----------                        -------                           ---------- -----
System.Data.Services.Client.En... {[DataServiceVersion, 1.0;], [... 201
PS > $wfsNew = New-Object DynamicOps.Repository.RepositoryModel.WorkflowSchedule
PS > $wfsNew
Id                        : 0
Name                      :
Description               :
NextRunDatetime           :
LastRunDatetime           :
LastSuccessfulRunDatetime :
StartDatetime             :
TimeOfDay                 :
DayOfWeek                 :
OccurrenceOfMonth         :
IntervalMinutes           :
IsActive                  : False
IsSystemGenerated         : False
TriggeringUser            :
WorkflowInstance          :
WorkflowDefinition        :
WorkflowScheduleArguments : {}

PS > $wfsNew.Name = 'My New Schedule'
PS > $wfsNew.Description = 'Without CDK'
PS > $wfsNew.IntervalMinutes = 5;
PS > $wfsNew.WorkflowDefinition = $wfNew;
PS > $wfsNew.NextRunDatetime = [datetime]::UtcNow.AddMinutes(5)
PS > $wfsNew.LastRunDatetime = [datetime]::UtcNow
PS > $wfsNew.LastSuccessfulRunDatetime = [datetime]::UtcNow
PS > $MetaModel.SetLink($wfsNew, 'WorkflowDefinition', $wfNew);
PS > $MetaModel.AddToWorkflowSchedules($wfsNew);
PS > $MetaModel.UpdateObject($wfsNew)
PS > $MetaModel.SaveChanges()
Descriptor                        Headers                           StatusCode Error
----------                        -------                           ---------- -----
System.Data.Services.Client.En... {[DataServiceVersion, 1.0;], [... 201
<!--
POST https://vcac52.sharedop.org/Repository/Data/MetaModel.svc/WorkflowSchedules HTTP/1.1
User-Agent: Microsoft ADO.NET Data Services
DataServiceVersion: 1.0;NetFx
MaxDataServiceVersion: 2.0;NetFx
Repository-Cache: AuthorizationStore=Tue, 18 Feb 2014 06:20:39 GMT;ModelConfiguration=Mon, 14 Oct 2013 14:38:27 GMT;ReadPermissions=Wed, 19 Jun 2013 01:45:17 GMT;WritePermissions=Wed, 19 Jun 2013 01:45:45 GMT
Accept: application/atom+xml,application/xml
Accept-Charset: UTF-8
Content-Type: application/atom+xml
Authorization: Negotiate AAAAAA==
Host: vcac52.sharedop.org
Content-Length: 1493
-->
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<entry xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom">
 <title />
 <author>
  <name />
 </author>
 <updated>2014-02-18T06:21:50.274422Z</updated>
 <id />
 <link href="https://vcac52.sharedop.org/Repository/Data/MetaModel.svc/WorkflowDefinitions(244)" rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/WorkflowDefinition" type="application/atom+xml;type=entry" />
 <content type="application/xml">
  <m:properties>
   <d:DayOfWeek m:type="Edm.Int16" m:null="true" />
   <d:Description>Without CDK</d:Description>
   <d:Id m:type="Edm.Int32">0</d:Id>
   <d:IntervalMinutes m:type="Edm.Int32" m:null="true" />
   <d:IsActive m:type="Edm.Boolean">false</d:IsActive>
   <d:IsSystemGenerated m:type="Edm.Boolean">false</d:IsSystemGenerated>
   <d:LastRunDatetime m:type="Edm.DateTime" m:null="true" />
   <d:LastSuccessfulRunDatetime m:type="Edm.DateTime" m:null="true" />
   <d:Name>My New Schedule</d:Name>
   <d:NextRunDatetime m:type="Edm.DateTime" m:null="true" />
   <d:OccurrenceOfMonth m:type="Edm.Int16" m:null="true" />
   <d:StartDatetime m:type="Edm.DateTime" m:null="true" />
   <d:TimeOfDay m:type="Edm.Int32" m:null="true" />
   <d:TriggeringUser m:null="true" />
  </m:properties>
 </content>
</entry>
<!--
HTTP/1.1 201 Created
Cache-Control: no-cache
Content-Length: 2307
Content-Type: application/atom+xml;charset=utf-8
Location: https://vcac52.sharedop.org/Repository/Data/MetaModel.svc/WorkflowSchedules(12)
DataServiceVersion: 1.0;
Repository-Cache: AuthorizationStore=Tue, 18 Feb 2014 06:21:40 GMT;ModelConfiguration=Mon, 14 Oct 2013 14:38:27 GMT;ReadPermissions=Wed, 19 Jun 2013 01:45:17 GMT;WritePermissions=Wed, 19 Jun 2013 01:45:45 GMT
Persistent-Auth: true
WWW-Authenticate: Negotiate QAAAAA=
Date: Tue, 18 Feb 2014 06:21:49 GMT
-->
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<entry xml:base="https://vcac52.sharedop.org/Repository/Data/MetaModel.svc/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom">
 <id>https://vcac52.sharedop.org/Repository/Data/MetaModel.svc/WorkflowSchedules(12)</id>
 <title type="text"></title>
 <updated>2014-02-18T06:21:50Z</updated>
 <author>
  <name />
 </author>
 <link rel="edit" title="WorkflowSchedule" href="WorkflowSchedules(12)" />
 <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/WorkflowInstance" type="application/atom+xml;type=entry" title="WorkflowInstance" href="WorkflowSchedules(12)/WorkflowInstance" />
 <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/WorkflowDefinition" type="application/atom+xml;type=entry" title="WorkflowDefinition" href="WorkflowSchedules(12)/WorkflowDefinition" />
 <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/WorkflowScheduleArguments" type="application/atom+xml;type=feed" title="WorkflowScheduleArguments" href="WorkflowSchedules(12)/WorkflowScheduleArguments" />
 <category term="DynamicOps.Repository.RepositoryModel.WorkflowSchedule" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
 <content type="application/xml">
  <m:properties>
   <d:Id m:type="Edm.Int32">12</d:Id>
   <d:Name>My New Schedule</d:Name>
   <d:Description>Without CDK</d:Description>
   <d:NextRunDatetime m:type="Edm.DateTime" m:null="true" />
   <d:LastRunDatetime m:type="Edm.DateTime" m:null="true" />
   <d:LastSuccessfulRunDatetime m:type="Edm.DateTime" m:null="true" />
   <d:StartDatetime m:type="Edm.DateTime" m:null="true" />
   <d:TimeOfDay m:type="Edm.Int32" m:null="true" />
   <d:DayOfWeek m:type="Edm.Int16" m:null="true" />
   <d:OccurrenceOfMonth m:type="Edm.Int16" m:null="true" />
   <d:IntervalMinutes m:type="Edm.Int32" m:null="true" />
   <d:IsActive m:type="Edm.Boolean">false</d:IsActive>
   <d:IsSystemGenerated m:type="Edm.Boolean">false</d:IsSystemGenerated>
   <d:TriggeringUser m:null="true" />
  </m:properties>
 </content>
</entry>

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: