lib/fog/azurerm/models/resources/deployment.rb in fog-azure-rm-0.0.4 vs lib/fog/azurerm/models/resources/deployment.rb in fog-azure-rm-0.0.5

- old
+ new

@@ -19,34 +19,34 @@ attribute :content_version attribute :provisioning_state def self.parse(deployment) hash = {} - hash['name'] = deployment['name'] - hash['id'] = deployment['id'] - hash['resource_group'] = deployment['id'].split('/')[4] - hash['correlation_id'] = deployment['correlationId'] - hash['timestamp'] = deployment['timestamp'] - hash['outputs'] = deployment['outputs'] + hash['name'] = deployment.name + hash['id'] = deployment.id + hash['resource_group'] = get_resource_from_resource_id(deployment.id, RESOURCE_GROUP_NAME) + hash['correlation_id'] = deployment.properties.correlation_id + hash['timestamp'] = deployment.properties.timestamp + hash['outputs'] = deployment.properties.outputs hash['providers'] = [] - deployment['properties']['providers'].each do |provider| + deployment.properties.providers.each do |provider| provider_obj = Fog::Resources::AzureRM::Provider.new hash['providers'] << provider_obj.merge_attributes(Fog::Resources::AzureRM::Provider.parse(provider)) end hash['dependencies'] = [] - deployment['properties']['dependencies'].each do |dependency| + deployment.properties.dependencies.each do |dependency| dependency_obj = Fog::Resources::AzureRM::Dependency.new hash['dependencies'] << dependency_obj.merge_attributes(Fog::Resources::AzureRM::Dependency.parse(dependency)) end - hash['template_link'] = deployment['properties']['templateLink']['uri'] - hash['parameters_link'] = deployment['properties']['parametersLink']['uri'] - hash['content_version'] = deployment['properties']['templateLink']['contentVersion'] - hash['mode'] = deployment['properties']['mode'] - hash['debug_setting'] = deployment['properties']['debugSetting']['detailLevel'] unless deployment['properties']['debugSetting'].nil? - hash['provisioning_state'] = deployment['properties']['provisioningState'] + hash['template_link'] = deployment.properties.template_link.uri + hash['parameters_link'] = deployment.properties.parameters_link.uri + hash['content_version'] = deployment.properties.template_link.content_version + hash['mode'] = deployment.properties.mode + hash['debug_setting'] = deployment.properties.debug_setting.detail_level unless deployment.properties.debug_setting.nil? + hash['provisioning_state'] = deployment.properties.provisioning_state hash end def save requires :name, :resource_group, :template_link, :parameters_link