Interface RuleSecretService

All Known Implementing Classes:
RuleSecretServiceImpl

public interface RuleSecretService
  • Method Details

    • getAllSecrets

      List<RuleSecretBean> getAllSecrets(TenantContext context)
      Retrieves all the rule secrets for a tenant
      Parameters:
      context - The database tenant context
      Returns:
      the complete list or rule secrets for the tenant
    • getSecretById

      Optional<RuleSecretBean> getSecretById(TenantContext context, long secretId)
      Gets a single rule secret by id
      Parameters:
      context - The database tenant context
      secretId - The id of the secret
      Returns:
      an optional of the secret
    • getSecretByKey

      Optional<RuleSecretBean> getSecretByKey(TenantContext context, String secretKey)
    • updateSecret

      io.atlassian.fugue.Either<ErrorCollection,RuleSecretBean> updateSecret(RemoteConnectUser remoteUser, TenantContext context, RuleSecretBean secret)
      Updates given secret if it passes validation
      Parameters:
      remoteUser - the user requesting the secrets
      context - The database tenant context
      secret - The secret with the updates to apply
      Returns:
      The updated secret or validation errors
    • createSecret

      io.atlassian.fugue.Either<ErrorCollection,RuleSecretBean> createSecret(RemoteConnectUser remoteUser, TenantContext context, RuleSecretBean secret)
      Creates secret if it passes validation
      Parameters:
      remoteUser - the user requesting the secrets
      context - The database tenant context
      secret - The secret to create
      Returns:
      The created secret or validation errors
    • createSecretAssignedToProject

      io.atlassian.fugue.Either<ErrorCollection,RuleSecretBean> createSecretAssignedToProject(RemoteConnectUser remoteUser, TenantContext context, RuleSecretBean secret, String projectId)
      Creates secret if it passes validation and assigns it ONLY to the passed project, ignoring values in the bean
      Parameters:
      remoteUser - the user requesting the secrets
      context - The database tenant context
      secret - The secret to create
      projectId - The project ID to assign secret to
      Returns:
      The created secret or validation errors
    • deleteSecret

      ErrorCollection deleteSecret(RemoteConnectUser remoteUser, TenantContext context, Long secretId)
      Deletes secret if it passes validation
      Parameters:
      context - The database tenant context
      secretId - The id of secret to delete
      Returns:
      ErrorCollection containing errors when the deletion fails, and empty if the deletion succeeded
    • getSecretsByProject

      List<RuleSecretBean> getSecretsByProject(TenantContext context, String projectId)
      Retrieves all secrets associated to the project and all global secrets.
      Parameters:
      context - The db tenant context
      projectId - The ID of a project to retrieve secrets for.
      Returns:
      list of secrets with loaded projects.
    • getSecretUsageData

      io.atlassian.fugue.Either<ErrorCollection,RuleSecretUsageBean> getSecretUsageData(RemoteConnectUser remoteUser, TenantContext context, Long secretId)
      Get secrets usage data, used to determine which projects can be removed from secret, or if the global secret can be restricted.
      Parameters:
      remoteUser - the user requesting the secrets
      context - The db tenant context
      secretId - ID of the secret to retrieve usage data for
      Returns:
      Secrets usage or errors if the secret doesn't exist
    • deleteAssociatedRuleSecrets

      void deleteAssociatedRuleSecrets(TenantContext globalTenant, String projectId)
      Deletes secret association to the project, or the whole secret if assigned only to this project
      Parameters:
      globalTenant - The db tenant context
      projectId - The ID of a project to delete associated secrets for.
    • createUniquelyNamedGlobalSecret

      RuleSecretBean createUniquelyNamedGlobalSecret(TenantContext tenant, String prefix, String value)
      Generates a secret with UUID based key with optional prefix, can be used e.g. in component transformation
    • createExposedSecret

      RuleSecretBean createExposedSecret(TenantContext tenant, String value)
      Generates exposed secret where key = value