class PulpAnsibleClient::AnsibleCollectionsApi

Attributes

api_client[RW]

Public Class Methods

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

Public Instance Methods

add_role(ansible_collection_href, nested_role, opts = {}) click to toggle source

Add a role Add a role for this object to users/groups. @param ansible_collection_href [String] @param nested_role [NestedRole] @param [Hash] opts the optional parameters @return [NestedRoleResponse]

# File lib/pulp_ansible_client/api/ansible_collections_api.rb, line 28
def add_role(ansible_collection_href, nested_role, opts = {})
  data, _status_code, _headers = add_role_with_http_info(ansible_collection_href, nested_role, opts)
  data
end
add_role_with_http_info(ansible_collection_href, nested_role, opts = {}) click to toggle source

Add a role Add a role for this object to users/groups. @param ansible_collection_href [String] @param nested_role [NestedRole] @param [Hash] opts the optional parameters @return [Array<(NestedRoleResponse, Integer, Hash)>] NestedRoleResponse data, response status code and response headers

# File lib/pulp_ansible_client/api/ansible_collections_api.rb, line 39
def add_role_with_http_info(ansible_collection_href, nested_role, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AnsibleCollectionsApi.add_role ...'
  end
  # verify the required parameter 'ansible_collection_href' is set
  if @api_client.config.client_side_validation && ansible_collection_href.nil?
    fail ArgumentError, "Missing the required parameter 'ansible_collection_href' when calling AnsibleCollectionsApi.add_role"
  end
  # verify the required parameter 'nested_role' is set
  if @api_client.config.client_side_validation && nested_role.nil?
    fail ArgumentError, "Missing the required parameter 'nested_role' when calling AnsibleCollectionsApi.add_role"
  end
  # resource path
  local_var_path = '{ansible_collection_href}add_role/'.sub('{' + 'ansible_collection_href' + '}', CGI.escape(ansible_collection_href.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', 'application/x-www-form-urlencoded', 'multipart/form-data'])

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

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

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

  # 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: AnsibleCollectionsApi#add_role\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
list(opts = {}) click to toggle source

List collections Viewset for Ansible Collections. @param [Hash] opts the optional parameters @option opts [Integer] :limit Number of results to return per page. @option opts [String] :name @option opts [String] :namespace @option opts [Integer] :offset The initial index from which to return the results. @option opts [Array<String>] :ordering Ordering * &#x60;pulp_id&#x60; - Pulp id * &#x60;-pulp_id&#x60; - Pulp id (descending) * &#x60;pulp_created&#x60; - Pulp created * &#x60;-pulp_created&#x60; - Pulp created (descending) * &#x60;pulp_last_updated&#x60; - Pulp last updated * &#x60;-pulp_last_updated&#x60; - Pulp last updated (descending) * &#x60;namespace&#x60; - Namespace * &#x60;-namespace&#x60; - Namespace (descending) * &#x60;name&#x60; - Name * &#x60;-name&#x60; - Name (descending) * &#x60;pk&#x60; - Pk * &#x60;-pk&#x60; - Pk (descending) @option opts [Array<String>] :pulp_href__in Multiple values may be separated by commas. @option opts [Array<String>] :pulp_id__in Multiple values may be separated by commas. @option opts [String] :q @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 [PaginatedansibleCollectionResponseList]

# File lib/pulp_ansible_client/api/ansible_collections_api.rb, line 106
def list(opts = {})
  data, _status_code, _headers = list_with_http_info(opts)
  data
end
list_roles(ansible_collection_href, opts = {}) click to toggle source

List roles List roles assigned to this object. @param ansible_collection_href [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 [ObjectRolesResponse]

# File lib/pulp_ansible_client/api/ansible_collections_api.rb, line 189
def list_roles(ansible_collection_href, opts = {})
  data, _status_code, _headers = list_roles_with_http_info(ansible_collection_href, opts)
  data
end
list_roles_with_http_info(ansible_collection_href, opts = {}) click to toggle source

List roles List roles assigned to this object. @param ansible_collection_href [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<(ObjectRolesResponse, Integer, Hash)>] ObjectRolesResponse data, response status code and response headers

# File lib/pulp_ansible_client/api/ansible_collections_api.rb, line 201
def list_roles_with_http_info(ansible_collection_href, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AnsibleCollectionsApi.list_roles ...'
  end
  # verify the required parameter 'ansible_collection_href' is set
  if @api_client.config.client_side_validation && ansible_collection_href.nil?
    fail ArgumentError, "Missing the required parameter 'ansible_collection_href' when calling AnsibleCollectionsApi.list_roles"
  end
  # resource path
  local_var_path = '{ansible_collection_href}list_roles/'.sub('{' + 'ansible_collection_href' + '}', CGI.escape(ansible_collection_href.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] || {}
  # 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[:body] 

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

  # 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: AnsibleCollectionsApi#list_roles\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
list_with_http_info(opts = {}) click to toggle source

List collections Viewset for Ansible Collections. @param [Hash] opts the optional parameters @option opts [Integer] :limit Number of results to return per page. @option opts [String] :name @option opts [String] :namespace @option opts [Integer] :offset The initial index from which to return the results. @option opts [Array<String>] :ordering Ordering * &#x60;pulp_id&#x60; - Pulp id * &#x60;-pulp_id&#x60; - Pulp id (descending) * &#x60;pulp_created&#x60; - Pulp created * &#x60;-pulp_created&#x60; - Pulp created (descending) * &#x60;pulp_last_updated&#x60; - Pulp last updated * &#x60;-pulp_last_updated&#x60; - Pulp last updated (descending) * &#x60;namespace&#x60; - Namespace * &#x60;-namespace&#x60; - Namespace (descending) * &#x60;name&#x60; - Name * &#x60;-name&#x60; - Name (descending) * &#x60;pk&#x60; - Pk * &#x60;-pk&#x60; - Pk (descending) @option opts [Array<String>] :pulp_href__in Multiple values may be separated by commas. @option opts [Array<String>] :pulp_id__in Multiple values may be separated by commas. @option opts [String] :q @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<(PaginatedansibleCollectionResponseList, Integer, Hash)>] PaginatedansibleCollectionResponseList data, response status code and response headers

# File lib/pulp_ansible_client/api/ansible_collections_api.rb, line 125
def list_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AnsibleCollectionsApi.list ...'
  end
  allowable_values = ["-name", "-namespace", "-pk", "-pulp_created", "-pulp_id", "-pulp_last_updated", "name", "namespace", "pk", "pulp_created", "pulp_id", "pulp_last_updated"]
  if @api_client.config.client_side_validation && opts[:'ordering'] && !opts[:'ordering'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"ordering\", must include one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/pulp/api/v3/ansible/collections/'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?
  query_params[:'namespace'] = opts[:'namespace'] if !opts[:'namespace'].nil?
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'ordering'] = @api_client.build_collection_param(opts[:'ordering'], :csv) if !opts[:'ordering'].nil?
  query_params[:'pulp_href__in'] = @api_client.build_collection_param(opts[:'pulp_href__in'], :csv) if !opts[:'pulp_href__in'].nil?
  query_params[:'pulp_id__in'] = @api_client.build_collection_param(opts[:'pulp_id__in'], :csv) if !opts[:'pulp_id__in'].nil?
  query_params[:'q'] = opts[:'q'] if !opts[:'q'].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] || {}
  # 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[:body] 

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

  # 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: AnsibleCollectionsApi#list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
my_permissions(ansible_collection_href, opts = {}) click to toggle source

List user permissions List permissions available to the current user on this object. @param ansible_collection_href [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 [MyPermissionsResponse]

# File lib/pulp_ansible_client/api/ansible_collections_api.rb, line 257
def my_permissions(ansible_collection_href, opts = {})
  data, _status_code, _headers = my_permissions_with_http_info(ansible_collection_href, opts)
  data
end
my_permissions_with_http_info(ansible_collection_href, opts = {}) click to toggle source

List user permissions List permissions available to the current user on this object. @param ansible_collection_href [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<(MyPermissionsResponse, Integer, Hash)>] MyPermissionsResponse data, response status code and response headers

# File lib/pulp_ansible_client/api/ansible_collections_api.rb, line 269
def my_permissions_with_http_info(ansible_collection_href, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AnsibleCollectionsApi.my_permissions ...'
  end
  # verify the required parameter 'ansible_collection_href' is set
  if @api_client.config.client_side_validation && ansible_collection_href.nil?
    fail ArgumentError, "Missing the required parameter 'ansible_collection_href' when calling AnsibleCollectionsApi.my_permissions"
  end
  # resource path
  local_var_path = '{ansible_collection_href}my_permissions/'.sub('{' + 'ansible_collection_href' + '}', CGI.escape(ansible_collection_href.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] || {}
  # 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[:body] 

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

  # 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: AnsibleCollectionsApi#my_permissions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
remove_role(ansible_collection_href, nested_role, opts = {}) click to toggle source

Remove a role Remove a role for this object from users/groups. @param ansible_collection_href [String] @param nested_role [NestedRole] @param [Hash] opts the optional parameters @return [NestedRoleResponse]

# File lib/pulp_ansible_client/api/ansible_collections_api.rb, line 324
def remove_role(ansible_collection_href, nested_role, opts = {})
  data, _status_code, _headers = remove_role_with_http_info(ansible_collection_href, nested_role, opts)
  data
end
remove_role_with_http_info(ansible_collection_href, nested_role, opts = {}) click to toggle source

Remove a role Remove a role for this object from users/groups. @param ansible_collection_href [String] @param nested_role [NestedRole] @param [Hash] opts the optional parameters @return [Array<(NestedRoleResponse, Integer, Hash)>] NestedRoleResponse data, response status code and response headers

# File lib/pulp_ansible_client/api/ansible_collections_api.rb, line 335
def remove_role_with_http_info(ansible_collection_href, nested_role, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AnsibleCollectionsApi.remove_role ...'
  end
  # verify the required parameter 'ansible_collection_href' is set
  if @api_client.config.client_side_validation && ansible_collection_href.nil?
    fail ArgumentError, "Missing the required parameter 'ansible_collection_href' when calling AnsibleCollectionsApi.remove_role"
  end
  # verify the required parameter 'nested_role' is set
  if @api_client.config.client_side_validation && nested_role.nil?
    fail ArgumentError, "Missing the required parameter 'nested_role' when calling AnsibleCollectionsApi.remove_role"
  end
  # resource path
  local_var_path = '{ansible_collection_href}remove_role/'.sub('{' + 'ansible_collection_href' + '}', CGI.escape(ansible_collection_href.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', 'application/x-www-form-urlencoded', 'multipart/form-data'])

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

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

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

  # 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: AnsibleCollectionsApi#remove_role\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
upload_collection(file, opts = {}) click to toggle source

Upload a collection Create an artifact and trigger an asynchronous task to create Collection content from it. @param file [File] The Collection tarball. @param [Hash] opts the optional parameters @option opts [String] :sha256 An optional sha256 checksum of the uploaded file. @option opts [String] :expected_namespace The expected &#39;namespace&#39; of the Collection to be verified against the metadata during import. @option opts [String] :expected_name The expected &#39;name&#39; of the Collection to be verified against the metadata during import. @option opts [String] :expected_version The expected version of the Collection to be verified against the metadata during import. @return [AsyncOperationResponse]

# File lib/pulp_ansible_client/api/ansible_collections_api.rb, line 397
def upload_collection(file, opts = {})
  data, _status_code, _headers = upload_collection_with_http_info(file, opts)
  data
end
upload_collection_with_http_info(file, opts = {}) click to toggle source

Upload a collection Create an artifact and trigger an asynchronous task to create Collection content from it. @param file [File] The Collection tarball. @param [Hash] opts the optional parameters @option opts [String] :sha256 An optional sha256 checksum of the uploaded file. @option opts [String] :expected_namespace The expected &#39;namespace&#39; of the Collection to be verified against the metadata during import. @option opts [String] :expected_name The expected &#39;name&#39; of the Collection to be verified against the metadata during import. @option opts [String] :expected_version The expected version of the Collection to be verified against the metadata during import. @return [Array<(AsyncOperationResponse, Integer, Hash)>] AsyncOperationResponse data, response status code and response headers

# File lib/pulp_ansible_client/api/ansible_collections_api.rb, line 411
def upload_collection_with_http_info(file, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: AnsibleCollectionsApi.upload_collection ...'
  end
  # verify the required parameter 'file' is set
  if @api_client.config.client_side_validation && file.nil?
    fail ArgumentError, "Missing the required parameter 'file' when calling AnsibleCollectionsApi.upload_collection"
  end
  if @api_client.config.client_side_validation && !opts[:'sha256'].nil? && opts[:'sha256'].to_s.length < 1
    fail ArgumentError, 'invalid value for "opts[:"sha256"]" when calling AnsibleCollectionsApi.upload_collection, the character length must be great than or equal to 1.'
  end

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

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

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

  # resource path
  local_var_path = '/ansible/collections/'

  # 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['file'] = file
  form_params['sha256'] = opts[:'sha256'] if !opts[:'sha256'].nil?
  form_params['expected_namespace'] = opts[:'expected_namespace'] if !opts[:'expected_namespace'].nil?
  form_params['expected_name'] = opts[:'expected_name'] if !opts[:'expected_name'].nil?
  form_params['expected_version'] = opts[:'expected_version'] if !opts[:'expected_version'].nil?

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

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

  # 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: AnsibleCollectionsApi#upload_collection\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end