Class: Google::Auth::ServiceAccountCredentials

Inherits:
Object
  • Object
show all
Defined in:
lib/fluent/plugin/out_google_cloud.rb

Overview

Extract project_id in initialize.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#project_id ⇒ Object (readonly)

Returns the value of attribute project_id.



57
58
59
# File 'lib/fluent/plugin/out_google_cloud.rb', line 57

def project_id
  @project_id
end

Class Method Details

.make_creds(options = {}) ⇒ Object



46
47
48
49
50
51
52
53
54
55
56
# File 'lib/fluent/plugin/out_google_cloud.rb', line 46

def self.make_creds(options = {})
  json_key_io, scope = options.values_at(:json_key_io, :scope)
  if json_key_io
    json_key = MultiJson.load(json_key_io.read)
    project_id = json_key['project_id']
  end
  creds = super_make_creds(
    json_key_io: StringIO.new(MultiJson.dump(json_key)), scope: scope)
  creds.instance_variable_set(:@project_id, project_id) if project_id
  creds
end