Class: VectorAmp::GitLabSource
- Defined in:
- lib/vector_amp/source.rb
Overview
GitLab ingestion source for gitlab.com or a self-managed instance.
Authenticates with an access token (auth_mode: "token" plus access_token)
or a stored OAuth connection (connection_id). At least one group or project
is required.
Constant Summary
Constants inherited from Source
Source::SUPPORTED_SOURCE_TYPES
Instance Attribute Summary
Attributes inherited from Source
#config, #description, #id, #metadata, #name, #source_type
Instance Method Summary collapse
Methods inherited from Source
#[], from_api, #inspect, normalize_hash, #to_create_body, #to_h
Constructor Details
#initialize(groups: nil, projects: nil, name: nil, auth_mode: "oauth", gitlab_url: "https://gitlab.com", access_token: nil, connection_id: nil, ref_mode: nil, refs: nil, excluded_refs: nil, active_branch_days: nil, include_merge_requests: nil, include_review_threads: nil, include_direct_commits: nil, include_globs: nil, exclude_globs: nil, max_file_size_bytes: nil, description: nil, metadata: nil, id: nil, **config) ⇒ GitLabSource
473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 |
# File 'lib/vector_amp/source.rb', line 473 def initialize(groups: nil, projects: nil, name: nil, auth_mode: "oauth", gitlab_url: "https://gitlab.com", access_token: nil, connection_id: nil, ref_mode: nil, refs: nil, excluded_refs: nil, active_branch_days: nil, include_merge_requests: nil, include_review_threads: nil, include_direct_commits: nil, include_globs: nil, exclude_globs: nil, max_file_size_bytes: nil, description: nil, metadata: nil, id: nil, **config) group_list = Array(groups) project_list = Array(projects) if group_list.empty? && project_list.empty? raise ArgumentError, "groups or projects is required" end super( id: id, source_type: "gitlab", name: name || SourceNames.gitlab(projects: project_list, groups: group_list), description: description, metadata: , config: Utils.compact_hash(config.merge( auth_mode: auth_mode, gitlab_url: gitlab_url, groups: group_list.empty? ? nil : group_list, projects: project_list.empty? ? nil : project_list, access_token: access_token, connection_id: connection_id, ref_mode: ref_mode, refs: refs.nil? ? nil : Array(refs), excluded_refs: excluded_refs.nil? ? nil : Array(excluded_refs), active_branch_days: active_branch_days, include_merge_requests: include_merge_requests, include_review_threads: include_review_threads, include_direct_commits: include_direct_commits, include_globs: include_globs.nil? ? nil : Array(include_globs), exclude_globs: exclude_globs.nil? ? nil : Array(exclude_globs), max_file_size_bytes: max_file_size_bytes )) ) end |