lib/vagrant-sakura/config.rb
# The ACCESS TOKEN to access Sakura Cloud API.
#
# @return [String]
The ACCESS TOKEN to access Sakura Cloud API.
The ACCESS TOKEN to access Sakura Cloud API .
def finalize!
        usacloud_config = get_usacloud_config(@config_path)
        if @access_token == UNSET_VALUE
          if usacloud_config.nil?
            @access_token = nil
          else
            @access_token = usacloud_config["AccessToken"]
          end
          @access_token = ENV['SAKURA_ACCESS_TOKEN'] if @access_token.nil?
          @access_token = ENV['SAKURACLOUD_ACCESS_TOKEN'] if @access_token.nil?
        end
        if @access_token_secret == UNSET_VALUE
          if usacloud_config.nil?
            @access_token_secret = nil
          else
            @access_token_secret = usacloud_config["AccessTokenSecret"]
          end
          @access_token_secret = ENV['SAKURA_ACCESS_TOKEN_SECRET'] if @access_token_secret.nil?
          @access_token_secret = ENV['SAKURACLOUD_ACCESS_TOKEN_SECRET'] if @access_token_secret.nil?
        end
        if @disk_id == UNSET_VALUE
          @disk_id = nil  
        end
        if @disk_plan == UNSET_VALUE
          @disk_plan = 4  
        end
        @disk_source_archive = nil if @disk_source_archive == UNSET_VALUE
        @os_type = nil if @os_type == UNSET_VALUE
        if @disk_source_archive.to_s.empty? && @os_type.to_s.empty?
          @os_type = "ubuntu"
        end
        @public_key_path = nil if @public_key_path == UNSET_VALUE
        if @server_name == UNSET_VALUE
          @server_name = nil
        end
        if @server_plan == UNSET_VALUE
          @server_plan = nil
        end
        if @server_core == UNSET_VALUE
          @server_core = 1
        end
        if @server_memory == UNSET_VALUE
          @server_memory = 1
        end
        @sshkey_id = nil if @sshkey_id == UNSET_VALUE
        @use_insecure_key = false if @use_insecure_key == UNSET_VALUE
        @enable_pw_auth = false if @enable_pw_auth == UNSET_VALUE
        @packet_filter = "" if @packet_filter == UNSET_VALUE
        @startup_scripts = [] if @startup_scripts == UNSET_VALUE
        @startup_scripts = [@startup_scripts] unless @startup_scripts.is_a?(Array)
        @startup_scripts.map! { |id| {"ID" => id.to_s} }
        if @zone_id == UNSET_VALUE
          if usacloud_config.nil?
            @zone_id = nil
          else
            @zone_id = usacloud_config["Zone"]
          end
          @zone_id = ENV['SAKURACLOUD_ZONE'] if @zone_id.nil?
          @zone_id = "is1b" if @zone_id.nil?
        end
        @tags = [] if @tags == UNSET_VALUE
        @tags = [@tags] unless @tags.is_a?(Array)
        @tags.map!(&:to_s)
        @description = "" if @description == UNSET_VALUE
        @description = @description.to_s
      end
def finalize! usacloud_config = get_usacloud_config ( @config_path ) if @access_token == UNSET_VALUE if usacloud_config . nil? @access_token = nil else @access_token = usacloud_config [ "AccessToken" ] end @access_token = ENV [ 'SAKURA_ACCESS_TOKEN' ] if @access_token . nil? @access_token = ENV [ 'SAKURACLOUD_ACCESS_TOKEN' ] if @access_token . nil? end if @access_token_secret == UNSET_VALUE if usacloud_config . nil? @access_token_secret = nil else @access_token_secret = usacloud_config [ "AccessTokenSecret" ] end @access_token_secret = ENV [ 'SAKURA_ACCESS_TOKEN_SECRET' ] if @access_token_secret . nil? @access_token_secret = ENV [ 'SAKURACLOUD_ACCESS_TOKEN_SECRET' ] if @access_token_secret . nil? end if @disk_id == UNSET_VALUE @disk_id = nil end if @disk_plan == UNSET_VALUE @disk_plan = 4 end @disk_source_archive = nil if @disk_source_archive == UNSET_VALUE @os_type = nil if @os_type == UNSET_VALUE if @disk_source_archive . to_s . empty? && @os_type . to_s . empty? @os_type = "ubuntu" end @public_key_path = nil if @public_key_path == UNSET_VALUE if @server_name == UNSET_VALUE @server_name = nil end if @server_plan == UNSET_VALUE @server_plan = nil end if @server_core == UNSET_VALUE @server_core = 1 end if @server_memory == UNSET_VALUE @server_memory = 1 end @sshkey_id = nil if @sshkey_id == UNSET_VALUE @use_insecure_key = false if @use_insecure_key == UNSET_VALUE @enable_pw_auth = false if @enable_pw_auth == UNSET_VALUE @packet_filter = "" if @packet_filter == UNSET_VALUE @startup_scripts = [ ] if @startup_scripts == UNSET_VALUE @startup_scripts = [ @startup_scripts ] unless @startup_scripts . is_a? ( Array ) @startup_scripts . map! { | id | { "ID" => id . to_s } } if @zone_id == UNSET_VALUE if usacloud_config . nil? @zone_id = nil else @zone_id = usacloud_config [ "Zone" ] end @zone_id = ENV [ 'SAKURACLOUD_ZONE' ] if @zone_id . nil? @zone_id = "is1b" if @zone_id . nil? end @tags = [ ] if @tags == UNSET_VALUE @tags = [ @tags ] unless @tags . is_a? ( Array ) @tags . map! ( & :to_s ) @description = "" if @description == UNSET_VALUE @description = @description . to_s end
The ACCESS TOKEN to access Sakura Cloud API.
The ACCESS TOKEN to access Sakura Cloud API .
# create a new disk # SSD
None
String