Class: PulpPythonClient::PypiSimpleApi

Inherits:
Object
  • Object
show all
Defined in:
lib/pulp_python_client/api/pypi_simple_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ PypiSimpleApi

Returns a new instance of PypiSimpleApi.



19
20
21
# File 'lib/pulp_python_client/api/pypi_simple_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/pulp_python_client/api/pypi_simple_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create(path, content, sha256_digest, opts = {}) ⇒ PackageUploadTaskResponse

Upload a package Upload package to the index. This endpoint has the same functionality as the upload endpoint at the ‘/legacy` url of the index. This is provided for convenience for users who want a single index url for all their Python tools. (pip, twine, poetry, pipenv, …)

Parameters:

  • path (String)
  • content (File)

    A Python package release file to upload to the index.

  • sha256_digest (String)

    SHA256 of package to validate upload integrity.

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

    the optional parameters

Options Hash (opts):

  • :x_task_diagnostics (Array<String>)

    List of profilers to use on tasks.

  • :action (String)

    Defaults to &#x60;file_upload&#x60;, don&#39;t change it or request will fail! (default to ‘file_upload’)

Returns:



31
32
33
34
# File 'lib/pulp_python_client/api/pypi_simple_api.rb', line 31

def create(path, content, sha256_digest, opts = {})
  data, _status_code, _headers = create_with_http_info(path, content, sha256_digest, opts)
  data
end

#create_with_http_info(path, content, sha256_digest, opts = {}) ⇒ Array<(PackageUploadTaskResponse, Integer, Hash)>

Upload a package Upload package to the index. This endpoint has the same functionality as the upload endpoint at the &#x60;/legacy&#x60; url of the index. This is provided for convenience for users who want a single index url for all their Python tools. (pip, twine, poetry, pipenv, …)

Parameters:

  • path (String)
  • content (File)

    A Python package release file to upload to the index.

  • sha256_digest (String)

    SHA256 of package to validate upload integrity.

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

    the optional parameters

Options Hash (opts):

  • :x_task_diagnostics (Array<String>)

    List of profilers to use on tasks.

  • :action (String)

    Defaults to &#x60;file_upload&#x60;, don&#39;t change it or request will fail! (default to ‘file_upload’)

Returns:

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

    PackageUploadTaskResponse data, response status code and response headers



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
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
# File 'lib/pulp_python_client/api/pypi_simple_api.rb', line 45

def create_with_http_info(path, content, sha256_digest, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PypiSimpleApi.create ...'
  end
  # verify the required parameter 'path' is set
  if @api_client.config.client_side_validation && path.nil?
    fail ArgumentError, "Missing the required parameter 'path' when calling PypiSimpleApi.create"
  end
  # verify the required parameter 'content' is set
  if @api_client.config.client_side_validation && content.nil?
    fail ArgumentError, "Missing the required parameter 'content' when calling PypiSimpleApi.create"
  end
  # verify the required parameter 'sha256_digest' is set
  if @api_client.config.client_side_validation && sha256_digest.nil?
    fail ArgumentError, "Missing the required parameter 'sha256_digest' when calling PypiSimpleApi.create"
  end
  if @api_client.config.client_side_validation && sha256_digest.to_s.length > 64
    fail ArgumentError, 'invalid value for "sha256_digest" when calling PypiSimpleApi.create, the character length must be smaller than or equal to 64.'
  end

  if @api_client.config.client_side_validation && sha256_digest.to_s.length < 64
    fail ArgumentError, 'invalid value for "sha256_digest" when calling PypiSimpleApi.create, the character length must be great than or equal to 64.'
  end

  if @api_client.config.client_side_validation && !opts[:'action'].nil? && opts[:'action'].to_s.length < 1
    fail ArgumentError, 'invalid value for "opts[:"action"]" when calling PypiSimpleApi.create, the character length must be great than or equal to 1.'
  end

  # resource path
  local_var_path = '/pypi/{path}/simple/'.sub('{' + 'path' + '}', CGI.escape(path.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']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['multipart/form-data', 'application/x-www-form-urlencoded'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end
  header_params[:'X-Task-Diagnostics'] = @api_client.build_collection_param(opts[:'x_task_diagnostics'], :csv) if !opts[:'x_task_diagnostics'].nil?

  # form parameters
  form_params = opts[:form_params] || {}
  form_params['content'] = content
  form_params['sha256_digest'] = sha256_digest
  form_params['action'] = opts[:'action'] if !opts[:'action'].nil?

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

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

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

  new_options = opts.merge(
    :operation => :"PypiSimpleApi.create",
    :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(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PypiSimpleApi#create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#pypi_simple_package_read(package, path, opts = {}) ⇒ nil

Get package simple page Retrieves the simple api html/json page for a package.

Parameters:

  • package (String)
  • path (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_task_diagnostics (Array<String>)

    List of profilers to use on tasks.

  • :format (String)
  • :fields (Array<String>)

    A list of fields to include in the response.

  • :exclude_fields (Array<String>)

    A list of fields to exclude from the response.

Returns:

  • (nil)


132
133
134
135
# File 'lib/pulp_python_client/api/pypi_simple_api.rb', line 132

def pypi_simple_package_read(package, path, opts = {})
  pypi_simple_package_read_with_http_info(package, path, opts)
  nil
end

#pypi_simple_package_read_with_http_info(package, path, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Get package simple page Retrieves the simple api html/json page for a package.

Parameters:

  • package (String)
  • path (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_task_diagnostics (Array<String>)

    List of profilers to use on tasks.

  • :format (String)
  • :fields (Array<String>)

    A list of fields to include in the response.

  • :exclude_fields (Array<String>)

    A list of fields to exclude from the response.

Returns:

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

    nil, 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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
# File 'lib/pulp_python_client/api/pypi_simple_api.rb', line 147

def pypi_simple_package_read_with_http_info(package, path, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PypiSimpleApi.pypi_simple_package_read ...'
  end
  # verify the required parameter 'package' is set
  if @api_client.config.client_side_validation && package.nil?
    fail ArgumentError, "Missing the required parameter 'package' when calling PypiSimpleApi.pypi_simple_package_read"
  end
  # verify the required parameter 'path' is set
  if @api_client.config.client_side_validation && path.nil?
    fail ArgumentError, "Missing the required parameter 'path' when calling PypiSimpleApi.pypi_simple_package_read"
  end
  allowable_values = ["html", "json"]
  if @api_client.config.client_side_validation && opts[:'format'] && !allowable_values.include?(opts[:'format'])
    fail ArgumentError, "invalid value for \"format\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/pypi/{path}/simple/{package}/'.sub('{' + 'package' + '}', CGI.escape(package.to_s).gsub('%2F', '/')).sub('{' + 'path' + '}', CGI.escape(path.to_s).gsub('%2F', '/'))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'format'] = opts[:'format'] if !opts[:'format'].nil?
  query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :multi) if !opts[:'fields'].nil?
  query_params[:'exclude_fields'] = @api_client.build_collection_param(opts[:'exclude_fields'], :multi) if !opts[:'exclude_fields'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  header_params[:'X-Task-Diagnostics'] = @api_client.build_collection_param(opts[:'x_task_diagnostics'], :csv) if !opts[:'x_task_diagnostics'].nil?

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

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

  # return_type
  return_type = opts[:debug_return_type]

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

  new_options = opts.merge(
    :operation => :"PypiSimpleApi.pypi_simple_package_read",
    :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: PypiSimpleApi#pypi_simple_package_read\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#read(path, opts = {}) ⇒ nil

Get index simple page Gets the simple api html page for the index.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :x_task_diagnostics (Array<String>)

    List of profilers to use on tasks.

  • :format (String)
  • :fields (Array<String>)

    A list of fields to include in the response.

  • :exclude_fields (Array<String>)

    A list of fields to exclude from the response.

Returns:

  • (nil)


214
215
216
217
# File 'lib/pulp_python_client/api/pypi_simple_api.rb', line 214

def read(path, opts = {})
  read_with_http_info(path, opts)
  nil
end

#read_with_http_info(path, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Get index simple page Gets the simple api html page for the index.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :x_task_diagnostics (Array<String>)

    List of profilers to use on tasks.

  • :format (String)
  • :fields (Array<String>)

    A list of fields to include in the response.

  • :exclude_fields (Array<String>)

    A list of fields to exclude from the response.

Returns:

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

    nil, response status code and response headers



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
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
# File 'lib/pulp_python_client/api/pypi_simple_api.rb', line 228

def read_with_http_info(path, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PypiSimpleApi.read ...'
  end
  # verify the required parameter 'path' is set
  if @api_client.config.client_side_validation && path.nil?
    fail ArgumentError, "Missing the required parameter 'path' when calling PypiSimpleApi.read"
  end
  allowable_values = ["html", "json"]
  if @api_client.config.client_side_validation && opts[:'format'] && !allowable_values.include?(opts[:'format'])
    fail ArgumentError, "invalid value for \"format\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/pypi/{path}/simple/'.sub('{' + 'path' + '}', CGI.escape(path.to_s).gsub('%2F', '/'))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'format'] = opts[:'format'] if !opts[:'format'].nil?
  query_params[:'fields'] = @api_client.build_collection_param(opts[:'fields'], :multi) if !opts[:'fields'].nil?
  query_params[:'exclude_fields'] = @api_client.build_collection_param(opts[:'exclude_fields'], :multi) if !opts[:'exclude_fields'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  header_params[:'X-Task-Diagnostics'] = @api_client.build_collection_param(opts[:'x_task_diagnostics'], :csv) if !opts[:'x_task_diagnostics'].nil?

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

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

  # return_type
  return_type = opts[:debug_return_type]

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

  new_options = opts.merge(
    :operation => :"PypiSimpleApi.read",
    :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: PypiSimpleApi#read\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end