1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 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 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 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 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 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 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578
|
# frozen_string_literal: true
module API
module Helpers
# Helpers module for API::Integrations
#
# The data structures inside this model are returned using class methods,
# allowing EE to extend them where necessary.
module IntegrationsHelpers
def self.chat_notification_flags
[
{
required: false,
name: :notify_only_broken_pipelines,
type: ::Grape::API::Boolean,
desc: 'Send notifications for broken pipelines'
}
].freeze
end
def self.chat_notification_channels
[
{
required: false,
name: :push_channel,
type: String,
desc: 'The name of the channel to receive push_events notifications'
},
{
required: false,
name: :issue_channel,
type: String,
desc: 'The name of the channel to receive issues_events notifications'
},
{
required: false,
name: :incident_channel,
type: String,
desc: 'The name of the channel to receive incident_events notifications'
},
{
required: false,
name: :alert_channel,
type: String,
desc: 'The name of the channel to receive alert_events notifications'
},
{
required: false,
name: :confidential_issue_channel,
type: String,
desc: 'The name of the channel to receive confidential_issues_events notifications'
},
{
required: false,
name: :merge_request_channel,
type: String,
desc: 'The name of the channel to receive merge_requests_events notifications'
},
{
required: false,
name: :note_channel,
type: String,
desc: 'The name of the channel to receive note_events notifications'
},
{
required: false,
name: :confidential_note_channel,
type: String,
desc: 'The name of the channel to receive confidential_note_events notifications'
},
{
required: false,
name: :tag_push_channel,
type: String,
desc: 'The name of the channel to receive tag_push_events notifications'
},
{
required: false,
name: :deployment_channel,
type: String,
desc: 'The name of the channel to receive deployment_events notifications'
},
{
required: false,
name: :pipeline_channel,
type: String,
desc: 'The name of the channel to receive pipeline_events notifications'
},
{
required: false,
name: :wiki_page_channel,
type: String,
desc: 'The name of the channel to receive wiki_page_events notifications'
}
].freeze
end
def self.integrations
{
'apple-app-store' => ::Integrations::AppleAppStore.api_arguments,
'asana' => ::Integrations::Asana.api_arguments,
'assembla' => ::Integrations::Assembla.api_arguments,
'bamboo' => ::Integrations::Bamboo.api_arguments,
'bugzilla' => ::Integrations::Bugzilla.api_arguments,
'buildkite' => ::Integrations::Buildkite.api_arguments,
'campfire' => ::Integrations::Campfire.api_arguments,
'confluence' => ::Integrations::Confluence.api_arguments,
'custom-issue-tracker' => ::Integrations::CustomIssueTracker.api_arguments,
'datadog' => ::Integrations::Datadog.api_arguments,
'diffblue-cover' => ::Integrations::DiffblueCover.api_arguments,
'discord' => [
::Integrations::Discord.api_arguments,
chat_notification_flags,
chat_notification_channels
].flatten,
'drone-ci' => ::Integrations::DroneCi.api_arguments,
'emails-on-push' => [
{
required: true,
name: :recipients,
type: String,
desc: 'Comma-separated list of recipient email addresses'
},
{
required: false,
name: :disable_diffs,
type: ::Grape::API::Boolean,
desc: 'Disable code diffs'
},
{
required: false,
name: :send_from_committer_email,
type: ::Grape::API::Boolean,
desc: 'Send from committer'
},
{
required: false,
name: :branches_to_be_notified,
type: String,
desc: 'Branches for which notifications are to be sent'
}
],
'external-wiki' => ::Integrations::ExternalWiki.api_arguments,
'gitlab-slack-application' => [
::Integrations::GitlabSlackApplication.api_arguments,
chat_notification_channels
].flatten,
'google-play' => ::Integrations::GooglePlay.api_arguments,
'hangouts-chat' => [
{
required: true,
name: :webhook,
type: String,
desc: 'The Hangouts Chat webhook. e.g. https://chat.googleapis.com/v1/spaces…'
},
{
required: false,
name: :branches_to_be_notified,
type: String,
desc: 'Branches for which notifications are to be sent'
}
].flatten,
'harbor' => ::Integrations::Harbor.api_arguments,
'irker' => [
{
required: true,
name: :recipients,
type: String,
desc: 'Recipients/channels separated by whitespaces'
},
{
required: false,
name: :default_irc_uri,
type: String,
desc: 'Default: irc://irc.network.net:6697'
},
{
required: false,
name: :server_host,
type: String,
desc: 'Server host. Default localhost'
},
{
required: false,
name: :server_port,
type: Integer,
desc: 'Server port. Default 6659'
},
{
required: false,
name: :colorize_messages,
type: ::Grape::API::Boolean,
desc: 'Colorize messages'
}
],
'jenkins' => ::Integrations::Jenkins.api_arguments,
'jira' => [
{
required: true,
name: :url,
type: String,
desc: 'The base URL to the Jira instance web interface which is being linked to this GitLab project. E.g., https://jira.example.com'
},
{
required: false,
name: :api_url,
type: String,
desc: 'The base URL to the Jira instance API. Web URL value will be used if not set. E.g., https://jira-api.example.com'
},
{
required: false,
name: :jira_auth_type,
type: Integer,
desc: 'The authentication method to be used with Jira. `0` means Basic Authentication. `1` means Jira personal access token. Defaults to `0`'
},
{
required: false,
name: :username,
type: String,
desc: 'The email or username to be used with Jira. For Jira Cloud use an email, for Jira Data Center and Jira Server use a username. Required when using Basic authentication (`jira_auth_type` is `0`)'
},
{
required: true,
name: :password,
type: String,
desc: 'The Jira API token, password, or personal access token to be used with Jira. When your authentication method is Basic (`jira_auth_type` is `0`) use an API token for Jira Cloud, or a password for Jira Data Center or Jira Server. When your authentication method is Jira personal access token (`jira_auth_type` is `1`) use a personal access token'
},
{
required: false,
name: :jira_issue_transition_automatic,
type: ::Grape::API::Boolean,
desc: 'Enable automatic issue transitions'
},
{
required: false,
name: :jira_issue_transition_id,
type: String,
desc: 'The ID of one or more transitions for custom issue transitions'
},
{
required: false,
name: :jira_issue_prefix,
type: String,
desc: 'Prefix to match Jira issue keys'
},
{
required: false,
name: :jira_issue_regex,
type: String,
desc: 'Regular expression to match Jira issue keys'
},
{
required: false,
name: :issues_enabled,
type: ::Grape::API::Boolean,
desc: 'Enable viewing Jira issues in GitLab'
},
{
required: false,
name: :project_keys,
type: Array[String],
desc: 'Keys of Jira projects to view issues from in GitLab'
},
{
required: false,
name: :comment_on_event_enabled,
type: ::Grape::API::Boolean,
desc: 'Enable comments inside Jira issues on each GitLab event (commit / merge request)'
}
],
'jira-cloud-app' => ::Integrations::JiraCloudApp.api_arguments,
'matrix' => ::Integrations::Matrix.api_arguments,
'mattermost-slash-commands' => ::Integrations::MattermostSlashCommands.api_arguments,
'slack-slash-commands' => [
{
required: true,
name: :token,
type: String,
desc: 'The Slack token'
}
],
'packagist' => [
{
required: true,
name: :username,
type: String,
desc: 'The username'
},
{
required: true,
name: :token,
type: String,
desc: 'The Packagist API token'
},
{
required: false,
name: :server,
type: String,
desc: 'The server'
}
],
'phorge' => ::Integrations::Phorge.api_arguments,
'pipelines-email' => [
{
required: true,
name: :recipients,
type: String,
desc: 'Comma-separated list of recipient email addresses'
},
{
required: false,
name: :notify_only_broken_pipelines,
type: ::Grape::API::Boolean,
desc: 'Notify only broken pipelines'
},
{
required: false,
name: :notify_only_default_branch,
type: ::Grape::API::Boolean,
desc: 'Send notifications only for the default branch'
},
{
required: false,
name: :branches_to_be_notified,
type: String,
desc: 'Branches for which notifications are to be sent'
}
],
'pivotaltracker' => [
{
required: true,
name: :token,
type: String,
desc: 'The Pivotaltracker token'
},
{
required: false,
name: :restrict_to_branch,
type: String,
desc: 'Comma-separated list of branches which will be automatically inspected. Leave blank to include all branches.'
}
],
'prometheus' => [
{
required: false,
name: :manual_configuration,
type: ::Grape::API::Boolean,
desc: 'When enabled, the default settings will be overridden with your custom configuration'
},
{
required: true,
name: :api_url,
type: String,
desc: 'Prometheus API Base URL, like http://prometheus.example.com/'
},
{
required: true,
name: :google_iap_audience_client_id,
type: String,
desc: 'Client ID of the IAP-secured resource (looks like IAP_CLIENT_ID.apps.googleusercontent.com)'
},
{
required: true,
name: :google_iap_service_account_json,
type: String,
desc: 'Contents of the credentials.json file of your service account, like: { "type": "service_account", "project_id": ... }'
}
],
'pumble' => [
{
required: true,
name: :webhook,
type: String,
desc: 'The Pumble chat webhook. For example, https://api.pumble.com/workspaces/x/...'
}
].flatten,
'pushover' => [
{
required: true,
name: :api_key,
type: String,
desc: 'The application key'
},
{
required: true,
name: :user_key,
type: String,
desc: 'The user key'
},
{
required: true,
name: :priority,
type: String,
desc: 'The priority'
},
{
required: true,
name: :device,
type: String,
desc: 'Leave blank for all active devices'
},
{
required: true,
name: :sound,
type: String,
desc: 'The sound of the notification'
}
],
'redmine' => ::Integrations::Redmine.api_arguments,
'ewm' => ::Integrations::Ewm.api_arguments,
'youtrack' => ::Integrations::Youtrack.api_arguments,
'clickup' => ::Integrations::Clickup.api_arguments,
'slack' => [
::Integrations::Slack.api_arguments,
chat_notification_channels
].flatten,
'microsoft-teams' => [
{
required: true,
name: :webhook,
type: String,
desc: 'The Microsoft Teams webhook. e.g. https://outlook.office.com/webhook/…'
},
{
required: false,
name: :branches_to_be_notified,
type: String,
desc: 'Branches for which notifications are to be sent'
},
chat_notification_flags
].flatten,
'mattermost' => [
::Integrations::Mattermost.api_arguments,
chat_notification_channels
].flatten,
'teamcity' => [
{
required: true,
name: :teamcity_url,
type: String,
desc: 'TeamCity root URL like https://teamcity.example.com'
},
{
required: false,
name: :enable_ssl_verification,
type: ::Grape::API::Boolean,
desc: 'Enable SSL verification'
},
{
required: true,
name: :build_type,
type: String,
desc: 'Build configuration ID'
},
{
required: true,
name: :username,
type: String,
desc: 'A user with permissions to trigger a manual build'
},
{
required: true,
name: :password,
type: String,
desc: 'The password of the user'
}
],
'telegram' => ::Integrations::Telegram.api_arguments,
'unify-circuit' => [
{
required: true,
name: :webhook,
type: String,
desc: 'The Unify Circuit webhook. e.g. https://circuit.com/rest/v2/webhooks/incoming/…'
}
].flatten,
'webex-teams' => ::Integrations::WebexTeams.api_arguments,
'zentao' => [
{
required: true,
name: :url,
type: String,
desc: 'The base URL to the ZenTao instance web interface which is being linked to this GitLab project. For example, https://www.zentao.net'
},
{
required: false,
name: :api_url,
type: String,
desc: 'The base URL to the ZenTao instance API. Web URL value will be used if not set. For example, https://www.zentao.net'
},
{
required: true,
name: :api_token,
type: String,
desc: 'The API token created from ZenTao dashboard'
},
{
required: true,
name: :zentao_product_xid,
type: String,
desc: 'The product ID of ZenTao project'
}
],
'squash-tm' => ::Integrations::SquashTm.api_arguments
}
end
def self.integration_classes
[
::Integrations::AppleAppStore,
::Integrations::Asana,
::Integrations::Assembla,
::Integrations::Bamboo,
::Integrations::Bugzilla,
::Integrations::Buildkite,
::Integrations::Campfire,
::Integrations::Clickup,
::Integrations::Confluence,
::Integrations::CustomIssueTracker,
::Integrations::Datadog,
::Integrations::DiffblueCover,
::Integrations::Discord,
::Integrations::DroneCi,
::Integrations::EmailsOnPush,
::Integrations::Ewm,
::Integrations::ExternalWiki,
::Integrations::GitlabSlackApplication,
::Integrations::GooglePlay,
::Integrations::HangoutsChat,
::Integrations::Harbor,
::Integrations::Irker,
::Integrations::Jenkins,
::Integrations::Jira,
::Integrations::JiraCloudApp,
::Integrations::Matrix,
::Integrations::Mattermost,
::Integrations::MattermostSlashCommands,
::Integrations::MicrosoftTeams,
::Integrations::Packagist,
::Integrations::Phorge,
::Integrations::PipelinesEmail,
::Integrations::Pivotaltracker,
::Integrations::Prometheus,
::Integrations::Pumble,
::Integrations::Pushover,
::Integrations::Redmine,
::Integrations::Slack,
::Integrations::SlackSlashCommands,
::Integrations::SquashTm,
::Integrations::Teamcity,
::Integrations::Telegram,
::Integrations::UnifyCircuit,
::Integrations::WebexTeams,
::Integrations::Youtrack,
::Integrations::Zentao
]
end
def self.development_integration_classes
[
::Integrations::MockCi,
::Integrations::MockMonitoring
]
end
def self.inheritance_field
{
required: false,
name: :use_inherited_settings,
type: ::Grape::API::Boolean,
desc: 'Indicates whether to inherit the default settings. Defaults to `false`.'
}
end
end
end
end
API::Helpers::IntegrationsHelpers.prepend_mod_with('API::Helpers::IntegrationsHelpers')
|