Class: Vantage::PricesApi

Inherits:
Object
  • Object
show all
Defined in:
lib/vantage-client/api/prices_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ PricesApi

Returns a new instance of PricesApi.



19
20
21
# File 'lib/vantage-client/api/prices_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/vantage-client/api/prices_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#get_price(product_id, id, opts = {}) ⇒ Price

Returns a price

Parameters:

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

    the optional parameters

Returns:



27
28
29
30
# File 'lib/vantage-client/api/prices_api.rb', line 27

def get_price(product_id, id, opts = {})
  data, _status_code, _headers = get_price_with_http_info(product_id, id, opts)
  data
end

#get_price_with_http_info(product_id, id, opts = {}) ⇒ Array<(Price, Fixnum, Hash)>

Returns a price

Parameters:

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

    the optional parameters

Returns:

  • (Array<(Price, Fixnum, Hash)>)

    Price data, response status code and response headers



37
38
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
# File 'lib/vantage-client/api/prices_api.rb', line 37

def get_price_with_http_info(product_id, id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PricesApi.get_price ...'
  end
  # verify the required parameter 'product_id' is set
  if @api_client.config.client_side_validation && product_id.nil?
    fail ArgumentError, "Missing the required parameter 'product_id' when calling PricesApi.get_price"
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling PricesApi.get_price"
  end
  # resource path
  local_var_path = '/v1/products/{product_id}/prices/{id}'.sub('{' + 'product_id' + '}', product_id.to_s).sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['oauth2']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Price')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PricesApi#get_price\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_prices(product_id, opts = {}) ⇒ Prices

Return available Prices across all Regions for a Product.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :page (Integer)

    The page of results to return.

  • :limit (Integer)

    The amount of results to return. The maximum is 1000

Returns:



84
85
86
87
# File 'lib/vantage-client/api/prices_api.rb', line 84

def get_prices(product_id, opts = {})
  data, _status_code, _headers = get_prices_with_http_info(product_id, opts)
  data
end

#get_prices_with_http_info(product_id, opts = {}) ⇒ Array<(Prices, Fixnum, Hash)>

Return available Prices across all Regions for a Product.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :page (Integer)

    The page of results to return.

  • :limit (Integer)

    The amount of results to return. The maximum is 1000

Returns:

  • (Array<(Prices, Fixnum, Hash)>)

    Prices data, response status code and response headers



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/vantage-client/api/prices_api.rb', line 95

def get_prices_with_http_info(product_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PricesApi.get_prices ...'
  end
  # verify the required parameter 'product_id' is set
  if @api_client.config.client_side_validation && product_id.nil?
    fail ArgumentError, "Missing the required parameter 'product_id' when calling PricesApi.get_prices"
  end
  # resource path
  local_var_path = '/v1/products/{product_id}/prices'.sub('{' + 'product_id' + '}', product_id.to_s)

  # query parameters
  query_params = {}
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['oauth2']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Prices')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PricesApi#get_prices\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_product(id, opts = {}) ⇒ Product

Return a product

Parameters:

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

    the optional parameters

Returns:



138
139
140
141
# File 'lib/vantage-client/api/prices_api.rb', line 138

def get_product(id, opts = {})
  data, _status_code, _headers = get_product_with_http_info(id, opts)
  data
end

#get_product_with_http_info(id, opts = {}) ⇒ Array<(Product, Fixnum, Hash)>

Return a product

Parameters:

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

    the optional parameters

Returns:

  • (Array<(Product, Fixnum, Hash)>)

    Product data, response status code and response headers



147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# File 'lib/vantage-client/api/prices_api.rb', line 147

def get_product_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PricesApi.get_product ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling PricesApi.get_product"
  end
  # resource path
  local_var_path = '/v1/products/{id}'.sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['oauth2']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Product')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PricesApi#get_product\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_products(opts = {}) ⇒ Products

Return available Products for a Service. For example, with a Provider of AWS and a Service of EC2, Products will be a list of all EC2 Instances. By default, this endpoint returns all Products across all Services and Providers but has optional query parameters for filtering listed below.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :provider_id (String)

    Query by Provider to list all Products across all Services for a Provider. e.g. aws

  • :service_id (String)

    Query by Service to list all Products for a specific provider service. e.g. aws-ec2

  • :name (String)

    Query by name of the Product to see a list of products which match that name. e.g. m5a.16xlarge

  • :page (Integer)

    The page of results to return.

  • :limit (Integer)

    The amount of results to return. The maximum is 1000

Returns:



192
193
194
195
# File 'lib/vantage-client/api/prices_api.rb', line 192

def get_products(opts = {})
  data, _status_code, _headers = get_products_with_http_info(opts)
  data
end

#get_products_with_http_info(opts = {}) ⇒ Array<(Products, Fixnum, Hash)>

Return available Products for a Service. For example, with a Provider of AWS and a Service of EC2, Products will be a list of all EC2 Instances. By default, this endpoint returns all Products across all Services and Providers but has optional query parameters for filtering listed below.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :provider_id (String)

    Query by Provider to list all Products across all Services for a Provider. e.g. aws

  • :service_id (String)

    Query by Service to list all Products for a specific provider service. e.g. aws-ec2

  • :name (String)

    Query by name of the Product to see a list of products which match that name. e.g. m5a.16xlarge

  • :page (Integer)

    The page of results to return.

  • :limit (Integer)

    The amount of results to return. The maximum is 1000

Returns:

  • (Array<(Products, Fixnum, Hash)>)

    Products data, response status code and response headers



205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
# File 'lib/vantage-client/api/prices_api.rb', line 205

def get_products_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PricesApi.get_products ...'
  end
  # resource path
  local_var_path = '/v1/products'

  # query parameters
  query_params = {}
  query_params[:'provider_id'] = opts[:'provider_id'] if !opts[:'provider_id'].nil?
  query_params[:'service_id'] = opts[:'service_id'] if !opts[:'service_id'].nil?
  query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['oauth2']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Products')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PricesApi#get_products\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_providers(opts = {}) ⇒ Providers

Providers are cloud infrastructure and service providers from which all cloud prices are derived. You can think of example Providers as being AWS, GCP, Cloudflare or Datadog. Currently, Vantage only supports a single provider of AWS but over time more will be added. Use this endpoint to retrieve a provider id for other API calls.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :page (Integer)

    The page of results to return.

  • :limit (Integer)

    The amount of results to return. The maximum is 1000

Returns:



248
249
250
251
# File 'lib/vantage-client/api/prices_api.rb', line 248

def get_providers(opts = {})
  data, _status_code, _headers = get_providers_with_http_info(opts)
  data
end

#get_providers_with_http_info(opts = {}) ⇒ Array<(Providers, Fixnum, Hash)>

Providers are cloud infrastructure and service providers from which all cloud prices are derived. You can think of example Providers as being AWS, GCP, Cloudflare or Datadog. Currently, Vantage only supports a single provider of AWS but over time more will be added. Use this endpoint to retrieve a provider id for other API calls.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :page (Integer)

    The page of results to return.

  • :limit (Integer)

    The amount of results to return. The maximum is 1000

Returns:

  • (Array<(Providers, Fixnum, Hash)>)

    Providers data, response status code and response headers



258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
# File 'lib/vantage-client/api/prices_api.rb', line 258

def get_providers_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PricesApi.get_providers ...'
  end
  # resource path
  local_var_path = '/v1/providers'

  # query parameters
  query_params = {}
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['oauth2']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Providers')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PricesApi#get_providers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_services(opts = {}) ⇒ Services

Return all Services. Examples of Services are EC2 for AWS. This endpoint will return all Services by default but you have the ability to filter Services by Provider using the optional query parameter documented below.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :provider_id (String)

    Query services for a specific provider. e.g. aws

  • :page (Integer)

    The page of results to return.

  • :limit (Integer)

    The amount of results to return. The maximum is 1000

Returns:



299
300
301
302
# File 'lib/vantage-client/api/prices_api.rb', line 299

def get_services(opts = {})
  data, _status_code, _headers = get_services_with_http_info(opts)
  data
end

#get_services_with_http_info(opts = {}) ⇒ Array<(Services, Fixnum, Hash)>

Return all Services. Examples of Services are EC2 for AWS. This endpoint will return all Services by default but you have the ability to filter Services by Provider using the optional query parameter documented below.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :provider_id (String)

    Query services for a specific provider. e.g. aws

  • :page (Integer)

    The page of results to return.

  • :limit (Integer)

    The amount of results to return. The maximum is 1000

Returns:

  • (Array<(Services, Fixnum, Hash)>)

    Services data, response status code and response headers



310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
# File 'lib/vantage-client/api/prices_api.rb', line 310

def get_services_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PricesApi.get_services ...'
  end
  # resource path
  local_var_path = '/v1/services'

  # query parameters
  query_params = {}
  query_params[:'provider_id'] = opts[:'provider_id'] if !opts[:'provider_id'].nil?
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['oauth2']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Services')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PricesApi#get_services\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end