class PulpPythonClient::PypiSimpleApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/pulp_python_client/api/pypi_simple_api.rb, line 19
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

create(path, content, sha256_digest, opts = {}) click to toggle source

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, …) @param path [String] @param content [File] A Python package release file to upload to the index. @param sha256_digest [String] SHA256 of package to validate upload integrity. @param [Hash] opts the optional parameters @option opts [String] :action Defaults to `file_upload`, don't change it or request will fail! (default to 'file_upload') @return [PackageUploadTaskResponse]

# File lib/pulp_python_client/api/pypi_simple_api.rb, line 30
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 = {}) click to toggle source

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, …) @param path [String] @param content [File] A Python package release file to upload to the index. @param sha256_digest [String] SHA256 of package to validate upload integrity. @param [Hash] opts the optional parameters @option opts [String] :action Defaults to &#x60;file_upload&#x60;, don&#39;t change it or request will fail! @return [Array<(PackageUploadTaskResponse, Integer, Hash)>] PackageUploadTaskResponse data, response status code and response headers

# File lib/pulp_python_client/api/pypi_simple_api.rb, line 43
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'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data', 'application/x-www-form-urlencoded'])

  # 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[:body] 

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

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

  new_options = opts.merge(
    :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 = {}) click to toggle source

Get package simple page Retrieves the simple api html page for a package. @param package [String] @param path [String] @param [Hash] opts the optional parameters @option opts [Array<String>] :fields A list of fields to include in the response. @option opts [Array<String>] :exclude_fields A list of fields to exclude from the response. @return [nil]

# File lib/pulp_python_client/api/pypi_simple_api.rb, line 123
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 = {}) click to toggle source

Get package simple page Retrieves the simple api html page for a package. @param package [String] @param path [String] @param [Hash] opts the optional parameters @option opts [Array<String>] :fields A list of fields to include in the response. @option opts [Array<String>] :exclude_fields A list of fields to exclude from the response. @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

# File lib/pulp_python_client/api/pypi_simple_api.rb, line 136
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
  # 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[:'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] || {}

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

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

  # return_type
  return_type = opts[:return_type] 

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

  new_options = opts.merge(
    :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 = {}) click to toggle source

Get index simple page Gets the simple api html page for the index. @param path [String] @param [Hash] opts the optional parameters @option opts [Array<String>] :fields A list of fields to include in the response. @option opts [Array<String>] :exclude_fields A list of fields to exclude from the response. @return [nil]

# File lib/pulp_python_client/api/pypi_simple_api.rb, line 194
def read(path, opts = {})
  read_with_http_info(path, opts)
  nil
end
read_with_http_info(path, opts = {}) click to toggle source

Get index simple page Gets the simple api html page for the index. @param path [String] @param [Hash] opts the optional parameters @option opts [Array<String>] :fields A list of fields to include in the response. @option opts [Array<String>] :exclude_fields A list of fields to exclude from the response. @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

# File lib/pulp_python_client/api/pypi_simple_api.rb, line 206
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
  # 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[:'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] || {}

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

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

  # return_type
  return_type = opts[:return_type] 

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

  new_options = opts.merge(
    :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