137
138
139
140
141
142
143
144
145
146
147
148
149
150
|
# File 'lib/circleci-tools/api_service.rb', line 137
def create_usage_export_job(org_id:, start_time:, end_time:, shared_org_ids: [])
url = "/api/v2/organizations/#{org_id}/usage_export_job"
body = { start: start_time, end: end_time, shared_org_ids: shared_org_ids }
response = with_retries(max_retries: 60) do
response = connection.post(url, body.to_json, .merge('Content-Type' => 'application/json'))
raise "API Error: #{response&.body}" unless response&.status == 201
response
end
return nil unless response
JSON.parse(response.body)
end
|