Method: Hyperb::Funcs#create_func
- Defined in:
- lib/hyperb/funcs/funcs.rb
#create_func(params = {}) ⇒ Object
create a func
to run the function (e.g. s1,s2, s3, s4, m1, m2, m3, l1, l2, l3)
object in the form of: “ExposedPorts”: { “<port>/<tcp|udp>: {}” }
Parameters:
-
params
(Hash)
(defaults to: {})
—
A customizable set of params.
-
params
(defaults to: {})
—
:name [String] the function name.
-
params
(defaults to: {})
—
:container_size [String] the size of containers
-
params
(defaults to: {})
—
:timeout [String] default is 300 seconds, maximum is 86400 seconds.
-
params
(defaults to: {})
—
:uuid [String] The uuid of function.
-
params
(defaults to: {})
—
:config [Hash] func configurations
-
params
(defaults to: {})
—
config :tty [Boolean] attach streams to a tty
-
params
(defaults to: {})
—
config :exposed_ports [Hash] an object mapping ports to an empty
-
params
(defaults to: {})
—
config :env [Array] list of env vars, “VAR=VALUE”
-
params
(defaults to: {})
—
config :cmd [Array|String] list of env vars, “VAR=VALUE”
-
params
(defaults to: {})
—
config :image [String] image to run
-
params
(defaults to: {})
—
config :entrypoint [String] entrypoint
-
params
(defaults to: {})
—
config :working_dir [String] working directory
-
params
(defaults to: {})
—
config :labels [Hash] labels
-
params
(defaults to: {})
—
:host_config [Hash] func host configurations
-
params
(defaults to: {})
—
host_config :links [Array] list of links
-
params
(defaults to: {})
—
host_config :port_bindings [Hash]
-
params
(defaults to: {})
—
host_config :publish_all_ports [Boolean]
-
params
(defaults to: {})
—
host_config :volumes_from [Array]
-
params
(defaults to: {})
—
host_config :network_mode [String]
Raises:
-
(Hyperb::Error::Unauthorized)
—
raised when credentials are not valid.
-
(Hyperb::Error::Conflict)
—
raised when func already exist
-
(Hyperb::Error::BadRequest)
—
raised when a bad parameter is sent
-
(Hyperb::Error::InternalServerError)
—
server error on hyper side.
-
(ArgumentError)
—
when required arguments are not provided.
See Also:
80 81 82 83 84 85 86 87 88 |
# File 'lib/hyperb/funcs/funcs.rb', line 80 def create_func(params = {}) raise ArgumentError, 'Invalid arguments.' unless check_arguments(params, 'name') path = '/funcs/create' body = {} body.merge!(prepare_json(params)) Hyperb::Request.new(self, path, {}, 'post', body).perform end |