Sha256: 3ab1cd48ab433a01b46ae3cc11923ebedcfcfe1a333278a01227ce5e83b2d981

Contents?: true

Size: 884 Bytes

Versions: 17

Compression:

Stored size: 884 Bytes

Contents

# frozen_string_literal: true

require 'uffizzi/helpers/config_helper'

class ClusterCommonService
  class << self
    def save_previous_current_context(kubeconfig_path, current_context)
      return if kubeconfig_path.nil? || Uffizzi::ConfigHelper.previous_current_context_by_path(kubeconfig_path).present?

      previous_current_contexts = Uffizzi::ConfigHelper.set_previous_current_context_by_path(kubeconfig_path, current_context)
      Uffizzi::ConfigFile.write_option(:previous_current_contexts, previous_current_contexts)
    end

    def update_clusters_config(id, params)
      clusters_config = Uffizzi::ConfigHelper.update_clusters_config_by_id(id, params)
      Uffizzi::ConfigFile.write_option(:clusters, clusters_config)
    end

    def parse_kubeconfig(kubeconfig)
      return if kubeconfig.nil?

      Psych.safe_load(Base64.decode64(kubeconfig))
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
uffizzi-cli-2.4.11 lib/uffizzi/services/cluster/common_service.rb
uffizzi-cli-2.4.10 lib/uffizzi/services/cluster/common_service.rb
uffizzi-cli-2.4.9 lib/uffizzi/services/cluster/common_service.rb
uffizzi-cli-2.4.8 lib/uffizzi/services/cluster/common_service.rb
uffizzi-cli-2.4.7 lib/uffizzi/services/cluster/common_service.rb
uffizzi-cli-2.4.6 lib/uffizzi/services/cluster/common_service.rb
uffizzi-cli-2.4.5 lib/uffizzi/services/cluster/common_service.rb
uffizzi-cli-2.4.4 lib/uffizzi/services/cluster/common_service.rb
uffizzi-cli-2.4.3 lib/uffizzi/services/cluster/common_service.rb
uffizzi-cli-2.4.2 lib/uffizzi/services/cluster/common_service.rb
uffizzi-cli-2.4.1 lib/uffizzi/services/cluster/common_service.rb
uffizzi-cli-2.4.0 lib/uffizzi/services/cluster/common_service.rb
uffizzi-cli-2.3.4 lib/uffizzi/services/cluster/common_service.rb
uffizzi-cli-2.3.3 lib/uffizzi/services/cluster/common_service.rb
uffizzi-cli-2.3.2 lib/uffizzi/services/cluster/common_service.rb
uffizzi-cli-2.3.1 lib/uffizzi/services/cluster/common_service.rb
uffizzi-cli-2.3.0 lib/uffizzi/services/cluster/common_service.rb