Module: BWStatusBoardAPI::Client::Environments::Services

Includes:
Helpers
Included in:
Boards, BWStatusBoardAPI::Client::Environments, Metrics
Defined in:
lib/bw_status_board_api/client/environments/services.rb

Overview

Services module for environment services endpoints

Instance Method Summary collapse

Methods included from Helpers

#filter

Instance Method Details

#create_service(environment_id, opts = {}) ⇒ Hash

Create service

Parameters:

  • environment_id (Integer)

    environment id

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

    options hash of parameters

Options Hash (opts):

  • environment (String)

    the id of the environment

  • name (String)

    name of the service

  • shortName (String)

    short name of the service

  • status (String)

    status of the service

  • url (String)

    url of the service

  • successStatusCode (Integer)

    success status code of the service

  • slackNotify (Boolean)

    notify on slack flag

  • slackUsersToNotify (Array)

    users to notify on status change

  • slackChannelsToNotify (Array)

    channels to notify on status change

  • enabled (Boolean)

    service enabled flag

Returns:

  • (Hash)

    service



57
58
59
# File 'lib/bw_status_board_api/client/environments/services.rb', line 57

def create_service(environment_id, opts = {})
  post "environments/#{environment_id}/services", opts
end

#delete_service(environment_id, service_id) ⇒ Hash

Delete environment service

Parameters:

  • environment_id (Integer)

    environment id

  • service_id (Integer)

    service id

Returns:

  • (Hash)

    service



106
107
108
# File 'lib/bw_status_board_api/client/environments/services.rb', line 106

def delete_service(environment_id, service_id)
  delete "environments/#{environment_id}/services/#{service_id}"
end

#failing_services(environment_id, summary = true) ⇒ Array

Returns failing services for environment

Parameters:

  • environment_id (Integer)

    environment id

  • summary (Boolean) (defaults to: true)

    summary flag

Returns:

  • (Array)

    services



115
116
117
# File 'lib/bw_status_board_api/client/environments/services.rb', line 115

def failing_services(environment_id, summary = true)
  filter(services(environment_id)['results'], summary, 'status', 'failure')
end

#patch_service(environment_id, service_id, opts = {}) ⇒ Hash

Patch environment service

Parameters:

  • environment_id (Integer)

    environment id

  • service_id (Integer)

    service id

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

    options hash of parameters

Options Hash (opts):

  • environment (String)

    the id of the environment

  • name (String)

    name of the service

  • shortName (String)

    short name of the service

  • status (String)

    status of the service

  • url (String)

    url of the service

  • successStatusCode (Integer)

    success status code of the service

  • slackNotify (Boolean)

    notify on slack flag

  • slackUsersToNotify (Array)

    users to notify on status change

  • slackChannelsToNotify (Array)

    channels to notify on status change

  • enabled (Boolean)

    service enabled flag

Returns:

  • (Hash)

    service



97
98
99
# File 'lib/bw_status_board_api/client/environments/services.rb', line 97

def patch_service(environment_id, service_id, opts = {})
  patch "environments/#{environment_id}/services/#{service_id}", opts
end

#service(environment_id, service_id) ⇒ Hash

Get environment service

Parameters:

  • environment_id (Integer)

    environment id

  • service_id (Integer)

    service id

Returns:

  • (Hash)

    service



38
39
40
# File 'lib/bw_status_board_api/client/environments/services.rb', line 38

def service(environment_id, service_id)
  get "environments/#{environment_id}/services/#{service_id}"
end

#services(environment_id, opts = {}) ⇒ Hash

Get environment services

Parameters:

  • environment_id (Integer)

    environment id

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

    options hash of parameters

Options Hash (opts):

  • page (Integer)

    the page

  • pageSize (Integer)

    the page size

  • orderBy (String)

    the parameter to order by

  • orderDirection (String)

    the direction to order

  • fields (String)

    the fields to return

Returns:

  • (Hash)

    services



20
21
22
# File 'lib/bw_status_board_api/client/environments/services.rb', line 20

def services(environment_id, opts = {})
  get "environments/#{environment_id}/services", opts
end

#services_summary(environment_id) ⇒ Array

Returns services name list

Parameters:

  • environment_id (Integer)

    environment id

  • opts (Hash)

    options hash of parameters

Returns:

  • (Array)

    the environments



29
30
31
# File 'lib/bw_status_board_api/client/environments/services.rb', line 29

def services_summary(environment_id)
  filter(services(environment_id)['results'], true)
end

#successful_services(environment_id, summary = true) ⇒ Array

Returns successful services for environment

Parameters:

  • environment_id (Integer)

    environment id

  • summary (Boolean) (defaults to: true)

    summary flag

Returns:

  • (Array)

    services



124
125
126
# File 'lib/bw_status_board_api/client/environments/services.rb', line 124

def successful_services(environment_id, summary = true)
  filter(services(environment_id)['results'], summary, 'status', 'success')
end

#update_service(environment_id, service_id, opts = {}) ⇒ Hash

Update environment service

Parameters:

  • environment_id (Integer)

    environment id

  • service_id (Integer)

    service id

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

    options hash of parameters

Options Hash (opts):

  • environment (String)

    the id of the environment

  • name (String)

    name of the service

  • shortName (String)

    short name of the service

  • status (String)

    status of the service

  • url (String)

    url of the service

  • successStatusCode (Integer)

    success status code of the service

  • slackNotify (Boolean)

    notify on slack flag

  • slackUsersToNotify (Array)

    users to notify on status change

  • slackChannelsToNotify (Array)

    channels to notify on status change

  • enabled (Boolean)

    service enabled flag

Returns:

  • (Hash)

    service



77
78
79
# File 'lib/bw_status_board_api/client/environments/services.rb', line 77

def update_service(environment_id, service_id, opts = {})
  put "environments/#{environment_id}/services/#{service_id}", opts
end