Class: Azure::Deploy
- Inherits:
-
Object
- Object
- Azure::Deploy
- Includes:
- AzureUtility
- Defined in:
- lib/azure/deploy.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
Returns the value of attribute connection.
-
#hostedservicename ⇒ Object
Returns the value of attribute hostedservicename.
-
#name ⇒ Object
Returns the value of attribute name.
-
#status ⇒ Object
Returns the value of attribute status.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
- #create(params, deployXML) ⇒ Object
-
#delete_role_if_present(role) ⇒ Object
just delete from local cache.
- #find_role(name) ⇒ Object
-
#initialize(connection) ⇒ Deploy
constructor
A new instance of Deploy.
- #retrieve(hostedservicename) ⇒ Object
- #roles ⇒ Object
- #setup(params) ⇒ Object
Methods included from AzureUtility
#error_from_response_xml, #xml_content
Constructor Details
#initialize(connection) ⇒ Deploy
Returns a new instance of Deploy.
114 115 116 |
# File 'lib/azure/deploy.rb', line 114 def initialize(connection) @connection = connection end |
Instance Attribute Details
#connection ⇒ Object
Returns the value of attribute connection.
112 113 114 |
# File 'lib/azure/deploy.rb', line 112 def connection @connection end |
#hostedservicename ⇒ Object
Returns the value of attribute hostedservicename.
112 113 114 |
# File 'lib/azure/deploy.rb', line 112 def hostedservicename @hostedservicename end |
#name ⇒ Object
Returns the value of attribute name.
112 113 114 |
# File 'lib/azure/deploy.rb', line 112 def name @name end |
#status ⇒ Object
Returns the value of attribute status.
112 113 114 |
# File 'lib/azure/deploy.rb', line 112 def status @status end |
#url ⇒ Object
Returns the value of attribute url.
112 113 114 |
# File 'lib/azure/deploy.rb', line 112 def url @url end |
Instance Method Details
#create(params, deployXML) ⇒ Object
154 155 156 157 |
# File 'lib/azure/deploy.rb', line 154 def create(params, deployXML) servicecall = "hostedservices/#{params[:azure_dns_name]}/deployments" @connection.query_azure(servicecall, "post", deployXML.to_xml) end |
#delete_role_if_present(role) ⇒ Object
just delete from local cache
164 165 166 |
# File 'lib/azure/deploy.rb', line 164 def delete_role_if_present(role) @roles.delete(role.name) if @roles end |
#find_role(name) ⇒ Object
168 169 170 |
# File 'lib/azure/deploy.rb', line 168 def find_role(name) @roles[name] if @roles end |
#retrieve(hostedservicename) ⇒ Object
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/azure/deploy.rb', line 117 def retrieve(hostedservicename) @hostedservicename = hostedservicename deployXML = @connection.query_azure("hostedservices/#{hostedservicename}/deploymentslots/Production") if deployXML.at_css('Deployment Name') != nil @name = xml_content(deployXML, 'Deployment Name') @status = xml_content(deployXML,'Deployment Status') @url = xml_content(deployXML, 'Deployment Url') @roles = Hash.new rolesXML = deployXML.css('Deployment RoleInstanceList RoleInstance') rolesXML.each do |roleXML| role = Role.new(@connection) role.parse(roleXML, hostedservicename, @name) @roles[role.name] = role end end end |
#roles ⇒ Object
159 160 161 |
# File 'lib/azure/deploy.rb', line 159 def roles @roles.values if @roles end |
#setup(params) ⇒ Object
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/azure/deploy.rb', line 133 def setup(params) role = Role.new(@connection) roleXML = role.setup(params) #roleXML = Nokogiri::XML role.setup(params) builder = Nokogiri::XML::Builder.new do |xml| xml.Deployment( 'xmlns'=>'http://schemas.microsoft.com/windowsazure', 'xmlns:i'=>'http://www.w3.org/2001/XMLSchema-instance' ) { xml.Name params['deploy_name'] xml.DeploymentSlot 'Production' xml.Label Base64.encode64(params['deploy_name']).strip xml.RoleList { xml.Role('i:type'=>'PersistentVMRole') } if params[:azure_network_name] xml.VirtualNetworkName params[:azure_network_name] end } end builder.doc.at_css('Role') << roleXML.at_css('PersistentVMRole').children.to_s builder.doc end |