Class: McServerTemplate
Overview
Instance Attribute Summary
#params
Class Method Summary
collapse
Instance Method Summary
collapse
create, filters, find, find_all, find_by, find_with_filter, load, load_all, parse_args, resource_post_name
#connection
#[], #create, #deny_methods, #filters, #find, #find_all, #find_by, #find_by_cloud_id, #find_by_id, #find_by_nickname, #find_by_nickname_speed, #find_with_filter
#connection
find_by_tags
#get_inputs, #show
#add_tags, #remove_tags, #tags
#add_tags, #clear_tags, #get_info_tags, #get_tags_by_namespace, #remove_info_tags, #remove_tags, #remove_tags_by_namespace, #set_info_tags, #set_tags_by_namespace, #set_tags_to, #tags
#[], #[]=, #actions, #hash_of_links, #href, #initialize, #load, #method_missing, #nickname, #parse_params, #rediscover, #save
#[], #[]=, #destroy, #initialize, #method_missing, #reload, #rs_id, #save
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class RightScale::Api::Gateway
Class Method Details
.filters ⇒ Object
50
51
52
|
# File 'lib/rest_connection/rightscale/mc_server_template.rb', line 50
def self.filters
[:description, :multi_cloud_image_href, :name, :revision]
end
|
.resource_plural_name ⇒ Object
42
43
44
|
# File 'lib/rest_connection/rightscale/mc_server_template.rb', line 42
def self.resource_plural_name
"server_templates"
end
|
.resource_singular_name ⇒ Object
46
47
48
|
# File 'lib/rest_connection/rightscale/mc_server_template.rb', line 46
def self.resource_singular_name
"server_template"
end
|
Instance Method Details
#add_multi_cloud_image(mci_href) ⇒ Object
67
68
69
70
71
72
73
74
75
76
77
|
# File 'lib/rest_connection/rightscale/mc_server_template.rb', line 67
def add_multi_cloud_image(mci_href)
@mci_links = McServerTemplateMultiCloudImage.find_with_filter(:server_template_href => self.href)
if @mci_links.detect { |mci_link| mci_link.multi_cloud_image == mci_href }
connection.logger("WARNING: MCI #{mci_href} is already attached")
else
ret = McServerTemplateMultiCloudImage.create(:multi_cloud_image_href => mci_href,
:server_template_href => self.href)
get_mcis_and_settings
ret
end
end
|
#commit(message, commit_head_dependencies, freeze_repositories) ⇒ Object
101
102
103
104
105
106
107
108
109
110
|
# File 'lib/rest_connection/rightscale/mc_server_template.rb', line 101
def commit(message, commit_head_dependencies, freeze_repositories)
options = {:commit_message => "#{message}",
:commit_head_dependencies => (commit_head_dependencies && true),
:freeze_repositories => (freeze_repositories && true)}
t = URI.parse(self.href)
location = connection.post(t.path + "/commit", options)
newrecord = McServerTemplate.new('links' => [ {'rel' => 'self', 'href' => location } ])
newrecord.reload
newrecord
end
|
#detach_multi_cloud_image(mci_href) ⇒ Object
79
80
81
82
83
84
85
86
87
88
|
# File 'lib/rest_connection/rightscale/mc_server_template.rb', line 79
def detach_multi_cloud_image(mci_href)
@mci_links = McServerTemplateMultiCloudImage.find_with_filter(:server_template_href => self.href)
if link = @mci_links.detect { |mci_link| mci_link.multi_cloud_image == mci_href }
ret = link.destroy
get_mcis_and_settings
ret
else
connection.logger("WARNING: MCI #{mci_href} is not attached")
end
end
|
#get_mcis_and_settings ⇒ Object
#multi_cloud_images ⇒ Object
60
61
62
63
64
65
|
# File 'lib/rest_connection/rightscale/mc_server_template.rb', line 60
def multi_cloud_images
unless @params["multi_cloud_images"]
get_mcis_and_settings
end
@params["multi_cloud_images"]
end
|
#resource_plural_name ⇒ Object
34
35
36
|
# File 'lib/rest_connection/rightscale/mc_server_template.rb', line 34
def resource_plural_name
"server_templates"
end
|
#resource_singular_name ⇒ Object
38
39
40
|
# File 'lib/rest_connection/rightscale/mc_server_template.rb', line 38
def resource_singular_name
"server_template"
end
|
#set_default_multi_cloud_image(mci_href) ⇒ Object
90
91
92
93
94
95
96
97
98
99
|
# File 'lib/rest_connection/rightscale/mc_server_template.rb', line 90
def set_default_multi_cloud_image(mci_href)
@mci_links = McServerTemplateMultiCloudImage.find_with_filter(:server_template_href => self.href)
if link = @mci_links.detect { |mci_link| mci_link.multi_cloud_image == mci_href }
ret = link.make_default
get_mcis_and_settings
ret
else
connection.logger("WARNING: MCI #{mci_href} is not attached")
end
end
|