lib/puppet/provider/grafana_dashboard/grafana.rb
def find_dashboard
    return unless dashboards.find { |x| x['title'] == resource[:title] }

    response = send_request('GET', format('/api/dashboards/db/%s', slug))
    if response.code != '200'
      raise format('Fail to retrieve dashboard %s (HTTP response: %s/%s)', resource[:title], response.code, response.body)
    end

    begin
      # Cache the dashboard's content
      @dashboard = JSON.parse(response.body)['dashboard']
    rescue JSON::ParserError
      raise format('Fail to parse dashboard %s: %s', resource[:title], response.body)
    end
  end
# Return the dashboard matching with the resource's title
Return the dashboard matching with the resource's title
Return the dashboard matching with the resource ' s title
def find_dashboard
    return unless dashboards.find { |x| x['title'] == resource[:title] }
    response = send_request('GET', format('/api/dashboards/db/%s', slug))
    if response.code != '200'
      raise format('Fail to retrieve dashboard %s (HTTP response: %s/%s)', resource[:title], response.code, response.body)
    end
    begin
      @dashboard = JSON.parse(response.body)['dashboard']
    rescue JSON::ParserError
      raise format('Fail to parse dashboard %s: %s', resource[:title], response.body)
    end
  end
def find_dashboard return unless dashboards . find { | x | x [ 'title' ] == resource [ :title ] } response = send_request ( 'GET' , format ( '/api/dashboards/db/%s' , slug ) ) if response . code != '200' raise format ( 'Fail to retrieve dashboard %s (HTTP response: %s/%s)' , resource [ :title ] , response . code , response . body ) end begin @dashboard = JSON . parse ( response . body ) [ 'dashboard' ] rescue JSON :: ParserError raise format ( 'Fail to parse dashboard %s: %s' , resource [ :title ] , response . body ) end end
Return the dashboard matching with the resource's title
Return the dashboard matching with the resource ' s title
# Cache the dashboard's content