Class: IbmCloudPower::PCloudEventsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/ibm_cloud_power/api/p_cloud_events_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ PCloudEventsApi

Returns a new instance of PCloudEventsApi.



19
20
21
# File 'lib/ibm_cloud_power/api/p_cloud_events_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/ibm_cloud_power/api/p_cloud_events_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#pcloud_events_get(cloud_instance_id, event_id, opts = {}) ⇒ Event

Get a single event

Parameters:

  • cloud_instance_id (String)

    Cloud Instance ID of a PCloud Instance

  • event_id (String)

    Event ID

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

    the optional parameters

Options Hash (opts):

  • :accept_language (String)

    The language requested for the return document

Returns:



28
29
30
31
# File 'lib/ibm_cloud_power/api/p_cloud_events_api.rb', line 28

def pcloud_events_get(cloud_instance_id, event_id, opts = {})
  data, _status_code, _headers = pcloud_events_get_with_http_info(cloud_instance_id, event_id, opts)
  data
end

#pcloud_events_get_with_http_info(cloud_instance_id, event_id, opts = {}) ⇒ Array<(Event, Integer, Hash)>

Get a single event

Parameters:

  • cloud_instance_id (String)

    Cloud Instance ID of a PCloud Instance

  • event_id (String)

    Event ID

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

    the optional parameters

Options Hash (opts):

  • :accept_language (String)

    The language requested for the return document

Returns:

  • (Array<(Event, Integer, Hash)>)

    Event data, response status code and response headers



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
# File 'lib/ibm_cloud_power/api/p_cloud_events_api.rb', line 39

def pcloud_events_get_with_http_info(cloud_instance_id, event_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PCloudEventsApi.pcloud_events_get ...'
  end
  # verify the required parameter 'cloud_instance_id' is set
  if @api_client.config.client_side_validation && cloud_instance_id.nil?
    fail ArgumentError, "Missing the required parameter 'cloud_instance_id' when calling PCloudEventsApi.pcloud_events_get"
  end
  # verify the required parameter 'event_id' is set
  if @api_client.config.client_side_validation && event_id.nil?
    fail ArgumentError, "Missing the required parameter 'event_id' when calling PCloudEventsApi.pcloud_events_get"
  end
  # resource path
  local_var_path = '/pcloud/v1/cloud-instances/{cloud_instance_id}/events/{event_id}'.sub('{' + 'cloud_instance_id' + '}', CGI.escape(cloud_instance_id.to_s)).sub('{' + 'event_id' + '}', CGI.escape(event_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Event'

  # auth_names
  auth_names = opts[:debug_auth_names] || []

  new_options = opts.merge(
    :operation => :"PCloudEventsApi.pcloud_events_get",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PCloudEventsApi#pcloud_events_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#pcloud_events_getsince(cloud_instance_id, from_time = nil, opts = {}) ⇒ Events

Get events from this cloud instance since a specific timestamp

Parameters:

  • cloud_instance_id (String)

    Cloud Instance ID of a PCloud Instance

  • from_time (String, Hash) (defaults to: nil)

    A starting timestamp in either ISO 8601 or unix epoch format, or a Hash of optional parameters Note: ‘from_time’ as a string is deprecated and will be removed in the next major release.

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

    the optional parameters

Options Hash (opts):

  • :to_time (String)

    An ending timestamp in either ISO 8601 or Unix epoch format

  • :accept_language (String)

    The language requested for the return document

Returns:



100
101
102
103
104
105
106
107
108
# File 'lib/ibm_cloud_power/api/p_cloud_events_api.rb', line 100

def pcloud_events_getsince(cloud_instance_id, from_time = nil, opts = {})
  if from_time.is_a?(Hash)
    opts.merge!(from_time)
  else
    opts[:from_time] = from_time
  end
  data, _status_code, _headers = pcloud_events_getsince_with_http_info(cloud_instance_id, opts)
  data
end

#pcloud_events_getsince_with_http_info(cloud_instance_id, opts = {}) ⇒ Array<(Events, Integer, Hash)>

Get events from this cloud instance since a specific timestamp

Parameters:

  • cloud_instance_id (String)

    Cloud Instance ID of a PCloud Instance

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

    the optional parameters

Options Hash (opts):

  • :time (String) — default: deprecated - use from_time

    A time in either ISO 8601 or unix epoch format

  • :from_time (String)

    A from query time in either ISO 8601 or unix epoch format

  • :to_time (String)

    A to query time in either ISO 8601 or unix epoch format

  • :accept_language (String)

    The language requested for the return document

Returns:

  • (Array<(Events, Integer, Hash)>)

    Events data, response status code and response headers



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
# File 'lib/ibm_cloud_power/api/p_cloud_events_api.rb', line 118

def pcloud_events_getsince_with_http_info(cloud_instance_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PCloudEventsApi.pcloud_events_getsince ...'
  end
  # verify the required parameter 'cloud_instance_id' is set
  if @api_client.config.client_side_validation && cloud_instance_id.nil?
    fail ArgumentError, "Missing the required parameter 'cloud_instance_id' when calling PCloudEventsApi.pcloud_events_getsince"
  end
  # resource path
  local_var_path = '/pcloud/v1/cloud-instances/{cloud_instance_id}/events'.sub('{' + 'cloud_instance_id' + '}', CGI.escape(cloud_instance_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'time'] = opts[:'time'] if !opts[:'time'].nil?
  query_params[:'from_time'] = opts[:'from_time'] if !opts[:'from_time'].nil?
  query_params[:'to_time'] = opts[:'to_time'] if !opts[:'to_time'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'Events'

  # auth_names
  auth_names = opts[:debug_auth_names] || []

  new_options = opts.merge(
    :operation => :"PCloudEventsApi.pcloud_events_getsince",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PCloudEventsApi#pcloud_events_getsince\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end