fastly 8.5.0 → 8.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +17 -0
  3. data/Gemfile.lock +1 -1
  4. data/README.md +15 -2
  5. data/docs/{RelationshipTlsDnsRecord.md → AsyncResponse.md} +3 -2
  6. data/docs/Billing.md +1 -2
  7. data/docs/BillingApi.md +2 -2
  8. data/docs/BillingBandwidth.md +11 -0
  9. data/docs/BillingBandwidthTiers.md +14 -0
  10. data/docs/{RelationshipTlsDnsRecords.md → BillingEstimateInvoiceId.md} +2 -2
  11. data/docs/BillingEstimateResponse.md +2 -2
  12. data/docs/{RelationshipTlsDnsRecordDnsRecord.md → BillingInvoiceId.md} +2 -2
  13. data/docs/BillingInvoicesApi.md +39 -6
  14. data/docs/BillingRegions.md +13 -0
  15. data/docs/BillingResponse.md +2 -2
  16. data/docs/BillingResponseLineItem.md +1 -1
  17. data/docs/BillingUsageMetricsApi.md +111 -0
  18. data/docs/CreateDashboardRequest.md +12 -0
  19. data/docs/Dashboard.md +17 -0
  20. data/docs/DashboardItem.md +15 -0
  21. data/docs/DashboardItemPropertyDataSource.md +11 -0
  22. data/docs/DashboardItemPropertyDataSourcePropertyConfig.md +10 -0
  23. data/docs/DashboardItemPropertyVisualization.md +11 -0
  24. data/docs/DashboardItemPropertyVisualizationPropertyConfig.md +12 -0
  25. data/docs/{LineItemDataReadOnlyInvoiceId.md → DashboardPropertyCreatedBy.md} +1 -1
  26. data/docs/DashboardPropertyUpdatedBy.md +9 -0
  27. data/docs/DomainInspectorMeasurements.md +1 -1
  28. data/docs/{InvoiceResponse.md → EomInvoiceResponse.md} +2 -2
  29. data/docs/GetServiceLevelUsageResponse.md +10 -0
  30. data/docs/GetServiceLevelUsageTypesResponse.md +10 -0
  31. data/docs/IncludedWithTlsConfiguration.md +10 -0
  32. data/docs/IncludedWithTlsConfigurationItem.md +12 -0
  33. data/docs/Invoice.md +1 -1
  34. data/docs/LineItemData.md +1 -1
  35. data/docs/ListDashboardsResponse.md +11 -0
  36. data/docs/{ListInvoicesResponse.md → ListEomInvoicesResponse.md} +1 -1
  37. data/docs/MtdInvoiceResponse.md +15 -0
  38. data/docs/Mtdinvoice.md +15 -0
  39. data/docs/Mtdlineitems.md +18 -0
  40. data/docs/ObservabilityCustomDashboardsApi.md +203 -0
  41. data/docs/RealtimeEntryAggregated.md +1 -0
  42. data/docs/RealtimeMeasurements.md +1 -0
  43. data/docs/RelationshipDefaultEcdsaTlsCertificate.md +10 -0
  44. data/docs/RelationshipDefaultEcdsaTlsCertificateDefaultEcdsaCertificate.md +10 -0
  45. data/docs/RelationshipDefaultEcdsaTlsCertificateDefaultEcdsaCertificateData.md +11 -0
  46. data/docs/RelationshipDefaultTlsCertificate.md +10 -0
  47. data/docs/RelationshipDefaultTlsCertificateDefaultCertificate.md +10 -0
  48. data/docs/RelationshipDefaultTlsCertificateDefaultCertificateData.md +11 -0
  49. data/docs/RelationshipTlsDnsRecordsRequest.md +10 -0
  50. data/docs/RelationshipTlsDnsRecordsRequestDnsRecords.md +10 -0
  51. data/docs/RelationshipTlsDnsRecordsRequestDnsRecordsData.md +11 -0
  52. data/docs/RelationshipTlsDnsRecordsResponse.md +10 -0
  53. data/docs/RelationshipTlsDnsRecordsResponseDnsRecords.md +10 -0
  54. data/docs/{RelationshipMemberTlsDnsRecord.md → RelationshipTlsDnsRecordsResponseDnsRecordsData.md} +1 -1
  55. data/docs/Results.md +1 -0
  56. data/docs/Serviceusagemetric.md +13 -0
  57. data/docs/Serviceusagemetrics.md +10 -0
  58. data/docs/ServiceusagemetricsData.md +16 -0
  59. data/docs/Serviceusagetype.md +11 -0
  60. data/docs/Serviceusagetypes.md +10 -0
  61. data/docs/TlsCertificateBlobResponse.md +10 -0
  62. data/docs/TlsCertificatesApi.md +38 -0
  63. data/docs/TlsDnsRecord.md +1 -2
  64. data/docs/UpdateDashboardRequest.md +12 -0
  65. data/docs/Values.md +1 -1
  66. data/lib/fastly/api/billing_api.rb +2 -2
  67. data/lib/fastly/api/billing_invoices_api.rb +64 -8
  68. data/lib/fastly/api/billing_usage_metrics_api.rb +213 -0
  69. data/lib/fastly/api/observability_custom_dashboards_api.rb +333 -0
  70. data/lib/fastly/api/tls_certificates_api.rb +63 -0
  71. data/lib/fastly/configuration.rb +54 -0
  72. data/lib/fastly/models/async_response.rb +225 -0
  73. data/lib/fastly/models/billing.rb +2 -11
  74. data/lib/fastly/models/billing_bandwidth.rb +227 -0
  75. data/lib/fastly/models/billing_bandwidth_tiers.rb +252 -0
  76. data/lib/fastly/models/{relationship_tls_dns_record.rb → billing_estimate_invoice_id.rb} +10 -10
  77. data/lib/fastly/models/billing_estimate_response.rb +12 -11
  78. data/lib/fastly/models/billing_invoice_id.rb +216 -0
  79. data/lib/fastly/models/billing_regions.rb +243 -0
  80. data/lib/fastly/models/billing_response.rb +12 -11
  81. data/lib/fastly/models/billing_response_line_item.rb +2 -1
  82. data/lib/fastly/models/create_dashboard_request.rb +245 -0
  83. data/lib/fastly/models/dashboard.rb +290 -0
  84. data/lib/fastly/models/dashboard_item.rb +368 -0
  85. data/lib/fastly/models/dashboard_item_property_data_source.rb +271 -0
  86. data/lib/fastly/models/dashboard_item_property_data_source_property_config.rb +244 -0
  87. data/lib/fastly/models/dashboard_item_property_visualization.rb +271 -0
  88. data/lib/fastly/models/dashboard_item_property_visualization_property_config.rb +303 -0
  89. data/lib/fastly/models/{line_item_data_read_only_invoice_id.rb → dashboard_property_created_by.rb} +4 -3
  90. data/lib/fastly/models/dashboard_property_updated_by.rb +208 -0
  91. data/lib/fastly/models/domain_inspector_measurements.rb +1 -1
  92. data/lib/fastly/models/{invoice_response.rb → eom_invoice_response.rb} +4 -4
  93. data/lib/fastly/models/get_service_level_usage_response.rb +223 -0
  94. data/lib/fastly/models/get_service_level_usage_types_response.rb +225 -0
  95. data/lib/fastly/models/included_with_tls_configuration.rb +218 -0
  96. data/lib/fastly/models/included_with_tls_configuration_item.rb +237 -0
  97. data/lib/fastly/models/invoice.rb +1 -1
  98. data/lib/fastly/models/invoicelineitems.rb +5 -5
  99. data/lib/fastly/models/line_item_data.rb +2 -1
  100. data/lib/fastly/models/list_dashboards_response.rb +229 -0
  101. data/lib/fastly/models/{list_invoices_response.rb → list_eom_invoices_response.rb} +3 -3
  102. data/lib/fastly/models/mtd_invoice_response.rb +275 -0
  103. data/lib/fastly/models/mtdinvoice.rb +268 -0
  104. data/lib/fastly/models/mtdlineitems.rb +297 -0
  105. data/lib/fastly/models/realtime_entry_aggregated.rb +14 -4
  106. data/lib/fastly/models/realtime_measurements.rb +14 -4
  107. data/lib/fastly/models/relationship_default_ecdsa_tls_certificate.rb +216 -0
  108. data/lib/fastly/models/relationship_default_ecdsa_tls_certificate_default_ecdsa_certificate.rb +216 -0
  109. data/lib/fastly/models/relationship_default_ecdsa_tls_certificate_default_ecdsa_certificate_data.rb +228 -0
  110. data/lib/fastly/models/relationship_default_tls_certificate.rb +216 -0
  111. data/lib/fastly/models/relationship_default_tls_certificate_default_certificate.rb +216 -0
  112. data/lib/fastly/models/relationship_default_tls_certificate_default_certificate_data.rb +228 -0
  113. data/lib/fastly/models/{relationship_tls_dns_records.rb → relationship_tls_dns_records_request.rb} +4 -4
  114. data/lib/fastly/models/relationship_tls_dns_records_request_dns_records.rb +218 -0
  115. data/lib/fastly/models/{relationship_member_tls_dns_record.rb → relationship_tls_dns_records_request_dns_records_data.rb} +3 -3
  116. data/lib/fastly/models/relationship_tls_dns_records_response.rb +216 -0
  117. data/lib/fastly/models/relationship_tls_dns_records_response_dns_records.rb +218 -0
  118. data/lib/fastly/models/relationship_tls_dns_records_response_dns_records_data.rb +227 -0
  119. data/lib/fastly/models/relationships_for_tls_configuration.rb +1 -1
  120. data/lib/fastly/models/results.rb +11 -1
  121. data/lib/fastly/models/serviceusagemetric.rb +246 -0
  122. data/lib/fastly/models/serviceusagemetrics.rb +216 -0
  123. data/lib/fastly/models/serviceusagemetrics_data.rb +276 -0
  124. data/lib/fastly/models/serviceusagetype.rb +227 -0
  125. data/lib/fastly/models/{relationship_tls_dns_record_dns_record.rb → serviceusagetypes.rb} +4 -4
  126. data/lib/fastly/models/tls_certificate_blob_response.rb +217 -0
  127. data/lib/fastly/models/tls_dns_record.rb +48 -12
  128. data/lib/fastly/models/update_dashboard_request.rb +240 -0
  129. data/lib/fastly/models/values.rb +1 -1
  130. data/lib/fastly/version.rb +1 -1
  131. data/lib/fastly.rb +46 -7
  132. data/sig.json +1 -1
  133. metadata +94 -16
