From 47b8755cbdc034cf4b47e7ba0c249f7bb06b8fed Mon Sep 17 00:00:00 2001 From: Bo Anderson Date: Sun, 5 Nov 2023 00:12:24 +0000 Subject: [PATCH] Orka 2.4.0 support --- Gemfile.lock | 2 +- lib/orka_api_client/client.rb | 125 +++++++++++++----- lib/orka_api_client/models/image.rb | 2 - lib/orka_api_client/models/log_entry.rb | 99 -------------- lib/orka_api_client/models/node.rb | 13 +- .../models/vm_configuration.rb | 25 +++- .../models/vm_deployment_result.rb | 4 + lib/orka_api_client/models/vm_instance.rb | 105 +-------------- lib/orka_api_client/models/vm_resource.rb | 22 ++- lib/orka_api_client/version.rb | 4 +- 10 files changed, 147 insertions(+), 254 deletions(-) delete mode 100644 lib/orka_api_client/models/log_entry.rb diff --git a/Gemfile.lock b/Gemfile.lock index 365af90..a19f993 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - orka_api_client (0.1.0) + orka_api_client (0.2.0) faraday (~> 2.0) faraday-multipart (~> 1.0) diff --git a/lib/orka_api_client/client.rb b/lib/orka_api_client/client.rb index 4431f3f..0fca9e0 100644 --- a/lib/orka_api_client/client.rb +++ b/lib/orka_api_client/client.rb @@ -12,7 +12,6 @@ require_relative "models/iso" require_relative "models/remote_iso" require_relative "models/kube_account" -require_relative "models/log_entry" require_relative "models/token_info" require_relative "models/password_requirements" @@ -279,28 +278,33 @@ def vm_configuration(name) # @param [Models::Image, String] attached_disk An additional storage disk to attach to the VM on deployment. The # option is supported for VMs deployed on Intel nodes only. # @param [Boolean] vnc_console By default, +true+. Enables or disables VNC for the VM configuration. You can - # override on deployment of specific VMs. The option is supported for VMs deployed on Intel nodes only. + # override on deployment of specific VMs. # @param [String] system_serial Assign an owned macOS system serial number to the VM configuration. The option is # supported for VMs deployed on Intel nodes only. # @param [Boolean] io_boost By default, +false+ for VM configurations created before Orka 1.5. Default value for # VM configurations created with Orka 1.5 or later depends on the cluster default. Enables or disables IO # performance improvements for the VM configuration. The option is supported for VMs deployed on Intel nodes # only. + # @param [Boolean] net_boost By default, +false+ for VM configurations created before Orka 2.3.0. Default value + # for VM configurations created with Orka 2.3.0 or later depends on the cluster default. Enables or disables + # network performance improvements for the VM configuration. The option is supported for VMs deployed on Intel + # nodes only. # @param [Boolean] gpu_passthrough Enables or disables GPU passthrough for the VM. When enabled, +vnc_console+ is - # automatically disabled. The option is supported for VMs deployed on Intel nodes only. GPU passthrough is an - # experimental feature. GPU passthrough must first be enabled in your cluster. + # automatically disabled. The option is supported for VMs deployed on Intel nodes only. GPU passthrough must + # first be enabled in your cluster. # @param [String] tag When specified, the VM is preferred to be deployed to a node marked with this tag. # @param [Boolean] tag_required By default, +false+. When set to +true+, the VM is required to be deployed to a # node marked with this tag. # @param [Symbol] scheduler Possible values are +:default+ and +:most-allocated+. By default, +:default+. When # set to +:most-allocated+ VMs deployed from the VM configuration will be scheduled to nodes having most of # their resources allocated. +:default+ keeps used vs free resources balanced between the nodes. + # @param [Numeric] memory # @return [Models::VMConfiguration] The lazily-loaded VM configuration. def create_vm_configuraton(name, base_image:, snapshot_image:, cpu_cores:, vcpu_count:, iso_image: nil, attached_disk: nil, vnc_console: nil, - system_serial: nil, io_boost: nil, gpu_passthrough: nil, - tag: nil, tag_required: nil, scheduler: nil) + system_serial: nil, io_boost: nil, net_boost: nil, gpu_passthrough: nil, + tag: nil, tag_required: nil, scheduler: nil, memory: nil) body = { orka_vm_name: name, orka_base_image: base_image.is_a?(Models::Image) ? base_image.name : base_image, @@ -312,10 +316,12 @@ def create_vm_configuraton(name, vnc_console: vnc_console, system_serial: system_serial, io_boost: io_boost, + net_boost: net_boost, gpu_passthrough: gpu_passthrough, tag: tag, tag_required: tag_required, scheduler: scheduler.to_s, + memory: memory, }.compact @conn.post("resources/vm/create", body) do |r| r.options.context = { @@ -488,6 +494,8 @@ def upload_image(file, name: nil) # # @macro lazy_enumerator # + # @note All ISO requests are supported for Intel nodes only. + # # @return [Models::Enumerator] The enumerator of the ISO list. def isos Models::Enumerator.new do @@ -506,6 +514,8 @@ def isos # # @macro lazy_object # + # @note All ISO requests are supported for Intel nodes only. + # # @param [String] name The name of the ISO to fetch. # @return [Models::ISO] The lazily-loaded ISO. def iso(name) @@ -521,6 +531,8 @@ def iso(name) # # @macro lazy_enumerator # + # @note All ISO requests are supported for Intel nodes only. + # # @return [Models::Enumerator] The enumerator of the remote ISO list. def remote_isos Models::Enumerator.new do @@ -538,6 +550,8 @@ def remote_isos # Note that this method does not perform any network requests and does not verify if the name supplied actually # exists in the Orka remote repo. # + # @note All ISO requests are supported for Intel nodes only. + # # @param [String] name The name of the remote ISO. # @return [Models::RemoteISO] The remote ISO object. def remote_iso(name) @@ -548,6 +562,8 @@ def remote_iso(name) # # @macro auth_token # + # @note All ISO requests are supported for Intel nodes only. + # # @param [String, IO] file The string file path or an open IO object to the ISO to upload. # @param [String] name The name to give to this ISO. Defaults to the local filename. # @return [Models::ISO] The new lazily-loaded ISO. @@ -658,34 +674,21 @@ def delete_all_kube_accounts(user: nil) # # @macro auth_license # - # @macro lazy_enumerator - # - # @param [Integer] limit Limit the amount of results returned to this amount. - # @return [Models::Enumerator] The enumerator of the log entries list. - def logs(limit: nil) - Models::Enumerator.new do - logs = @conn.post("logs/query") do |r| - r.params[:limit] = limit unless limit.nil? - - r.options.context = { - orka_auth_type: :license, - } - end.body["logs"] - logs.map { |hash| Models::LogEntry.new(hash) } - end - end + # @param [Integer] limit Limit the amount of results returned to this quantity. + # @param [DateTime] start Limit the results to be log entries after this date. + # @param [String] query The LogQL query to filter by. Defaults to +{log_type="user_logs"}+. + # @return [Hash] A raw Grafana Loki query result payload. Parsing this is out-of-scope for this gem. + def logs(limit: nil, start: nil, query: nil) + @conn.post("logs/query") do |r| + r.params[:logs20] = "true" + r.params[:limit] = limit unless limit.nil? + r.params[:start] = start.rfc3339 unless start.nil? + r.params[:query] = query unless query.nil? - # Delete all logs for your Orka environment. - # - # @macro auth_token_and_license - # - # @return [void] - def delete_logs - @conn.delete("logs") do |r| r.options.context = { - orka_auth_type: [:license, :token], + orka_auth_type: :license, } - end + end.body end # @!endgroup @@ -706,13 +709,34 @@ def token_info Models::TokenInfo.new(body, conn: @conn) end + # Retrieve detailed information about the health of your Orka environment. + # + # @macro auth_none + # + # @return [Hash] The status information on different components of your environment. + def environment_status + @conn.get("health-check").body["status"] + end + # Retrieve the current API version of your Orka environment. # # @macro auth_none # # @return [String] The remote API version. def remote_api_version - @conn.get("health-check").body["api_version"] + @conn.get("version").body["api_version"] + end + + # Retrieve the current version of the components in your Orka environment. + # + # @macro auth_none + # + # @return [Hash{String => String}] The version of each component. + def environment_component_versions + @conn.get("version", { all: "true" }).body.filter_map do |key, value| + new_key = key.delete_suffix("_version") + [new_key, value] if new_key != key + end.to_h end # Retrieve the current password requirements for creating an Orka user. @@ -749,7 +773,42 @@ def license_key_valid?(license_key = @license_key) # # @return [Models::Image] The lazily-loaded default base image object. def default_base_image - Image.lazy_prepare(name: @conn.get("default-base-image").body["default_base_image"], conn: @conn) + Models::Image.lazy_prepare(name: @conn.get("default-base-image").body["default_base_image"], conn: @conn) + end + + # Upload a custom TLS certificate and its private key in PEM format from your computer to your cluster. You can + # then access Orka via {https://orkadocs.macstadium.com/docs/custom-tls-certificate external custom domain}. + # + # The certificate and the key must meet the following requirements: + # + # * Both files are in PEM format. + # * The private key is not passphrase protected. + # * The certificate might be any of the following: + # * A single domain certificate (e.g. +company.com+). + # * Multi-domain certificate (e.g. +app1.company.com+, +app2.company.com+, and so on). + # * Wildcard TLS certificate (e.g. +*.company.com+). If containing an asterisk, it must be a single asterisk + # and must be in the leftmost position of the domain name. For example: You cannot use a +*.*.company.com+ + # certificate to work with Orka. + # * A certificate chain (bundle) that contains your server, intermediates, and root certificates concatenated + # (in the proper order) into one file. + # * The certificate must be a domain certificate issued by a certificate authority for a registered domain OR a + # self-signed certificate for any domain + # ({https://orkadocs.macstadium.com/docs/custom-tls-certificate#32-create-a-local-mapping for local use only}). + # + # @macro auth_token_and_license + # + # @param [String, IO] cert The string file path or an open IO object to the certificate. + # @param [String, IO] key The string file path or an open IO object to the key. + # @return [void] + def upload_tls_certificate(cert, key) + cert_part = Faraday::Multipart::FilePart.new(cert, "application/x-pem-file") + key_part = Faraday::Multipart::FilePart.new(key, "application/x-pem-file") + body = { certPath: cert_part, keyPath: key_part } + @conn.post("resources/cert/set", body, "Content-Type" => "multipart/form-data") do |r| + r.options.context = { + orka_auth_type: [:token, :license], + } + end end # @!endgroup diff --git a/lib/orka_api_client/models/image.rb b/lib/orka_api_client/models/image.rb index b9963e2..513e8c4 100644 --- a/lib/orka_api_client/models/image.rb +++ b/lib/orka_api_client/models/image.rb @@ -75,8 +75,6 @@ def rename(new_name) # # @macro auth_token # - # @note This request is supported for Intel images only. Intel images have +.img+ extension. - # # @param [String] new_name The name for the copy of this image. # @return [Image] The lazily-loaded image copy. def copy(new_name) diff --git a/lib/orka_api_client/models/log_entry.rb b/lib/orka_api_client/models/log_entry.rb deleted file mode 100644 index 7a4ba78..0000000 --- a/lib/orka_api_client/models/log_entry.rb +++ /dev/null @@ -1,99 +0,0 @@ -# frozen_string_literal: true - -module OrkaAPI - module Models - # A particular log event. - class LogEntry - # Information on the request element of a log event. - class Request - # @return [Hash] The body of the request. - attr_reader :body - - # @return [Hash{String => String}] The headers of the request. - attr_reader :headers - - # @return [String] The HTTP method used for the request. - attr_reader :method - - # @return [String] The request URL. - attr_reader :url - - # @api private - # @param [Hash] hash - def initialize(hash) - @body = hash["body"] - @headers = hash["headers"] - @method = hash["method"] - @url = hash["url"] - end - end - - # Information on the response element of a log event. - class Response - # @return [Hash] The body of the response. - attr_reader :body - - # @return [Hash{String => String}] The headers of the response. - attr_reader :headers - - # @return [Integer] The resultant HTTP status code of the response. - attr_reader :status_code - - # @api private - # @param [Hash] hash - def initialize(hash) - @body = hash["body"] - @headers = hash["headers"] - @status_code = hash["statusCode"] - end - end - - # Information on the user responsible for the log event. - class User - # @return [String] The user's email. - attr_reader :email - - # @return [String] The user's ID. - attr_reader :id - - # @api private - # @param [Hash] hash - def initialize(hash) - @email = hash["email"] - @id = hash["id"] - end - end - - # @return [DateTime] The time the log entry was created. - attr_reader :creation_time - - # @return [String] The ID of the log entry. - attr_reader :id - - # @return [Request] The HTTP request made. - attr_reader :request - - # @return [Response] The HTTP response returned. - attr_reader :response - - # @return [LogEntry::User, nil] The user which performed the action, if authenticated. - attr_reader :user - - # @api private - # @param [Hash] hash - def initialize(hash) - raise UnrecognisedStateError, "Unknown log version." if hash["logVersion"] != "1.0" - - @creation_time = DateTime.iso8601(hash["createdAt"]) - @id = hash["id"] - @request = Request.new(hash["request"]) - @response = Response.new(hash["response"]) - @user = if hash["user"].empty? - nil - else - User.new(hash["user"]) - end - end - end - end -end diff --git a/lib/orka_api_client/models/node.rb b/lib/orka_api_client/models/node.rb index f987b6a..1991571 100644 --- a/lib/orka_api_client/models/node.rb +++ b/lib/orka_api_client/models/node.rb @@ -42,6 +42,9 @@ class Node < LazyModel # @return [String] The total amount of RAM on this node. lazy_attr :total_memory + # @return [String] The type of this node (WORKER, FOUNDATION, SANDBOX). + lazy_attr :type + # @return [String] The state of this node. lazy_attr :state @@ -157,8 +160,6 @@ def disable_sandbox # # @macro auth_token_and_license # - # @note This is a BETA feature. - # # @param [String, nil] group The user group to dedicate the node to. # @return [void] def dedicate_to_group(group) @@ -175,14 +176,13 @@ def dedicate_to_group(group) # # @macro auth_token_and_license # - # @note This is a BETA feature. - # # @return [void] def remove_group_dedication dedicate_to_group(nil) end - # Mark a node with a custom tag. This allows when deploying a VM to target nodes having this custom tag. + # Assign the specified tag to the specified node (enable node affinity). When node affinity is configured, + # Orka first attempts to deploy to the specified node or group of nodes, before moving to any other nodes. # # @macro auth_token_and_license # @@ -200,7 +200,7 @@ def tag(tag_name) @tags << tag_name end - # Remove a custom tag from a certain node. + # Remove the specified tag from the specified node. # # @macro auth_token_and_license # @@ -260,6 +260,7 @@ def deserialize(hash) @available_memory = hash["available_memory"] @total_cpu_cores = hash["total_cpu"] @total_memory = hash["total_memory"] + @type = hash["node_type"] @state = hash["state"] @orka_group = hash["orka_group"] @tags = hash["orka_tags"] diff --git a/lib/orka_api_client/models/vm_configuration.rb b/lib/orka_api_client/models/vm_configuration.rb index 914c584..39f2d0f 100644 --- a/lib/orka_api_client/models/vm_configuration.rb +++ b/lib/orka_api_client/models/vm_configuration.rb @@ -42,6 +42,9 @@ class VMConfiguration < LazyModel # @return [Boolean] True if IO boost should be enabled for deployed VMs of this configuration. lazy_attr :io_boost? + # @return [Boolean] True if network boost should be enabled for deployed VMs of this configuration. + lazy_attr :net_boost? + # @return [Boolean] True if deployed VMs of this configuration should use a prior saved state (created via # {VMInstance#save_state}) rather than a clean base image. lazy_attr :use_saved_state? @@ -61,6 +64,10 @@ class VMConfiguration < LazyModel # @return [Symbol] The scheduler mode chosen for VM deployment. Can be either +:default+ or +:most_allocated+. lazy_attr :scheduler + # @return [Numeric, nil] The amount of RAM this VM is assigned to take, in gigabytes. If not set, Orka will + # automatically select a value when deploying. + lazy_attr :memory + # @api private # @param [String] name # @param [Connection] conn @@ -97,7 +104,9 @@ def initialize(conn:, name: nil, hash: nil) # to accommodate the VM. # @param [Integer] replicas The scale at which to deploy the VM configuration. If not specified, defaults to # +1+ (non-scaled). The option is supported for VMs deployed on Intel nodes only. - # @param [Array] reserved_ports One or more port mappings that enable additional ports on your VM. + # @param [Array] reserved_ports One or more port mappings that forward traffic to the specified + # ports on the VM. The following ports and port ranges are reserved and cannot be used: +22+, +443+, +6443+, + # +5000-5014+, +5999-6013+, +8822-8836+. # @param [Boolean] iso_install Set to +true+ if you want to use an ISO. The option is supported for VMs # deployed on Intel nodes only. # @param [Models::ISO, String] iso_image An ISO to attach to the VM during deployment. If already set in the @@ -113,9 +122,9 @@ def initialize(conn:, name: nil, hash: nil) # @param [Boolean] vnc_console Enables or disables VNC for the VM. If not set in the VM configuration or here, # defaults to +true+. If already set in the respective VM configuration and not set here, Orka applies the # setting from the VM configuration. You can also use this field to override the VNC setting specified in the - # VM configuration. The option is supported for VMs deployed on Intel nodes only. + # VM configuration. # @param [Hash{String => String}] vm_metadata Inject custom metadata to the VM. If not set, only the built-in - # metadata is injected into the VM. The option is supported for VMs deployed on Intel nodes only. + # metadata is injected into the VM. # @param [String] system_serial Assign an owned macOS system serial number to the VM. If already set in the # respective VM configuration and not set here, Orka applies the setting from the VM configuration. The # option is supported for VMs deployed on Intel nodes only. @@ -123,8 +132,8 @@ def initialize(conn:, name: nil, hash: nil) # configuration or here, defaults to +false+. If already set in the respective VM configuration and not set # here, Orka applies the setting from the VM configuration. You can also use this field to override the GPU # passthrough setting specified in the VM configuration. When enabled, +vnc_console+ is automatically - # disabled. The option is supported for VMs deployed on Intel nodes only. GPU passthrough is an experimental - # feature. GPU passthrough must first be enabled in your cluster. + # disabled. The option is supported for VMs deployed on Intel nodes only. GPU passthrough must first be + # enabled in your cluster. # @param [String] tag When specified, the VM is preferred to be deployed to a node marked with this tag. # @param [Boolean] tag_required By default, +false+. When set to +true+, the VM is required to be deployed to a # node marked with this tag. @@ -217,6 +226,7 @@ def deserialize(hash) end @vnc_console = hash["vnc_console"] @io_boost = hash["io_boost"] + @net_boost = hash["net_boost"] @use_saved_state = hash["use_saved_state"] @gpu_passthrough = hash["gpu_passthrough"] @system_serial = if hash["system_serial"] == "N/A" @@ -235,6 +245,11 @@ def deserialize(hash) else hash["scheduler"].tr("-", "_").to_sym end + @memory = if hash["memory"] == "automatic" + nil + else + hash["memory"] + end end end end diff --git a/lib/orka_api_client/models/vm_deployment_result.rb b/lib/orka_api_client/models/vm_deployment_result.rb index 4a2631e..ed9684b 100644 --- a/lib/orka_api_client/models/vm_deployment_result.rb +++ b/lib/orka_api_client/models/vm_deployment_result.rb @@ -32,6 +32,9 @@ class VMDeploymentResult # @return [Boolean] True if IO boost is enabled for this VM. attr_predicate :io_boost + # @return [Boolean] True if network boost is enabled for this VM. + attr_predicate :io_boost + # @return [Boolean] True if this VM is using a prior saved state rather than a clean base image. attr_predicate :use_saved_state @@ -55,6 +58,7 @@ def initialize(hash, conn:, admin: false) @resource = Models::VMResource.lazy_prepare(name: hash["vm_id"], conn: conn, admin: admin) # TODO: port_warnings? @io_boost = hash["io_boost"] + @net_boost = hash["net_boost"] @use_saved_state = if hash["use_saved_state"] == "N/A" false else diff --git a/lib/orka_api_client/models/vm_instance.rb b/lib/orka_api_client/models/vm_instance.rb index ffff53c..d531c83 100644 --- a/lib/orka_api_client/models/vm_instance.rb +++ b/lib/orka_api_client/models/vm_instance.rb @@ -66,6 +66,9 @@ class VMInstance # @return [Boolean] True if IO boost is enabled for this VM. attr_predicate :io_boost + # @return [Boolean] True if network boost is enabled for this VM. + attr_predicate :net_boost + # @return [Boolean] True if this VM is using a prior saved state rather than a clean base image. attr_predicate :use_saved_state @@ -276,105 +279,6 @@ def attach_disk(image:, mount_point:) end end - # Scale the VM to the specified number of replicas. - # - # When you are working with scaled VMs, the following limitations are in place: - # - # * Some operations are not available for scaled VMs (saving an image, committing changes to a base image, - # cloning a VM, migrating a VM). - # * If you specify a node during deployment, scaling is limited to the resources of that node and will not - # create new replicas on other nodes. - # * All replicas share the same ID. - # * When you scale down, you have no control over which replicas will be destroyed and which ones will be - # preserved. This might result in loss of data. - # * When you scale up, newly deployed replicas use the base image of the original VM config. Changes from any - # other running replicas are not applied to the new replicas. - # * Deleting a VM deletes all replicas. - # - # @macro auth_token - # - # @note This request is supported for VMs deployed on Intel nodes only. - # - # @param [Integer] replicas The number of replicas to scale to. - # @return [void] - def scale(replicas) - body = { - orka_vm_name: @id, - replicas: replicas, - }.compact - @conn.patch("resources/vm/scale", body) do |r| - r.options.context = { - orka_auth_type: :token, - } - end - end - - # Un-scale a scaled VM. This removes any additional replicas of the VM and leaves only one running copy. - # - # When you scale down, you have no control over which replicas will be destroyed and which one will be - # preserved. This might result in loss of data. - # - # @macro auth_token - # - # @note This request is supported for VMs deployed on Intel nodes only. - # - # @return [void] - def unscale - scale(1) - end - - # Migrate the VM from its {#node current node} to another destination node. The destination node should be - # different from the source node. - # - # This operation changes the IP of the migrated VM and might change its assigned ports. This operation removes - # the VM from the source node. - # - # @macro auth_token - # - # @macro vm_instance_state_note - # - # @note This request is supported for VMs deployed on Intel nodes only. - # - # @param [Node, String] destination_node The node to migrate the VM to. - # @return [void] - def migrate(destination_node) - body = { - orka_vm_name: @id, - current_node_name: @node.name, - new_nodes: [destination_node.is_a?(Node) ? node.name : node], - }.compact - @conn.post("resources/vm/migrate", body) do |r| - r.options.context = { - orka_auth_type: :token, - } - end - end - - # Clone the VM from its {#node current node} to another destination node. The destination node should be - # different from the source node. - # - # This operation retains the VM on the source node. The clone receives a new ID and might receive a new IP and - # assigned ports, based on the destination node. - # - # @macro auth_token - # - # @note This request is supported for VMs deployed on Intel nodes only. - # - # @param [Node, String] destination_node The node to migrate the VM to. - # @return [void] - def clone(destination_node) - body = { - orka_vm_name: @id, - current_node_name: @node.name, - new_nodes: [destination_node.is_a?(Node) ? node.name : node], - }.compact - @conn.post("resources/vm/clone", body) do |r| - r.options.context = { - orka_auth_type: :token, - } - end - end - # Save the VM configuration state (disk and memory). # # If VM state is previously saved, it is overwritten. To overwrite the VM state, it must not be used by any @@ -446,8 +350,6 @@ def save_new_base_image(image_name) # # @macro auth_token # - # @note This request is supported for Intel images only. Intel images have +.img+ extension. - # # @param [String] username The username of the VM user. # @param [String] password The password of the VM user. # @param [String] image_name The new name for the resized image. @@ -494,6 +396,7 @@ def deserialize(hash) @configuration_template = hash["configuration_template"] @status = hash["vm_status"] @io_boost = hash["io_boost"] + @net_boost = hash["net_boost"] @use_saved_state = hash["use_saved_state"] @reserved_ports = hash["reserved_ports"].map do |mapping| ProtocolPortMapping.new( diff --git a/lib/orka_api_client/models/vm_resource.rb b/lib/orka_api_client/models/vm_resource.rb index 0aa772e..dd6baa5 100644 --- a/lib/orka_api_client/models/vm_resource.rb +++ b/lib/orka_api_client/models/vm_resource.rb @@ -40,6 +40,10 @@ class VMResource < LazyModel # +nil+ if {#deployed?} is +true+. lazy_attr :io_boost? + # @return [Boolean, nil] True if network boost is enabled, specified by the associated VM configuration. This is + # +nil+ if {#deployed?} is +true+. + lazy_attr :net_boost? + # @return [Boolean, nil] True if the saved state should be used rather than cleanly from the base image, # specified by the associated VM configuration. This is +nil+ if {#deployed?} is +true+. lazy_attr :use_saved_state? @@ -51,6 +55,10 @@ class VMResource < LazyModel # @return [String, nil] lazy_attr :configuration_template + # @return [String, nil] The amount of RAM assigned for this VM, if it has been manually configured in advance of + # deployment. This is always +nil+ if {#deployed?} is +true+. + lazy_attr :ram + # @api private # @param [String] name # @param [Connection] conn @@ -98,7 +106,9 @@ def initialize(conn:, name: nil, hash: nil, admin: false) # to accommodate the VM. # @param [Integer] replicas The scale at which to deploy the VM configuration. If not specified, defaults to # +1+ (non-scaled). The option is supported for VMs deployed on Intel nodes only. - # @param [Array] reserved_ports One or more port mappings that enable additional ports on your VM. + # @param [Array] reserved_ports One or more port mappings that forward traffic to the specified + # ports on the VM. The following ports and port ranges are reserved and cannot be used: +22+, +443+, +6443+, + # +5000-5014+, +5999-6013+, +8822-8836+. # @param [Boolean] iso_install Set to +true+ if you want to use an ISO. The option is supported for VMs # deployed on Intel nodes only. # @param [Models::ISO, String] iso_image An ISO to attach to the VM during deployment. If already set in the @@ -114,9 +124,9 @@ def initialize(conn:, name: nil, hash: nil, admin: false) # @param [Boolean] vnc_console Enables or disables VNC for the VM. If not set in the VM configuration or here, # defaults to +true+. If already set in the respective VM configuration and not set here, Orka applies the # setting from the VM configuration. You can also use this field to override the VNC setting specified in the - # VM configuration. The option is supported for VMs deployed on Intel nodes only. + # VM configuration. # @param [Hash{String => String}] vm_metadata Inject custom metadata to the VM. If not set, only the built-in - # metadata is injected into the VM. The option is supported for VMs deployed on Intel nodes only. + # metadata is injected into the VM. # @param [String] system_serial Assign an owned macOS system serial number to the VM. If already set in the # respective VM configuration and not set here, Orka applies the setting from the VM configuration. The # option is supported for VMs deployed on Intel nodes only. @@ -124,8 +134,8 @@ def initialize(conn:, name: nil, hash: nil, admin: false) # configuration or here, defaults to +false+. If already set in the respective VM configuration and not set # here, Orka applies the setting from the VM configuration. You can also use this field to override the GPU # passthrough setting specified in the VM configuration. When enabled, +vnc_console+ is automatically - # disabled. The option is supported for VMs deployed on Intel nodes only. GPU passthrough is an experimental - # feature. GPU passthrough must first be enabled in your cluster. + # disabled. The option is supported for VMs deployed on Intel nodes only. GPU passthrough must first be + # enabled in your cluster. # @param [String] tag When specified, the VM is preferred to be deployed to a node marked with this tag. # @param [Boolean] tag_required By default, +false+. When set to +true+, the VM is required to be deployed to a # node marked with this tag. @@ -377,9 +387,11 @@ def deserialize(hash) @base_image = Image.lazy_prepare(name: hash["base_image"], conn: @conn) @config = VMConfiguration.lazy_prepare(name: hash["image"], conn: @conn) @io_boost = hash["io_boost"] + @net_boost = hash["net_boost"] @use_saved_state = hash["use_saved_state"] @gpu_passthrough = hash["gpu_passthrough"] @configuration_template = hash["configuration_template"] + @ram = hash["RAM"] end end end diff --git a/lib/orka_api_client/version.rb b/lib/orka_api_client/version.rb index a800768..bffdce2 100644 --- a/lib/orka_api_client/version.rb +++ b/lib/orka_api_client/version.rb @@ -3,10 +3,10 @@ module OrkaAPI class Client # The version of this gem. - VERSION = "0.1.0" + VERSION = "0.2.0" # The Orka API version this gem supports. Support for other versions is not guaranteed, in particular older # versions. - API_VERSION = "2.0.0" + API_VERSION = "2.4.0" end end