Class: VCloudCloud::Steps::CreateTemplate
Instance Attribute Summary
#client, #state
Instance Method Summary
collapse
#cleanup, #initialize
Instance Method Details
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/cloud/vcloud/steps/create_template.rb', line 4
def perform(name, catalog_type, &block)
catalog = client.catalog catalog_type
params = VCloudSdk::Xml::WrapperFactory.create_instance 'UploadVAppTemplateParams'
params.name = name
upload_link = catalog.add_vapp_template_link
catalog_item = client.invoke(
:post,
upload_link,
:payload => params,
:headers => {:content_type => upload_link.type}
)
template = client.invoke :get, catalog_item.entity.href
state[:catalog_item] = catalog_item
state[:vapp_template] = template
end
|
#rollback ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/cloud/vcloud/steps/create_template.rb', line 24
def rollback
template = state[:vapp_template]
if template
if template.cancel_link
client.invoke :post, template.cancel_link
template = client.reload template
end
if template.remove_link
client.invoke_and_wait :delete, template.remove_link
end
end
end
|