Module: OCI::Core::Util
- Defined in:
- lib/oci/core/util.rb
Overview
This module contains utility methods for dealing with Core Services (Compute, Block Volume and Networking)
Class Method Summary collapse
-
.file_content_as_launch_instance_user_data(file_path) ⇒ String
Takes a file path and returns a Base64-encoded string which can be provided as the value of the
user_data
key in themetadata
dictionary when launching an instance.
Class Method Details
.file_content_as_launch_instance_user_data(file_path) ⇒ String
Takes a file path and returns a Base64-encoded string which can be provided as the value of the user_data
key in the metadata
dictionary when launching an instance. See Models::LaunchInstanceDetails for more information.
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/oci/core/util.rb', line 18 def self.file_content_as_launch_instance_user_data(file_path) = File.(file_path) raise 'The specified file does not exist' unless File.exist?(file_path) file_content = nil File.open(, 'rb') do |file| file_content = file.read end Base64.strict_encode64(file_content) end |