Class: StackMate::CloudStackResource
- Inherits:
-
Ruote::Participant
- Object
- Ruote::Participant
- StackMate::CloudStackResource
- Defined in:
- lib/stackmate/participants/cloudstack.rb
Direct Known Subclasses
CloudStackAffinityGroup, CloudStackAutoScalePolicy, CloudStackAutoScaleVmGroup, CloudStackAutoScaleVmProfile, CloudStackCondition, CloudStackEgressFirewallRule, CloudStackFirewallRule, CloudStackGlobalLoadBalancerRule, CloudStackInstance, CloudStackInstanceGroup, CloudStackIpAddress, CloudStackIpForwardingRule, CloudStackIpToNic, CloudStackIso, CloudStackLBHealthCheckPolicy, CloudStackLBStickinessPolicy, CloudStackLoadBalancer, CloudStackLoadBalancerRule, CloudStackNetwork, CloudStackNetworkACL, CloudStackNetworkACLList, CloudStackNicToVirtualMachine, CloudStackPortForwardingRule, CloudStackProject, CloudStackRemoteAccessVpn, CloudStackSSHKeyPair, CloudStackSecurityGroup, CloudStackSecurityGroupAWS, CloudStackSecurityGroupEgress, CloudStackSecurityGroupIngress, CloudStackSnapshot, CloudStackSnapshotPolicy, CloudStackStaticNat, CloudStackStaticRoute, CloudStackTags, CloudStackTemplate, CloudStackToGlobalLoadBalancerRule, CloudStackToLoadBalancerRule, CloudStackVMSnapshot, CloudStackVPC, CloudStackVirtualMachine, CloudStackVirtualMachineOps, CloudStackVolume, CloudStackVolumeOps, CloudStackVpnConnection, CloudStackVpnCustomerGateway, CloudStackVpnGateway, CloudStackVpnUser
Constant Summary
Constants included from Resolver
Resolver::INTEXP, Resolver::STRINGEXP, Resolver::UUIDEXP
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(opts) ⇒ CloudStackResource
constructor
A new instance of CloudStackResource.
- #on_workitem ⇒ Object
- #set_metadata ⇒ Object
Methods included from Resolver
#get_named_tag, #get_resolved, #recursive_resolve, #resolve_tags, #resolve_to_deviceid, #validate_param
Methods included from Logging
configure_logger_for, #logger, logger_for
Constructor Details
#initialize(opts) ⇒ CloudStackResource
Returns a new instance of CloudStackResource.
24 25 26 27 28 29 30 31 |
# File 'lib/stackmate/participants/cloudstack.rb', line 24 def initialize(opts) @opts = opts @url = opts['URL'] || ENV['URL'] or raise ArgumentError.new("CloudStackResources: no URL supplied for CloudStack API") @apikey = opts['APIKEY'] || ENV['APIKEY'] or raise ArgumentError.new("CloudStackResources: no api key supplied for CloudStack API") @seckey = opts['SECKEY'] || ENV['SECKEY'] or raise ArgumentError.new("CloudStackResources: no secret key supplied for CloudStack API") #@client = CloudstackRubyClient::Client.new(@url, @apikey, @seckey, false) @client = StackMate::CloudStackClient.new(@url, @apikey, @seckey, false) end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
22 23 24 |
# File 'lib/stackmate/participants/cloudstack.rb', line 22 def name @name end |
Instance Method Details
#on_workitem ⇒ Object
33 34 35 36 |
# File 'lib/stackmate/participants/cloudstack.rb', line 33 def on_workitem p workitem.participant_name reply end |
#set_metadata ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/stackmate/participants/cloudstack.rb', line 38 def = recursive_resolve(workitem['Resources'][@name]['Metadata'],workitem) stack_id = @resolved_names["CloudStack::StackId"] data = {} data['Description'] = workitem['Resources'][@name]['Description'] data['ResourceType'] = workitem['Resources'][@name]['Type'] data['LogicalResourceId'] = @name data['Metadata'] = .to_json data['PhysicalResourceId'] = workitem[@name]['physical_id'] data['ResourceStatus'] = 'CREATE_COMPLETE' data['ResourceStatusReason'] = 'StackMate_Resource' data['StackId'] = @resolved_names["CloudStack::StackId"] data['StackName'] = @resolved_names["CloudStack::StackName"] data['LastUpdatedTimestamp'] = Time.new.to_i = {} #TODO figure out a good workaround for this ['RequestId'] = "be8e5b39-40b7-11e3-90b2-d9d62a5d5348" data['ResponseMetadata'] = detail = {} detail['StackResourceDetail'] = data result = {} result['DescribeStackResourceResult'] = detail response = {} response['DescribeStackResourceResponse'] = result Metadata.(stack_id,@name,response) end |