Class: StackMate::CloudStackSecurityGroup
- Inherits:
-
CloudStackResource
- Object
- Ruote::Participant
- CloudStackResource
- StackMate::CloudStackSecurityGroup
- Defined in:
- lib/stackmate/participants/cloudstack.rb
Instance Attribute Summary
Attributes inherited from CloudStackResource
Instance Method Summary collapse
Methods inherited from CloudStackResource
Methods included from Logging
configure_logger_for, #logger, logger_for
Constructor Details
This class inherits a constructor from StackMate::CloudStackResource
Instance Method Details
#on_workitem ⇒ Object
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
# File 'lib/stackmate/participants/cloudstack.rb', line 167 def on_workitem myname = workitem.participant_name logger.debug("Going to create resource #{myname}") @name = myname p myname resolved = workitem.fields['ResolvedNames'] props = workitem.fields['Resources'][myname]['Properties'] name = workitem.fields['StackName'] + '-' + workitem.participant_name; resolved[myname] = name args = { 'name' => name, 'description' => props['GroupDescription'] } make_request('createSecurityGroup', args) logger.debug("created resource #{myname}") props['SecurityGroupIngress'].each do |rule| cidrIp = rule['CidrIp'] if cidrIp.kind_of? Hash #TODO: some sort of validation cidrIpName = cidrIp['Ref'] cidrIp = resolved[cidrIpName] end args = { 'securitygroupname' => name, 'startport' => rule['FromPort'], 'endport' => rule['ToPort'], 'protocol' => rule['IpProtocol'], 'cidrlist' => cidrIp } #TODO handle usersecuritygrouplist make_request('authorizeSecurityGroupIngress', args) end reply end |