Class: DatadogAPIClient::V2::DataDeletionAPI

Inherits:
Object
  • Object
show all
Defined in:
lib/datadog_api_client/v2/api/data_deletion_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = DatadogAPIClient::APIClient.default) ⇒ DataDeletionAPI

Returns a new instance of DataDeletionAPI.



22
23
24
# File 'lib/datadog_api_client/v2/api/data_deletion_api.rb', line 22

def initialize(api_client = DatadogAPIClient::APIClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



20
21
22
# File 'lib/datadog_api_client/v2/api/data_deletion_api.rb', line 20

def api_client
  @api_client
end

Instance Method Details

#cancel_data_deletion_request(id, opts = {}) ⇒ Object

Cancels a data deletion request.



29
30
31
32
# File 'lib/datadog_api_client/v2/api/data_deletion_api.rb', line 29

def cancel_data_deletion_request(id, opts = {})
  data, _status_code, _headers = cancel_data_deletion_request_with_http_info(id, opts)
  data
end

#cancel_data_deletion_request_with_http_info(id, opts = {}) ⇒ Array<(CancelDataDeletionResponseBody, Integer, Hash)>

Cancels a data deletion request.

Cancels a data deletion request by providing its ID.

Parameters:

  • ID of the deletion request.

  • (defaults to: {})

    the optional parameters

Returns:

  • CancelDataDeletionResponseBody data, response status code and response headers



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
91
92
93
94
95
# File 'lib/datadog_api_client/v2/api/data_deletion_api.rb', line 41

def cancel_data_deletion_request_with_http_info(id, opts = {})
  unstable_enabled = @api_client.config.unstable_operations["v2.cancel_data_deletion_request".to_sym]
  if unstable_enabled
    @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.cancel_data_deletion_request")
  else
    raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.cancel_data_deletion_request"))
  end

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DataDeletionAPI.cancel_data_deletion_request ...'
  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 DataDeletionAPI.cancel_data_deletion_request"
  end
  # resource path
  local_var_path = '/api/v2/deletion/requests/{id}/cancel'.sub('{id}', CGI.escape(id.to_s).gsub('%2F', '/'))

  # 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'])

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]

  new_options = opts.merge(
    :operation => :cancel_data_deletion_request,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type,
    :api_version => "V2"
  )

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

#create_data_deletion_request(product, body, opts = {}) ⇒ Object

Creates a data deletion request.



100
101
102
103
# File 'lib/datadog_api_client/v2/api/data_deletion_api.rb', line 100

def create_data_deletion_request(product, body, opts = {})
  data, _status_code, _headers = create_data_deletion_request_with_http_info(product, body, opts)
  data
end

#create_data_deletion_request_with_http_info(product, body, opts = {}) ⇒ Array<(CreateDataDeletionResponseBody, Integer, Hash)>

Creates a data deletion request.

Creates a data deletion request by providing a query and a timeframe targeting the proper data.

Parameters:

  • Name of the product to be deleted, either ‘logs` or `rum`.

  • (defaults to: {})

    the optional parameters

Returns:

  • CreateDataDeletionResponseBody data, response status code and response headers



113
114
115
116
117
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
169
170
171
172
173
# File 'lib/datadog_api_client/v2/api/data_deletion_api.rb', line 113

def create_data_deletion_request_with_http_info(product, body, opts = {})
  unstable_enabled = @api_client.config.unstable_operations["v2.create_data_deletion_request".to_sym]
  if unstable_enabled
    @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.create_data_deletion_request")
  else
    raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.create_data_deletion_request"))
  end

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DataDeletionAPI.create_data_deletion_request ...'
  end
  # verify the required parameter 'product' is set
  if @api_client.config.client_side_validation && product.nil?
    fail ArgumentError, "Missing the required parameter 'product' when calling DataDeletionAPI.create_data_deletion_request"
  end
  # verify the required parameter 'body' is set
  if @api_client.config.client_side_validation && body.nil?
    fail ArgumentError, "Missing the required parameter 'body' when calling DataDeletionAPI.create_data_deletion_request"
  end
  # resource path
  local_var_path = '/api/v2/deletion/data/{product}'.sub('{product}', CGI.escape(product.to_s).gsub('%2F', '/'))

  # 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'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

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

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(body)

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

  # auth_names
  auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]

  new_options = opts.merge(
    :operation => :create_data_deletion_request,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type,
    :api_version => "V2"
  )

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

#get_data_deletion_requests(opts = {}) ⇒ Object

Gets a list of data deletion requests.



178
179
180
181
# File 'lib/datadog_api_client/v2/api/data_deletion_api.rb', line 178

def get_data_deletion_requests(opts = {})
  data, _status_code, _headers = get_data_deletion_requests_with_http_info(opts)
  data
end

#get_data_deletion_requests_with_http_info(opts = {}) ⇒ Array<(GetDataDeletionsResponseBody, Integer, Hash)>

Gets a list of data deletion requests.

Gets a list of data deletion requests based on several filter parameters.

Parameters:

  • (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :next_page (String)

    The next page of the previous search. If the next_page parameter is included, the rest of the query elements are ignored.

  • :product (String)

    Retrieve only the requests related to the given product.

  • :query (String)

    Retrieve only the requests that matches the given query.

  • :status (String)

    Retrieve only the requests with the given status.

  • :page_size (Integer)

    Sets the page size of the search.

Returns:

  • GetDataDeletionsResponseBody data, response status code and response headers



194
195
196
197
198
199
200
201
202
203
204
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
243
244
245
246
247
248
249
250
251
252
253
254
255
# File 'lib/datadog_api_client/v2/api/data_deletion_api.rb', line 194

def get_data_deletion_requests_with_http_info(opts = {})
  unstable_enabled = @api_client.config.unstable_operations["v2.get_data_deletion_requests".to_sym]
  if unstable_enabled
    @api_client.config.logger.warn format("Using unstable operation '%s'", "v2.get_data_deletion_requests")
  else
    raise DatadogAPIClient::APIError.new(message: format("Unstable operation '%s' is disabled", "v2.get_data_deletion_requests"))
  end

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: DataDeletionAPI.get_data_deletion_requests ...'
  end
  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 50
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling DataDeletionAPI.get_data_deletion_requests, must be smaller than or equal to 50.'
  end
  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling DataDeletionAPI.get_data_deletion_requests, must be greater than or equal to 1.'
  end
  # resource path
  local_var_path = '/api/v2/deletion/requests'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'next_page'] = opts[:'next_page'] if !opts[:'next_page'].nil?
  query_params[:'product'] = opts[:'product'] if !opts[:'product'].nil?
  query_params[:'query'] = opts[:'query'] if !opts[:'query'].nil?
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
  query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?

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

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]

  new_options = opts.merge(
    :operation => :get_data_deletion_requests,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type,
    :api_version => "V2"
  )

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