Method: Common::Utils#get_project_id

Defined in:
lib/fluent/plugin/common.rb

#get_project_id(platform, project_id) ⇒ Object

  1. Return the value if it is explicitly set in the config already.

  2. If not, try to retrieve it by calling metadata server directly.

  3. If still not set, try to obtain it from the credentials.

[View source]

174
175
176
177
178
179
# File 'lib/fluent/plugin/common.rb', line 174

def get_project_id(platform, project_id)
  project_id ||= CredentialsInfo.project_id
  project_id ||= (platform, 'project/project-id') if
    platform == Platform::GCE
  project_id
end