id int32 0 24.9k | repo stringlengths 5 58 | path stringlengths 9 168 | func_name stringlengths 9 130 | original_string stringlengths 66 10.5k | language stringclasses 1
value | code stringlengths 66 10.5k | code_tokens list | docstring stringlengths 8 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 94 266 |
|---|---|---|---|---|---|---|---|---|---|---|---|
1,200 | piotrmurach/lex | lib/lex/linter.rb | Lex.Linter.validate_tokens | def validate_tokens(lexer)
if lexer.lex_tokens.empty?
complain("No token list defined")
end
if !lexer.lex_tokens.respond_to?(:to_ary)
complain("Tokens must be a list or enumerable")
end
terminals = []
lexer.lex_tokens.each do |token|
if !identifier?(token)
... | ruby | def validate_tokens(lexer)
if lexer.lex_tokens.empty?
complain("No token list defined")
end
if !lexer.lex_tokens.respond_to?(:to_ary)
complain("Tokens must be a list or enumerable")
end
terminals = []
lexer.lex_tokens.each do |token|
if !identifier?(token)
... | [
"def",
"validate_tokens",
"(",
"lexer",
")",
"if",
"lexer",
".",
"lex_tokens",
".",
"empty?",
"complain",
"(",
"\"No token list defined\"",
")",
"end",
"if",
"!",
"lexer",
".",
"lex_tokens",
".",
"respond_to?",
"(",
":to_ary",
")",
"complain",
"(",
"\"Tokens m... | Validate provided tokens
@api private | [
"Validate",
"provided",
"tokens"
] | 28460ecafb8b92cf9a31e821f9f088c8f7573665 | https://github.com/piotrmurach/lex/blob/28460ecafb8b92cf9a31e821f9f088c8f7573665/lib/lex/linter.rb#L43-L61 |
1,201 | piotrmurach/lex | lib/lex/linter.rb | Lex.Linter.validate_states | def validate_states(lexer)
if !lexer.state_info.respond_to?(:each_pair)
complain("States must be defined as a hash")
end
lexer.state_info.each do |state_name, state_type|
if ![:inclusive, :exclusive].include?(state_type)
complain("State type for state #{state_name}" \
... | ruby | def validate_states(lexer)
if !lexer.state_info.respond_to?(:each_pair)
complain("States must be defined as a hash")
end
lexer.state_info.each do |state_name, state_type|
if ![:inclusive, :exclusive].include?(state_type)
complain("State type for state #{state_name}" \
... | [
"def",
"validate_states",
"(",
"lexer",
")",
"if",
"!",
"lexer",
".",
"state_info",
".",
"respond_to?",
"(",
":each_pair",
")",
"complain",
"(",
"\"States must be defined as a hash\"",
")",
"end",
"lexer",
".",
"state_info",
".",
"each",
"do",
"|",
"state_name",... | Validate provided state names
@api private | [
"Validate",
"provided",
"state",
"names"
] | 28460ecafb8b92cf9a31e821f9f088c8f7573665 | https://github.com/piotrmurach/lex/blob/28460ecafb8b92cf9a31e821f9f088c8f7573665/lib/lex/linter.rb#L66-L88 |
1,202 | Wardrop/Scorched | lib/scorched/response.rb | Scorched.Response.body= | def body=(value)
value = [] if !value || value == ''
super(value.respond_to?(:each) ? value : [value.to_s])
end | ruby | def body=(value)
value = [] if !value || value == ''
super(value.respond_to?(:each) ? value : [value.to_s])
end | [
"def",
"body",
"=",
"(",
"value",
")",
"value",
"=",
"[",
"]",
"if",
"!",
"value",
"||",
"value",
"==",
"''",
"super",
"(",
"value",
".",
"respond_to?",
"(",
":each",
")",
"?",
"value",
":",
"[",
"value",
".",
"to_s",
"]",
")",
"end"
] | Automatically wraps the assigned value in an array if it doesn't respond to ``each``.
Also filters out non-true values and empty strings. | [
"Automatically",
"wraps",
"the",
"assigned",
"value",
"in",
"an",
"array",
"if",
"it",
"doesn",
"t",
"respond",
"to",
"each",
".",
"Also",
"filters",
"out",
"non",
"-",
"true",
"values",
"and",
"empty",
"strings",
"."
] | 0833a6f9ed9ff42976577e5bbe5f23b7323eacb5 | https://github.com/Wardrop/Scorched/blob/0833a6f9ed9ff42976577e5bbe5f23b7323eacb5/lib/scorched/response.rb#L17-L20 |
1,203 | Wardrop/Scorched | lib/scorched/response.rb | Scorched.Response.finish | def finish(*args, &block)
self['Content-Type'] ||= 'text/html;charset=utf-8'
@block = block if block
if [204, 205, 304].include?(status.to_i)
header.delete "Content-Type"
header.delete "Content-Length"
close
[status.to_i, header, []]
else
[status.to_i, hea... | ruby | def finish(*args, &block)
self['Content-Type'] ||= 'text/html;charset=utf-8'
@block = block if block
if [204, 205, 304].include?(status.to_i)
header.delete "Content-Type"
header.delete "Content-Length"
close
[status.to_i, header, []]
else
[status.to_i, hea... | [
"def",
"finish",
"(",
"*",
"args",
",",
"&",
"block",
")",
"self",
"[",
"'Content-Type'",
"]",
"||=",
"'text/html;charset=utf-8'",
"@block",
"=",
"block",
"if",
"block",
"if",
"[",
"204",
",",
"205",
",",
"304",
"]",
".",
"include?",
"(",
"status",
"."... | Override finish to avoid using BodyProxy | [
"Override",
"finish",
"to",
"avoid",
"using",
"BodyProxy"
] | 0833a6f9ed9ff42976577e5bbe5f23b7323eacb5 | https://github.com/Wardrop/Scorched/blob/0833a6f9ed9ff42976577e5bbe5f23b7323eacb5/lib/scorched/response.rb#L23-L34 |
1,204 | Wardrop/Scorched | lib/scorched/controller.rb | Scorched.Controller.try_matches | def try_matches
eligable_matches.each do |match,idx|
request.breadcrumb << match
catch(:pass) {
dispatch(match)
return true
}
request.breadcrumb.pop # Current match passed, so pop the breadcrumb before the next iteration.
end
response.status = (!matc... | ruby | def try_matches
eligable_matches.each do |match,idx|
request.breadcrumb << match
catch(:pass) {
dispatch(match)
return true
}
request.breadcrumb.pop # Current match passed, so pop the breadcrumb before the next iteration.
end
response.status = (!matc... | [
"def",
"try_matches",
"eligable_matches",
".",
"each",
"do",
"|",
"match",
",",
"idx",
"|",
"request",
".",
"breadcrumb",
"<<",
"match",
"catch",
"(",
":pass",
")",
"{",
"dispatch",
"(",
"match",
")",
"return",
"true",
"}",
"request",
".",
"breadcrumb",
... | Tries to dispatch to each eligable match. If the first match _passes_, tries the second match and so on.
If there are no eligable matches, or all eligable matches pass, an appropriate 4xx response status is set. | [
"Tries",
"to",
"dispatch",
"to",
"each",
"eligable",
"match",
".",
"If",
"the",
"first",
"match",
"_passes_",
"tries",
"the",
"second",
"match",
"and",
"so",
"on",
".",
"If",
"there",
"are",
"no",
"eligable",
"matches",
"or",
"all",
"eligable",
"matches",
... | 0833a6f9ed9ff42976577e5bbe5f23b7323eacb5 | https://github.com/Wardrop/Scorched/blob/0833a6f9ed9ff42976577e5bbe5f23b7323eacb5/lib/scorched/controller.rb#L315-L325 |
1,205 | Wardrop/Scorched | lib/scorched/controller.rb | Scorched.Controller.dispatch | def dispatch(match)
@_dispatched = true
target = match.mapping[:target]
response.merge! begin
if Proc === target
instance_exec(&target)
else
target.call(env.merge(
'SCRIPT_NAME' => request.matched_path.chomp('/'),
'PATH_INFO' => request.unmat... | ruby | def dispatch(match)
@_dispatched = true
target = match.mapping[:target]
response.merge! begin
if Proc === target
instance_exec(&target)
else
target.call(env.merge(
'SCRIPT_NAME' => request.matched_path.chomp('/'),
'PATH_INFO' => request.unmat... | [
"def",
"dispatch",
"(",
"match",
")",
"@_dispatched",
"=",
"true",
"target",
"=",
"match",
".",
"mapping",
"[",
":target",
"]",
"response",
".",
"merge!",
"begin",
"if",
"Proc",
"===",
"target",
"instance_exec",
"(",
"target",
")",
"else",
"target",
".",
... | Dispatches the request to the matched target.
Overriding this method provides the opportunity for one to have more control over how mapping targets are invoked. | [
"Dispatches",
"the",
"request",
"to",
"the",
"matched",
"target",
".",
"Overriding",
"this",
"method",
"provides",
"the",
"opportunity",
"for",
"one",
"to",
"have",
"more",
"control",
"over",
"how",
"mapping",
"targets",
"are",
"invoked",
"."
] | 0833a6f9ed9ff42976577e5bbe5f23b7323eacb5 | https://github.com/Wardrop/Scorched/blob/0833a6f9ed9ff42976577e5bbe5f23b7323eacb5/lib/scorched/controller.rb#L329-L342 |
1,206 | Wardrop/Scorched | lib/scorched/controller.rb | Scorched.Controller.matches | def matches
@_matches ||= begin
to_match = request.unmatched_path
to_match = to_match.chomp('/') if config[:strip_trailing_slash] == :ignore && to_match =~ %r{./$}
mappings.map { |mapping|
mapping[:pattern].match(to_match) do |match_data|
if match_data.pre_match == ''... | ruby | def matches
@_matches ||= begin
to_match = request.unmatched_path
to_match = to_match.chomp('/') if config[:strip_trailing_slash] == :ignore && to_match =~ %r{./$}
mappings.map { |mapping|
mapping[:pattern].match(to_match) do |match_data|
if match_data.pre_match == ''... | [
"def",
"matches",
"@_matches",
"||=",
"begin",
"to_match",
"=",
"request",
".",
"unmatched_path",
"to_match",
"=",
"to_match",
".",
"chomp",
"(",
"'/'",
")",
"if",
"config",
"[",
":strip_trailing_slash",
"]",
"==",
":ignore",
"&&",
"to_match",
"=~",
"%r{",
"... | Finds mappings that match the unmatched portion of the request path, returning an array of `Match` objects, or an
empty array if no matches were found.
The `:eligable` attribute of the `Match` object indicates whether the conditions for that mapping passed.
The result is cached for the life time of the controller i... | [
"Finds",
"mappings",
"that",
"match",
"the",
"unmatched",
"portion",
"of",
"the",
"request",
"path",
"returning",
"an",
"array",
"of",
"Match",
"objects",
"or",
"an",
"empty",
"array",
"if",
"no",
"matches",
"were",
"found",
"."
] | 0833a6f9ed9ff42976577e5bbe5f23b7323eacb5 | https://github.com/Wardrop/Scorched/blob/0833a6f9ed9ff42976577e5bbe5f23b7323eacb5/lib/scorched/controller.rb#L349-L369 |
1,207 | Wardrop/Scorched | lib/scorched/controller.rb | Scorched.Controller.eligable_matches | def eligable_matches
@_eligable_matches ||= begin
matches.select { |m| m.failed_condition.nil? }.each_with_index.sort_by do |m,idx|
priority = m.mapping[:priority] || 0
media_type_rank = [*m.mapping[:conditions][:media_type]].map { |type|
env['scorched.accept'][:accept].ran... | ruby | def eligable_matches
@_eligable_matches ||= begin
matches.select { |m| m.failed_condition.nil? }.each_with_index.sort_by do |m,idx|
priority = m.mapping[:priority] || 0
media_type_rank = [*m.mapping[:conditions][:media_type]].map { |type|
env['scorched.accept'][:accept].ran... | [
"def",
"eligable_matches",
"@_eligable_matches",
"||=",
"begin",
"matches",
".",
"select",
"{",
"|",
"m",
"|",
"m",
".",
"failed_condition",
".",
"nil?",
"}",
".",
"each_with_index",
".",
"sort_by",
"do",
"|",
"m",
",",
"idx",
"|",
"priority",
"=",
"m",
... | Returns an ordered list of eligable matches.
Orders matches based on media_type, ensuring priority and definition order are respected appropriately.
Sorts by mapping priority first, media type appropriateness second, and definition order third. | [
"Returns",
"an",
"ordered",
"list",
"of",
"eligable",
"matches",
".",
"Orders",
"matches",
"based",
"on",
"media_type",
"ensuring",
"priority",
"and",
"definition",
"order",
"are",
"respected",
"appropriately",
".",
"Sorts",
"by",
"mapping",
"priority",
"first",
... | 0833a6f9ed9ff42976577e5bbe5f23b7323eacb5 | https://github.com/Wardrop/Scorched/blob/0833a6f9ed9ff42976577e5bbe5f23b7323eacb5/lib/scorched/controller.rb#L374-L385 |
1,208 | Wardrop/Scorched | lib/scorched/controller.rb | Scorched.Controller.check_for_failed_condition | def check_for_failed_condition(conds)
failed = (conds || []).find { |c, v| !check_condition?(c, v) }
if failed
failed[0] = failed[0][0..-2].to_sym if failed[0][-1] == '!'
end
failed
end | ruby | def check_for_failed_condition(conds)
failed = (conds || []).find { |c, v| !check_condition?(c, v) }
if failed
failed[0] = failed[0][0..-2].to_sym if failed[0][-1] == '!'
end
failed
end | [
"def",
"check_for_failed_condition",
"(",
"conds",
")",
"failed",
"=",
"(",
"conds",
"||",
"[",
"]",
")",
".",
"find",
"{",
"|",
"c",
",",
"v",
"|",
"!",
"check_condition?",
"(",
"c",
",",
"v",
")",
"}",
"if",
"failed",
"failed",
"[",
"0",
"]",
"... | Tests the given conditions, returning the name of the first failed condition, or nil otherwise. | [
"Tests",
"the",
"given",
"conditions",
"returning",
"the",
"name",
"of",
"the",
"first",
"failed",
"condition",
"or",
"nil",
"otherwise",
"."
] | 0833a6f9ed9ff42976577e5bbe5f23b7323eacb5 | https://github.com/Wardrop/Scorched/blob/0833a6f9ed9ff42976577e5bbe5f23b7323eacb5/lib/scorched/controller.rb#L388-L394 |
1,209 | Wardrop/Scorched | lib/scorched/controller.rb | Scorched.Controller.check_condition? | def check_condition?(c, v)
c = c[0..-2].to_sym if invert = (c[-1] == '!')
raise Error, "The condition `#{c}` either does not exist, or is not an instance of Proc" unless Proc === self.conditions[c]
retval = instance_exec(v, &self.conditions[c])
invert ? !retval : !!retval
end | ruby | def check_condition?(c, v)
c = c[0..-2].to_sym if invert = (c[-1] == '!')
raise Error, "The condition `#{c}` either does not exist, or is not an instance of Proc" unless Proc === self.conditions[c]
retval = instance_exec(v, &self.conditions[c])
invert ? !retval : !!retval
end | [
"def",
"check_condition?",
"(",
"c",
",",
"v",
")",
"c",
"=",
"c",
"[",
"0",
"..",
"-",
"2",
"]",
".",
"to_sym",
"if",
"invert",
"=",
"(",
"c",
"[",
"-",
"1",
"]",
"==",
"'!'",
")",
"raise",
"Error",
",",
"\"The condition `#{c}` either does not exist... | Test the given condition, returning true if the condition passes, or false otherwise. | [
"Test",
"the",
"given",
"condition",
"returning",
"true",
"if",
"the",
"condition",
"passes",
"or",
"false",
"otherwise",
"."
] | 0833a6f9ed9ff42976577e5bbe5f23b7323eacb5 | https://github.com/Wardrop/Scorched/blob/0833a6f9ed9ff42976577e5bbe5f23b7323eacb5/lib/scorched/controller.rb#L397-L402 |
1,210 | Wardrop/Scorched | lib/scorched/controller.rb | Scorched.Controller.redirect | def redirect(url, status: (env['HTTP_VERSION'] == 'HTTP/1.1') ? 303 : 302, halt: true)
response['Location'] = absolute(url)
response.status = status
self.halt if halt
end | ruby | def redirect(url, status: (env['HTTP_VERSION'] == 'HTTP/1.1') ? 303 : 302, halt: true)
response['Location'] = absolute(url)
response.status = status
self.halt if halt
end | [
"def",
"redirect",
"(",
"url",
",",
"status",
":",
"(",
"env",
"[",
"'HTTP_VERSION'",
"]",
"==",
"'HTTP/1.1'",
")",
"?",
"303",
":",
"302",
",",
"halt",
":",
"true",
")",
"response",
"[",
"'Location'",
"]",
"=",
"absolute",
"(",
"url",
")",
"response... | Redirects to the specified path or URL. An optional HTTP status is also accepted. | [
"Redirects",
"to",
"the",
"specified",
"path",
"or",
"URL",
".",
"An",
"optional",
"HTTP",
"status",
"is",
"also",
"accepted",
"."
] | 0833a6f9ed9ff42976577e5bbe5f23b7323eacb5 | https://github.com/Wardrop/Scorched/blob/0833a6f9ed9ff42976577e5bbe5f23b7323eacb5/lib/scorched/controller.rb#L405-L409 |
1,211 | Wardrop/Scorched | lib/scorched/controller.rb | Scorched.Controller.flash | def flash(key = :flash)
raise Error, "Flash session data cannot be used without a valid Rack session" unless session
flash_hash = env['scorched.flash'] ||= {}
flash_hash[key] ||= {}
session[key] ||= {}
unless session[key].methods(false).include? :[]=
session[key].define_singleton_m... | ruby | def flash(key = :flash)
raise Error, "Flash session data cannot be used without a valid Rack session" unless session
flash_hash = env['scorched.flash'] ||= {}
flash_hash[key] ||= {}
session[key] ||= {}
unless session[key].methods(false).include? :[]=
session[key].define_singleton_m... | [
"def",
"flash",
"(",
"key",
"=",
":flash",
")",
"raise",
"Error",
",",
"\"Flash session data cannot be used without a valid Rack session\"",
"unless",
"session",
"flash_hash",
"=",
"env",
"[",
"'scorched.flash'",
"]",
"||=",
"{",
"}",
"flash_hash",
"[",
"key",
"]",
... | Flash session storage helper.
Stores session data until the next time this method is called with the same arguments, at which point it's reset.
The typical use case is to provide feedback to the user on the previous action they performed. | [
"Flash",
"session",
"storage",
"helper",
".",
"Stores",
"session",
"data",
"until",
"the",
"next",
"time",
"this",
"method",
"is",
"called",
"with",
"the",
"same",
"arguments",
"at",
"which",
"point",
"it",
"s",
"reset",
".",
"The",
"typical",
"use",
"case... | 0833a6f9ed9ff42976577e5bbe5f23b7323eacb5 | https://github.com/Wardrop/Scorched/blob/0833a6f9ed9ff42976577e5bbe5f23b7323eacb5/lib/scorched/controller.rb#L440-L451 |
1,212 | Wardrop/Scorched | lib/scorched/controller.rb | Scorched.Controller.run_filters | def run_filters(type)
halted = false
tracker = env['scorched.executed_filters'] ||= {before: Set.new, after: Set.new}
filters[type].reject { |f| tracker[type].include?(f) }.each do |f|
unless check_for_failed_condition(f[:conditions]) || (halted && !f[:force])
tracker[type] << f
... | ruby | def run_filters(type)
halted = false
tracker = env['scorched.executed_filters'] ||= {before: Set.new, after: Set.new}
filters[type].reject { |f| tracker[type].include?(f) }.each do |f|
unless check_for_failed_condition(f[:conditions]) || (halted && !f[:force])
tracker[type] << f
... | [
"def",
"run_filters",
"(",
"type",
")",
"halted",
"=",
"false",
"tracker",
"=",
"env",
"[",
"'scorched.executed_filters'",
"]",
"||=",
"{",
"before",
":",
"Set",
".",
"new",
",",
"after",
":",
"Set",
".",
"new",
"}",
"filters",
"[",
"type",
"]",
".",
... | Returns false if any of the filters halted the request. True otherwise. | [
"Returns",
"false",
"if",
"any",
"of",
"the",
"filters",
"halted",
"the",
"request",
".",
"True",
"otherwise",
"."
] | 0833a6f9ed9ff42976577e5bbe5f23b7323eacb5 | https://github.com/Wardrop/Scorched/blob/0833a6f9ed9ff42976577e5bbe5f23b7323eacb5/lib/scorched/controller.rb#L598-L608 |
1,213 | Wardrop/Scorched | lib/scorched/request.rb | Scorched.Request.unescaped_path | def unescaped_path
path_info.split(/(%25|%2F)/i).each_slice(2).map { |v, m| URI.unescape(v) << (m || '') }.join('')
end | ruby | def unescaped_path
path_info.split(/(%25|%2F)/i).each_slice(2).map { |v, m| URI.unescape(v) << (m || '') }.join('')
end | [
"def",
"unescaped_path",
"path_info",
".",
"split",
"(",
"/",
"/i",
")",
".",
"each_slice",
"(",
"2",
")",
".",
"map",
"{",
"|",
"v",
",",
"m",
"|",
"URI",
".",
"unescape",
"(",
"v",
")",
"<<",
"(",
"m",
"||",
"''",
")",
"}",
".",
"join",
"("... | The unescaped URL, excluding the escaped forward-slash and percent. The resulting string will always be safe
to unescape again in situations where the forward-slash or percent are expected and valid characters. | [
"The",
"unescaped",
"URL",
"excluding",
"the",
"escaped",
"forward",
"-",
"slash",
"and",
"percent",
".",
"The",
"resulting",
"string",
"will",
"always",
"be",
"safe",
"to",
"unescape",
"again",
"in",
"situations",
"where",
"the",
"forward",
"-",
"slash",
"o... | 0833a6f9ed9ff42976577e5bbe5f23b7323eacb5 | https://github.com/Wardrop/Scorched/blob/0833a6f9ed9ff42976577e5bbe5f23b7323eacb5/lib/scorched/request.rb#L35-L37 |
1,214 | softlayer/softlayer-ruby | lib/softlayer/Server.rb | SoftLayer.Server.reboot! | def reboot!(reboot_technique = :default_reboot)
case reboot_technique
when :default_reboot
self.service.rebootDefault
when :os_reboot
self.service.rebootSoft
when :power_cycle
self.service.rebootHard
else
raise ArgumentError, "Unrecognized reboot technique i... | ruby | def reboot!(reboot_technique = :default_reboot)
case reboot_technique
when :default_reboot
self.service.rebootDefault
when :os_reboot
self.service.rebootSoft
when :power_cycle
self.service.rebootHard
else
raise ArgumentError, "Unrecognized reboot technique i... | [
"def",
"reboot!",
"(",
"reboot_technique",
"=",
":default_reboot",
")",
"case",
"reboot_technique",
"when",
":default_reboot",
"self",
".",
"service",
".",
"rebootDefault",
"when",
":os_reboot",
"self",
".",
"service",
".",
"rebootSoft",
"when",
":power_cycle",
"sel... | Construct a server from the given client using the network data found in +network_hash+
Most users should not have to call this method directly. Instead you should access the
servers property of an Account object, or use methods like BareMetalServer#find_servers
or VirtualServer#find_servers
Reboot the server. ... | [
"Construct",
"a",
"server",
"from",
"the",
"given",
"client",
"using",
"the",
"network",
"data",
"found",
"in",
"+",
"network_hash",
"+"
] | 48d7e0e36a3b02d832e7e303a513020a8fbde93b | https://github.com/softlayer/softlayer-ruby/blob/48d7e0e36a3b02d832e7e303a513020a8fbde93b/lib/softlayer/Server.rb#L174-L185 |
1,215 | softlayer/softlayer-ruby | lib/softlayer/Server.rb | SoftLayer.Server.notes= | def notes=(new_notes)
raise ArgumentError, "The new notes cannot be nil" unless new_notes
edit_template = {
"notes" => new_notes
}
self.service.editObject(edit_template)
self.refresh_details()
end | ruby | def notes=(new_notes)
raise ArgumentError, "The new notes cannot be nil" unless new_notes
edit_template = {
"notes" => new_notes
}
self.service.editObject(edit_template)
self.refresh_details()
end | [
"def",
"notes",
"=",
"(",
"new_notes",
")",
"raise",
"ArgumentError",
",",
"\"The new notes cannot be nil\"",
"unless",
"new_notes",
"edit_template",
"=",
"{",
"\"notes\"",
"=>",
"new_notes",
"}",
"self",
".",
"service",
".",
"editObject",
"(",
"edit_template",
")... | Change the notes of the server
raises ArgumentError if you pass nil as the notes | [
"Change",
"the",
"notes",
"of",
"the",
"server",
"raises",
"ArgumentError",
"if",
"you",
"pass",
"nil",
"as",
"the",
"notes"
] | 48d7e0e36a3b02d832e7e303a513020a8fbde93b | https://github.com/softlayer/softlayer-ruby/blob/48d7e0e36a3b02d832e7e303a513020a8fbde93b/lib/softlayer/Server.rb#L205-L214 |
1,216 | softlayer/softlayer-ruby | lib/softlayer/Server.rb | SoftLayer.Server.set_hostname! | def set_hostname!(new_hostname)
raise ArgumentError, "The new hostname cannot be nil" unless new_hostname
raise ArgumentError, "The new hostname cannot be empty" if new_hostname.empty?
edit_template = {
"hostname" => new_hostname
}
self.service.editObject(edit_template)
sel... | ruby | def set_hostname!(new_hostname)
raise ArgumentError, "The new hostname cannot be nil" unless new_hostname
raise ArgumentError, "The new hostname cannot be empty" if new_hostname.empty?
edit_template = {
"hostname" => new_hostname
}
self.service.editObject(edit_template)
sel... | [
"def",
"set_hostname!",
"(",
"new_hostname",
")",
"raise",
"ArgumentError",
",",
"\"The new hostname cannot be nil\"",
"unless",
"new_hostname",
"raise",
"ArgumentError",
",",
"\"The new hostname cannot be empty\"",
"if",
"new_hostname",
".",
"empty?",
"edit_template",
"=",
... | Change the hostname of this server
Raises an ArgumentError if the new hostname is nil or empty | [
"Change",
"the",
"hostname",
"of",
"this",
"server",
"Raises",
"an",
"ArgumentError",
"if",
"the",
"new",
"hostname",
"is",
"nil",
"or",
"empty"
] | 48d7e0e36a3b02d832e7e303a513020a8fbde93b | https://github.com/softlayer/softlayer-ruby/blob/48d7e0e36a3b02d832e7e303a513020a8fbde93b/lib/softlayer/Server.rb#L229-L239 |
1,217 | softlayer/softlayer-ruby | lib/softlayer/Server.rb | SoftLayer.Server.set_domain! | def set_domain!(new_domain)
raise ArgumentError, "The new hostname cannot be nil" unless new_domain
raise ArgumentError, "The new hostname cannot be empty" if new_domain.empty?
edit_template = {
"domain" => new_domain
}
self.service.editObject(edit_template)
self.refresh_de... | ruby | def set_domain!(new_domain)
raise ArgumentError, "The new hostname cannot be nil" unless new_domain
raise ArgumentError, "The new hostname cannot be empty" if new_domain.empty?
edit_template = {
"domain" => new_domain
}
self.service.editObject(edit_template)
self.refresh_de... | [
"def",
"set_domain!",
"(",
"new_domain",
")",
"raise",
"ArgumentError",
",",
"\"The new hostname cannot be nil\"",
"unless",
"new_domain",
"raise",
"ArgumentError",
",",
"\"The new hostname cannot be empty\"",
"if",
"new_domain",
".",
"empty?",
"edit_template",
"=",
"{",
... | Change the domain of this server
Raises an ArgumentError if the new domain is nil or empty
no further validation is done on the domain name | [
"Change",
"the",
"domain",
"of",
"this",
"server"
] | 48d7e0e36a3b02d832e7e303a513020a8fbde93b | https://github.com/softlayer/softlayer-ruby/blob/48d7e0e36a3b02d832e7e303a513020a8fbde93b/lib/softlayer/Server.rb#L247-L257 |
1,218 | softlayer/softlayer-ruby | lib/softlayer/Server.rb | SoftLayer.Server.change_port_speed | def change_port_speed(new_speed, public = true)
if public
self.service.setPublicNetworkInterfaceSpeed(new_speed)
else
self.service.setPrivateNetworkInterfaceSpeed(new_speed)
end
self.refresh_details()
self
end | ruby | def change_port_speed(new_speed, public = true)
if public
self.service.setPublicNetworkInterfaceSpeed(new_speed)
else
self.service.setPrivateNetworkInterfaceSpeed(new_speed)
end
self.refresh_details()
self
end | [
"def",
"change_port_speed",
"(",
"new_speed",
",",
"public",
"=",
"true",
")",
"if",
"public",
"self",
".",
"service",
".",
"setPublicNetworkInterfaceSpeed",
"(",
"new_speed",
")",
"else",
"self",
".",
"service",
".",
"setPrivateNetworkInterfaceSpeed",
"(",
"new_s... | Change the current port speed of the server
+new_speed+ is expressed Mbps and should be 0, 10, 100, or 1000.
Ports have a maximum speed that will limit the actual speed set
on the port.
Set +public+ to +false+ in order to change the speed of the
private network interface. | [
"Change",
"the",
"current",
"port",
"speed",
"of",
"the",
"server"
] | 48d7e0e36a3b02d832e7e303a513020a8fbde93b | https://github.com/softlayer/softlayer-ruby/blob/48d7e0e36a3b02d832e7e303a513020a8fbde93b/lib/softlayer/Server.rb#L278-L287 |
1,219 | softlayer/softlayer-ruby | lib/softlayer/Server.rb | SoftLayer.Server.reload_os! | def reload_os!(token = '', provisioning_script_uri = nil, ssh_keys = nil)
configuration = {}
configuration['customProvisionScriptUri'] = provisioning_script_uri if provisioning_script_uri
configuration['sshKeyIds'] = ssh_keys if ssh_keys
self.service.reloadOperatingSystem(token, configuration)... | ruby | def reload_os!(token = '', provisioning_script_uri = nil, ssh_keys = nil)
configuration = {}
configuration['customProvisionScriptUri'] = provisioning_script_uri if provisioning_script_uri
configuration['sshKeyIds'] = ssh_keys if ssh_keys
self.service.reloadOperatingSystem(token, configuration)... | [
"def",
"reload_os!",
"(",
"token",
"=",
"''",
",",
"provisioning_script_uri",
"=",
"nil",
",",
"ssh_keys",
"=",
"nil",
")",
"configuration",
"=",
"{",
"}",
"configuration",
"[",
"'customProvisionScriptUri'",
"]",
"=",
"provisioning_script_uri",
"if",
"provisioning... | Begins an OS reload on this server.
The OS reload can wipe out the data on your server so this method uses a
confirmation mechanism built into the underlying SoftLayer API. If you
call this method once without a token, it will not actually start the
reload. Instead it will return a token to you. That token is good... | [
"Begins",
"an",
"OS",
"reload",
"on",
"this",
"server",
"."
] | 48d7e0e36a3b02d832e7e303a513020a8fbde93b | https://github.com/softlayer/softlayer-ruby/blob/48d7e0e36a3b02d832e7e303a513020a8fbde93b/lib/softlayer/Server.rb#L303-L310 |
1,220 | drone/drone-ruby | lib/drone/plugin.rb | Drone.Plugin.parse | def parse
self.result ||= Payload.new.tap do |payload|
PayloadRepresenter.new(
payload
).from_json(
input
)
end
rescue MultiJson::ParseError
raise InvalidJsonError
end | ruby | def parse
self.result ||= Payload.new.tap do |payload|
PayloadRepresenter.new(
payload
).from_json(
input
)
end
rescue MultiJson::ParseError
raise InvalidJsonError
end | [
"def",
"parse",
"self",
".",
"result",
"||=",
"Payload",
".",
"new",
".",
"tap",
"do",
"|",
"payload",
"|",
"PayloadRepresenter",
".",
"new",
"(",
"payload",
")",
".",
"from_json",
"(",
"input",
")",
"end",
"rescue",
"MultiJson",
"::",
"ParseError",
"rai... | Initialize the plugin parser
@param input [String] the JSON as a string to parse
@return [Drone::Plugin] the instance of that class
Parse the provided payload
@return [Drone::Payload] the parsed payload within model
@raise [Drone::InvalidJsonError] if the provided JSON is invalid | [
"Initialize",
"the",
"plugin",
"parser"
] | 4b95286c45a9c44f2e38c393b804f753fb286b50 | https://github.com/drone/drone-ruby/blob/4b95286c45a9c44f2e38c393b804f753fb286b50/lib/drone/plugin.rb#L43-L53 |
1,221 | softlayer/softlayer-ruby | lib/softlayer/APIParameterFilter.rb | SoftLayer.APIParameterFilter.object_filter | def object_filter(filter)
raise ArgumentError, "object_filter expects an instance of SoftLayer::ObjectFilter" if filter.nil? || !filter.kind_of?(SoftLayer::ObjectFilter)
# we create a new object in case the user wants to store off the
# filter chain and reuse it later
APIParameterFilter.new(self.target... | ruby | def object_filter(filter)
raise ArgumentError, "object_filter expects an instance of SoftLayer::ObjectFilter" if filter.nil? || !filter.kind_of?(SoftLayer::ObjectFilter)
# we create a new object in case the user wants to store off the
# filter chain and reuse it later
APIParameterFilter.new(self.target... | [
"def",
"object_filter",
"(",
"filter",
")",
"raise",
"ArgumentError",
",",
"\"object_filter expects an instance of SoftLayer::ObjectFilter\"",
"if",
"filter",
".",
"nil?",
"||",
"!",
"filter",
".",
"kind_of?",
"(",
"SoftLayer",
"::",
"ObjectFilter",
")",
"# we create a ... | Adds an object_filter to the result. An Object Filter allows you
to specify criteria which are used to filter the results returned
by the server. | [
"Adds",
"an",
"object_filter",
"to",
"the",
"result",
".",
"An",
"Object",
"Filter",
"allows",
"you",
"to",
"specify",
"criteria",
"which",
"are",
"used",
"to",
"filter",
"the",
"results",
"returned",
"by",
"the",
"server",
"."
] | 48d7e0e36a3b02d832e7e303a513020a8fbde93b | https://github.com/softlayer/softlayer-ruby/blob/48d7e0e36a3b02d832e7e303a513020a8fbde93b/lib/softlayer/APIParameterFilter.rb#L114-L120 |
1,222 | softlayer/softlayer-ruby | lib/softlayer/VirtualServerUpgradeOrder.rb | SoftLayer.VirtualServerUpgradeOrder.verify | def verify()
if has_order_items?
order_template = order_object
order_template = yield order_object if block_given?
@virtual_server.softlayer_client[:Product_Order].verifyOrder(order_template)
end
end | ruby | def verify()
if has_order_items?
order_template = order_object
order_template = yield order_object if block_given?
@virtual_server.softlayer_client[:Product_Order].verifyOrder(order_template)
end
end | [
"def",
"verify",
"(",
")",
"if",
"has_order_items?",
"order_template",
"=",
"order_object",
"order_template",
"=",
"yield",
"order_object",
"if",
"block_given?",
"@virtual_server",
".",
"softlayer_client",
"[",
":Product_Order",
"]",
".",
"verifyOrder",
"(",
"order_te... | Create an upgrade order for the virtual server provided.
Sends the order represented by this object to SoftLayer for validation.
If a block is passed to verify, the code will send the order template
being constructed to the block before the order is actually sent for
validation. | [
"Create",
"an",
"upgrade",
"order",
"for",
"the",
"virtual",
"server",
"provided",
"."
] | 48d7e0e36a3b02d832e7e303a513020a8fbde93b | https://github.com/softlayer/softlayer-ruby/blob/48d7e0e36a3b02d832e7e303a513020a8fbde93b/lib/softlayer/VirtualServerUpgradeOrder.rb#L52-L58 |
1,223 | softlayer/softlayer-ruby | lib/softlayer/VirtualServerUpgradeOrder.rb | SoftLayer.VirtualServerUpgradeOrder.place_order! | def place_order!()
if has_order_items?
order_template = order_object
order_template = yield order_object if block_given?
@virtual_server.softlayer_client[:Product_Order].placeOrder(order_template)
end
end | ruby | def place_order!()
if has_order_items?
order_template = order_object
order_template = yield order_object if block_given?
@virtual_server.softlayer_client[:Product_Order].placeOrder(order_template)
end
end | [
"def",
"place_order!",
"(",
")",
"if",
"has_order_items?",
"order_template",
"=",
"order_object",
"order_template",
"=",
"yield",
"order_object",
"if",
"block_given?",
"@virtual_server",
".",
"softlayer_client",
"[",
":Product_Order",
"]",
".",
"placeOrder",
"(",
"ord... | Places the order represented by this object. This is likely to
involve a change to the charges on an account.
If a block is passed to this routine, the code will send the order template
being constructed to that block before the order is sent | [
"Places",
"the",
"order",
"represented",
"by",
"this",
"object",
".",
"This",
"is",
"likely",
"to",
"involve",
"a",
"change",
"to",
"the",
"charges",
"on",
"an",
"account",
"."
] | 48d7e0e36a3b02d832e7e303a513020a8fbde93b | https://github.com/softlayer/softlayer-ruby/blob/48d7e0e36a3b02d832e7e303a513020a8fbde93b/lib/softlayer/VirtualServerUpgradeOrder.rb#L67-L74 |
1,224 | softlayer/softlayer-ruby | lib/softlayer/VirtualServerUpgradeOrder.rb | SoftLayer.VirtualServerUpgradeOrder._item_prices_in_category | def _item_prices_in_category(which_category)
@virtual_server.upgrade_options.select { |item_price| item_price['categories'].find { |category| category['categoryCode'] == which_category } }
end | ruby | def _item_prices_in_category(which_category)
@virtual_server.upgrade_options.select { |item_price| item_price['categories'].find { |category| category['categoryCode'] == which_category } }
end | [
"def",
"_item_prices_in_category",
"(",
"which_category",
")",
"@virtual_server",
".",
"upgrade_options",
".",
"select",
"{",
"|",
"item_price",
"|",
"item_price",
"[",
"'categories'",
"]",
".",
"find",
"{",
"|",
"category",
"|",
"category",
"[",
"'categoryCode'",... | Returns a list of the update item prices, in the given category, for the server | [
"Returns",
"a",
"list",
"of",
"the",
"update",
"item",
"prices",
"in",
"the",
"given",
"category",
"for",
"the",
"server"
] | 48d7e0e36a3b02d832e7e303a513020a8fbde93b | https://github.com/softlayer/softlayer-ruby/blob/48d7e0e36a3b02d832e7e303a513020a8fbde93b/lib/softlayer/VirtualServerUpgradeOrder.rb#L106-L108 |
1,225 | softlayer/softlayer-ruby | lib/softlayer/VirtualServerUpgradeOrder.rb | SoftLayer.VirtualServerUpgradeOrder._item_price_with_capacity | def _item_price_with_capacity(which_category, capacity)
_item_prices_in_category(which_category).find { |item_price| item_price['item']['capacity'].to_i == capacity}
end | ruby | def _item_price_with_capacity(which_category, capacity)
_item_prices_in_category(which_category).find { |item_price| item_price['item']['capacity'].to_i == capacity}
end | [
"def",
"_item_price_with_capacity",
"(",
"which_category",
",",
"capacity",
")",
"_item_prices_in_category",
"(",
"which_category",
")",
".",
"find",
"{",
"|",
"item_price",
"|",
"item_price",
"[",
"'item'",
"]",
"[",
"'capacity'",
"]",
".",
"to_i",
"==",
"capac... | Searches through the upgrade items prices known to this server for the one that is in a particular category
and whose capacity matches the value given. Returns the item_price or nil | [
"Searches",
"through",
"the",
"upgrade",
"items",
"prices",
"known",
"to",
"this",
"server",
"for",
"the",
"one",
"that",
"is",
"in",
"a",
"particular",
"category",
"and",
"whose",
"capacity",
"matches",
"the",
"value",
"given",
".",
"Returns",
"the",
"item_... | 48d7e0e36a3b02d832e7e303a513020a8fbde93b | https://github.com/softlayer/softlayer-ruby/blob/48d7e0e36a3b02d832e7e303a513020a8fbde93b/lib/softlayer/VirtualServerUpgradeOrder.rb#L114-L116 |
1,226 | softlayer/softlayer-ruby | lib/softlayer/VirtualServerUpgradeOrder.rb | SoftLayer.VirtualServerUpgradeOrder.order_object | def order_object
prices = []
cores_price_item = @cores ? _item_price_with_capacity("guest_core", @cores) : nil
ram_price_item = @ram ? _item_price_with_capacity("ram", @ram) : nil
max_port_speed_price_item = @max_port_speed ? _item_price_with_capacity("port_speed", @max_port_speed) : nil
... | ruby | def order_object
prices = []
cores_price_item = @cores ? _item_price_with_capacity("guest_core", @cores) : nil
ram_price_item = @ram ? _item_price_with_capacity("ram", @ram) : nil
max_port_speed_price_item = @max_port_speed ? _item_price_with_capacity("port_speed", @max_port_speed) : nil
... | [
"def",
"order_object",
"prices",
"=",
"[",
"]",
"cores_price_item",
"=",
"@cores",
"?",
"_item_price_with_capacity",
"(",
"\"guest_core\"",
",",
"@cores",
")",
":",
"nil",
"ram_price_item",
"=",
"@ram",
"?",
"_item_price_with_capacity",
"(",
"\"ram\"",
",",
"@ram"... | construct an order object | [
"construct",
"an",
"order",
"object"
] | 48d7e0e36a3b02d832e7e303a513020a8fbde93b | https://github.com/softlayer/softlayer-ruby/blob/48d7e0e36a3b02d832e7e303a513020a8fbde93b/lib/softlayer/VirtualServerUpgradeOrder.rb#L121-L139 |
1,227 | softlayer/softlayer-ruby | lib/softlayer/NetworkStorage.rb | SoftLayer.NetworkStorage.assign_credential | def assign_credential(username)
raise ArgumentError, "The username cannot be nil" unless username
raise ArgumentError, "The username cannot be empty" if username.empty?
self.service.assignCredential(username.to_s)
@credentials = nil
end | ruby | def assign_credential(username)
raise ArgumentError, "The username cannot be nil" unless username
raise ArgumentError, "The username cannot be empty" if username.empty?
self.service.assignCredential(username.to_s)
@credentials = nil
end | [
"def",
"assign_credential",
"(",
"username",
")",
"raise",
"ArgumentError",
",",
"\"The username cannot be nil\"",
"unless",
"username",
"raise",
"ArgumentError",
",",
"\"The username cannot be empty\"",
"if",
"username",
".",
"empty?",
"self",
".",
"service",
".",
"ass... | Assign an existing network storage credential specified by the username to the network storage instance | [
"Assign",
"an",
"existing",
"network",
"storage",
"credential",
"specified",
"by",
"the",
"username",
"to",
"the",
"network",
"storage",
"instance"
] | 48d7e0e36a3b02d832e7e303a513020a8fbde93b | https://github.com/softlayer/softlayer-ruby/blob/48d7e0e36a3b02d832e7e303a513020a8fbde93b/lib/softlayer/NetworkStorage.rb#L141-L148 |
1,228 | softlayer/softlayer-ruby | lib/softlayer/NetworkStorage.rb | SoftLayer.NetworkStorage.password= | def password=(password)
raise ArgumentError, "The new password cannot be nil" unless password
raise ArgumentError, "The new password cannot be empty" if password.empty?
self.service.editObject({ "password" => password.to_s })
self.refresh_details()
end | ruby | def password=(password)
raise ArgumentError, "The new password cannot be nil" unless password
raise ArgumentError, "The new password cannot be empty" if password.empty?
self.service.editObject({ "password" => password.to_s })
self.refresh_details()
end | [
"def",
"password",
"=",
"(",
"password",
")",
"raise",
"ArgumentError",
",",
"\"The new password cannot be nil\"",
"unless",
"password",
"raise",
"ArgumentError",
",",
"\"The new password cannot be empty\"",
"if",
"password",
".",
"empty?",
"self",
".",
"service",
".",
... | Updates the password for the network storage instance. | [
"Updates",
"the",
"password",
"for",
"the",
"network",
"storage",
"instance",
"."
] | 48d7e0e36a3b02d832e7e303a513020a8fbde93b | https://github.com/softlayer/softlayer-ruby/blob/48d7e0e36a3b02d832e7e303a513020a8fbde93b/lib/softlayer/NetworkStorage.rb#L168-L174 |
1,229 | softlayer/softlayer-ruby | lib/softlayer/NetworkStorage.rb | SoftLayer.NetworkStorage.remove_credential | def remove_credential(username)
raise ArgumentError, "The username cannot be nil" unless username
raise ArgumentError, "The username cannot be empty" if username.empty?
self.service.removeCredential(username.to_s)
@credentials = nil
end | ruby | def remove_credential(username)
raise ArgumentError, "The username cannot be nil" unless username
raise ArgumentError, "The username cannot be empty" if username.empty?
self.service.removeCredential(username.to_s)
@credentials = nil
end | [
"def",
"remove_credential",
"(",
"username",
")",
"raise",
"ArgumentError",
",",
"\"The username cannot be nil\"",
"unless",
"username",
"raise",
"ArgumentError",
",",
"\"The username cannot be empty\"",
"if",
"username",
".",
"empty?",
"self",
".",
"service",
".",
"rem... | Remove an existing network storage credential specified by the username from the network storage instance | [
"Remove",
"an",
"existing",
"network",
"storage",
"credential",
"specified",
"by",
"the",
"username",
"from",
"the",
"network",
"storage",
"instance"
] | 48d7e0e36a3b02d832e7e303a513020a8fbde93b | https://github.com/softlayer/softlayer-ruby/blob/48d7e0e36a3b02d832e7e303a513020a8fbde93b/lib/softlayer/NetworkStorage.rb#L179-L186 |
1,230 | softlayer/softlayer-ruby | lib/softlayer/NetworkStorage.rb | SoftLayer.NetworkStorage.softlayer_properties | def softlayer_properties(object_mask = nil)
my_service = self.service
if(object_mask)
my_service = my_service.object_mask(object_mask)
else
my_service = my_service.object_mask(self.class.default_object_mask)
end
my_service.getObject()
end | ruby | def softlayer_properties(object_mask = nil)
my_service = self.service
if(object_mask)
my_service = my_service.object_mask(object_mask)
else
my_service = my_service.object_mask(self.class.default_object_mask)
end
my_service.getObject()
end | [
"def",
"softlayer_properties",
"(",
"object_mask",
"=",
"nil",
")",
"my_service",
"=",
"self",
".",
"service",
"if",
"(",
"object_mask",
")",
"my_service",
"=",
"my_service",
".",
"object_mask",
"(",
"object_mask",
")",
"else",
"my_service",
"=",
"my_service",
... | Make an API request to SoftLayer and return the latest properties hash
for this object. | [
"Make",
"an",
"API",
"request",
"to",
"SoftLayer",
"and",
"return",
"the",
"latest",
"properties",
"hash",
"for",
"this",
"object",
"."
] | 48d7e0e36a3b02d832e7e303a513020a8fbde93b | https://github.com/softlayer/softlayer-ruby/blob/48d7e0e36a3b02d832e7e303a513020a8fbde93b/lib/softlayer/NetworkStorage.rb#L310-L320 |
1,231 | softlayer/softlayer-ruby | lib/softlayer/NetworkStorage.rb | SoftLayer.NetworkStorage.update_credential_password | def update_credential_password(username, password)
raise ArgumentError, "The new password cannot be nil" unless password
raise ArgumentError, "The new username cannot be nil" unless username
raise ArgumentError, "The new password cannot be empty" if password.empty?
raise ArgumentError, "The ... | ruby | def update_credential_password(username, password)
raise ArgumentError, "The new password cannot be nil" unless password
raise ArgumentError, "The new username cannot be nil" unless username
raise ArgumentError, "The new password cannot be empty" if password.empty?
raise ArgumentError, "The ... | [
"def",
"update_credential_password",
"(",
"username",
",",
"password",
")",
"raise",
"ArgumentError",
",",
"\"The new password cannot be nil\"",
"unless",
"password",
"raise",
"ArgumentError",
",",
"\"The new username cannot be nil\"",
"unless",
"username",
"raise",
"Argument... | Updates the password for the network storage credential of the username specified. | [
"Updates",
"the",
"password",
"for",
"the",
"network",
"storage",
"credential",
"of",
"the",
"username",
"specified",
"."
] | 48d7e0e36a3b02d832e7e303a513020a8fbde93b | https://github.com/softlayer/softlayer-ruby/blob/48d7e0e36a3b02d832e7e303a513020a8fbde93b/lib/softlayer/NetworkStorage.rb#L325-L334 |
1,232 | softlayer/softlayer-ruby | lib/softlayer/ProductPackage.rb | SoftLayer.ProductPackage.items_with_description | def items_with_description(expected_description)
filter = ObjectFilter.new { |filter| filter.accept("items.description").when_it is(expected_description) }
items_data = self.service.object_filter(filter).getItems()
items_data.collect do |item_data|
first_price = item_data['prices'][0]
... | ruby | def items_with_description(expected_description)
filter = ObjectFilter.new { |filter| filter.accept("items.description").when_it is(expected_description) }
items_data = self.service.object_filter(filter).getItems()
items_data.collect do |item_data|
first_price = item_data['prices'][0]
... | [
"def",
"items_with_description",
"(",
"expected_description",
")",
"filter",
"=",
"ObjectFilter",
".",
"new",
"{",
"|",
"filter",
"|",
"filter",
".",
"accept",
"(",
"\"items.description\"",
")",
".",
"when_it",
"is",
"(",
"expected_description",
")",
"}",
"items... | Returns the package items with the given description
Currently this is returning the low-level hash representation directly from the Network API | [
"Returns",
"the",
"package",
"items",
"with",
"the",
"given",
"description",
"Currently",
"this",
"is",
"returning",
"the",
"low",
"-",
"level",
"hash",
"representation",
"directly",
"from",
"the",
"Network",
"API"
] | 48d7e0e36a3b02d832e7e303a513020a8fbde93b | https://github.com/softlayer/softlayer-ruby/blob/48d7e0e36a3b02d832e7e303a513020a8fbde93b/lib/softlayer/ProductPackage.rb#L143-L151 |
1,233 | softlayer/softlayer-ruby | lib/softlayer/ImageTemplate.rb | SoftLayer.ImageTemplate.available_datacenters | def available_datacenters
datacenters_data = self.service.getStorageLocations()
datacenters_data.collect { |datacenter_data| SoftLayer::Datacenter.datacenter_named(datacenter_data['name']) }
end | ruby | def available_datacenters
datacenters_data = self.service.getStorageLocations()
datacenters_data.collect { |datacenter_data| SoftLayer::Datacenter.datacenter_named(datacenter_data['name']) }
end | [
"def",
"available_datacenters",
"datacenters_data",
"=",
"self",
".",
"service",
".",
"getStorageLocations",
"(",
")",
"datacenters_data",
".",
"collect",
"{",
"|",
"datacenter_data",
"|",
"SoftLayer",
"::",
"Datacenter",
".",
"datacenter_named",
"(",
"datacenter_data... | Returns an array of the datacenters that this image can be stored in.
This is the set of datacenters that you may choose from, when putting
together a list you will send to the datacenters= setter. | [
"Returns",
"an",
"array",
"of",
"the",
"datacenters",
"that",
"this",
"image",
"can",
"be",
"stored",
"in",
".",
"This",
"is",
"the",
"set",
"of",
"datacenters",
"that",
"you",
"may",
"choose",
"from",
"when",
"putting",
"together",
"a",
"list",
"you",
"... | 48d7e0e36a3b02d832e7e303a513020a8fbde93b | https://github.com/softlayer/softlayer-ruby/blob/48d7e0e36a3b02d832e7e303a513020a8fbde93b/lib/softlayer/ImageTemplate.rb#L110-L113 |
1,234 | softlayer/softlayer-ruby | lib/softlayer/ImageTemplate.rb | SoftLayer.ImageTemplate.shared_with_accounts= | def shared_with_accounts= (account_id_list)
already_sharing_with = self.shared_with_accounts
accounts_to_add = account_id_list.select { |account_id| !already_sharing_with.include?(account_id) }
# Note, using the network API, it is possible to "unshare" an image template
# with the account that... | ruby | def shared_with_accounts= (account_id_list)
already_sharing_with = self.shared_with_accounts
accounts_to_add = account_id_list.select { |account_id| !already_sharing_with.include?(account_id) }
# Note, using the network API, it is possible to "unshare" an image template
# with the account that... | [
"def",
"shared_with_accounts",
"=",
"(",
"account_id_list",
")",
"already_sharing_with",
"=",
"self",
".",
"shared_with_accounts",
"accounts_to_add",
"=",
"account_id_list",
".",
"select",
"{",
"|",
"account_id",
"|",
"!",
"already_sharing_with",
".",
"include?",
"(",... | Change the set of accounts that this image is shared with.
The parameter is an array of account ID's.
Note that this routine will "unshare" with any accounts
not included in the list passed in so the list should
be comprehensive | [
"Change",
"the",
"set",
"of",
"accounts",
"that",
"this",
"image",
"is",
"shared",
"with",
".",
"The",
"parameter",
"is",
"an",
"array",
"of",
"account",
"ID",
"s",
"."
] | 48d7e0e36a3b02d832e7e303a513020a8fbde93b | https://github.com/softlayer/softlayer-ruby/blob/48d7e0e36a3b02d832e7e303a513020a8fbde93b/lib/softlayer/ImageTemplate.rb#L132-L150 |
1,235 | softlayer/softlayer-ruby | lib/softlayer/ImageTemplate.rb | SoftLayer.ImageTemplate.wait_until_ready | def wait_until_ready(max_trials, seconds_between_tries = 2)
# pessimistically assume the server is not ready
num_trials = 0
begin
self.refresh_details()
parent_ready = !(has_sl_property? :transactionId) || (self[:transactionId] == "")
children_ready = (nil == self['children'].... | ruby | def wait_until_ready(max_trials, seconds_between_tries = 2)
# pessimistically assume the server is not ready
num_trials = 0
begin
self.refresh_details()
parent_ready = !(has_sl_property? :transactionId) || (self[:transactionId] == "")
children_ready = (nil == self['children'].... | [
"def",
"wait_until_ready",
"(",
"max_trials",
",",
"seconds_between_tries",
"=",
"2",
")",
"# pessimistically assume the server is not ready",
"num_trials",
"=",
"0",
"begin",
"self",
".",
"refresh_details",
"(",
")",
"parent_ready",
"=",
"!",
"(",
"has_sl_property?",
... | Repeatedly poll the network API until transactions related to this image
template are finished
A template is not 'ready' until all the transactions on the template
itself, and all its children are complete.
At each trial, the routine will yield to a block if one is given
The block is passed one parameter, a bool... | [
"Repeatedly",
"poll",
"the",
"network",
"API",
"until",
"transactions",
"related",
"to",
"this",
"image",
"template",
"are",
"finished"
] | 48d7e0e36a3b02d832e7e303a513020a8fbde93b | https://github.com/softlayer/softlayer-ruby/blob/48d7e0e36a3b02d832e7e303a513020a8fbde93b/lib/softlayer/ImageTemplate.rb#L175-L192 |
1,236 | softlayer/softlayer-ruby | lib/softlayer/ServerFirewallOrder.rb | SoftLayer.ServerFirewallOrder.verify | def verify()
order_template = firewall_order_template
order_template = yield order_template if block_given?
server.softlayer_client[:Product_Order].verifyOrder(order_template)
end | ruby | def verify()
order_template = firewall_order_template
order_template = yield order_template if block_given?
server.softlayer_client[:Product_Order].verifyOrder(order_template)
end | [
"def",
"verify",
"(",
")",
"order_template",
"=",
"firewall_order_template",
"order_template",
"=",
"yield",
"order_template",
"if",
"block_given?",
"server",
".",
"softlayer_client",
"[",
":Product_Order",
"]",
".",
"verifyOrder",
"(",
"order_template",
")",
"end"
] | Create a new order for the given server
Calls the SoftLayer API to verify that the template provided by this order is valid
This routine will return the order template generated by the API or will throw an exception
This routine will not actually create a Bare Metal Instance and will not affect billing.
If you p... | [
"Create",
"a",
"new",
"order",
"for",
"the",
"given",
"server"
] | 48d7e0e36a3b02d832e7e303a513020a8fbde93b | https://github.com/softlayer/softlayer-ruby/blob/48d7e0e36a3b02d832e7e303a513020a8fbde93b/lib/softlayer/ServerFirewallOrder.rb#L31-L36 |
1,237 | softlayer/softlayer-ruby | lib/softlayer/VLANFirewall.rb | SoftLayer.VLANFirewall.cancel! | def cancel!(notes = nil)
user = self.softlayer_client[:Account].object_mask("mask[id,account.id]").getCurrentUser
notes = "Cancelled by a call to #{__method__} in the softlayer_api gem" if notes == nil || notes == ""
cancellation_request = {
'accountId' => user['account']['id'],
'user... | ruby | def cancel!(notes = nil)
user = self.softlayer_client[:Account].object_mask("mask[id,account.id]").getCurrentUser
notes = "Cancelled by a call to #{__method__} in the softlayer_api gem" if notes == nil || notes == ""
cancellation_request = {
'accountId' => user['account']['id'],
'user... | [
"def",
"cancel!",
"(",
"notes",
"=",
"nil",
")",
"user",
"=",
"self",
".",
"softlayer_client",
"[",
":Account",
"]",
".",
"object_mask",
"(",
"\"mask[id,account.id]\"",
")",
".",
"getCurrentUser",
"notes",
"=",
"\"Cancelled by a call to #{__method__} in the softlayer_... | Cancel the firewall
This method cancels the firewall and releases its
resources. The cancellation is processed immediately!
Call this method with careful deliberation!
Notes is a string that describes the reason for the
cancellation. If empty or nil, a default string will
be added. | [
"Cancel",
"the",
"firewall"
] | 48d7e0e36a3b02d832e7e303a513020a8fbde93b | https://github.com/softlayer/softlayer-ruby/blob/48d7e0e36a3b02d832e7e303a513020a8fbde93b/lib/softlayer/VLANFirewall.rb#L123-L138 |
1,238 | softlayer/softlayer-ruby | lib/softlayer/VLANFirewall.rb | SoftLayer.VLANFirewall.change_rules_bypass! | def change_rules_bypass!(bypass_symbol)
change_object = {
"firewallContextAccessControlListId" => rules_ACL_id(),
"rules" => self.rules
}
case bypass_symbol
when :apply_firewall_rules
change_object['bypassFlag'] = false
self.softlayer_client[:Network_Firewall_Upd... | ruby | def change_rules_bypass!(bypass_symbol)
change_object = {
"firewallContextAccessControlListId" => rules_ACL_id(),
"rules" => self.rules
}
case bypass_symbol
when :apply_firewall_rules
change_object['bypassFlag'] = false
self.softlayer_client[:Network_Firewall_Upd... | [
"def",
"change_rules_bypass!",
"(",
"bypass_symbol",
")",
"change_object",
"=",
"{",
"\"firewallContextAccessControlListId\"",
"=>",
"rules_ACL_id",
"(",
")",
",",
"\"rules\"",
"=>",
"self",
".",
"rules",
"}",
"case",
"bypass_symbol",
"when",
":apply_firewall_rules",
... | This method asks the firewall to ignore its rule set and pass all traffic
through the firewall. Compare the behavior of this routine with
change_routing_bypass!
It is important to note that changing the bypass to :bypass_firewall_rules
removes ALL the protection offered by the firewall. This routine should be
use... | [
"This",
"method",
"asks",
"the",
"firewall",
"to",
"ignore",
"its",
"rule",
"set",
"and",
"pass",
"all",
"traffic",
"through",
"the",
"firewall",
".",
"Compare",
"the",
"behavior",
"of",
"this",
"routine",
"with",
"change_routing_bypass!"
] | 48d7e0e36a3b02d832e7e303a513020a8fbde93b | https://github.com/softlayer/softlayer-ruby/blob/48d7e0e36a3b02d832e7e303a513020a8fbde93b/lib/softlayer/VLANFirewall.rb#L187-L203 |
1,239 | softlayer/softlayer-ruby | lib/softlayer/VLANFirewall.rb | SoftLayer.VLANFirewall.change_routing_bypass! | def change_routing_bypass!(routing_symbol)
vlan_firewall_id = self['networkVlanFirewall']['id']
raise "Could not identify the device for a VLAN firewall" if !vlan_firewall_id
case routing_symbol
when :route_through_firewall
self.softlayer_client[:Network_Vlan_Firewall].object_with_id(v... | ruby | def change_routing_bypass!(routing_symbol)
vlan_firewall_id = self['networkVlanFirewall']['id']
raise "Could not identify the device for a VLAN firewall" if !vlan_firewall_id
case routing_symbol
when :route_through_firewall
self.softlayer_client[:Network_Vlan_Firewall].object_with_id(v... | [
"def",
"change_routing_bypass!",
"(",
"routing_symbol",
")",
"vlan_firewall_id",
"=",
"self",
"[",
"'networkVlanFirewall'",
"]",
"[",
"'id'",
"]",
"raise",
"\"Could not identify the device for a VLAN firewall\"",
"if",
"!",
"vlan_firewall_id",
"case",
"routing_symbol",
"whe... | This method allows you to route traffic around the firewall
and directly to the servers it protects. Compare the behavior of this routine with
change_rules_bypass!
It is important to note that changing the routing to :route_around_firewall
removes ALL the protection offered by the firewall. This routine should be
... | [
"This",
"method",
"allows",
"you",
"to",
"route",
"traffic",
"around",
"the",
"firewall",
"and",
"directly",
"to",
"the",
"servers",
"it",
"protects",
".",
"Compare",
"the",
"behavior",
"of",
"this",
"routine",
"with",
"change_rules_bypass!"
] | 48d7e0e36a3b02d832e7e303a513020a8fbde93b | https://github.com/softlayer/softlayer-ruby/blob/48d7e0e36a3b02d832e7e303a513020a8fbde93b/lib/softlayer/VLANFirewall.rb#L221-L234 |
1,240 | softlayer/softlayer-ruby | lib/softlayer/VLANFirewall.rb | SoftLayer.VLANFirewall.rules_ACL_id | def rules_ACL_id
outside_interface_data = self['firewallInterfaces'].find { |interface_data| interface_data['name'] == 'outside' }
incoming_ACL = outside_interface_data['firewallContextAccessControlLists'].find { |firewallACL_data| firewallACL_data['direction'] == 'in' } if outside_interface_data
if ... | ruby | def rules_ACL_id
outside_interface_data = self['firewallInterfaces'].find { |interface_data| interface_data['name'] == 'outside' }
incoming_ACL = outside_interface_data['firewallContextAccessControlLists'].find { |firewallACL_data| firewallACL_data['direction'] == 'in' } if outside_interface_data
if ... | [
"def",
"rules_ACL_id",
"outside_interface_data",
"=",
"self",
"[",
"'firewallInterfaces'",
"]",
".",
"find",
"{",
"|",
"interface_data",
"|",
"interface_data",
"[",
"'name'",
"]",
"==",
"'outside'",
"}",
"incoming_ACL",
"=",
"outside_interface_data",
"[",
"'firewall... | Searches the set of access control lists for the firewall device in order to locate the one that
sits on the "outside" side of the network and handles 'in'coming traffic. | [
"Searches",
"the",
"set",
"of",
"access",
"control",
"lists",
"for",
"the",
"firewall",
"device",
"in",
"order",
"to",
"locate",
"the",
"one",
"that",
"sits",
"on",
"the",
"outside",
"side",
"of",
"the",
"network",
"and",
"handles",
"in",
"coming",
"traffi... | 48d7e0e36a3b02d832e7e303a513020a8fbde93b | https://github.com/softlayer/softlayer-ruby/blob/48d7e0e36a3b02d832e7e303a513020a8fbde93b/lib/softlayer/VLANFirewall.rb#L277-L286 |
1,241 | softlayer/softlayer-ruby | lib/softlayer/VirtualServerOrder.rb | SoftLayer.VirtualServerOrder.place_order! | def place_order!()
order_template = virtual_guest_template
order_template = yield order_template if block_given?
virtual_server_hash = @softlayer_client[:Virtual_Guest].createObject(order_template)
SoftLayer::VirtualServer.server_with_id(virtual_server_hash['id'], :client => @softlayer_client) ... | ruby | def place_order!()
order_template = virtual_guest_template
order_template = yield order_template if block_given?
virtual_server_hash = @softlayer_client[:Virtual_Guest].createObject(order_template)
SoftLayer::VirtualServer.server_with_id(virtual_server_hash['id'], :client => @softlayer_client) ... | [
"def",
"place_order!",
"(",
")",
"order_template",
"=",
"virtual_guest_template",
"order_template",
"=",
"yield",
"order_template",
"if",
"block_given?",
"virtual_server_hash",
"=",
"@softlayer_client",
"[",
":Virtual_Guest",
"]",
".",
"createObject",
"(",
"order_template... | Calls the SoftLayer API to place an order for a new virtual server based on the template in this
order. If this succeeds then you will be billed for the new Virtual Server.
If you provide a block, it will receive the order template as a parameter and
should return an order template, **carefully** modified, that wil... | [
"Calls",
"the",
"SoftLayer",
"API",
"to",
"place",
"an",
"order",
"for",
"a",
"new",
"virtual",
"server",
"based",
"on",
"the",
"template",
"in",
"this",
"order",
".",
"If",
"this",
"succeeds",
"then",
"you",
"will",
"be",
"billed",
"for",
"the",
"new",
... | 48d7e0e36a3b02d832e7e303a513020a8fbde93b | https://github.com/softlayer/softlayer-ruby/blob/48d7e0e36a3b02d832e7e303a513020a8fbde93b/lib/softlayer/VirtualServerOrder.rb#L141-L147 |
1,242 | softlayer/softlayer-ruby | lib/softlayer/Software.rb | SoftLayer.Software.delete_user_password! | def delete_user_password!(username)
user_password = self.passwords.select { |sw_pw| sw_pw.username == username.to_s }
unless user_password.empty?
softlayer_client[:Software_Component_Password].object_with_id(user_password.first['id']).deleteObject
@passwords = nil
end
end | ruby | def delete_user_password!(username)
user_password = self.passwords.select { |sw_pw| sw_pw.username == username.to_s }
unless user_password.empty?
softlayer_client[:Software_Component_Password].object_with_id(user_password.first['id']).deleteObject
@passwords = nil
end
end | [
"def",
"delete_user_password!",
"(",
"username",
")",
"user_password",
"=",
"self",
".",
"passwords",
".",
"select",
"{",
"|",
"sw_pw",
"|",
"sw_pw",
".",
"username",
"==",
"username",
".",
"to_s",
"}",
"unless",
"user_password",
".",
"empty?",
"softlayer_clie... | Deletes specified username password from current software instance
This is a final action and cannot be undone.
the transaction will proceed immediately.
Call it with extreme care! | [
"Deletes",
"specified",
"username",
"password",
"from",
"current",
"software",
"instance"
] | 48d7e0e36a3b02d832e7e303a513020a8fbde93b | https://github.com/softlayer/softlayer-ruby/blob/48d7e0e36a3b02d832e7e303a513020a8fbde93b/lib/softlayer/Software.rb#L109-L116 |
1,243 | hanneskaeufler/danger-todoist | lib/todoist/plugin.rb | Danger.DangerTodoist.print_todos_table | def print_todos_table
find_todos if @todos.nil?
return if @todos.empty?
markdown("#### Todos left in files")
@todos
.group_by(&:file)
.each { |file, todos| print_todos_per_file(file, todos) }
end | ruby | def print_todos_table
find_todos if @todos.nil?
return if @todos.empty?
markdown("#### Todos left in files")
@todos
.group_by(&:file)
.each { |file, todos| print_todos_per_file(file, todos) }
end | [
"def",
"print_todos_table",
"find_todos",
"if",
"@todos",
".",
"nil?",
"return",
"if",
"@todos",
".",
"empty?",
"markdown",
"(",
"\"#### Todos left in files\"",
")",
"@todos",
".",
"group_by",
"(",
":file",
")",
".",
"each",
"{",
"|",
"file",
",",
"todos",
"... | Adds a list of offending files to the danger comment
@return [void] | [
"Adds",
"a",
"list",
"of",
"offending",
"files",
"to",
"the",
"danger",
"comment"
] | 6f2075fc6a1ca1426b473885f90f7234c4ed0ce7 | https://github.com/hanneskaeufler/danger-todoist/blob/6f2075fc6a1ca1426b473885f90f7234c4ed0ce7/lib/todoist/plugin.rb#L72-L81 |
1,244 | softlayer/softlayer-ruby | lib/softlayer/VirtualServerOrder_Package.rb | SoftLayer.VirtualServerOrder_Package.virtual_server_order | def virtual_server_order
product_order = {
'packageId' => @package.id,
'useHourlyPricing' => !!@hourly,
'virtualGuests' => [{
'domain' => @domain,
'hostname' => @hostname
}]
}... | ruby | def virtual_server_order
product_order = {
'packageId' => @package.id,
'useHourlyPricing' => !!@hourly,
'virtualGuests' => [{
'domain' => @domain,
'hostname' => @hostname
}]
}... | [
"def",
"virtual_server_order",
"product_order",
"=",
"{",
"'packageId'",
"=>",
"@package",
".",
"id",
",",
"'useHourlyPricing'",
"=>",
"!",
"!",
"@hourly",
",",
"'virtualGuests'",
"=>",
"[",
"{",
"'domain'",
"=>",
"@domain",
",",
"'hostname'",
"=>",
"@hostname",... | Construct and return a hash representing a +SoftLayer_Container_Product_Order_Virtual_Guest+
based on the configuration options given. | [
"Construct",
"and",
"return",
"a",
"hash",
"representing",
"a",
"+",
"SoftLayer_Container_Product_Order_Virtual_Guest",
"+",
"based",
"on",
"the",
"configuration",
"options",
"given",
"."
] | 48d7e0e36a3b02d832e7e303a513020a8fbde93b | https://github.com/softlayer/softlayer-ruby/blob/48d7e0e36a3b02d832e7e303a513020a8fbde93b/lib/softlayer/VirtualServerOrder_Package.rb#L145-L177 |
1,245 | softlayer/softlayer-ruby | lib/softlayer/VirtualServer.rb | SoftLayer.VirtualServer.capture_image | def capture_image(image_name, include_attached_storage = false, image_notes = '')
image_notes = '' if !image_notes
image_name = 'Captured Image' if !image_name
disk_filter = lambda { |disk| disk['device'] == '0' }
disk_filter = lambda { |disk| disk['device'] != '1' } if include_attached_storage... | ruby | def capture_image(image_name, include_attached_storage = false, image_notes = '')
image_notes = '' if !image_notes
image_name = 'Captured Image' if !image_name
disk_filter = lambda { |disk| disk['device'] == '0' }
disk_filter = lambda { |disk| disk['device'] != '1' } if include_attached_storage... | [
"def",
"capture_image",
"(",
"image_name",
",",
"include_attached_storage",
"=",
"false",
",",
"image_notes",
"=",
"''",
")",
"image_notes",
"=",
"''",
"if",
"!",
"image_notes",
"image_name",
"=",
"'Captured Image'",
"if",
"!",
"image_name",
"disk_filter",
"=",
... | Capture a disk image of this virtual server for use with other servers.
image_name will become the name of the image in the portal.
If include_attached_storage is true, the images of attached storage will be
included as well.
The image_notes should be a string and will be added to the image as notes.
The routi... | [
"Capture",
"a",
"disk",
"image",
"of",
"this",
"virtual",
"server",
"for",
"use",
"with",
"other",
"servers",
"."
] | 48d7e0e36a3b02d832e7e303a513020a8fbde93b | https://github.com/softlayer/softlayer-ruby/blob/48d7e0e36a3b02d832e7e303a513020a8fbde93b/lib/softlayer/VirtualServer.rb#L132-L145 |
1,246 | softlayer/softlayer-ruby | lib/softlayer/VirtualServer.rb | SoftLayer.VirtualServer.wait_until_ready | def wait_until_ready(max_trials, wait_for_transactions = false, seconds_between_tries = 2)
# pessimistically assume the server is not ready
num_trials = 0
begin
self.refresh_details()
has_os_reload = has_sl_property? :lastOperatingSystemReload
has_active_transaction = has_sl_p... | ruby | def wait_until_ready(max_trials, wait_for_transactions = false, seconds_between_tries = 2)
# pessimistically assume the server is not ready
num_trials = 0
begin
self.refresh_details()
has_os_reload = has_sl_property? :lastOperatingSystemReload
has_active_transaction = has_sl_p... | [
"def",
"wait_until_ready",
"(",
"max_trials",
",",
"wait_for_transactions",
"=",
"false",
",",
"seconds_between_tries",
"=",
"2",
")",
"# pessimistically assume the server is not ready",
"num_trials",
"=",
"0",
"begin",
"self",
".",
"refresh_details",
"(",
")",
"has_os_... | Repeatedly polls the API to find out if this server is 'ready'.
The server is ready when it is provisioned and any operating system reloads have completed.
If wait_for_transactions is true, then the routine will poll until all transactions
(not just an OS Reload) have completed on the server.
max_trials is the m... | [
"Repeatedly",
"polls",
"the",
"API",
"to",
"find",
"out",
"if",
"this",
"server",
"is",
"ready",
"."
] | 48d7e0e36a3b02d832e7e303a513020a8fbde93b | https://github.com/softlayer/softlayer-ruby/blob/48d7e0e36a3b02d832e7e303a513020a8fbde93b/lib/softlayer/VirtualServer.rb#L166-L190 |
1,247 | softlayer/softlayer-ruby | lib/softlayer/Account.rb | SoftLayer.Account.find_vlan_with_number | def find_vlan_with_number(vlan_number)
filter = SoftLayer::ObjectFilter.new() { |filter|
filter.accept('networkVlans.vlanNumber').when_it is vlan_number
}
vlan_data = self.service.object_mask("mask[id,vlanNumber,primaryRouter,networkSpace]").object_filter(filter).getNetworkVlans
return ... | ruby | def find_vlan_with_number(vlan_number)
filter = SoftLayer::ObjectFilter.new() { |filter|
filter.accept('networkVlans.vlanNumber').when_it is vlan_number
}
vlan_data = self.service.object_mask("mask[id,vlanNumber,primaryRouter,networkSpace]").object_filter(filter).getNetworkVlans
return ... | [
"def",
"find_vlan_with_number",
"(",
"vlan_number",
")",
"filter",
"=",
"SoftLayer",
"::",
"ObjectFilter",
".",
"new",
"(",
")",
"{",
"|",
"filter",
"|",
"filter",
".",
"accept",
"(",
"'networkVlans.vlanNumber'",
")",
".",
"when_it",
"is",
"vlan_number",
"}",
... | Searches the account's list of VLANs for the ones with the given
vlan number. This may return multiple results because a VLAN can
span different routers and you will get a separate segment for
each router.
The IDs of the different segments can be helpful for ordering
firewalls. | [
"Searches",
"the",
"account",
"s",
"list",
"of",
"VLANs",
"for",
"the",
"ones",
"with",
"the",
"given",
"vlan",
"number",
".",
"This",
"may",
"return",
"multiple",
"results",
"because",
"a",
"VLAN",
"can",
"span",
"different",
"routers",
"and",
"you",
"wil... | 48d7e0e36a3b02d832e7e303a513020a8fbde93b | https://github.com/softlayer/softlayer-ruby/blob/48d7e0e36a3b02d832e7e303a513020a8fbde93b/lib/softlayer/Account.rb#L267-L274 |
1,248 | softlayer/softlayer-ruby | lib/softlayer/Client.rb | SoftLayer.Client.service_named | def service_named(service_name, service_options = {})
raise ArgumentError,"Please provide a service name" if service_name.nil? || service_name.empty?
# Strip whitespace from service_name and ensure that it starts with "SoftLayer_".
# If it does not, then add the prefix.
full_name = service_name... | ruby | def service_named(service_name, service_options = {})
raise ArgumentError,"Please provide a service name" if service_name.nil? || service_name.empty?
# Strip whitespace from service_name and ensure that it starts with "SoftLayer_".
# If it does not, then add the prefix.
full_name = service_name... | [
"def",
"service_named",
"(",
"service_name",
",",
"service_options",
"=",
"{",
"}",
")",
"raise",
"ArgumentError",
",",
"\"Please provide a service name\"",
"if",
"service_name",
".",
"nil?",
"||",
"service_name",
".",
"empty?",
"# Strip whitespace from service_name and e... | Returns a service with the given name.
If a service has already been created by this client that same service
will be returned each time it is called for by name. Otherwise the system
will try to construct a new service object and return that.
If the service has to be created then the service_options will be pass... | [
"Returns",
"a",
"service",
"with",
"the",
"given",
"name",
"."
] | 48d7e0e36a3b02d832e7e303a513020a8fbde93b | https://github.com/softlayer/softlayer-ruby/blob/48d7e0e36a3b02d832e7e303a513020a8fbde93b/lib/softlayer/Client.rb#L170-L188 |
1,249 | softlayer/softlayer-ruby | lib/softlayer/Service.rb | SoftLayer.Service.call_softlayer_api_with_params | def call_softlayer_api_with_params(method_name, parameters, args)
additional_headers = {};
# The client knows about authentication, so ask him for the auth headers
authentication_headers = self.client.authentication_headers
additional_headers.merge!(authentication_headers)
if parameters ... | ruby | def call_softlayer_api_with_params(method_name, parameters, args)
additional_headers = {};
# The client knows about authentication, so ask him for the auth headers
authentication_headers = self.client.authentication_headers
additional_headers.merge!(authentication_headers)
if parameters ... | [
"def",
"call_softlayer_api_with_params",
"(",
"method_name",
",",
"parameters",
",",
"args",
")",
"additional_headers",
"=",
"{",
"}",
";",
"# The client knows about authentication, so ask him for the auth headers",
"authentication_headers",
"=",
"self",
".",
"client",
".",
... | Issue an HTTP request to call the given method from the SoftLayer API with
the parameters and arguments given.
Parameters are information _about_ the call, the object mask or the
particular object in the SoftLayer API you are calling.
Arguments are the arguments to the SoftLayer method that you wish to
invoke.
... | [
"Issue",
"an",
"HTTP",
"request",
"to",
"call",
"the",
"given",
"method",
"from",
"the",
"SoftLayer",
"API",
"with",
"the",
"parameters",
"and",
"arguments",
"given",
"."
] | 48d7e0e36a3b02d832e7e303a513020a8fbde93b | https://github.com/softlayer/softlayer-ruby/blob/48d7e0e36a3b02d832e7e303a513020a8fbde93b/lib/softlayer/Service.rb#L221-L276 |
1,250 | HewlettPackard/ilo-sdk-ruby | lib/ilo-sdk/helpers/bios_helper.rb | ILO_SDK.BiosHelper.set_bios_settings | def set_bios_settings(options, system_id = 1)
r = response_handler(rest_patch("/redfish/v1/Systems/#{system_id}/bios/Settings/", body: options))
@logger.warn(r) if r['error']
true
end | ruby | def set_bios_settings(options, system_id = 1)
r = response_handler(rest_patch("/redfish/v1/Systems/#{system_id}/bios/Settings/", body: options))
@logger.warn(r) if r['error']
true
end | [
"def",
"set_bios_settings",
"(",
"options",
",",
"system_id",
"=",
"1",
")",
"r",
"=",
"response_handler",
"(",
"rest_patch",
"(",
"\"/redfish/v1/Systems/#{system_id}/bios/Settings/\"",
",",
"body",
":",
"options",
")",
")",
"@logger",
".",
"warn",
"(",
"r",
")"... | Set BIOS settings
@param options [Hash] Hash of options to set
@param system_id [Integer, String] ID of the system
@raise [RuntimeError] if the request failed
@return true | [
"Set",
"BIOS",
"settings"
] | ac171cd75d070ccf64017d43777ded40a5f018f9 | https://github.com/HewlettPackard/ilo-sdk-ruby/blob/ac171cd75d070ccf64017d43777ded40a5f018f9/lib/ilo-sdk/helpers/bios_helper.rb#L28-L32 |
1,251 | HewlettPackard/ilo-sdk-ruby | lib/ilo-sdk/helpers/bios_helper.rb | ILO_SDK.BiosHelper.set_uefi_shell_startup | def set_uefi_shell_startup(uefi_shell_startup, uefi_shell_startup_location, uefi_shell_startup_url)
new_action = {
'UefiShellStartup' => uefi_shell_startup,
'UefiShellStartupLocation' => uefi_shell_startup_location,
'UefiShellStartupUrl' => uefi_shell_startup_url
}
response = r... | ruby | def set_uefi_shell_startup(uefi_shell_startup, uefi_shell_startup_location, uefi_shell_startup_url)
new_action = {
'UefiShellStartup' => uefi_shell_startup,
'UefiShellStartupLocation' => uefi_shell_startup_location,
'UefiShellStartupUrl' => uefi_shell_startup_url
}
response = r... | [
"def",
"set_uefi_shell_startup",
"(",
"uefi_shell_startup",
",",
"uefi_shell_startup_location",
",",
"uefi_shell_startup_url",
")",
"new_action",
"=",
"{",
"'UefiShellStartup'",
"=>",
"uefi_shell_startup",
",",
"'UefiShellStartupLocation'",
"=>",
"uefi_shell_startup_location",
... | Set the UEFI shell start up
@param uefi_shell_startup [String, Symbol]
@param uefi_shell_startup_location [String, Symbol]
@param uefi_shell_startup_url [String, Symbol]
@raise [RuntimeError] if the request failed
@return true | [
"Set",
"the",
"UEFI",
"shell",
"start",
"up"
] | ac171cd75d070ccf64017d43777ded40a5f018f9 | https://github.com/HewlettPackard/ilo-sdk-ruby/blob/ac171cd75d070ccf64017d43777ded40a5f018f9/lib/ilo-sdk/helpers/bios_helper.rb#L71-L80 |
1,252 | HewlettPackard/ilo-sdk-ruby | lib/ilo-sdk/helpers/bios_helper.rb | ILO_SDK.BiosHelper.get_bios_dhcp | def get_bios_dhcp
response = rest_get('/redfish/v1/Systems/1/bios/Settings/')
bios = response_handler(response)
{
'Dhcpv4' => bios['Dhcpv4'],
'Ipv4Address' => bios['Ipv4Address'],
'Ipv4Gateway' => bios['Ipv4Gateway'],
'Ipv4PrimaryDNS' => bios['Ipv4PrimaryDNS'],
... | ruby | def get_bios_dhcp
response = rest_get('/redfish/v1/Systems/1/bios/Settings/')
bios = response_handler(response)
{
'Dhcpv4' => bios['Dhcpv4'],
'Ipv4Address' => bios['Ipv4Address'],
'Ipv4Gateway' => bios['Ipv4Gateway'],
'Ipv4PrimaryDNS' => bios['Ipv4PrimaryDNS'],
... | [
"def",
"get_bios_dhcp",
"response",
"=",
"rest_get",
"(",
"'/redfish/v1/Systems/1/bios/Settings/'",
")",
"bios",
"=",
"response_handler",
"(",
"response",
")",
"{",
"'Dhcpv4'",
"=>",
"bios",
"[",
"'Dhcpv4'",
"]",
",",
"'Ipv4Address'",
"=>",
"bios",
"[",
"'Ipv4Addr... | Get the BIOS DHCP
@raise [RuntimeError] if the request failed
@return [String] bios_dhcp | [
"Get",
"the",
"BIOS",
"DHCP"
] | ac171cd75d070ccf64017d43777ded40a5f018f9 | https://github.com/HewlettPackard/ilo-sdk-ruby/blob/ac171cd75d070ccf64017d43777ded40a5f018f9/lib/ilo-sdk/helpers/bios_helper.rb#L85-L96 |
1,253 | HewlettPackard/ilo-sdk-ruby | lib/ilo-sdk/helpers/bios_helper.rb | ILO_SDK.BiosHelper.set_bios_dhcp | def set_bios_dhcp(dhcpv4, ipv4_address = '', ipv4_gateway = '', ipv4_primary_dns = '', ipv4_secondary_dns = '', ipv4_subnet_mask = '')
new_action = {
'Dhcpv4' => dhcpv4,
'Ipv4Address' => ipv4_address,
'Ipv4Gateway' => ipv4_gateway,
'Ipv4PrimaryDNS' => ipv4_primary_dns,
'Ipv... | ruby | def set_bios_dhcp(dhcpv4, ipv4_address = '', ipv4_gateway = '', ipv4_primary_dns = '', ipv4_secondary_dns = '', ipv4_subnet_mask = '')
new_action = {
'Dhcpv4' => dhcpv4,
'Ipv4Address' => ipv4_address,
'Ipv4Gateway' => ipv4_gateway,
'Ipv4PrimaryDNS' => ipv4_primary_dns,
'Ipv... | [
"def",
"set_bios_dhcp",
"(",
"dhcpv4",
",",
"ipv4_address",
"=",
"''",
",",
"ipv4_gateway",
"=",
"''",
",",
"ipv4_primary_dns",
"=",
"''",
",",
"ipv4_secondary_dns",
"=",
"''",
",",
"ipv4_subnet_mask",
"=",
"''",
")",
"new_action",
"=",
"{",
"'Dhcpv4'",
"=>"... | Set the BIOS DHCP
@param dhcpv4 [String, Symbol]
@param ipv4_address [String, Symbol]
@param ipv4_gateway [String, Symbol]
@param ipv4_primary_dns [String, Symbol]
@param ipv4_secondary_dns [String, Symbol]
@param ipv4_subnet_mask [String, Symbol]
@raise [RuntimeError] if the request failed
@return true | [
"Set",
"the",
"BIOS",
"DHCP"
] | ac171cd75d070ccf64017d43777ded40a5f018f9 | https://github.com/HewlettPackard/ilo-sdk-ruby/blob/ac171cd75d070ccf64017d43777ded40a5f018f9/lib/ilo-sdk/helpers/bios_helper.rb#L107-L119 |
1,254 | HewlettPackard/ilo-sdk-ruby | lib/ilo-sdk/helpers/bios_helper.rb | ILO_SDK.BiosHelper.set_url_boot_file | def set_url_boot_file(url_boot_file)
new_action = { 'UrlBootFile' => url_boot_file }
response = rest_patch('/redfish/v1/Systems/1/bios/Settings/', body: new_action)
response_handler(response)
true
end | ruby | def set_url_boot_file(url_boot_file)
new_action = { 'UrlBootFile' => url_boot_file }
response = rest_patch('/redfish/v1/Systems/1/bios/Settings/', body: new_action)
response_handler(response)
true
end | [
"def",
"set_url_boot_file",
"(",
"url_boot_file",
")",
"new_action",
"=",
"{",
"'UrlBootFile'",
"=>",
"url_boot_file",
"}",
"response",
"=",
"rest_patch",
"(",
"'/redfish/v1/Systems/1/bios/Settings/'",
",",
"body",
":",
"new_action",
")",
"response_handler",
"(",
"res... | Set the URL boot file
@param url_boot_file [String, Symbol]
@raise [RuntimeError] if the request failed
@return true | [
"Set",
"the",
"URL",
"boot",
"file"
] | ac171cd75d070ccf64017d43777ded40a5f018f9 | https://github.com/HewlettPackard/ilo-sdk-ruby/blob/ac171cd75d070ccf64017d43777ded40a5f018f9/lib/ilo-sdk/helpers/bios_helper.rb#L133-L138 |
1,255 | HewlettPackard/ilo-sdk-ruby | lib/ilo-sdk/helpers/bios_helper.rb | ILO_SDK.BiosHelper.set_bios_service | def set_bios_service(name, email)
new_action = {
'ServiceName' => name,
'ServiceEmail' => email
}
response = rest_patch('/redfish/v1/Systems/1/bios/Settings/', body: new_action)
response_handler(response)
true
end | ruby | def set_bios_service(name, email)
new_action = {
'ServiceName' => name,
'ServiceEmail' => email
}
response = rest_patch('/redfish/v1/Systems/1/bios/Settings/', body: new_action)
response_handler(response)
true
end | [
"def",
"set_bios_service",
"(",
"name",
",",
"email",
")",
"new_action",
"=",
"{",
"'ServiceName'",
"=>",
"name",
",",
"'ServiceEmail'",
"=>",
"email",
"}",
"response",
"=",
"rest_patch",
"(",
"'/redfish/v1/Systems/1/bios/Settings/'",
",",
"body",
":",
"new_action... | Set the BIOS service
@param name [String, Symbol]
@param email [String, Symbol]
@raise [RuntimeError] if the request failed
@return true | [
"Set",
"the",
"BIOS",
"service"
] | ac171cd75d070ccf64017d43777ded40a5f018f9 | https://github.com/HewlettPackard/ilo-sdk-ruby/blob/ac171cd75d070ccf64017d43777ded40a5f018f9/lib/ilo-sdk/helpers/bios_helper.rb#L157-L165 |
1,256 | HewlettPackard/ilo-sdk-ruby | lib/ilo-sdk/helpers/log_entry_helper.rb | ILO_SDK.LogEntryHelper.clear_logs | def clear_logs(log_type)
new_action = { 'Action' => 'ClearLog' }
response = rest_post(uri_for_log_type(log_type), body: new_action)
response_handler(response)
true
end | ruby | def clear_logs(log_type)
new_action = { 'Action' => 'ClearLog' }
response = rest_post(uri_for_log_type(log_type), body: new_action)
response_handler(response)
true
end | [
"def",
"clear_logs",
"(",
"log_type",
")",
"new_action",
"=",
"{",
"'Action'",
"=>",
"'ClearLog'",
"}",
"response",
"=",
"rest_post",
"(",
"uri_for_log_type",
"(",
"log_type",
")",
",",
"body",
":",
"new_action",
")",
"response_handler",
"(",
"response",
")",
... | Clear the specified logs
@param [String, Symbol] log_type
@raise [RuntimeError] if the request failed
@return true | [
"Clear",
"the",
"specified",
"logs"
] | ac171cd75d070ccf64017d43777ded40a5f018f9 | https://github.com/HewlettPackard/ilo-sdk-ruby/blob/ac171cd75d070ccf64017d43777ded40a5f018f9/lib/ilo-sdk/helpers/log_entry_helper.rb#L34-L39 |
1,257 | HewlettPackard/ilo-sdk-ruby | lib/ilo-sdk/helpers/log_entry_helper.rb | ILO_SDK.LogEntryHelper.get_logs | def get_logs(severity_level, duration, log_type)
response = rest_get("#{uri_for_log_type(log_type)}Entries/")
entries = response_handler(response)['Items']
start_time = Time.now.utc - (duration * 3600)
if severity_level.nil?
entries.select { |e| Time.parse(e['Created']) > start_time }
... | ruby | def get_logs(severity_level, duration, log_type)
response = rest_get("#{uri_for_log_type(log_type)}Entries/")
entries = response_handler(response)['Items']
start_time = Time.now.utc - (duration * 3600)
if severity_level.nil?
entries.select { |e| Time.parse(e['Created']) > start_time }
... | [
"def",
"get_logs",
"(",
"severity_level",
",",
"duration",
",",
"log_type",
")",
"response",
"=",
"rest_get",
"(",
"\"#{uri_for_log_type(log_type)}Entries/\"",
")",
"entries",
"=",
"response_handler",
"(",
"response",
")",
"[",
"'Items'",
"]",
"start_time",
"=",
"... | Get the specified logs
@param [String, Symbol, NilClass] severity_level Set to nil to get all logs
@param [String, Symbol] duration Up to this many hours ago
@param [String, Symbol] log_type IEL or IML
@raise [RuntimeError] if the request failed
@return [Array] log entries | [
"Get",
"the",
"specified",
"logs"
] | ac171cd75d070ccf64017d43777ded40a5f018f9 | https://github.com/HewlettPackard/ilo-sdk-ruby/blob/ac171cd75d070ccf64017d43777ded40a5f018f9/lib/ilo-sdk/helpers/log_entry_helper.rb#L56-L65 |
1,258 | HewlettPackard/ilo-sdk-ruby | lib/ilo-sdk/helpers/computer_details_helper.rb | ILO_SDK.ComputerDetailsHelper.get_computer_details | def get_computer_details
general_computer_details = get_general_computer_details
computer_network_details = get_computer_network_details
array_controller_details = get_array_controller_details
general_computer_details.merge(computer_network_details).merge(array_controller_details)
end | ruby | def get_computer_details
general_computer_details = get_general_computer_details
computer_network_details = get_computer_network_details
array_controller_details = get_array_controller_details
general_computer_details.merge(computer_network_details).merge(array_controller_details)
end | [
"def",
"get_computer_details",
"general_computer_details",
"=",
"get_general_computer_details",
"computer_network_details",
"=",
"get_computer_network_details",
"array_controller_details",
"=",
"get_array_controller_details",
"general_computer_details",
".",
"merge",
"(",
"computer_net... | Get all of the computer details
@raise [RuntimeError] if the request failed
@return [Hash] computer_details | [
"Get",
"all",
"of",
"the",
"computer",
"details"
] | ac171cd75d070ccf64017d43777ded40a5f018f9 | https://github.com/HewlettPackard/ilo-sdk-ruby/blob/ac171cd75d070ccf64017d43777ded40a5f018f9/lib/ilo-sdk/helpers/computer_details_helper.rb#L18-L23 |
1,259 | HewlettPackard/ilo-sdk-ruby | lib/ilo-sdk/helpers/computer_details_helper.rb | ILO_SDK.ComputerDetailsHelper.get_general_computer_details | def get_general_computer_details
response = rest_get('/redfish/v1/Systems/1/')
details = response_handler(response)
{
'GeneralDetails' => {
'manufacturer' => details['Manufacturer'],
'model' => details['Model'],
'AssetTag' => details['AssetTag'],
'bios_v... | ruby | def get_general_computer_details
response = rest_get('/redfish/v1/Systems/1/')
details = response_handler(response)
{
'GeneralDetails' => {
'manufacturer' => details['Manufacturer'],
'model' => details['Model'],
'AssetTag' => details['AssetTag'],
'bios_v... | [
"def",
"get_general_computer_details",
"response",
"=",
"rest_get",
"(",
"'/redfish/v1/Systems/1/'",
")",
"details",
"=",
"response_handler",
"(",
"response",
")",
"{",
"'GeneralDetails'",
"=>",
"{",
"'manufacturer'",
"=>",
"details",
"[",
"'Manufacturer'",
"]",
",",
... | Get the general computer details
@raise [RuntimeError] if the request failed
@return [Fixnum] general_computer_details | [
"Get",
"the",
"general",
"computer",
"details"
] | ac171cd75d070ccf64017d43777ded40a5f018f9 | https://github.com/HewlettPackard/ilo-sdk-ruby/blob/ac171cd75d070ccf64017d43777ded40a5f018f9/lib/ilo-sdk/helpers/computer_details_helper.rb#L28-L41 |
1,260 | HewlettPackard/ilo-sdk-ruby | lib/ilo-sdk/helpers/computer_details_helper.rb | ILO_SDK.ComputerDetailsHelper.get_computer_network_details | def get_computer_network_details
network_adapters = []
response = rest_get('/redfish/v1/Systems/1/NetworkAdapters/')
networks = response_handler(response)['links']['Member']
networks.each do |network|
response = rest_get(network['href'])
detail = response_handler(response)
... | ruby | def get_computer_network_details
network_adapters = []
response = rest_get('/redfish/v1/Systems/1/NetworkAdapters/')
networks = response_handler(response)['links']['Member']
networks.each do |network|
response = rest_get(network['href'])
detail = response_handler(response)
... | [
"def",
"get_computer_network_details",
"network_adapters",
"=",
"[",
"]",
"response",
"=",
"rest_get",
"(",
"'/redfish/v1/Systems/1/NetworkAdapters/'",
")",
"networks",
"=",
"response_handler",
"(",
"response",
")",
"[",
"'links'",
"]",
"[",
"'Member'",
"]",
"networks... | Get the computer network details
@raise [RuntimeError] if the request failed
@return [Hash] computer_network_details | [
"Get",
"the",
"computer",
"network",
"details"
] | ac171cd75d070ccf64017d43777ded40a5f018f9 | https://github.com/HewlettPackard/ilo-sdk-ruby/blob/ac171cd75d070ccf64017d43777ded40a5f018f9/lib/ilo-sdk/helpers/computer_details_helper.rb#L46-L76 |
1,261 | HewlettPackard/ilo-sdk-ruby | lib/ilo-sdk/helpers/firmware_update.rb | ILO_SDK.FirmwareUpdateHelper.set_fw_upgrade | def set_fw_upgrade(uri, tpm_override_flag = true)
new_action = { 'Action' => 'InstallFromURI', 'FirmwareURI' => uri, 'TPMOverrideFlag' => tpm_override_flag }
response = rest_post('/redfish/v1/Managers/1/UpdateService/', body: new_action)
response_handler(response)
true
end | ruby | def set_fw_upgrade(uri, tpm_override_flag = true)
new_action = { 'Action' => 'InstallFromURI', 'FirmwareURI' => uri, 'TPMOverrideFlag' => tpm_override_flag }
response = rest_post('/redfish/v1/Managers/1/UpdateService/', body: new_action)
response_handler(response)
true
end | [
"def",
"set_fw_upgrade",
"(",
"uri",
",",
"tpm_override_flag",
"=",
"true",
")",
"new_action",
"=",
"{",
"'Action'",
"=>",
"'InstallFromURI'",
",",
"'FirmwareURI'",
"=>",
"uri",
",",
"'TPMOverrideFlag'",
"=>",
"tpm_override_flag",
"}",
"response",
"=",
"rest_post"... | Set the Firmware Upgrade
@param [String, Symbol] uri
@raise [RuntimeError] if the request failed
@return true | [
"Set",
"the",
"Firmware",
"Upgrade"
] | ac171cd75d070ccf64017d43777ded40a5f018f9 | https://github.com/HewlettPackard/ilo-sdk-ruby/blob/ac171cd75d070ccf64017d43777ded40a5f018f9/lib/ilo-sdk/helpers/firmware_update.rb#L27-L32 |
1,262 | petebrowne/sprockets-helpers | lib/sprockets/helpers.rb | Sprockets.Helpers.asset_path | def asset_path(source, options = {})
uri = URI.parse(source)
return source if uri.absolute?
options[:prefix] = Sprockets::Helpers.prefix unless options[:prefix]
if Helpers.debug || options[:debug]
options[:manifest] = false
options[:digest] = false
options[:asset_host] ... | ruby | def asset_path(source, options = {})
uri = URI.parse(source)
return source if uri.absolute?
options[:prefix] = Sprockets::Helpers.prefix unless options[:prefix]
if Helpers.debug || options[:debug]
options[:manifest] = false
options[:digest] = false
options[:asset_host] ... | [
"def",
"asset_path",
"(",
"source",
",",
"options",
"=",
"{",
"}",
")",
"uri",
"=",
"URI",
".",
"parse",
"(",
"source",
")",
"return",
"source",
"if",
"uri",
".",
"absolute?",
"options",
"[",
":prefix",
"]",
"=",
"Sprockets",
"::",
"Helpers",
".",
"p... | Returns the path to an asset either in the Sprockets environment
or the public directory. External URIs are untouched.
==== Options
* <tt>:ext</tt> - The extension to append if the source does not have one.
* <tt>:dir</tt> - The directory to prepend if the file is in the public directory.
* <tt>:digest</tt> - We... | [
"Returns",
"the",
"path",
"to",
"an",
"asset",
"either",
"in",
"the",
"Sprockets",
"environment",
"or",
"the",
"public",
"directory",
".",
"External",
"URIs",
"are",
"untouched",
"."
] | e3b952a392345432046ef7016bf60c502eb370ae | https://github.com/petebrowne/sprockets-helpers/blob/e3b952a392345432046ef7016bf60c502eb370ae/lib/sprockets/helpers.rb#L127-L151 |
1,263 | HewlettPackard/ilo-sdk-ruby | lib/ilo-sdk/helpers/chassis_helper.rb | ILO_SDK.ChassisHelper.get_power_metrics | def get_power_metrics
chassis = rest_get('/redfish/v1/Chassis/')
chassis_uri = response_handler(chassis)['links']['Member'][0]['href']
power_metrics_uri = response_handler(rest_get(chassis_uri))['links']['PowerMetrics']['href']
response = rest_get(power_metrics_uri)
metrics = response_hand... | ruby | def get_power_metrics
chassis = rest_get('/redfish/v1/Chassis/')
chassis_uri = response_handler(chassis)['links']['Member'][0]['href']
power_metrics_uri = response_handler(rest_get(chassis_uri))['links']['PowerMetrics']['href']
response = rest_get(power_metrics_uri)
metrics = response_hand... | [
"def",
"get_power_metrics",
"chassis",
"=",
"rest_get",
"(",
"'/redfish/v1/Chassis/'",
")",
"chassis_uri",
"=",
"response_handler",
"(",
"chassis",
")",
"[",
"'links'",
"]",
"[",
"'Member'",
"]",
"[",
"0",
"]",
"[",
"'href'",
"]",
"power_metrics_uri",
"=",
"re... | Get the power metrics
@raise [RuntimeError] if the request failed
@return [Hash] power_metrics | [
"Get",
"the",
"power",
"metrics"
] | ac171cd75d070ccf64017d43777ded40a5f018f9 | https://github.com/HewlettPackard/ilo-sdk-ruby/blob/ac171cd75d070ccf64017d43777ded40a5f018f9/lib/ilo-sdk/helpers/chassis_helper.rb#L18-L43 |
1,264 | HewlettPackard/ilo-sdk-ruby | lib/ilo-sdk/helpers/chassis_helper.rb | ILO_SDK.ChassisHelper.get_thermal_metrics | def get_thermal_metrics
chassis = rest_get('/redfish/v1/Chassis/')
chassis_uri = response_handler(chassis)['links']['Member'][0]['href']
thermal_metrics_uri = response_handler(rest_get(chassis_uri))['links']['ThermalMetrics']['href']
response = rest_get(thermal_metrics_uri)
temperatures = ... | ruby | def get_thermal_metrics
chassis = rest_get('/redfish/v1/Chassis/')
chassis_uri = response_handler(chassis)['links']['Member'][0]['href']
thermal_metrics_uri = response_handler(rest_get(chassis_uri))['links']['ThermalMetrics']['href']
response = rest_get(thermal_metrics_uri)
temperatures = ... | [
"def",
"get_thermal_metrics",
"chassis",
"=",
"rest_get",
"(",
"'/redfish/v1/Chassis/'",
")",
"chassis_uri",
"=",
"response_handler",
"(",
"chassis",
")",
"[",
"'links'",
"]",
"[",
"'Member'",
"]",
"[",
"0",
"]",
"[",
"'href'",
"]",
"thermal_metrics_uri",
"=",
... | Get the thermal metrics
@raise [RuntimeError] if the request failed
@return [Hash] thermal_metrics | [
"Get",
"the",
"thermal",
"metrics"
] | ac171cd75d070ccf64017d43777ded40a5f018f9 | https://github.com/HewlettPackard/ilo-sdk-ruby/blob/ac171cd75d070ccf64017d43777ded40a5f018f9/lib/ilo-sdk/helpers/chassis_helper.rb#L48-L67 |
1,265 | HewlettPackard/ilo-sdk-ruby | lib/ilo-sdk/helpers/date_time_helper.rb | ILO_SDK.DateTimeHelper.set_time_zone | def set_time_zone(time_zone)
time_response = rest_get('/redfish/v1/Managers/1/DateTime/')
new_time_zone = response_handler(time_response)['TimeZoneList'].select { |timezone| timezone['Name'] == time_zone }
new_action = { 'TimeZone' => { 'Index' => new_time_zone[0]['Index'] } }
response = rest_pa... | ruby | def set_time_zone(time_zone)
time_response = rest_get('/redfish/v1/Managers/1/DateTime/')
new_time_zone = response_handler(time_response)['TimeZoneList'].select { |timezone| timezone['Name'] == time_zone }
new_action = { 'TimeZone' => { 'Index' => new_time_zone[0]['Index'] } }
response = rest_pa... | [
"def",
"set_time_zone",
"(",
"time_zone",
")",
"time_response",
"=",
"rest_get",
"(",
"'/redfish/v1/Managers/1/DateTime/'",
")",
"new_time_zone",
"=",
"response_handler",
"(",
"time_response",
")",
"[",
"'TimeZoneList'",
"]",
".",
"select",
"{",
"|",
"timezone",
"|"... | Set the Time Zone
@param [Fixnum] time_zone
@raise [RuntimeError] if the request failed
@return true | [
"Set",
"the",
"Time",
"Zone"
] | ac171cd75d070ccf64017d43777ded40a5f018f9 | https://github.com/HewlettPackard/ilo-sdk-ruby/blob/ac171cd75d070ccf64017d43777ded40a5f018f9/lib/ilo-sdk/helpers/date_time_helper.rb#L27-L34 |
1,266 | HewlettPackard/ilo-sdk-ruby | lib/ilo-sdk/helpers/date_time_helper.rb | ILO_SDK.DateTimeHelper.set_ntp | def set_ntp(use_ntp)
new_action = { 'Oem' => { 'Hp' => { 'DHCPv4' => { 'UseNTPServers' => use_ntp } } } }
response = rest_patch('/redfish/v1/Managers/1/EthernetInterfaces/1/', body: new_action)
response_handler(response)
true
end | ruby | def set_ntp(use_ntp)
new_action = { 'Oem' => { 'Hp' => { 'DHCPv4' => { 'UseNTPServers' => use_ntp } } } }
response = rest_patch('/redfish/v1/Managers/1/EthernetInterfaces/1/', body: new_action)
response_handler(response)
true
end | [
"def",
"set_ntp",
"(",
"use_ntp",
")",
"new_action",
"=",
"{",
"'Oem'",
"=>",
"{",
"'Hp'",
"=>",
"{",
"'DHCPv4'",
"=>",
"{",
"'UseNTPServers'",
"=>",
"use_ntp",
"}",
"}",
"}",
"}",
"response",
"=",
"rest_patch",
"(",
"'/redfish/v1/Managers/1/EthernetInterfaces... | Set whether or not ntp servers are being used
@param [TrueClass, FalseClass] use_ntp
@raise [RuntimeError] if the request failed
@return true | [
"Set",
"whether",
"or",
"not",
"ntp",
"servers",
"are",
"being",
"used"
] | ac171cd75d070ccf64017d43777ded40a5f018f9 | https://github.com/HewlettPackard/ilo-sdk-ruby/blob/ac171cd75d070ccf64017d43777ded40a5f018f9/lib/ilo-sdk/helpers/date_time_helper.rb#L48-L53 |
1,267 | HewlettPackard/ilo-sdk-ruby | lib/ilo-sdk/helpers/date_time_helper.rb | ILO_SDK.DateTimeHelper.set_ntp_servers | def set_ntp_servers(ntp_servers)
new_action = { 'StaticNTPServers' => ntp_servers }
response = rest_patch('/redfish/v1/Managers/1/DateTime/', body: new_action)
response_handler(response)
true
end | ruby | def set_ntp_servers(ntp_servers)
new_action = { 'StaticNTPServers' => ntp_servers }
response = rest_patch('/redfish/v1/Managers/1/DateTime/', body: new_action)
response_handler(response)
true
end | [
"def",
"set_ntp_servers",
"(",
"ntp_servers",
")",
"new_action",
"=",
"{",
"'StaticNTPServers'",
"=>",
"ntp_servers",
"}",
"response",
"=",
"rest_patch",
"(",
"'/redfish/v1/Managers/1/DateTime/'",
",",
"body",
":",
"new_action",
")",
"response_handler",
"(",
"response... | Set the NTP Servers
@param [Fixnum] ntp_servers
@raise [RuntimeError] if the request failed
@return true | [
"Set",
"the",
"NTP",
"Servers"
] | ac171cd75d070ccf64017d43777ded40a5f018f9 | https://github.com/HewlettPackard/ilo-sdk-ruby/blob/ac171cd75d070ccf64017d43777ded40a5f018f9/lib/ilo-sdk/helpers/date_time_helper.rb#L67-L72 |
1,268 | HewlettPackard/ilo-sdk-ruby | lib/ilo-sdk/cli.rb | ILO_SDK.Cli.output | def output(data = {}, indent = 0)
case @options['format']
when 'json'
puts JSON.pretty_generate(data)
when 'yaml'
puts data.to_yaml
else
# rubocop:disable Metrics/BlockNesting
if data.class == Hash
data.each do |k, v|
if v.class == Hash || v.... | ruby | def output(data = {}, indent = 0)
case @options['format']
when 'json'
puts JSON.pretty_generate(data)
when 'yaml'
puts data.to_yaml
else
# rubocop:disable Metrics/BlockNesting
if data.class == Hash
data.each do |k, v|
if v.class == Hash || v.... | [
"def",
"output",
"(",
"data",
"=",
"{",
"}",
",",
"indent",
"=",
"0",
")",
"case",
"@options",
"[",
"'format'",
"]",
"when",
"'json'",
"puts",
"JSON",
".",
"pretty_generate",
"(",
"data",
")",
"when",
"'yaml'",
"puts",
"data",
".",
"to_yaml",
"else",
... | Print output in a given format. | [
"Print",
"output",
"in",
"a",
"given",
"format",
"."
] | ac171cd75d070ccf64017d43777ded40a5f018f9 | https://github.com/HewlettPackard/ilo-sdk-ruby/blob/ac171cd75d070ccf64017d43777ded40a5f018f9/lib/ilo-sdk/cli.rb#L223-L254 |
1,269 | HewlettPackard/ilo-sdk-ruby | lib/ilo-sdk/helpers/boot_settings_helper.rb | ILO_SDK.BootSettingsHelper.set_boot_order | def set_boot_order(boot_order)
new_action = { 'PersistentBootConfigOrder' => boot_order }
response = rest_patch('/redfish/v1/systems/1/bios/Boot/Settings/', body: new_action)
response_handler(response)
true
end | ruby | def set_boot_order(boot_order)
new_action = { 'PersistentBootConfigOrder' => boot_order }
response = rest_patch('/redfish/v1/systems/1/bios/Boot/Settings/', body: new_action)
response_handler(response)
true
end | [
"def",
"set_boot_order",
"(",
"boot_order",
")",
"new_action",
"=",
"{",
"'PersistentBootConfigOrder'",
"=>",
"boot_order",
"}",
"response",
"=",
"rest_patch",
"(",
"'/redfish/v1/systems/1/bios/Boot/Settings/'",
",",
"body",
":",
"new_action",
")",
"response_handler",
"... | Set the boot order
@param [Fixnum] boot_order
@raise [RuntimeError] if the request failed
@return true | [
"Set",
"the",
"boot",
"order"
] | ac171cd75d070ccf64017d43777ded40a5f018f9 | https://github.com/HewlettPackard/ilo-sdk-ruby/blob/ac171cd75d070ccf64017d43777ded40a5f018f9/lib/ilo-sdk/helpers/boot_settings_helper.rb#L45-L50 |
1,270 | HewlettPackard/ilo-sdk-ruby | lib/ilo-sdk/helpers/boot_settings_helper.rb | ILO_SDK.BootSettingsHelper.set_temporary_boot_order | def set_temporary_boot_order(boot_target)
response = rest_get('/redfish/v1/Systems/1/')
boottargets = response_handler(response)['Boot']['BootSourceOverrideSupported']
unless boottargets.include? boot_target
raise "BootSourceOverrideTarget value - #{boot_target} is not supported. Valid values ... | ruby | def set_temporary_boot_order(boot_target)
response = rest_get('/redfish/v1/Systems/1/')
boottargets = response_handler(response)['Boot']['BootSourceOverrideSupported']
unless boottargets.include? boot_target
raise "BootSourceOverrideTarget value - #{boot_target} is not supported. Valid values ... | [
"def",
"set_temporary_boot_order",
"(",
"boot_target",
")",
"response",
"=",
"rest_get",
"(",
"'/redfish/v1/Systems/1/'",
")",
"boottargets",
"=",
"response_handler",
"(",
"response",
")",
"[",
"'Boot'",
"]",
"[",
"'BootSourceOverrideSupported'",
"]",
"unless",
"boott... | Set the temporary boot order
@param [Fixnum] boot_target
@raise [RuntimeError] if the request failed
@return true | [
"Set",
"the",
"temporary",
"boot",
"order"
] | ac171cd75d070ccf64017d43777ded40a5f018f9 | https://github.com/HewlettPackard/ilo-sdk-ruby/blob/ac171cd75d070ccf64017d43777ded40a5f018f9/lib/ilo-sdk/helpers/boot_settings_helper.rb#L64-L74 |
1,271 | HewlettPackard/ilo-sdk-ruby | lib/ilo-sdk/helpers/service_root_helper.rb | ILO_SDK.ServiceRootHelper.get_schema | def get_schema(schema_prefix)
response = rest_get('/redfish/v1/Schemas/')
schemas = response_handler(response)['Items']
schema = schemas.select { |s| s['Schema'].start_with?(schema_prefix) }
raise "NO schema found with this schema prefix : #{schema_prefix}" if schema.empty?
info = []
... | ruby | def get_schema(schema_prefix)
response = rest_get('/redfish/v1/Schemas/')
schemas = response_handler(response)['Items']
schema = schemas.select { |s| s['Schema'].start_with?(schema_prefix) }
raise "NO schema found with this schema prefix : #{schema_prefix}" if schema.empty?
info = []
... | [
"def",
"get_schema",
"(",
"schema_prefix",
")",
"response",
"=",
"rest_get",
"(",
"'/redfish/v1/Schemas/'",
")",
"schemas",
"=",
"response_handler",
"(",
"response",
")",
"[",
"'Items'",
"]",
"schema",
"=",
"schemas",
".",
"select",
"{",
"|",
"s",
"|",
"s",
... | Get the schema information with given prefix
@param [String, Symbol] schema_prefix
@raise [RuntimeError] if the request failed
@return [Array] schema | [
"Get",
"the",
"schema",
"information",
"with",
"given",
"prefix"
] | ac171cd75d070ccf64017d43777ded40a5f018f9 | https://github.com/HewlettPackard/ilo-sdk-ruby/blob/ac171cd75d070ccf64017d43777ded40a5f018f9/lib/ilo-sdk/helpers/service_root_helper.rb#L19-L31 |
1,272 | HewlettPackard/ilo-sdk-ruby | lib/ilo-sdk/helpers/service_root_helper.rb | ILO_SDK.ServiceRootHelper.get_registry | def get_registry(registry_prefix)
response = rest_get('/redfish/v1/Registries/')
registries = response_handler(response)['Items']
registry = registries.select { |reg| reg['Schema'].start_with?(registry_prefix) }
info = []
registry.each do |reg|
response = rest_get(reg['Location'][0... | ruby | def get_registry(registry_prefix)
response = rest_get('/redfish/v1/Registries/')
registries = response_handler(response)['Items']
registry = registries.select { |reg| reg['Schema'].start_with?(registry_prefix) }
info = []
registry.each do |reg|
response = rest_get(reg['Location'][0... | [
"def",
"get_registry",
"(",
"registry_prefix",
")",
"response",
"=",
"rest_get",
"(",
"'/redfish/v1/Registries/'",
")",
"registries",
"=",
"response_handler",
"(",
"response",
")",
"[",
"'Items'",
"]",
"registry",
"=",
"registries",
".",
"select",
"{",
"|",
"reg... | Get the Registry with given registry_prefix
@param [String, Symbol] registry_prefix
@raise [RuntimeError] if the request failed
@return [Array] registry | [
"Get",
"the",
"Registry",
"with",
"given",
"registry_prefix"
] | ac171cd75d070ccf64017d43777ded40a5f018f9 | https://github.com/HewlettPackard/ilo-sdk-ruby/blob/ac171cd75d070ccf64017d43777ded40a5f018f9/lib/ilo-sdk/helpers/service_root_helper.rb#L37-L48 |
1,273 | HewlettPackard/ilo-sdk-ruby | lib/ilo-sdk/helpers/manager_network_protocol_helper.rb | ILO_SDK.ManagerNetworkProtocolHelper.set_timeout | def set_timeout(timeout)
new_action = { 'SessionTimeoutMinutes' => timeout }
response = rest_patch('/redfish/v1/Managers/1/NetworkService/', body: new_action)
response_handler(response)
true
end | ruby | def set_timeout(timeout)
new_action = { 'SessionTimeoutMinutes' => timeout }
response = rest_patch('/redfish/v1/Managers/1/NetworkService/', body: new_action)
response_handler(response)
true
end | [
"def",
"set_timeout",
"(",
"timeout",
")",
"new_action",
"=",
"{",
"'SessionTimeoutMinutes'",
"=>",
"timeout",
"}",
"response",
"=",
"rest_patch",
"(",
"'/redfish/v1/Managers/1/NetworkService/'",
",",
"body",
":",
"new_action",
")",
"response_handler",
"(",
"response"... | Set the Session Timeout Minutes
@param [Fixnum] timeout
@raise [RuntimeError] if the request failed
@return true | [
"Set",
"the",
"Session",
"Timeout",
"Minutes"
] | ac171cd75d070ccf64017d43777ded40a5f018f9 | https://github.com/HewlettPackard/ilo-sdk-ruby/blob/ac171cd75d070ccf64017d43777ded40a5f018f9/lib/ilo-sdk/helpers/manager_network_protocol_helper.rb#L27-L32 |
1,274 | HewlettPackard/ilo-sdk-ruby | lib/ilo-sdk/helpers/ethernet_interface_helper.rb | ILO_SDK.EthernetInterfaceHelper.set_ilo_ipv4_dhcp | def set_ilo_ipv4_dhcp(manager_id: 1, ethernet_interface: 1)
new_action = {
'Oem' => {
'Hp' => {
'DHCPv4' => {
'Enabled' => true,
'UseDNSServers' => true,
'UseDomainName' => true,
'UseGateway' => true,
'UseNTPServer... | ruby | def set_ilo_ipv4_dhcp(manager_id: 1, ethernet_interface: 1)
new_action = {
'Oem' => {
'Hp' => {
'DHCPv4' => {
'Enabled' => true,
'UseDNSServers' => true,
'UseDomainName' => true,
'UseGateway' => true,
'UseNTPServer... | [
"def",
"set_ilo_ipv4_dhcp",
"(",
"manager_id",
":",
"1",
",",
"ethernet_interface",
":",
"1",
")",
"new_action",
"=",
"{",
"'Oem'",
"=>",
"{",
"'Hp'",
"=>",
"{",
"'DHCPv4'",
"=>",
"{",
"'Enabled'",
"=>",
"true",
",",
"'UseDNSServers'",
"=>",
"true",
",",
... | Set EthernetInterface to obtain IPv4 settings from DHCP
@param manager_id [Integer, String] ID of the Manager
@param ethernet_interface [Integer, String] ID of the EthernetInterface
@raise [RuntimeError] if the request failed
@return true | [
"Set",
"EthernetInterface",
"to",
"obtain",
"IPv4",
"settings",
"from",
"DHCP"
] | ac171cd75d070ccf64017d43777ded40a5f018f9 | https://github.com/HewlettPackard/ilo-sdk-ruby/blob/ac171cd75d070ccf64017d43777ded40a5f018f9/lib/ilo-sdk/helpers/ethernet_interface_helper.rb#L29-L48 |
1,275 | HewlettPackard/ilo-sdk-ruby | lib/ilo-sdk/helpers/ethernet_interface_helper.rb | ILO_SDK.EthernetInterfaceHelper.set_ilo_ipv4_static | def set_ilo_ipv4_static(ip:, netmask:, gateway: '0.0.0.0', manager_id: 1, ethernet_interface: 1)
new_action = {
'Oem' => { 'Hp' => { 'DHCPv4' => { 'Enabled' => false } } },
'IPv4Addresses' => [
'Address' => ip, 'SubnetMask' => netmask, 'Gateway' => gateway
]
}
respons... | ruby | def set_ilo_ipv4_static(ip:, netmask:, gateway: '0.0.0.0', manager_id: 1, ethernet_interface: 1)
new_action = {
'Oem' => { 'Hp' => { 'DHCPv4' => { 'Enabled' => false } } },
'IPv4Addresses' => [
'Address' => ip, 'SubnetMask' => netmask, 'Gateway' => gateway
]
}
respons... | [
"def",
"set_ilo_ipv4_static",
"(",
"ip",
":",
",",
"netmask",
":",
",",
"gateway",
":",
"'0.0.0.0'",
",",
"manager_id",
":",
"1",
",",
"ethernet_interface",
":",
"1",
")",
"new_action",
"=",
"{",
"'Oem'",
"=>",
"{",
"'Hp'",
"=>",
"{",
"'DHCPv4'",
"=>",
... | Set EthernetInterface to static IPv4 address
@param ip [String] IPv4 address
@param netmask [String] IPv4 subnet mask
@param gateway [String] IPv4 default gateway
@param manager_id [Integer, String] ID of the Manager
@param ethernet_interface [Integer, String] ID of the EthernetInterface
@raise [RuntimeError] if ... | [
"Set",
"EthernetInterface",
"to",
"static",
"IPv4",
"address"
] | ac171cd75d070ccf64017d43777ded40a5f018f9 | https://github.com/HewlettPackard/ilo-sdk-ruby/blob/ac171cd75d070ccf64017d43777ded40a5f018f9/lib/ilo-sdk/helpers/ethernet_interface_helper.rb#L58-L68 |
1,276 | HewlettPackard/ilo-sdk-ruby | lib/ilo-sdk/helpers/ethernet_interface_helper.rb | ILO_SDK.EthernetInterfaceHelper.set_ilo_ipv4_dns_servers | def set_ilo_ipv4_dns_servers(dns_servers:, manager_id: 1, ethernet_interface: 1)
new_action = {
'Oem' => {
'Hp' => {
'DHCPv4' => { 'UseDNSServers' => false },
'IPv4' => { 'DNSServers' => dns_servers }
}
}
}
response = rest_patch("/redfish/v1/... | ruby | def set_ilo_ipv4_dns_servers(dns_servers:, manager_id: 1, ethernet_interface: 1)
new_action = {
'Oem' => {
'Hp' => {
'DHCPv4' => { 'UseDNSServers' => false },
'IPv4' => { 'DNSServers' => dns_servers }
}
}
}
response = rest_patch("/redfish/v1/... | [
"def",
"set_ilo_ipv4_dns_servers",
"(",
"dns_servers",
":",
",",
"manager_id",
":",
"1",
",",
"ethernet_interface",
":",
"1",
")",
"new_action",
"=",
"{",
"'Oem'",
"=>",
"{",
"'Hp'",
"=>",
"{",
"'DHCPv4'",
"=>",
"{",
"'UseDNSServers'",
"=>",
"false",
"}",
... | Set EthernetInterface DNS servers
@param dns_servers [Array] list of DNS servers
@param manager_id [Integer, String] ID of the Manager
@param ethernet_interface [Integer, String] ID of the EthernetInterface
@raise [RuntimeError] if the request failed
@return true | [
"Set",
"EthernetInterface",
"DNS",
"servers"
] | ac171cd75d070ccf64017d43777ded40a5f018f9 | https://github.com/HewlettPackard/ilo-sdk-ruby/blob/ac171cd75d070ccf64017d43777ded40a5f018f9/lib/ilo-sdk/helpers/ethernet_interface_helper.rb#L76-L88 |
1,277 | HewlettPackard/ilo-sdk-ruby | lib/ilo-sdk/helpers/ethernet_interface_helper.rb | ILO_SDK.EthernetInterfaceHelper.set_ilo_hostname | def set_ilo_hostname(hostname:, domain_name: nil, manager_id: 1, ethernet_interface: 1)
new_action = { 'Oem' => { 'Hp' => { 'HostName' => hostname } } }
new_action['Oem']['Hp'].merge!('DHCPv4' => {}, 'DHCPv6' => {}) if domain_name
new_action['Oem']['Hp']['DHCPv4']['UseDomainName'] = false if domain_na... | ruby | def set_ilo_hostname(hostname:, domain_name: nil, manager_id: 1, ethernet_interface: 1)
new_action = { 'Oem' => { 'Hp' => { 'HostName' => hostname } } }
new_action['Oem']['Hp'].merge!('DHCPv4' => {}, 'DHCPv6' => {}) if domain_name
new_action['Oem']['Hp']['DHCPv4']['UseDomainName'] = false if domain_na... | [
"def",
"set_ilo_hostname",
"(",
"hostname",
":",
",",
"domain_name",
":",
"nil",
",",
"manager_id",
":",
"1",
",",
"ethernet_interface",
":",
"1",
")",
"new_action",
"=",
"{",
"'Oem'",
"=>",
"{",
"'Hp'",
"=>",
"{",
"'HostName'",
"=>",
"hostname",
"}",
"}... | Set iLO hostname and domain name
@param hostname [String] iLO hostname
@param domain_name [String] iLO domain name
@param manager_id [Integer, String] ID of the Manager
@param ethernet_interface [Integer, String] ID of the EthernetInterface
@raise [RuntimeError] if the request failed
@return true | [
"Set",
"iLO",
"hostname",
"and",
"domain",
"name"
] | ac171cd75d070ccf64017d43777ded40a5f018f9 | https://github.com/HewlettPackard/ilo-sdk-ruby/blob/ac171cd75d070ccf64017d43777ded40a5f018f9/lib/ilo-sdk/helpers/ethernet_interface_helper.rb#L97-L106 |
1,278 | HewlettPackard/ilo-sdk-ruby | lib/ilo-sdk/rest.rb | ILO_SDK.Rest.rest_api | def rest_api(type, path, options = {})
raise InvalidRequest, 'Must specify path' unless path
raise InvalidRequest, 'Must specify type' unless type
@logger.debug "Making :#{type} rest call to #{@host}#{path}"
uri = URI.parse(URI.escape("#{@host}#{path}"))
http = @disable_proxy ? Net::HTTP.... | ruby | def rest_api(type, path, options = {})
raise InvalidRequest, 'Must specify path' unless path
raise InvalidRequest, 'Must specify type' unless type
@logger.debug "Making :#{type} rest call to #{@host}#{path}"
uri = URI.parse(URI.escape("#{@host}#{path}"))
http = @disable_proxy ? Net::HTTP.... | [
"def",
"rest_api",
"(",
"type",
",",
"path",
",",
"options",
"=",
"{",
"}",
")",
"raise",
"InvalidRequest",
",",
"'Must specify path'",
"unless",
"path",
"raise",
"InvalidRequest",
",",
"'Must specify type'",
"unless",
"type",
"@logger",
".",
"debug",
"\"Making ... | Make a restful API request to the iLO
@param [Symbol] type the rest method/type Options are :get, :post, :put, :patch, and :delete
@param [String] path the path for the request. Usually starts with "/rest/"
@param [Hash] options the options for the request
@option options [String] :body Hash to be converted into js... | [
"Make",
"a",
"restful",
"API",
"request",
"to",
"the",
"iLO"
] | ac171cd75d070ccf64017d43777ded40a5f018f9 | https://github.com/HewlettPackard/ilo-sdk-ruby/blob/ac171cd75d070ccf64017d43777ded40a5f018f9/lib/ilo-sdk/rest.rb#L30-L54 |
1,279 | HewlettPackard/ilo-sdk-ruby | lib/ilo-sdk/rest.rb | ILO_SDK.Rest.response_handler | def response_handler(response)
case response.code.to_i
when RESPONSE_CODE_OK # Synchronous read/query
begin
return JSON.parse(response.body)
rescue JSON::ParserError => e
@logger.warn "Failed to parse JSON response. #{e}"
return response.body
end
w... | ruby | def response_handler(response)
case response.code.to_i
when RESPONSE_CODE_OK # Synchronous read/query
begin
return JSON.parse(response.body)
rescue JSON::ParserError => e
@logger.warn "Failed to parse JSON response. #{e}"
return response.body
end
w... | [
"def",
"response_handler",
"(",
"response",
")",
"case",
"response",
".",
"code",
".",
"to_i",
"when",
"RESPONSE_CODE_OK",
"# Synchronous read/query",
"begin",
"return",
"JSON",
".",
"parse",
"(",
"response",
".",
"body",
")",
"rescue",
"JSON",
"::",
"ParserErro... | Handle the response for rest call.
If an asynchronous task was started, this waits for it to complete.
@param [HTTPResponse] HTTP response
@raise [ILO_SDK::BadRequest] if the request failed with a 400 status
@raise [ILO_SDK::Unauthorized] if the request failed with a 401 status
@raise [ILO_SDK::NotFound] if the ... | [
"Handle",
"the",
"response",
"for",
"rest",
"call",
".",
"If",
"an",
"asynchronous",
"task",
"was",
"started",
"this",
"waits",
"for",
"it",
"to",
"complete",
"."
] | ac171cd75d070ccf64017d43777ded40a5f018f9 | https://github.com/HewlettPackard/ilo-sdk-ruby/blob/ac171cd75d070ccf64017d43777ded40a5f018f9/lib/ilo-sdk/rest.rb#L102-L132 |
1,280 | HewlettPackard/ilo-sdk-ruby | lib/ilo-sdk/helpers/manager_account_helper.rb | ILO_SDK.ManagerAccountHelper.get_account_privileges | def get_account_privileges(username)
response = rest_get('/redfish/v1/AccountService/Accounts/')
accounts = response_handler(response)['Items']
accounts.each do |account|
if account['Oem']['Hp']['LoginName'] == username
return account['Oem']['Hp']['Privileges']
end
end
... | ruby | def get_account_privileges(username)
response = rest_get('/redfish/v1/AccountService/Accounts/')
accounts = response_handler(response)['Items']
accounts.each do |account|
if account['Oem']['Hp']['LoginName'] == username
return account['Oem']['Hp']['Privileges']
end
end
... | [
"def",
"get_account_privileges",
"(",
"username",
")",
"response",
"=",
"rest_get",
"(",
"'/redfish/v1/AccountService/Accounts/'",
")",
"accounts",
"=",
"response_handler",
"(",
"response",
")",
"[",
"'Items'",
"]",
"accounts",
".",
"each",
"do",
"|",
"account",
"... | Get the Privileges for a user
@param [String, Symbol] username
@raise [RuntimeError] if the request failed
@return [Hash] privileges | [
"Get",
"the",
"Privileges",
"for",
"a",
"user"
] | ac171cd75d070ccf64017d43777ded40a5f018f9 | https://github.com/HewlettPackard/ilo-sdk-ruby/blob/ac171cd75d070ccf64017d43777ded40a5f018f9/lib/ilo-sdk/helpers/manager_account_helper.rb#L19-L27 |
1,281 | HewlettPackard/ilo-sdk-ruby | lib/ilo-sdk/helpers/manager_account_helper.rb | ILO_SDK.ManagerAccountHelper.set_account_privileges | def set_account_privileges(username, privileges)
response = rest_get('/redfish/v1/AccountService/Accounts/')
accounts = response_handler(response)['Items']
id = '0'
accounts.each do |account|
if account['Oem']['Hp']['LoginName'] == username
id = account['Id']
break
... | ruby | def set_account_privileges(username, privileges)
response = rest_get('/redfish/v1/AccountService/Accounts/')
accounts = response_handler(response)['Items']
id = '0'
accounts.each do |account|
if account['Oem']['Hp']['LoginName'] == username
id = account['Id']
break
... | [
"def",
"set_account_privileges",
"(",
"username",
",",
"privileges",
")",
"response",
"=",
"rest_get",
"(",
"'/redfish/v1/AccountService/Accounts/'",
")",
"accounts",
"=",
"response_handler",
"(",
"response",
")",
"[",
"'Items'",
"]",
"id",
"=",
"'0'",
"accounts",
... | Set the privileges for a user
@param [TrueClass, FalseClass] username
@param [Hash] privileges
@option privileges [TrueClass, FalseClass] :LoginPriv
@option privileges [TrueClass, FalseClass] :RemoteConsolePriv
@option privileges [TrueClass, FalseClass] :UserConfigPriv
@option privileges [TrueClass, FalseClass] :... | [
"Set",
"the",
"privileges",
"for",
"a",
"user"
] | ac171cd75d070ccf64017d43777ded40a5f018f9 | https://github.com/HewlettPackard/ilo-sdk-ruby/blob/ac171cd75d070ccf64017d43777ded40a5f018f9/lib/ilo-sdk/helpers/manager_account_helper.rb#L40-L60 |
1,282 | HewlettPackard/ilo-sdk-ruby | lib/ilo-sdk/helpers/https_cert_helper.rb | ILO_SDK.HttpsCertHelper.get_certificate | def get_certificate
uri = URI.parse(URI.escape(@host))
options = { use_ssl: true, verify_mode: OpenSSL::SSL::VERIFY_NONE }
Net::HTTP.start(uri.host, uri.port, options) do |http|
http.peer_cert
end
end | ruby | def get_certificate
uri = URI.parse(URI.escape(@host))
options = { use_ssl: true, verify_mode: OpenSSL::SSL::VERIFY_NONE }
Net::HTTP.start(uri.host, uri.port, options) do |http|
http.peer_cert
end
end | [
"def",
"get_certificate",
"uri",
"=",
"URI",
".",
"parse",
"(",
"URI",
".",
"escape",
"(",
"@host",
")",
")",
"options",
"=",
"{",
"use_ssl",
":",
"true",
",",
"verify_mode",
":",
"OpenSSL",
"::",
"SSL",
"::",
"VERIFY_NONE",
"}",
"Net",
"::",
"HTTP",
... | Get the SSL Certificate
@raise [RuntimeError] if the request failed
@return [OpenSSL::X509::Certificate] x509_certificate
rubocop:disable Style/SymbolProc | [
"Get",
"the",
"SSL",
"Certificate"
] | ac171cd75d070ccf64017d43777ded40a5f018f9 | https://github.com/HewlettPackard/ilo-sdk-ruby/blob/ac171cd75d070ccf64017d43777ded40a5f018f9/lib/ilo-sdk/helpers/https_cert_helper.rb#L19-L25 |
1,283 | HewlettPackard/ilo-sdk-ruby | lib/ilo-sdk/helpers/https_cert_helper.rb | ILO_SDK.HttpsCertHelper.generate_csr | def generate_csr(country, state, city, org_name, org_unit, common_name)
new_action = {
'Action' => 'GenerateCSR',
'Country' => country,
'State' => state,
'City' => city,
'OrgName' => org_name,
'OrgUnit' => org_unit,
'CommonName' => common_name
}
... | ruby | def generate_csr(country, state, city, org_name, org_unit, common_name)
new_action = {
'Action' => 'GenerateCSR',
'Country' => country,
'State' => state,
'City' => city,
'OrgName' => org_name,
'OrgUnit' => org_unit,
'CommonName' => common_name
}
... | [
"def",
"generate_csr",
"(",
"country",
",",
"state",
",",
"city",
",",
"org_name",
",",
"org_unit",
",",
"common_name",
")",
"new_action",
"=",
"{",
"'Action'",
"=>",
"'GenerateCSR'",
",",
"'Country'",
"=>",
"country",
",",
"'State'",
"=>",
"state",
",",
"... | Generate a Certificate Signing Request
@param [String] country
@param [String] state
@param [String] city
@param [String] orgName
@param [String] orgUnit
@param [String] commonName
@raise [RuntimeError] if the request failed
@return true | [
"Generate",
"a",
"Certificate",
"Signing",
"Request"
] | ac171cd75d070ccf64017d43777ded40a5f018f9 | https://github.com/HewlettPackard/ilo-sdk-ruby/blob/ac171cd75d070ccf64017d43777ded40a5f018f9/lib/ilo-sdk/helpers/https_cert_helper.rb#L51-L64 |
1,284 | HewlettPackard/ilo-sdk-ruby | lib/ilo-sdk/helpers/secure_boot_helper.rb | ILO_SDK.SecureBootHelper.set_uefi_secure_boot | def set_uefi_secure_boot(secure_boot_enable)
new_action = { 'SecureBootEnable' => secure_boot_enable }
response = rest_patch('/redfish/v1/Systems/1/SecureBoot/', body: new_action)
response_handler(response)
true
end | ruby | def set_uefi_secure_boot(secure_boot_enable)
new_action = { 'SecureBootEnable' => secure_boot_enable }
response = rest_patch('/redfish/v1/Systems/1/SecureBoot/', body: new_action)
response_handler(response)
true
end | [
"def",
"set_uefi_secure_boot",
"(",
"secure_boot_enable",
")",
"new_action",
"=",
"{",
"'SecureBootEnable'",
"=>",
"secure_boot_enable",
"}",
"response",
"=",
"rest_patch",
"(",
"'/redfish/v1/Systems/1/SecureBoot/'",
",",
"body",
":",
"new_action",
")",
"response_handler"... | Set the UEFI secure boot true or false
@param [Boolean] secure_boot_enable
@raise [RuntimeError] if the request failed
@return true | [
"Set",
"the",
"UEFI",
"secure",
"boot",
"true",
"or",
"false"
] | ac171cd75d070ccf64017d43777ded40a5f018f9 | https://github.com/HewlettPackard/ilo-sdk-ruby/blob/ac171cd75d070ccf64017d43777ded40a5f018f9/lib/ilo-sdk/helpers/secure_boot_helper.rb#L27-L32 |
1,285 | HewlettPackard/ilo-sdk-ruby | lib/ilo-sdk/helpers/power_helper.rb | ILO_SDK.PowerHelper.set_power_state | def set_power_state(state)
new_action = { 'Action' => 'Reset', 'ResetType' => state }
response = rest_post('/redfish/v1/Systems/1/', body: new_action)
response_handler(response)
true
end | ruby | def set_power_state(state)
new_action = { 'Action' => 'Reset', 'ResetType' => state }
response = rest_post('/redfish/v1/Systems/1/', body: new_action)
response_handler(response)
true
end | [
"def",
"set_power_state",
"(",
"state",
")",
"new_action",
"=",
"{",
"'Action'",
"=>",
"'Reset'",
",",
"'ResetType'",
"=>",
"state",
"}",
"response",
"=",
"rest_post",
"(",
"'/redfish/v1/Systems/1/'",
",",
"body",
":",
"new_action",
")",
"response_handler",
"(",... | Set the Power State
@param [String, Symbol] state
@raise [RuntimeError] if the request failed
@return true | [
"Set",
"the",
"Power",
"State"
] | ac171cd75d070ccf64017d43777ded40a5f018f9 | https://github.com/HewlettPackard/ilo-sdk-ruby/blob/ac171cd75d070ccf64017d43777ded40a5f018f9/lib/ilo-sdk/helpers/power_helper.rb#L27-L32 |
1,286 | HewlettPackard/ilo-sdk-ruby | lib/ilo-sdk/helpers/snmp_service_helper.rb | ILO_SDK.SNMPServiceHelper.set_snmp | def set_snmp(snmp_mode, snmp_alerts)
new_action = { 'Mode' => snmp_mode, 'AlertsEnabled' => snmp_alerts }
response = rest_patch('/redfish/v1/Managers/1/SnmpService/', body: new_action)
response_handler(response)
true
end | ruby | def set_snmp(snmp_mode, snmp_alerts)
new_action = { 'Mode' => snmp_mode, 'AlertsEnabled' => snmp_alerts }
response = rest_patch('/redfish/v1/Managers/1/SnmpService/', body: new_action)
response_handler(response)
true
end | [
"def",
"set_snmp",
"(",
"snmp_mode",
",",
"snmp_alerts",
")",
"new_action",
"=",
"{",
"'Mode'",
"=>",
"snmp_mode",
",",
"'AlertsEnabled'",
"=>",
"snmp_alerts",
"}",
"response",
"=",
"rest_patch",
"(",
"'/redfish/v1/Managers/1/SnmpService/'",
",",
"body",
":",
"new... | Set the SNMP Mode and Alerts Enabled value
@param [String, Symbol] snmp_mode
@param [Boolean] snmp_alerts
@raise [RuntimeError] if the request failed
@return true | [
"Set",
"the",
"SNMP",
"Mode",
"and",
"Alerts",
"Enabled",
"value"
] | ac171cd75d070ccf64017d43777ded40a5f018f9 | https://github.com/HewlettPackard/ilo-sdk-ruby/blob/ac171cd75d070ccf64017d43777ded40a5f018f9/lib/ilo-sdk/helpers/snmp_service_helper.rb#L36-L41 |
1,287 | HewlettPackard/ilo-sdk-ruby | lib/ilo-sdk/helpers/virtual_media_helper.rb | ILO_SDK.VirtualMediaHelper.get_virtual_media | def get_virtual_media
response = rest_get('/redfish/v1/Managers/1/VirtualMedia/')
media = {}
response_handler(response)['links']['Member'].each do |vm|
response = rest_get(vm['href'])
virtual_media = response_handler(response)
media[virtual_media['Id']] = {
'Image' =>... | ruby | def get_virtual_media
response = rest_get('/redfish/v1/Managers/1/VirtualMedia/')
media = {}
response_handler(response)['links']['Member'].each do |vm|
response = rest_get(vm['href'])
virtual_media = response_handler(response)
media[virtual_media['Id']] = {
'Image' =>... | [
"def",
"get_virtual_media",
"response",
"=",
"rest_get",
"(",
"'/redfish/v1/Managers/1/VirtualMedia/'",
")",
"media",
"=",
"{",
"}",
"response_handler",
"(",
"response",
")",
"[",
"'links'",
"]",
"[",
"'Member'",
"]",
".",
"each",
"do",
"|",
"vm",
"|",
"respon... | Get the Virtual Media Information
@raise [RuntimeError] if the request failed
@return [String] virtual_media | [
"Get",
"the",
"Virtual",
"Media",
"Information"
] | ac171cd75d070ccf64017d43777ded40a5f018f9 | https://github.com/HewlettPackard/ilo-sdk-ruby/blob/ac171cd75d070ccf64017d43777ded40a5f018f9/lib/ilo-sdk/helpers/virtual_media_helper.rb#L18-L30 |
1,288 | HewlettPackard/ilo-sdk-ruby | lib/ilo-sdk/helpers/virtual_media_helper.rb | ILO_SDK.VirtualMediaHelper.insert_virtual_media | def insert_virtual_media(id, image)
new_action = {
'Action' => 'InsertVirtualMedia',
'Target' => '/Oem/Hp',
'Image' => image
}
response = rest_post("/redfish/v1/Managers/1/VirtualMedia/#{id}/", body: new_action)
response_handler(response)
true
end | ruby | def insert_virtual_media(id, image)
new_action = {
'Action' => 'InsertVirtualMedia',
'Target' => '/Oem/Hp',
'Image' => image
}
response = rest_post("/redfish/v1/Managers/1/VirtualMedia/#{id}/", body: new_action)
response_handler(response)
true
end | [
"def",
"insert_virtual_media",
"(",
"id",
",",
"image",
")",
"new_action",
"=",
"{",
"'Action'",
"=>",
"'InsertVirtualMedia'",
",",
"'Target'",
"=>",
"'/Oem/Hp'",
",",
"'Image'",
"=>",
"image",
"}",
"response",
"=",
"rest_post",
"(",
"\"/redfish/v1/Managers/1/Virt... | Insert Virtual Media
@param [String, Symbol] id
@param [String, Symbol] image
@return true | [
"Insert",
"Virtual",
"Media"
] | ac171cd75d070ccf64017d43777ded40a5f018f9 | https://github.com/HewlettPackard/ilo-sdk-ruby/blob/ac171cd75d070ccf64017d43777ded40a5f018f9/lib/ilo-sdk/helpers/virtual_media_helper.rb#L44-L53 |
1,289 | HewlettPackard/ilo-sdk-ruby | lib/ilo-sdk/helpers/virtual_media_helper.rb | ILO_SDK.VirtualMediaHelper.eject_virtual_media | def eject_virtual_media(id)
new_action = {
'Action' => 'EjectVirtualMedia',
'Target' => '/Oem/Hp'
}
response = rest_post("/redfish/v1/Managers/1/VirtualMedia/#{id}/", body: new_action)
response_handler(response)
true
end | ruby | def eject_virtual_media(id)
new_action = {
'Action' => 'EjectVirtualMedia',
'Target' => '/Oem/Hp'
}
response = rest_post("/redfish/v1/Managers/1/VirtualMedia/#{id}/", body: new_action)
response_handler(response)
true
end | [
"def",
"eject_virtual_media",
"(",
"id",
")",
"new_action",
"=",
"{",
"'Action'",
"=>",
"'EjectVirtualMedia'",
",",
"'Target'",
"=>",
"'/Oem/Hp'",
"}",
"response",
"=",
"rest_post",
"(",
"\"/redfish/v1/Managers/1/VirtualMedia/#{id}/\"",
",",
"body",
":",
"new_action",... | Eject Virtual Media
@param [String, Symbol] id
@return true | [
"Eject",
"Virtual",
"Media"
] | ac171cd75d070ccf64017d43777ded40a5f018f9 | https://github.com/HewlettPackard/ilo-sdk-ruby/blob/ac171cd75d070ccf64017d43777ded40a5f018f9/lib/ilo-sdk/helpers/virtual_media_helper.rb#L58-L66 |
1,290 | HewlettPackard/ilo-sdk-ruby | lib/ilo-sdk/helpers/computer_system_helper.rb | ILO_SDK.ComputerSystemHelper.set_asset_tag | def set_asset_tag(asset_tag)
@logger.warn '[Deprecated] `set_asset_tag` is deprecated. Please use `set_system_settings(AssetTag: <tag>)` instead.'
new_action = { 'AssetTag' => asset_tag }
response = rest_patch('/redfish/v1/Systems/1/', body: new_action)
response_handler(response)
true
... | ruby | def set_asset_tag(asset_tag)
@logger.warn '[Deprecated] `set_asset_tag` is deprecated. Please use `set_system_settings(AssetTag: <tag>)` instead.'
new_action = { 'AssetTag' => asset_tag }
response = rest_patch('/redfish/v1/Systems/1/', body: new_action)
response_handler(response)
true
... | [
"def",
"set_asset_tag",
"(",
"asset_tag",
")",
"@logger",
".",
"warn",
"'[Deprecated] `set_asset_tag` is deprecated. Please use `set_system_settings(AssetTag: <tag>)` instead.'",
"new_action",
"=",
"{",
"'AssetTag'",
"=>",
"asset_tag",
"}",
"response",
"=",
"rest_patch",
"(",
... | Set the Asset Tag
@deprecated Use {#set_system_settings} instead
@param asset_tag [String, Symbol]
@raise [RuntimeError] if the request failed
@return true | [
"Set",
"the",
"Asset",
"Tag"
] | ac171cd75d070ccf64017d43777ded40a5f018f9 | https://github.com/HewlettPackard/ilo-sdk-ruby/blob/ac171cd75d070ccf64017d43777ded40a5f018f9/lib/ilo-sdk/helpers/computer_system_helper.rb#L48-L54 |
1,291 | HewlettPackard/ilo-sdk-ruby | lib/ilo-sdk/helpers/computer_system_helper.rb | ILO_SDK.ComputerSystemHelper.set_indicator_led | def set_indicator_led(state)
@logger.warn '[Deprecated] `set_indicator_led` is deprecated. Please use `set_system_settings(IndicatorLED: <state>)` instead.'
new_action = { 'IndicatorLED' => state }
response = rest_patch('/redfish/v1/Systems/1/', body: new_action)
response_handler(response)
... | ruby | def set_indicator_led(state)
@logger.warn '[Deprecated] `set_indicator_led` is deprecated. Please use `set_system_settings(IndicatorLED: <state>)` instead.'
new_action = { 'IndicatorLED' => state }
response = rest_patch('/redfish/v1/Systems/1/', body: new_action)
response_handler(response)
... | [
"def",
"set_indicator_led",
"(",
"state",
")",
"@logger",
".",
"warn",
"'[Deprecated] `set_indicator_led` is deprecated. Please use `set_system_settings(IndicatorLED: <state>)` instead.'",
"new_action",
"=",
"{",
"'IndicatorLED'",
"=>",
"state",
"}",
"response",
"=",
"rest_patch"... | Set the UID indicator LED
@deprecated Use {#set_system_settings} instead
@param state [String, Symbol]
@raise [RuntimeError] if the request failed
@return true | [
"Set",
"the",
"UID",
"indicator",
"LED"
] | ac171cd75d070ccf64017d43777ded40a5f018f9 | https://github.com/HewlettPackard/ilo-sdk-ruby/blob/ac171cd75d070ccf64017d43777ded40a5f018f9/lib/ilo-sdk/helpers/computer_system_helper.rb#L71-L77 |
1,292 | HewlettPackard/ilo-sdk-ruby | lib/ilo-sdk/helpers/account_service_helper.rb | ILO_SDK.AccountServiceHelper.userhref | def userhref(uri, username)
response = rest_get(uri)
items = response_handler(response)['Items']
items.each do |it|
return it['links']['self']['href'] if it['UserName'] == username
end
end | ruby | def userhref(uri, username)
response = rest_get(uri)
items = response_handler(response)['Items']
items.each do |it|
return it['links']['self']['href'] if it['UserName'] == username
end
end | [
"def",
"userhref",
"(",
"uri",
",",
"username",
")",
"response",
"=",
"rest_get",
"(",
"uri",
")",
"items",
"=",
"response_handler",
"(",
"response",
")",
"[",
"'Items'",
"]",
"items",
".",
"each",
"do",
"|",
"it",
"|",
"return",
"it",
"[",
"'links'",
... | Get the HREF for a user with a specific username
@param [String, Symbol] uri
@param [String, Symbol] username
@raise [RuntimeError] if the request failed
@return [String] userhref | [
"Get",
"the",
"HREF",
"for",
"a",
"user",
"with",
"a",
"specific",
"username"
] | ac171cd75d070ccf64017d43777ded40a5f018f9 | https://github.com/HewlettPackard/ilo-sdk-ruby/blob/ac171cd75d070ccf64017d43777ded40a5f018f9/lib/ilo-sdk/helpers/account_service_helper.rb#L20-L26 |
1,293 | HewlettPackard/ilo-sdk-ruby | lib/ilo-sdk/helpers/account_service_helper.rb | ILO_SDK.AccountServiceHelper.create_user | def create_user(username, password)
new_action = { 'UserName' => username, 'Password' => password, 'Oem' => { 'Hp' => { 'LoginName' => username } } }
response = rest_post('/redfish/v1/AccountService/Accounts/', body: new_action)
response_handler(response)
true
end | ruby | def create_user(username, password)
new_action = { 'UserName' => username, 'Password' => password, 'Oem' => { 'Hp' => { 'LoginName' => username } } }
response = rest_post('/redfish/v1/AccountService/Accounts/', body: new_action)
response_handler(response)
true
end | [
"def",
"create_user",
"(",
"username",
",",
"password",
")",
"new_action",
"=",
"{",
"'UserName'",
"=>",
"username",
",",
"'Password'",
"=>",
"password",
",",
"'Oem'",
"=>",
"{",
"'Hp'",
"=>",
"{",
"'LoginName'",
"=>",
"username",
"}",
"}",
"}",
"response"... | Create a user
@param [String, Symbol] username
@param [String, Symbol] password
@raise [RuntimeError] if the request failed
@return true | [
"Create",
"a",
"user"
] | ac171cd75d070ccf64017d43777ded40a5f018f9 | https://github.com/HewlettPackard/ilo-sdk-ruby/blob/ac171cd75d070ccf64017d43777ded40a5f018f9/lib/ilo-sdk/helpers/account_service_helper.rb#L41-L46 |
1,294 | HewlettPackard/ilo-sdk-ruby | lib/ilo-sdk/helpers/account_service_helper.rb | ILO_SDK.AccountServiceHelper.change_password | def change_password(username, password)
new_action = { 'Password' => password }
userhref = userhref('/redfish/v1/AccountService/Accounts/', username)
response = rest_patch(userhref, body: new_action)
response_handler(response)
true
end | ruby | def change_password(username, password)
new_action = { 'Password' => password }
userhref = userhref('/redfish/v1/AccountService/Accounts/', username)
response = rest_patch(userhref, body: new_action)
response_handler(response)
true
end | [
"def",
"change_password",
"(",
"username",
",",
"password",
")",
"new_action",
"=",
"{",
"'Password'",
"=>",
"password",
"}",
"userhref",
"=",
"userhref",
"(",
"'/redfish/v1/AccountService/Accounts/'",
",",
"username",
")",
"response",
"=",
"rest_patch",
"(",
"use... | Change the password for a user
@param [String, Symbol] username
@param [String, Symbol] password
@raise [RuntimeError] if the request failed
@return true | [
"Change",
"the",
"password",
"for",
"a",
"user"
] | ac171cd75d070ccf64017d43777ded40a5f018f9 | https://github.com/HewlettPackard/ilo-sdk-ruby/blob/ac171cd75d070ccf64017d43777ded40a5f018f9/lib/ilo-sdk/helpers/account_service_helper.rb#L53-L59 |
1,295 | HewlettPackard/ilo-sdk-ruby | lib/ilo-sdk/helpers/account_service_helper.rb | ILO_SDK.AccountServiceHelper.delete_user | def delete_user(username)
userhref = userhref('/redfish/v1/AccountService/Accounts/', username)
response = rest_delete(userhref)
response_handler(response)
true
end | ruby | def delete_user(username)
userhref = userhref('/redfish/v1/AccountService/Accounts/', username)
response = rest_delete(userhref)
response_handler(response)
true
end | [
"def",
"delete_user",
"(",
"username",
")",
"userhref",
"=",
"userhref",
"(",
"'/redfish/v1/AccountService/Accounts/'",
",",
"username",
")",
"response",
"=",
"rest_delete",
"(",
"userhref",
")",
"response_handler",
"(",
"response",
")",
"true",
"end"
] | Delete a specific user
@param [String, Symbol] username
@raise [RuntimeError] if the request failed
@return true | [
"Delete",
"a",
"specific",
"user"
] | ac171cd75d070ccf64017d43777ded40a5f018f9 | https://github.com/HewlettPackard/ilo-sdk-ruby/blob/ac171cd75d070ccf64017d43777ded40a5f018f9/lib/ilo-sdk/helpers/account_service_helper.rb#L65-L70 |
1,296 | nledez/proxmox | lib/proxmox.rb | Proxmox.Proxmox.templates | def templates
data = http_action_get "nodes/#{@node}/storage/local/content"
template_list = {}
data.each do |ve|
name = ve['volid'].gsub(%r{local:vztmpl\/(.*).tar.gz}, '\1')
template_list[name] = ve
end
template_list
end | ruby | def templates
data = http_action_get "nodes/#{@node}/storage/local/content"
template_list = {}
data.each do |ve|
name = ve['volid'].gsub(%r{local:vztmpl\/(.*).tar.gz}, '\1')
template_list[name] = ve
end
template_list
end | [
"def",
"templates",
"data",
"=",
"http_action_get",
"\"nodes/#{@node}/storage/local/content\"",
"template_list",
"=",
"{",
"}",
"data",
".",
"each",
"do",
"|",
"ve",
"|",
"name",
"=",
"ve",
"[",
"'volid'",
"]",
".",
"gsub",
"(",
"%r{",
"\\/",
"}",
",",
"'\... | Get template list
:call-seq:
templates -> Hash
Return a Hash of all templates
Example:
templates
Example return:
{
'ubuntu-10.04-standard_10.04-4_i386' => {
'format' => 'tgz',
'content' => 'vztmpl',
'volid' => 'local:vztmpl/ubuntu-10.04-standard_10.04-4_i386.tar.gz',
... | [
"Get",
"template",
"list"
] | cc679cc69deb78b20f88074b235e172869070a0d | https://github.com/nledez/proxmox/blob/cc679cc69deb78b20f88074b235e172869070a0d/lib/proxmox.rb#L108-L116 |
1,297 | nledez/proxmox | lib/proxmox.rb | Proxmox.Proxmox.openvz_get | def openvz_get
data = http_action_get "nodes/#{@node}/openvz"
ve_list = {}
data.each do |ve|
ve_list[ve['vmid']] = ve
end
ve_list
end | ruby | def openvz_get
data = http_action_get "nodes/#{@node}/openvz"
ve_list = {}
data.each do |ve|
ve_list[ve['vmid']] = ve
end
ve_list
end | [
"def",
"openvz_get",
"data",
"=",
"http_action_get",
"\"nodes/#{@node}/openvz\"",
"ve_list",
"=",
"{",
"}",
"data",
".",
"each",
"do",
"|",
"ve",
"|",
"ve_list",
"[",
"ve",
"[",
"'vmid'",
"]",
"]",
"=",
"ve",
"end",
"ve_list",
"end"
] | Get CT list
:call-seq:
openvz_get -> Hash
Return a Hash of all openvz container
Example:
openvz_get
Example return:
{
'101' => {
'maxswap' => 536870912,
'disk' => 405168128,
'ip' => '192.168.1.5',
'status' => 'running',
'netout' => 272,
... | [
"Get",
"CT",
"list"
] | cc679cc69deb78b20f88074b235e172869070a0d | https://github.com/nledez/proxmox/blob/cc679cc69deb78b20f88074b235e172869070a0d/lib/proxmox.rb#L155-L162 |
1,298 | nledez/proxmox | lib/proxmox.rb | Proxmox.Proxmox.openvz_post | def openvz_post(ostemplate, vmid, config = {})
config['vmid'] = vmid
config['ostemplate'] = "local%3Avztmpl%2F#{ostemplate}.tar.gz"
vm_definition = config.to_a.map { |v| v.join '=' }.join '&'
http_action_post("nodes/#{@node}/openvz", vm_definition)
end | ruby | def openvz_post(ostemplate, vmid, config = {})
config['vmid'] = vmid
config['ostemplate'] = "local%3Avztmpl%2F#{ostemplate}.tar.gz"
vm_definition = config.to_a.map { |v| v.join '=' }.join '&'
http_action_post("nodes/#{@node}/openvz", vm_definition)
end | [
"def",
"openvz_post",
"(",
"ostemplate",
",",
"vmid",
",",
"config",
"=",
"{",
"}",
")",
"config",
"[",
"'vmid'",
"]",
"=",
"vmid",
"config",
"[",
"'ostemplate'",
"]",
"=",
"\"local%3Avztmpl%2F#{ostemplate}.tar.gz\"",
"vm_definition",
"=",
"config",
".",
"to_a... | Create CT container
:call-seq:
openvz_post(ostemplate, vmid) -> String
openvz_post(ostemplate, vmid, options) -> String
Return a String as task ID
Examples:
openvz_post('ubuntu-10.04-standard_10.04-4_i386', 200)
openvz_post('ubuntu-10.04-standard_10.04-4_i386', 200, {'hostname' => 'test.test.com', 'p... | [
"Create",
"CT",
"container"
] | cc679cc69deb78b20f88074b235e172869070a0d | https://github.com/nledez/proxmox/blob/cc679cc69deb78b20f88074b235e172869070a0d/lib/proxmox.rb#L181-L187 |
1,299 | nledez/proxmox | lib/proxmox.rb | Proxmox.Proxmox.create_ticket | def create_ticket
post_param = { username: @username, realm: @realm, password: @password }
@site['access/ticket'].post post_param do |response, _request, _result, &_block|
if response.code == 200
extract_ticket response
else
@connection_status = 'error'
end
... | ruby | def create_ticket
post_param = { username: @username, realm: @realm, password: @password }
@site['access/ticket'].post post_param do |response, _request, _result, &_block|
if response.code == 200
extract_ticket response
else
@connection_status = 'error'
end
... | [
"def",
"create_ticket",
"post_param",
"=",
"{",
"username",
":",
"@username",
",",
"realm",
":",
"@realm",
",",
"password",
":",
"@password",
"}",
"@site",
"[",
"'access/ticket'",
"]",
".",
"post",
"post_param",
"do",
"|",
"response",
",",
"_request",
",",
... | Methods manages auth | [
"Methods",
"manages",
"auth"
] | cc679cc69deb78b20f88074b235e172869070a0d | https://github.com/nledez/proxmox/blob/cc679cc69deb78b20f88074b235e172869070a0d/lib/proxmox.rb#L340-L349 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.