summaryrefslogtreecommitdiff
path: root/vendor/gems/kubeclient/lib/kubeclient/gcp_auth_provider.rb
blob: b28e54bfd88007ab6fbeff047804e7a5bfcc28b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# frozen_string_literal: true

require 'kubeclient/google_application_default_credentials'
require 'kubeclient/gcp_command_credentials'

module Kubeclient
  # Handle different ways to get a bearer token for Google Cloud Platform.
  class GCPAuthProvider
    class << self
      def token(config)
        if config.key?('cmd-path')
          Kubeclient::GCPCommandCredentials.token(config)
        else
          Kubeclient::GoogleApplicationDefaultCredentials.token
        end
      end
    end
  end
end