Class: DatadogAPIClient::V2::CIVisibilityGitHubAccountsAPI

Inherits:
Object
  • Object
show all
Defined in:
lib/datadog_api_client/v2/api/ci_visibility_git_hub_accounts_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = DatadogAPIClient::APIClient.default) ⇒ CIVisibilityGitHubAccountsAPI

Returns a new instance of CIVisibilityGitHubAccountsAPI.



22
23
24
# File 'lib/datadog_api_client/v2/api/ci_visibility_git_hub_accounts_api.rb', line 22

def initialize(api_client = DatadogAPIClient::APIClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



20
21
22
# File 'lib/datadog_api_client/v2/api/ci_visibility_git_hub_accounts_api.rb', line 20

def api_client
  @api_client
end

Instance Method Details

#list_ci_app_git_hub_accounts(opts = {}) ⇒ Object

List GitHub CI Visibility status.



29
30
31
32
# File 'lib/datadog_api_client/v2/api/ci_visibility_git_hub_accounts_api.rb', line 29

def list_ci_app_git_hub_accounts(opts = {})
  data, _status_code, _headers = list_ci_app_git_hub_accounts_with_http_info(opts)
  data
end

#list_ci_app_git_hub_accounts_with_http_info(opts = {}) ⇒ Array<(CIAppGitHubAccountsResponse, Integer, Hash)>

List GitHub CI Visibility status.

Retrieve the list of GitHub accounts (organizations or users) available to this Datadog organization through its GitHub App installation, along with each account's and repository's CI Visibility opt-in status.

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(CIAppGitHubAccountsResponse, Integer, Hash)>)

    CIAppGitHubAccountsResponse data, response status code and response headers



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/datadog_api_client/v2/api/ci_visibility_git_hub_accounts_api.rb', line 41

def list_ci_app_git_hub_accounts_with_http_info(opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CIVisibilityGitHubAccountsAPI.list_ci_app_git_hub_accounts ...'
  end
  # resource path
  local_var_path = '/api/v2/ci/github/accounts'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'CIAppGitHubAccountsResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]

  new_options = opts.merge(
    :operation => :list_ci_app_git_hub_accounts,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type,
    :api_version => "V2"
  )

  data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CIVisibilityGitHubAccountsAPI#list_ci_app_git_hub_accounts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_ci_app_git_hub_account(body, opts = {}) ⇒ Object

Update GitHub CI Visibility status.



90
91
92
93
# File 'lib/datadog_api_client/v2/api/ci_visibility_git_hub_accounts_api.rb', line 90

def (body, opts = {})
  data, _status_code, _headers = (body, opts)
  data
end

#update_ci_app_git_hub_account_with_http_info(body, opts = {}) ⇒ Array<(CIAppGitHubAccountResponse, Integer, Hash)>

Update GitHub CI Visibility status.

Enable or disable CI Visibility for a GitHub account, one of its repositories, or both in the same request. The account (and, optionally, repository) are identified by name. Account-level and repository-level changes are independent and may both be supplied in the same request. At least one of enabled or repository.enabled must be provided. If the account name matches installations on more than one host, host must be supplied to disambiguate, otherwise a 409 is returned. Returns a 404 if the CI Visibility GitHub integration is not enabled for this organization, or if the given account or repository cannot be found by name.

Parameters:

Returns:

  • (Array<(CIAppGitHubAccountResponse, Integer, Hash)>)

    CIAppGitHubAccountResponse data, response status code and response headers



108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# File 'lib/datadog_api_client/v2/api/ci_visibility_git_hub_accounts_api.rb', line 108

def (body, opts = {})

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CIVisibilityGitHubAccountsAPI.update_ci_app_git_hub_account ...'
  end
  # verify the required parameter 'body' is set
  if @api_client.config.client_side_validation && body.nil?
    fail ArgumentError, "Missing the required parameter 'body' when calling CIVisibilityGitHubAccountsAPI.update_ci_app_git_hub_account"
  end
  # resource path
  local_var_path = '/api/v2/ci/github/accounts'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(body)

  # return_type
  return_type = opts[:debug_return_type] || 'CIAppGitHubAccountResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]

  new_options = opts.merge(
    :operation => :update_ci_app_git_hub_account,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type,
    :api_version => "V2"
  )

  data, status_code, headers = @api_client.call_api(Net::HTTP::Patch, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CIVisibilityGitHubAccountsAPI#update_ci_app_git_hub_account\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end