Class: IbmCloudActivityTracker::ActivityTrackerApiV1
- Inherits:
-
IBMCloudSdkCore::BaseService
- Object
- IBMCloudSdkCore::BaseService
- IbmCloudActivityTracker::ActivityTrackerApiV1
- Includes:
- Concurrent::Async
- Defined in:
- lib/ibm_cloud_activity_tracker/activity_tracker_api_v1.rb
Overview
The Activity Tracker API V1 service.
Constant Summary collapse
- DEFAULT_SERVICE_NAME =
"activity_tracker_api"
- DEFAULT_SERVICE_URL =
"https://api.us-south.logging.cloud.ibm.com"
Instance Method Summary collapse
-
#create_group(groups_request: , content_type: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Create group.
-
#create_view(config_request: , content_type: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Create a view.
-
#delete_group(group_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
Delete a group.
-
#delete_view(view_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
Delete a view.
-
#export(from: , to: , size: nil, hosts: nil, apps: nil, levels: nil, query: nil, prefer: nil, email: nil, email_subject: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Export logs V1.
-
#exportv2(from: , to: , size: nil, hosts: nil, apps: nil, levels: nil, query: nil, prefer: nil, pagination_id: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Export logs V2.
-
#initialize(args) ⇒ ActivityTrackerApiV1
constructor
Construct a new client for the Activity Tracker API service.
-
#list_group ⇒ IBMCloudSdkCore::DetailedResponse
List groups.
-
#read_group(group_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
Get details of a group.
-
#update_group(group_id: , groups_request: , content_type: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Update group.
-
#update_view(view_id: , config_request: , content_type: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Update view.
Constructor Details
#initialize(args) ⇒ ActivityTrackerApiV1
Construct a new client for the Activity Tracker API service.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/ibm_cloud_activity_tracker/activity_tracker_api_v1.rb', line 45 def initialize(args = {}) @__async_initialized__ = false @service_key = args[:service_key] raise ArgumentError.new("service_key must be provided") if @service_key.nil? args.delete(:service_key) defaults = {} defaults[:service_url] = DEFAULT_SERVICE_URL defaults[:service_name] = DEFAULT_SERVICE_NAME defaults[:authenticator] = nil user_service_url = args[:service_url] unless args[:service_url].nil? args = defaults.merge(args) super @service_url = user_service_url unless user_service_url.nil? end |
Instance Method Details
#create_group(groups_request: , content_type: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Create group. Use this method to create a log group where you can scope the data that is
accessible by members in that group.
290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 |
# File 'lib/ibm_cloud_activity_tracker/activity_tracker_api_v1.rb', line 290 def create_group(groups_request:, content_type: nil) raise ArgumentError.new("groups_request must be provided") if groups_request.nil? headers = { "Content-Type" => content_type } sdk_headers = Common.new.get_sdk_headers("activity_tracker_api", "V1", "create_group", @service_key) headers.merge!(sdk_headers) data = groups_request method_url = "/v1/config/groups" response = request( method: "POST", url: method_url, headers: headers, data: data, accept_json: false ) response end |
#create_view(config_request: , content_type: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Create a view. Use this method to create a view and attach alerts to the view.
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
# File 'lib/ibm_cloud_activity_tracker/activity_tracker_api_v1.rb', line 178 def create_view(config_request:, content_type: nil) raise ArgumentError.new("config_request must be provided") if config_request.nil? headers = { "Content-Type" => content_type } sdk_headers = Common.new.get_sdk_headers("activity_tracker_api", "V1", "create_view", @service_key) headers.merge!(sdk_headers) data = config_request method_url = "/v1/config/view" response = request( method: "POST", url: method_url, headers: headers, data: data, accept_json: false ) response end |
#delete_group(group_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
Delete a group. Use this method to list the log groups.
344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 |
# File 'lib/ibm_cloud_activity_tracker/activity_tracker_api_v1.rb', line 344 def delete_group(group_id:) raise ArgumentError.new("group_id must be provided") if group_id.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("activity_tracker_api", "V1", "delete_group", @service_key) headers.merge!(sdk_headers) method_url = "/v1/config/groups/%s" % [ERB::Util.url_encode(group_id)] response = request( method: "DELETE", url: method_url, headers: headers, accept_json: false ) response end |
#delete_view(view_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
Delete a view. Use this method to delete a view and any attached alerts.
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
# File 'lib/ibm_cloud_activity_tracker/activity_tracker_api_v1.rb', line 241 def delete_view(view_id:) raise ArgumentError.new("view_id must be provided") if view_id.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("activity_tracker_api", "V1", "delete_view", @service_key) headers.merge!(sdk_headers) method_url = "/v1/config/view/%s" % [ERB::Util.url_encode(view_id)] response = request( method: "DELETE", url: method_url, headers: headers, accept_json: false ) response end |
#export(from: , to: , size: nil, hosts: nil, apps: nil, levels: nil, query: nil, prefer: nil, email: nil, email_subject: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Export logs V1. Use this method to export logs in JSON format from a logging instance.
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 |
# File 'lib/ibm_cloud_activity_tracker/activity_tracker_api_v1.rb', line 83 def export(from:, to:, size: nil, hosts: nil, apps: nil, levels: nil, query: nil, prefer: nil, email: nil, email_subject: nil) raise ArgumentError.new("from must be provided") if from.nil? raise ArgumentError.new("to must be provided") if to.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("activity_tracker_api", "V1", "export", @service_key) headers.merge!(sdk_headers) params = { "from" => from, "to" => to, "size" => size, "hosts" => hosts, "apps" => apps, "levels" => levels, "query" => query, "prefer" => prefer, "email" => email, "emailSubject" => email_subject } method_url = "/v1/export" response = request( method: "GET", url: method_url, headers: headers, params: params, accept_json: false ) response end |
#exportv2(from: , to: , size: nil, hosts: nil, apps: nil, levels: nil, query: nil, prefer: nil, pagination_id: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Export logs V2. Use this method to export logs in JSON format from a logging instance.
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 |
# File 'lib/ibm_cloud_activity_tracker/activity_tracker_api_v1.rb', line 134 def exportv2(from:, to:, size: nil, hosts: nil, apps: nil, levels: nil, query: nil, prefer: nil, pagination_id: nil) raise ArgumentError.new("from must be provided") if from.nil? raise ArgumentError.new("to must be provided") if to.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("activity_tracker_api", "V1", "exportv2", @service_key) headers.merge!(sdk_headers) params = { "from" => from, "to" => to, "size" => size, "hosts" => hosts, "apps" => apps, "levels" => levels, "query" => query, "prefer" => prefer, "pagination_id" => pagination_id } method_url = "/v2/export" response = request( method: "GET", url: method_url, headers: headers, params: params, accept_json: false ) response end |
#list_group ⇒ IBMCloudSdkCore::DetailedResponse
List groups. Use this method to list the log groups.
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 |
# File 'lib/ibm_cloud_activity_tracker/activity_tracker_api_v1.rb', line 265 def list_group headers = { } sdk_headers = Common.new.get_sdk_headers("activity_tracker_api", "V1", "list_group", @service_key) headers.merge!(sdk_headers) method_url = "/v1/config/groups" response = request( method: "GET", url: method_url, headers: headers, accept_json: false ) response end |
#read_group(group_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
Get details of a group. Use this method to get information on a group.
319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 |
# File 'lib/ibm_cloud_activity_tracker/activity_tracker_api_v1.rb', line 319 def read_group(group_id:) raise ArgumentError.new("group_id must be provided") if group_id.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("activity_tracker_api", "V1", "read_group", @service_key) headers.merge!(sdk_headers) method_url = "/v1/config/groups/%s" % [ERB::Util.url_encode(group_id)] response = request( method: "GET", url: method_url, headers: headers, accept_json: false ) response end |
#update_group(group_id: , groups_request: , content_type: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Update group. Use this method to modify a log group. You can change the name of the group and
the access scope that defines the data that is accessible by members in that
group.
373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 |
# File 'lib/ibm_cloud_activity_tracker/activity_tracker_api_v1.rb', line 373 def update_group(group_id:, groups_request:, content_type: nil) raise ArgumentError.new("group_id must be provided") if group_id.nil? raise ArgumentError.new("groups_request must be provided") if groups_request.nil? headers = { "Content-Type" => content_type } sdk_headers = Common.new.get_sdk_headers("activity_tracker_api", "V1", "update_group", @service_key) headers.merge!(sdk_headers) data = groups_request method_url = "/v1/config/groups/%s" % [ERB::Util.url_encode(group_id)] response = request( method: "PATCH", url: method_url, headers: headers, data: data, accept_json: false ) response end |
#update_view(view_id: , config_request: , content_type: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Update view. Use this method to update a view. You can change the view configuration details,
attach or modify alerts, and detach alerts.
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 |
# File 'lib/ibm_cloud_activity_tracker/activity_tracker_api_v1.rb', line 210 def update_view(view_id:, config_request:, content_type: nil) raise ArgumentError.new("view_id must be provided") if view_id.nil? raise ArgumentError.new("config_request must be provided") if config_request.nil? headers = { "Content-Type" => content_type } sdk_headers = Common.new.get_sdk_headers("activity_tracker_api", "V1", "update_view", @service_key) headers.merge!(sdk_headers) data = config_request method_url = "/v1/config/view/%s" % [ERB::Util.url_encode(view_id)] response = request( method: "PUT", url: method_url, headers: headers, data: data, accept_json: false ) response end |