Class: SupportOps::GitLab::Configuration::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/support_ops_gitlab/gitlab/configuration.rb

Overview

Defined the class Config within the module SupportOps::GitLab::Configuration

Author:

  • Jason Colyer

Since:

  • 1.0.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#job_tokenString

The job token to use for authentication

Returns:

  • (String)

    the current value of job_token



59
60
61
# File 'lib/support_ops_gitlab/gitlab/configuration.rb', line 59

def job_token
  @job_token
end

#retry_backoffInteger

multiplier applied to the retry_interval after each retry attempt, causing exponential backoff. Defaults to 2

Returns:

  • (Integer)

    the current value of retry_backoff



59
60
61
# File 'lib/support_ops_gitlab/gitlab/configuration.rb', line 59

def retry_backoff
  @retry_backoff
end

#retry_exceptionsArray

Specifies which types of exceptions or errors should trigger the retry mechanism.

Returns:

  • (Array)

    the current value of retry_exceptions



59
60
61
# File 'lib/support_ops_gitlab/gitlab/configuration.rb', line 59

def retry_exceptions
  @retry_exceptions
end

#retry_intervalInteger

The base time interval (typically in seconds or milliseconds) between retry attempts. Defaults to 1

Returns:

  • (Integer)

    the current value of retry_interval



59
60
61
# File 'lib/support_ops_gitlab/gitlab/configuration.rb', line 59

def retry_interval
  @retry_interval
end

#retry_maxInteger

The maximum number of retry attempts that will be made when an operation fails. Defaults to 5

Returns:

  • (Integer)

    the current value of retry_max



59
60
61
# File 'lib/support_ops_gitlab/gitlab/configuration.rb', line 59

def retry_max
  @retry_max
end

#retry_randomnessFloat

Adds a random element to the retry interval to prevent “thundering herd” problems where many systems retry simultaneously. Defaults to 0.5

Returns:

  • (Float)

    the current value of retry_randomness



59
60
61
# File 'lib/support_ops_gitlab/gitlab/configuration.rb', line 59

def retry_randomness
  @retry_randomness
end

#tokenString

The token to use for authentication

Returns:

  • (String)

    the current value of token



59
60
61
# File 'lib/support_ops_gitlab/gitlab/configuration.rb', line 59

def token
  @token
end

#urlString

The API url to connect to, it should alwaus be in the format of ‘https://YOUR_DOMAIN.com/api/v4’ (note the lack of a trailing /)

Returns:

  • (String)

    the current value of url



59
60
61
# File 'lib/support_ops_gitlab/gitlab/configuration.rb', line 59

def url
  @url
end

Instance Method Details

#clientObject

Since:

  • 1.0.0



71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/support_ops_gitlab/gitlab/configuration.rb', line 71

def client
  @client ||= Client.new(
    job_token: job_token,
    retry_max: retry_max,
    retry_interval: retry_interval,
    retry_randomness: retry_randomness,
    retry_backoff: retry_backoff,
    retry_exceptions: retry_exceptions,
    url: url,
    token: token
  )
end