Method: NexusCli::RepositoryActions#add_to_group_repository

Defined in:
lib/nexus_cli/mixins/repository_actions.rb

#add_to_group_repository(group_id, repository_to_add_id) ⇒ Boolean

Adds the given [repository_to_add_id] to the given group repository, [group_id].

Parameters:

  • group_id (String)

    the group repository to add to

  • repository_to_add_id (String)

    the repository to added to the group

Returns:

  • (Boolean)

    true if the repository is successfully added, false otherwise

Raises:



132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/nexus_cli/mixins/repository_actions.rb', line 132

def add_to_group_repository(group_id, repository_to_add_id)
  raise RepositoryInGroupException if repository_in_group?(group_id, repository_to_add_id)
  response = nexus.put(nexus_url("service/local/repo_groups/#{sanitize_for_id(group_id)}"), :body => create_add_to_group_repository_json(group_id, repository_to_add_id), :header => DEFAULT_CONTENT_TYPE_HEADER)
  case response.status
  when 200
    return true
  when 400
    raise RepositoryNotFoundException
  else
    raise UnexpectedStatusCodeException.new(response.status)
  end
end