data/docs/Values.md CHANGED
@@ -42,7 +42,7 @@
42
42
  | **origin_fetch_resp_body_bytes** | **Integer** | Total body bytes received from origin. | [optional] |
43
43
  | **bandwidth** | **Integer** | Total bytes delivered (`resp_header_bytes` + `resp_body_bytes` + `bereq_header_bytes` + `bereq_body_bytes`). | [optional] |
44
44
  | **edge_hit_ratio** | **Float** | Ratio of cache hits to cache misses at the edge, between 0 and 1 (`edge_hit_requests` / (`edge_hit_requests` + `edge_miss_requests`)). | [optional] |
45
- | **origin_offload** | **Float** | Ratio of response bytes delivered from the edge compared to what is delivered from origin, between 0 and 1. (`edge_resp_body_bytes` + `edge_resp_header_bytes`) / (`origin_fetch_resp_body_bytes` + `origin_fetch_resp_header_bytes` + `edge_resp_body_bytes` + `edge_resp_header_bytes`). | [optional] |
45
+ | **origin_offload** | **Float** | Origin Offload measures the ratio of bytes served to end users that were cached by Fastly, over the bytes served to end users, between 0 and 1. ((`edge_resp_body_bytes` + `edge_resp_header_bytes`) - (`origin_fetch_resp_body_bytes` + `origin_fetch_resp_header_bytes`)) / (`edge_resp_body_bytes` + `edge_resp_header_bytes`). Previously, Origin Offload used a different formula. [Learn more](https://www.fastly.com/documentation/reference/changes/2024/06/add-origin_offload-metric). | [optional] |
46
46
  | **origin_status_200** | **Integer** | Number of responses received from origin with status code 200 (Success). | [optional] |
47
47
  | **origin_status_204** | **Integer** | Number of responses received from origin with status code 204 (No Content). | [optional] |
48
48
  | **origin_status_206** | **Integer** | Number of responses received from origin with status code 206 (Partial Content). | [optional] |
@@ -90,7 +90,7 @@ module Fastly
90
90
  # Get an invoice
91
91
  # Get the invoice for the given invoice_id.
92
92
  # @option opts [String] :customer_id Alphanumeric string identifying the customer. (required)
93
- # @option opts [String] :invoice_id Alphanumeric string identifying the invoice. (required)
93
+ # @option opts [Integer] :invoice_id (required)
94
94
  # @return [BillingResponse]
95
95
  def get_invoice_by_id(opts = {})
96
96
  data, _status_code, _headers = get_invoice_by_id_with_http_info(opts)
@@ -100,7 +100,7 @@ module Fastly
100
100
  # Get an invoice
101
101
  # Get the invoice for the given invoice_id.
102
102
  # @option opts [String] :customer_id Alphanumeric string identifying the customer. (required)
103
- # @option opts [String] :invoice_id Alphanumeric string identifying the invoice. (required)
103
+ # @option opts [Integer] :invoice_id (required)
104
104
  # @return [Array<(BillingResponse, Integer, Hash)>] BillingResponse data, response status code and response headers
105
105
  def get_invoice_by_id_with_http_info(opts = {})
106
106
  if @api_client.config.debugging
@@ -19,8 +19,8 @@ module Fastly
19
19
  end
20
20
  # Get invoice by ID.
21
21
  # Returns invoice associated with the invoice id.
22
- # @option opts [String] :invoice_id Alphanumeric string identifying the invoice. (required)
23
- # @return [InvoiceResponse]
22
+ # @option opts [Integer] :invoice_id (required)
23
+ # @return [EomInvoiceResponse]
24
24
  def get_invoice_by_invoice_id(opts = {})
25
25
  data, _status_code, _headers = get_invoice_by_invoice_id_with_http_info(opts)
26
26
  data
@@ -28,8 +28,8 @@ module Fastly
28
28
 
29
29
  # Get invoice by ID.
30
30
  # Returns invoice associated with the invoice id.
31
- # @option opts [String] :invoice_id Alphanumeric string identifying the invoice. (required)
32
- # @return [Array<(InvoiceResponse, Integer, Hash)>] InvoiceResponse data, response status code and response headers
31
+ # @option opts [Integer] :invoice_id (required)
32
+ # @return [Array<(EomInvoiceResponse, Integer, Hash)>] EomInvoiceResponse data, response status code and response headers
33
33
  def get_invoice_by_invoice_id_with_http_info(opts = {})
34
34
  if @api_client.config.debugging
35
35
  @api_client.config.logger.debug 'Calling API: BillingInvoicesApi.get_invoice_by_invoice_id ...'
@@ -58,7 +58,7 @@ module Fastly
58
58
  post_body = opts[:debug_body]
59
59
 
60
60
  # return_type
61
- return_type = opts[:debug_return_type] || 'InvoiceResponse'
61
+ return_type = opts[:debug_return_type] || 'EomInvoiceResponse'
62
62
 
63
63
  # auth_names
64
64
  auth_names = opts[:debug_auth_names] || ['token']
@@ -80,13 +80,69 @@ module Fastly
80
80
  return data, status_code, headers
81
81
  end
82
82
 
83
+ # Get month-to-date invoice.
84
+ # Returns month-to-date invoice for the current month.
85
+ # @return [MtdInvoiceResponse]
86
+ def get_month_to_date_invoice(opts = {})
87
+ data, _status_code, _headers = get_month_to_date_invoice_with_http_info(opts)
88
+ data
89
+ end
90
+
91
+ # Get month-to-date invoice.
92
+ # Returns month-to-date invoice for the current month.
93
+ # @return [Array<(MtdInvoiceResponse, Integer, Hash)>] MtdInvoiceResponse data, response status code and response headers
94
+ def get_month_to_date_invoice_with_http_info(opts = {})
95
+ if @api_client.config.debugging
96
+ @api_client.config.logger.debug 'Calling API: BillingInvoicesApi.get_month_to_date_invoice ...'
97
+ end
98
+ # unbox the parameters from the hash
99
+ # resource path
100
+ local_var_path = '/billing/v3/invoices/month-to-date'
101
+
102
+ # query parameters
103
+ query_params = opts[:query_params] || {}
104
+
105
+ # header parameters
106
+ header_params = opts[:header_params] || {}
107
+ # HTTP header 'Accept' (if needed)
108
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
109
+
110
+ # form parameters
111
+ form_params = opts[:form_params] || {}
112
+
113
+ # http body (model)
114
+ post_body = opts[:debug_body]
115
+
116
+ # return_type
117
+ return_type = opts[:debug_return_type] || 'MtdInvoiceResponse'
118
+
119
+ # auth_names
120
+ auth_names = opts[:debug_auth_names] || ['token']
121
+
122
+ new_options = opts.merge(
123
+ :operation => :"BillingInvoicesApi.get_month_to_date_invoice",
124
+ :header_params => header_params,
125
+ :query_params => query_params,
126
+ :form_params => form_params,
127
+ :body => post_body,
128
+ :auth_names => auth_names,
129
+ :return_type => return_type
130
+ )
131
+
132
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
133
+ if @api_client.config.debugging
134
+ @api_client.config.logger.debug "API called: BillingInvoicesApi#get_month_to_date_invoice\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
135
+ end
136
+ return data, status_code, headers
137
+ end
138
+
83
139
  # List of invoices.
84
140
  # Returns the list of invoices, sorted by billing start date (newest to oldest).
85
141
  # @option opts [String] :billing_start_date
86
142
  # @option opts [String] :billing_end_date
87
143
  # @option opts [String] :limit Number of results per page. The maximum is 200. (default to '100')
88
144
  # @option opts [String] :cursor Cursor value from the &#x60;next_cursor&#x60; field of a previous response, used to retrieve the next page. To request the first page, this should be empty.
89
- # @return [ListInvoicesResponse]
145
+ # @return [ListEomInvoicesResponse]
90
146
  def list_invoices(opts = {})
91
147
  data, _status_code, _headers = list_invoices_with_http_info(opts)
92
148
  data
@@ -98,7 +154,7 @@ module Fastly
98
154
  # @option opts [String] :billing_end_date
99
155
  # @option opts [String] :limit Number of results per page. The maximum is 200. (default to '100')
100
156
  # @option opts [String] :cursor Cursor value from the &#x60;next_cursor&#x60; field of a previous response, used to retrieve the next page. To request the first page, this should be empty.
101
- # @return [Array<(ListInvoicesResponse, Integer, Hash)>] ListInvoicesResponse data, response status code and response headers
157
+ # @return [Array<(ListEomInvoicesResponse, Integer, Hash)>] ListEomInvoicesResponse data, response status code and response headers
102
158
  def list_invoices_with_http_info(opts = {})
103
159
  if @api_client.config.debugging
104
160
  @api_client.config.logger.debug 'Calling API: BillingInvoicesApi.list_invoices ...'
@@ -126,7 +182,7 @@ module Fastly
126
182
  post_body = opts[:debug_body]
127
183
 
128
184
  # return_type
129
- return_type = opts[:debug_return_type] || 'ListInvoicesResponse'
185
+ return_type = opts[:debug_return_type] || 'ListEomInvoicesResponse'
130
186
 
131
187
  # auth_names
132
188
  auth_names = opts[:debug_auth_names] || ['token']
@@ -0,0 +1,213 @@
1
+ =begin
2
+ #Fastly API
3
+
4
+ #Via the Fastly API you can perform any of the operations that are possible within the management console, including creating services, domains, and backends, configuring rules or uploading your own application code, as well as account operations such as user administration and billing reports. The API is organized into collections of endpoints that allow manipulation of objects related to Fastly services and accounts. For the most accurate and up-to-date API reference content, visit our [Developer Hub](https://www.fastly.com/documentation/reference/api/)
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: oss@fastly.com
8
+
9
+ =end
10
+
11
+ require 'cgi'
12
+
13
+ module Fastly
14
+ class BillingUsageMetricsApi
15
+ attr_accessor :api_client
16
+
17
+ def initialize(api_client = ApiClient.default)
18
+ @api_client = api_client
19
+ end
20
+ # Retrieve service-level usage metrics for a product.
21
+ # Returns product usage, broken down by service.
22
+ # @option opts [String] :customer_id Alphanumeric string identifying the customer. (required)
23
+ # @option opts [String] :product_id The product identifier for the metrics returned (e.g., &#x60;cdn_usage&#x60;). This field is not required for CSV requests. (required)
24
+ # @option opts [String] :usage_type_name The usage type name for the metrics returned (e.g., &#x60;North America Requests&#x60;). This field is not required for CSV requests. (required)
25
+ # @option opts [String] :time_granularity (required)
26
+ # @option opts [String] :start_date
27
+ # @option opts [String] :end_date
28
+ # @option opts [String] :start_month
29
+ # @option opts [String] :end_month
30
+ # @option opts [String] :limit Number of results per page. The maximum is 100. (default to '5')
31
+ # @option opts [String] :cursor Cursor value from the &#x60;next_cursor&#x60; field of a previous response, used to retrieve the next page. To request the first page, this should be empty.
32
+ # @return [Serviceusagemetrics]
33
+ def get_service_level_usage(opts = {})
34
+ data, _status_code, _headers = get_service_level_usage_with_http_info(opts)
35
+ data
36
+ end
37
+
38
+ # Retrieve service-level usage metrics for a product.
39
+ # Returns product usage, broken down by service.
40
+ # @option opts [String] :customer_id Alphanumeric string identifying the customer. (required)
41
+ # @option opts [String] :product_id The product identifier for the metrics returned (e.g., &#x60;cdn_usage&#x60;). This field is not required for CSV requests. (required)
42
+ # @option opts [String] :usage_type_name The usage type name for the metrics returned (e.g., &#x60;North America Requests&#x60;). This field is not required for CSV requests. (required)
43
+ # @option opts [String] :time_granularity (required)
44
+ # @option opts [String] :start_date
45
+ # @option opts [String] :end_date
46
+ # @option opts [String] :start_month
47
+ # @option opts [String] :end_month
48
+ # @option opts [String] :limit Number of results per page. The maximum is 100. (default to '5')
49
+ # @option opts [String] :cursor Cursor value from the &#x60;next_cursor&#x60; field of a previous response, used to retrieve the next page. To request the first page, this should be empty.
50
+ # @return [Array<(Serviceusagemetrics, Integer, Hash)>] Serviceusagemetrics data, response status code and response headers
51
+ def get_service_level_usage_with_http_info(opts = {})
52
+ if @api_client.config.debugging
53
+ @api_client.config.logger.debug 'Calling API: BillingUsageMetricsApi.get_service_level_usage ...'
54
+ end
55
+ # unbox the parameters from the hash
56
+ customer_id = opts[:'customer_id']
57
+ product_id = opts[:'product_id']
58
+ usage_type_name = opts[:'usage_type_name']
59
+ time_granularity = opts[:'time_granularity']
60
+ # verify the required parameter 'customer_id' is set
61
+ if @api_client.config.client_side_validation && customer_id.nil?
62
+ fail ArgumentError, "Missing the required parameter 'customer_id' when calling BillingUsageMetricsApi.get_service_level_usage"
63
+ end
64
+ # verify the required parameter 'product_id' is set
65
+ if @api_client.config.client_side_validation && product_id.nil?
66
+ fail ArgumentError, "Missing the required parameter 'product_id' when calling BillingUsageMetricsApi.get_service_level_usage"
67
+ end
68
+ # verify the required parameter 'usage_type_name' is set
69
+ if @api_client.config.client_side_validation && usage_type_name.nil?
70
+ fail ArgumentError, "Missing the required parameter 'usage_type_name' when calling BillingUsageMetricsApi.get_service_level_usage"
71
+ end
72
+ # verify the required parameter 'time_granularity' is set
73
+ if @api_client.config.client_side_validation && time_granularity.nil?
74
+ fail ArgumentError, "Missing the required parameter 'time_granularity' when calling BillingUsageMetricsApi.get_service_level_usage"
75
+ end
76
+ pattern = Regexp.new(/^day$|^month$/)
77
+ if @api_client.config.client_side_validation && time_granularity !~ pattern
78
+ fail ArgumentError, "invalid value for 'time_granularity' when calling BillingUsageMetricsApi.get_service_level_usage, must conform to the pattern #{pattern}."
79
+ end
80
+
81
+ pattern = Regexp.new(/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/)
82
+ if @api_client.config.client_side_validation && !opts[:'start_date'].nil? && opts[:'start_date'] !~ pattern
83
+ fail ArgumentError, "invalid value for 'opts[:\"start_date\"]' when calling BillingUsageMetricsApi.get_service_level_usage, must conform to the pattern #{pattern}."
84
+ end
85
+
86
+ pattern = Regexp.new(/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/)
87
+ if @api_client.config.client_side_validation && !opts[:'end_date'].nil? && opts[:'end_date'] !~ pattern
88
+ fail ArgumentError, "invalid value for 'opts[:\"end_date\"]' when calling BillingUsageMetricsApi.get_service_level_usage, must conform to the pattern #{pattern}."
89
+ end
90
+
91
+ pattern = Regexp.new(/^[0-9]{4}-[0-9]{2}$/)
92
+ if @api_client.config.client_side_validation && !opts[:'start_month'].nil? && opts[:'start_month'] !~ pattern
93
+ fail ArgumentError, "invalid value for 'opts[:\"start_month\"]' when calling BillingUsageMetricsApi.get_service_level_usage, must conform to the pattern #{pattern}."
94
+ end
95
+
96
+ pattern = Regexp.new(/^[0-9]{4}-[0-9]{2}$/)
97
+ if @api_client.config.client_side_validation && !opts[:'end_month'].nil? && opts[:'end_month'] !~ pattern
98
+ fail ArgumentError, "invalid value for 'opts[:\"end_month\"]' when calling BillingUsageMetricsApi.get_service_level_usage, must conform to the pattern #{pattern}."
99
+ end
100
+
101
+ # resource path
102
+ local_var_path = '/billing/v2/account_customers/{customer_id}/service-usage-metrics'.sub('{' + 'customer_id' + '}', CGI.escape(customer_id.to_s))
103
+
104
+ # query parameters
105
+ query_params = opts[:query_params] || {}
106
+ query_params[:'product_id'] = product_id
107
+ query_params[:'usage_type_name'] = usage_type_name
108
+ query_params[:'time_granularity'] = time_granularity
109
+ query_params[:'start_date'] = opts[:'start_date'] if !opts[:'start_date'].nil?
110
+ query_params[:'end_date'] = opts[:'end_date'] if !opts[:'end_date'].nil?
111
+ query_params[:'start_month'] = opts[:'start_month'] if !opts[:'start_month'].nil?
112
+ query_params[:'end_month'] = opts[:'end_month'] if !opts[:'end_month'].nil?
113
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
114
+ query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
115
+
116
+ # header parameters
117
+ header_params = opts[:header_params] || {}
118
+ # HTTP header 'Accept' (if needed)
119
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
120
+
121
+ # form parameters
122
+ form_params = opts[:form_params] || {}
123
+
124
+ # http body (model)
125
+ post_body = opts[:debug_body]
126
+
127
+ # return_type
128
+ return_type = opts[:debug_return_type] || 'Serviceusagemetrics'
129
+
130
+ # auth_names
131
+ auth_names = opts[:debug_auth_names] || ['token']
132
+
133
+ new_options = opts.merge(
134
+ :operation => :"BillingUsageMetricsApi.get_service_level_usage",
135
+ :header_params => header_params,
136
+ :query_params => query_params,
137
+ :form_params => form_params,
138
+ :body => post_body,
139
+ :auth_names => auth_names,
140
+ :return_type => return_type
141
+ )
142
+
143
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
144
+ if @api_client.config.debugging
145
+ @api_client.config.logger.debug "API called: BillingUsageMetricsApi#get_service_level_usage\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
146
+ end
147
+ return data, status_code, headers
148
+ end
149
+
150
+ # Retrieve product usage types for a customer.
151
+ # Returns product usage types reported by the customer's services.
152
+ # @option opts [String] :customer_id Alphanumeric string identifying the customer. (required)
153
+ # @return [Serviceusagetypes]
154
+ def get_service_level_usage_types(opts = {})
155
+ data, _status_code, _headers = get_service_level_usage_types_with_http_info(opts)
156
+ data
157
+ end
158
+
159
+ # Retrieve product usage types for a customer.
160
+ # Returns product usage types reported by the customer&#39;s services.
161
+ # @option opts [String] :customer_id Alphanumeric string identifying the customer. (required)
162
+ # @return [Array<(Serviceusagetypes, Integer, Hash)>] Serviceusagetypes data, response status code and response headers
163
+ def get_service_level_usage_types_with_http_info(opts = {})
164
+ if @api_client.config.debugging
165
+ @api_client.config.logger.debug 'Calling API: BillingUsageMetricsApi.get_service_level_usage_types ...'
166
+ end
167
+ # unbox the parameters from the hash
168
+ customer_id = opts[:'customer_id']
169
+ # verify the required parameter 'customer_id' is set
170
+ if @api_client.config.client_side_validation && customer_id.nil?
171
+ fail ArgumentError, "Missing the required parameter 'customer_id' when calling BillingUsageMetricsApi.get_service_level_usage_types"
172
+ end
173
+ # resource path
174
+ local_var_path = '/billing/v2/account_customers/{customer_id}/service-usage-types'.sub('{' + 'customer_id' + '}', CGI.escape(customer_id.to_s))
175
+
176
+ # query parameters
177
+ query_params = opts[:query_params] || {}
178
+
179
+ # header parameters
180
+ header_params = opts[:header_params] || {}
181
+ # HTTP header 'Accept' (if needed)
182
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
183
+
184
+ # form parameters
185
+ form_params = opts[:form_params] || {}
186
+
187
+ # http body (model)
188
+ post_body = opts[:debug_body]
189
+
190
+ # return_type
191
+ return_type = opts[:debug_return_type] || 'Serviceusagetypes'
192
+
193
+ # auth_names
194
+ auth_names = opts[:debug_auth_names] || ['token']
195
+
196
+ new_options = opts.merge(
197
+ :operation => :"BillingUsageMetricsApi.get_service_level_usage_types",
198
+ :header_params => header_params,
199
+ :query_params => query_params,
200
+ :form_params => form_params,
201
+ :body => post_body,
202
+ :auth_names => auth_names,
203
+ :return_type => return_type
204
+ )
205
+
206
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
207
+ if @api_client.config.debugging
208
+ @api_client.config.logger.debug "API called: BillingUsageMetricsApi#get_service_level_usage_types\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
209
+ end
210
+ return data, status_code, headers
211
+ end
212
+ end
213
+ end