Configure Jenkins EC2-Plugin with Groovy
<p>I am trying to configure the Jenkins EC2-Plugin via Groovy.
Plugin code: <a href="https://github.com/jenkinsci/ec2-plugin" rel="nofollow noreferrer">https://github.com/jenkinsci/ec2-plugin</a></p>

<p>I'm trying to setup the cloud with a name to get started</p>

<pre><code>import hudson.model.*
import jenkins.model.*
import hudson.plugins.ec2.*
import com.amazonaws.services.ec2.model.*

SlaveTemplate awsTemplate = new SlaveTemplate(
  'ami-1234567',
  '',
  '',
  'sg-1234567',
  't2.micro',
  true,
  'foo',
  '',
  'stuff',
  'run code',
  '/var/tmp',
  'more code',
  '4',
  '',
  '',
  '',
  false,
  'subnet-1234567',
  '',
  '60',
  false,
  '',
  'iam-profile',
  false,
  false,
  '',
  false,
  '',
  true,
  false
)

def slaveTemplates = [awsTemplate]

def ec2Cloud = new AmazonEC2Cloud(
  'foo',
  true,
  '',
  'us-west-2',
  '',
  '10',
  slaveTemplates
)

def cloudList = Jenkins.instance.clouds
cloudList.add(ec2Cloud)
</code></pre>

<p>Any ideas?</p>

<p>These are the error messages</p>

<pre><code>Error: Could not find matching constructor for: hudson.plugins.ec2.SlaveTemplate
</code></pre>

<p>or </p>

<pre><code>Error: Could not find matching constructor for: hudson.plugins.ec2.AmazonEC2Cloud
</code></pre>