io.apicurio.registry.rest.v3.AdminResource Maven / Gradle / Ivy
package io.apicurio.registry.rest.v3;
import io.apicurio.registry.rest.v3.beans.ArtifactTypeInfo;
import io.apicurio.registry.rest.v3.beans.ConfigurationProperty;
import io.apicurio.registry.rest.v3.beans.CreateRule;
import io.apicurio.registry.rest.v3.beans.RoleMapping;
import io.apicurio.registry.rest.v3.beans.RoleMappingSearchResults;
import io.apicurio.registry.rest.v3.beans.Rule;
import io.apicurio.registry.rest.v3.beans.SnapshotMetaData;
import io.apicurio.registry.rest.v3.beans.UpdateConfigurationProperty;
import io.apicurio.registry.rest.v3.beans.UpdateRole;
import io.apicurio.registry.types.RuleType;
import jakarta.validation.constraints.NotNull;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.DELETE;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.HeaderParam;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.PUT;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.PathParam;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.QueryParam;
import jakarta.ws.rs.core.Response;
import java.io.InputStream;
import java.math.BigInteger;
import java.util.List;
/**
* A JAX-RS interface. An implementation of this interface must be provided.
*/
@Path("/apis/registry/v3/admin")
public interface AdminResource {
/**
*
* Gets a list of all the currently configured global rules (if any).
*
*
* This operation can fail for the following reasons:
*
*
* - A server error occurred (HTTP error
500
)
*
*
*/
@Path("/rules")
@GET
@Produces("application/json")
List listGlobalRules();
/**
*
* Adds a rule to the list of globally configured rules.
*
*
* This operation can fail for the following reasons:
*
*
* - The rule type is unknown (HTTP error
400
)
* - The rule already exists (HTTP error
409
)
* - A server error occurred (HTTP error
500
)
*
*
*/
@Path("/rules")
@POST
@Consumes("application/json")
void createGlobalRule(@NotNull CreateRule data);
/**
*
* Deletes all globally configured rules.
*
*
* This operation can fail for the following reasons:
*
*
* - A server error occurred (HTTP error
500
)
*
*
*/
@Path("/rules")
@DELETE
void deleteAllGlobalRules();
/**
*
* Returns information about the named globally configured rule.
*
*
* This operation can fail for the following reasons:
*
*
* - Invalid rule name/type (HTTP error
400
)
* - No rule with name/type
rule
exists (HTTP error
* 404
)
* - A server error occurred (HTTP error
500
)
*
*
*/
@Path("/rules/{ruleType}")
@GET
@Produces("application/json")
Rule getGlobalRuleConfig(@PathParam("ruleType") RuleType ruleType);
/**
*
* Updates the configuration for a globally configured rule.
*
*
* This operation can fail for the following reasons:
*
*
* - Invalid rule name/type (HTTP error
400
)
* - No rule with name/type
rule
exists (HTTP error
* 404
)
* - A server error occurred (HTTP error
500
)
*
*
*/
@Path("/rules/{ruleType}")
@PUT
@Produces("application/json")
@Consumes("application/json")
Rule updateGlobalRuleConfig(@PathParam("ruleType") RuleType ruleType, @NotNull Rule data);
/**
*
* Deletes a single global rule. If this is the only rule configured, this is
* the same as deleting all rules.
*
*
* This operation can fail for the following reasons:
*
*
* - Invalid rule name/type (HTTP error
400
)
* - No rule with name/type
rule
exists (HTTP error
* 404
)
* - Rule cannot be deleted (HTTP error
409
)
* - A server error occurred (HTTP error
500
)
*
*
*/
@Path("/rules/{ruleType}")
@DELETE
void deleteGlobalRule(@PathParam("ruleType") RuleType ruleType);
/**
*
* Exports registry data as a ZIP archive.
*
*
*/
@Path("/export")
@GET
@Produces({"application/json", "application/zip"})
Response exportData(@QueryParam("forBrowser") Boolean forBrowser);
/**
*
* Imports registry data that was previously exported using the
* /admin/export
operation.
*
*
*/
@Path("/import")
@POST
@Consumes("application/zip")
void importData(@HeaderParam("X-Registry-Preserve-GlobalId") Boolean xRegistryPreserveGlobalId,
@HeaderParam("X-Registry-Preserve-ContentId") Boolean xRegistryPreserveContentId,
@QueryParam("requireEmptyRegistry") Boolean requireEmptyRegistry, @NotNull InputStream data);
/**
*
* Gets the details of a single role mapping (by principalId
).
*
*
* This operation can fail for the following reasons:
*
*
* - No role mapping for the
principalId
exists (HTTP error
* 404
)
* - A server error occurred (HTTP error
500
)
*
*
*/
@Path("/roleMappings/{principalId}")
@GET
@Produces("application/json")
RoleMapping getRoleMapping(@PathParam("principalId") String principalId);
/**
*
* Updates a single role mapping for one user/principal.
*
*
* This operation can fail for the following reasons:
*
*
* - No role mapping for the principalId exists (HTTP error
*
404
)
* - A server error occurred (HTTP error
500
)
*
*
*/
@Path("/roleMappings/{principalId}")
@PUT
@Consumes("application/json")
void updateRoleMapping(@PathParam("principalId") String principalId, @NotNull UpdateRole data);
/**
*
* Deletes a single role mapping, effectively denying access to a
* user/principal.
*
*
* This operation can fail for the following reasons:
*
*
* - No role mapping for the principalId exists (HTTP error
*
404
)
* - A server error occurred (HTTP error
500
)
*
*
*/
@Path("/roleMappings/{principalId}")
@DELETE
void deleteRoleMapping(@PathParam("principalId") String principalId);
/**
*
* Returns a list of all configuration properties that have been set. The list
* is not paged.
*
*
* This operation may fail for one of the following reasons:
*
*
* - A server error occurred (HTTP error
500
)
*
*
*/
@Path("/config/properties")
@GET
@Produces("application/json")
List listConfigProperties();
/**
*
* Returns the value of a single configuration property.
*
*
* This operation may fail for one of the following reasons:
*
*
* - Property not found or not configured (HTTP error
404
)
* - A server error occurred (HTTP error
500
)
*
*
*/
@Path("/config/properties/{propertyName}")
@GET
@Produces("application/json")
ConfigurationProperty getConfigProperty(@PathParam("propertyName") String propertyName);
/**
*
* Updates the value of a single configuration property.
*
*
* This operation may fail for one of the following reasons:
*
*
* - Property not found or not configured (HTTP error
404
)
* - A server error occurred (HTTP error
500
)
*
*
*/
@Path("/config/properties/{propertyName}")
@PUT
@Consumes("application/json")
void updateConfigProperty(@PathParam("propertyName") String propertyName, @NotNull UpdateConfigurationProperty data);
/**
*
* Resets the value of a single configuration property. This will return the
* property to its default value (see external documentation for supported
* properties and their default values).
*
*
* This operation may fail for one of the following reasons:
*
*
* - Property not found or not configured (HTTP error
404
)
* - A server error occurred (HTTP error
500
)
*
*
*/
@Path("/config/properties/{propertyName}")
@DELETE
void resetConfigProperty(@PathParam("propertyName") String propertyName);
/**
*
* Gets a list of all role mappings configured in the registry (if any).
*
*
* This operation can fail for the following reasons:
*
*
* - A server error occurred (HTTP error
500
)
*
*
*/
@Path("/roleMappings")
@GET
@Produces("application/json")
RoleMappingSearchResults listRoleMappings(@QueryParam("limit") BigInteger limit,
@QueryParam("offset") BigInteger offset);
/**
*
* Creates a new mapping between a user/principal and a role.
*
*
* This operation can fail for the following reasons:
*
*
* - A server error occurred (HTTP error
500
)
*
*
*/
@Path("/roleMappings")
@POST
@Consumes("application/json")
void createRoleMapping(@NotNull RoleMapping data);
/**
*
* Gets a list of all the configured artifact types.
*
*
* This operation can fail for the following reasons:
*
*
* - A server error occurred (HTTP error
500
)
*
*
*/
@Path("/config/artifactTypes")
@GET
@Produces("application/json")
List listArtifactTypes();
/**
*
* Triggers the creation of a snapshot of the internal database for compatible
* storages.
*
*
* This operation can fail for the following reasons:
*
*
* - A server error occurred (HTTP error
500
)
*
*
*/
@Path("/snapshots")
@POST
@Produces("application/json")
SnapshotMetaData triggerSnapshot();
}