001/*
002 * Copyright 2020 Global Biodiversity Information Facility (GBIF)
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.gbif.api.service.registry;
017
018import org.gbif.api.model.registry.Endpoint;
019
020import java.util.List;
021import java.util.UUID;
022
023import javax.validation.Valid;
024import javax.validation.constraints.NotNull;
025
026/**
027 * Service provides a set of operations on {@link Endpoint}.
028 */
029@SuppressWarnings("unused")
030public interface EndpointService {
031
032  /**
033   * Add a new Endpoint to a target entity.
034   *
035   * @param targetEntityKey key of target entity
036   * @param endpoint        Endpoint to add
037   *
038   * @return key of Endpoint added
039   */
040  int addEndpoint(@NotNull UUID targetEntityKey, @NotNull @Valid Endpoint endpoint);
041
042  /**
043   * Delete an existing Endpoint from a target entity by endpoint key.
044   *
045   * @param targetEntityKey key of target entity
046   * @param endpointKey     Endpoint key to delete
047   */
048  void deleteEndpoint(@NotNull UUID targetEntityKey, int endpointKey);
049
050  /**
051   * List all endpoints of a target entity.
052   *
053   * @param targetEntityKey key of target entity
054   *
055   * @return list of endpoints that belong to the entity
056   */
057  List<Endpoint> listEndpoints(@NotNull UUID targetEntityKey);
058}