Class: ServerTemplateInternal

Inherits:
Object
  • Object
show all
Extended by:
RightScale::Api::BaseExtend, RightScale::Api::InternalExtend
Includes:
RightScale::Api::Base, RightScale::Api::Internal
Defined in:
lib/rest_connection/rightscale/server_template_internal.rb

Overview

API 0.1

Instance Attribute Summary

Attributes included from RightScale::Api::Base

#params

Class Method Summary collapse

Instance Method Summary collapse

Methods included from RightScale::Api::BaseExtend

[], 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

Methods included from RightScale::Api::BaseConnection

#connection

Methods included from RightScale::Api::InternalConnection

#connection

Methods included from RightScale::Api::Base

#[], #[]=, #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::Base

Class Method Details

.resource_plural_nameObject



43
44
45
# File 'lib/rest_connection/rightscale/server_template_internal.rb', line 43

def self.resource_plural_name
  "server_templates"
end

.resource_singular_nameObject



47
48
49
# File 'lib/rest_connection/rightscale/server_template_internal.rb', line 47

def self.resource_singular_name
  "server_template"
end

Instance Method Details

#add_executable(executable, apply = "operational") ⇒ Object

<~Executable> executable, an Executable object to add <~String> Apply, a string designating the type of executable: “boot”, “operational”, “decommission”. Default is operational



79
80
81
82
83
84
85
86
87
88
89
# File 'lib/rest_connection/rightscale/server_template_internal.rb', line 79

def add_executable(executable, apply="operational")
  t = URI.parse(self.href)
  params = {}
  if executable.recipe?
    params[:recipe] = executable.href
  else
    params[:right_script_href] = executable.href
  end
  params[:apply] = apply
  connection.post(t.path + "/add_executable", params)
end

#add_multi_cloud_image(mci_href) ⇒ Object



51
52
53
54
# File 'lib/rest_connection/rightscale/server_template_internal.rb', line 51

def add_multi_cloud_image(mci_href)
  t = URI.parse(self.href)
  connection.put(t.path + "/add_multi_cloud_image", :multi_cloud_image_href => mci_href)
end

#commit(message) ⇒ Object

message <~String>: commit message string (required)



72
73
74
75
# File 'lib/rest_connection/rightscale/server_template_internal.rb', line 72

def commit(message)
  t = URI.parse(self.href)
  ServerTemplate.new(:href => connection.post(t.path + "/commit", :commit_message => message))
end

#delete_executable(executable, apply = "operational") ⇒ Object

<~Executable> executable, an Executable object to delete <~String> Apply, a string designating the type of executable: “boot”, “operational”, “decommission”. Default is operational



93
94
95
96
97
98
99
100
101
102
103
# File 'lib/rest_connection/rightscale/server_template_internal.rb', line 93

def delete_executable(executable, apply="operational")
  t = URI.parse(self.href)
  params = {}
  if executable.recipe?
    params[:recipe] = executable.href
  else
    params[:right_script_href] = executable.href
  end
  params[:apply] = apply
  connection.delete(t.path + "/delete_executable", params)
end

#delete_multi_cloud_image(mci_href) ⇒ Object



56
57
58
59
# File 'lib/rest_connection/rightscale/server_template_internal.rb', line 56

def delete_multi_cloud_image(mci_href)
  t = URI.parse(self.href)
  connection.put(t.path + "/delete_multi_cloud_image", :multi_cloud_image_href => mci_href)
end

#multi_cloud_imagesObject



66
67
68
69
# File 'lib/rest_connection/rightscale/server_template_internal.rb', line 66

def multi_cloud_images
  t = URI.parse(self.href)
  connection.get(t.path + "/multi_cloud_images")
end

#resource_plural_nameObject



35
36
37
# File 'lib/rest_connection/rightscale/server_template_internal.rb', line 35

def resource_plural_name
  "server_templates"
end

#resource_singular_nameObject



39
40
41
# File 'lib/rest_connection/rightscale/server_template_internal.rb', line 39

def resource_singular_name
  "server_template"
end

#set_default_multi_cloud_image(mci_href) ⇒ Object



61
62
63
64
# File 'lib/rest_connection/rightscale/server_template_internal.rb', line 61

def set_default_multi_cloud_image(mci_href)
  t = URI.parse(self.href)
  connection.put(t.path + "/set_default_multi_cloud_image", :multi_cloud_image_href => mci_href)
end