Class: OpenObserve::Api::Api::Folders

Inherits:
Object
  • Object
show all
Defined in:
lib/openobserve-api/api/api/folders.rb

Instance Method Summary collapse

Constructor Details

#initialize(connection) ⇒ Folders

Returns a new instance of Folders.



5
6
7
# File 'lib/openobserve-api/api/api/folders.rb', line 5

def initialize(connection)
  @connection = connection
end

Instance Method Details

#create(org_id:, create_folder_request:) ⇒ Object

Raises:

  • (ArgumentError)


9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/openobserve-api/api/api/folders.rb', line 9

def create(org_id:, create_folder_request:)
  raise ArgumentError, 'org_id is required' if org_id.nil?
  raise ArgumentError, 'create_folder_request is required' if create_folder_request.nil?

  @connection.call(
    :POST,
    '/api/{org_id}/folders'
      .gsub('{org_id}', ERB::Util.url_encode(org_id.to_s)),
    type: OpenObserve::Api::Models::Folder,
    auth: ['Authorization'],
    body: create_folder_request
  )
end

#dashboards(org_id:, dashboard_id:, move_dashboard_request:) ⇒ Object

Raises:

  • (ArgumentError)


23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/openobserve-api/api/api/folders.rb', line 23

def dashboards(org_id:, dashboard_id:, move_dashboard_request:)
  raise ArgumentError, 'org_id is required' if org_id.nil?
  raise ArgumentError, 'dashboard_id is required' if dashboard_id.nil?
  raise ArgumentError, 'move_dashboard_request is required' if move_dashboard_request.nil?

  @connection.call(
    :PUT,
    '/api/{org_id}/folders/dashboards/{dashboard_id}'
      .gsub('{org_id}', ERB::Util.url_encode(org_id.to_s))
      .gsub('{dashboard_id}', ERB::Util.url_encode(dashboard_id.to_s)),
    type: nil,
    auth: ['Authorization'],
    body: move_dashboard_request
  )
end

#delete(org_id:, folder_id:) ⇒ Object

Raises:

  • (ArgumentError)


39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/openobserve-api/api/api/folders.rb', line 39

def delete(org_id:, folder_id:)
  raise ArgumentError, 'org_id is required' if org_id.nil?
  raise ArgumentError, 'folder_id is required' if folder_id.nil?

  @connection.call(
    :DELETE,
    '/api/{org_id}/folders/{folder_id}'
      .gsub('{org_id}', ERB::Util.url_encode(org_id.to_s))
      .gsub('{folder_id}', ERB::Util.url_encode(folder_id.to_s)),
    type: nil,
    auth: ['Authorization']
  )
end

#get(org_id:, folder_id:) ⇒ Object

Raises:

  • (ArgumentError)


53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/openobserve-api/api/api/folders.rb', line 53

def get(org_id:, folder_id:)
  raise ArgumentError, 'org_id is required' if org_id.nil?
  raise ArgumentError, 'folder_id is required' if folder_id.nil?

  @connection.call(
    :GET,
    '/api/{org_id}/folders/{folder_id}'
      .gsub('{org_id}', ERB::Util.url_encode(org_id.to_s))
      .gsub('{folder_id}', ERB::Util.url_encode(folder_id.to_s)),
    type: OpenObserve::Api::Models::Folder,
    auth: ['Authorization']
  )
end

#list(org_id:) ⇒ Object

Raises:

  • (ArgumentError)


67
68
69
70
71
72
73
74
75
76
77
# File 'lib/openobserve-api/api/api/folders.rb', line 67

def list(org_id:)
  raise ArgumentError, 'org_id is required' if org_id.nil?

  @connection.call(
    :GET,
    '/api/{org_id}/folders'
      .gsub('{org_id}', ERB::Util.url_encode(org_id.to_s)),
    type: OpenObserve::Api::Models::ListFolders200Response,
    auth: ['Authorization']
  )
end

#name(org_id:, folder_name:) ⇒ Object

Raises:

  • (ArgumentError)


79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/openobserve-api/api/api/folders.rb', line 79

def name(org_id:, folder_name:)
  raise ArgumentError, 'org_id is required' if org_id.nil?
  raise ArgumentError, 'folder_name is required' if folder_name.nil?

  @connection.call(
    :GET,
    '/api/{org_id}/folders/name/{folder_name}'
      .gsub('{org_id}', ERB::Util.url_encode(org_id.to_s))
      .gsub('{folder_name}', ERB::Util.url_encode(folder_name.to_s)),
    type: OpenObserve::Api::Models::Folder,
    auth: ['Authorization']
  )
end

#update(org_id:, folder_id:, update_folder_request:) ⇒ Object

Raises:

  • (ArgumentError)


93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/openobserve-api/api/api/folders.rb', line 93

def update(org_id:, folder_id:, update_folder_request:)
  raise ArgumentError, 'org_id is required' if org_id.nil?
  raise ArgumentError, 'folder_id is required' if folder_id.nil?
  raise ArgumentError, 'update_folder_request is required' if update_folder_request.nil?

  @connection.call(
    :PUT,
    '/api/{org_id}/folders/{folder_id}'
      .gsub('{org_id}', ERB::Util.url_encode(org_id.to_s))
      .gsub('{folder_id}', ERB::Util.url_encode(folder_id.to_s)),
    type: nil,
    auth: ['Authorization'],
    body: update_folder_request
  )
end