Class RuleSecretServiceImpl
java.lang.Object
com.codebarrel.automation.api.service.RuleSecretServiceImpl
- All Implemented Interfaces:
RuleSecretService
-
Constructor Summary
ConstructorsConstructorDescriptionRuleSecretServiceImpl(RuleSecretStore ruleSecretStore, I18nFactory i18nFactory, ProjectService projectService, AutomationConfigService configService, RuleSecretTransformer ruleSecretTransformer) -
Method Summary
Modifier and TypeMethodDescriptioncreateExposedSecret(TenantContext tenant, String value) Generates exposed secret where key = valueio.atlassian.fugue.Either<ErrorCollection, RuleSecretBean> createSecret(RemoteConnectUser remoteUser, TenantContext context, RuleSecretBean secret) Creates secret if it passes validationio.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 beancreateUniquelyNamedGlobalSecret(TenantContext tenant, String prefix, String value) Generates a secret with UUID based key with optional prefix, can be used e.g.voiddeleteAssociatedRuleSecrets(TenantContext context, String projectId) Deletes secret association to the project, or the whole secret if assigned only to this projectdeleteSecret(RemoteConnectUser remoteUser, TenantContext context, Long secretId) Deletes secret if it passes validationgetAllSecrets(TenantContext context) Retrieves all the rule secrets for a tenantgetSecretById(TenantContext context, long secretId) Gets a single rule secret by idgetSecretByKey(TenantContext context, String secretKey) getSecretsByProject(TenantContext context, String projectId) Retrieves all secrets associated to the project and all global secrets.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.io.atlassian.fugue.Either<ErrorCollection, RuleSecretBean> updateSecret(RemoteConnectUser remoteUser, TenantContext context, RuleSecretBean secret) Updates given secret if it passes validation
-
Constructor Details
-
RuleSecretServiceImpl
@Inject public RuleSecretServiceImpl(RuleSecretStore ruleSecretStore, I18nFactory i18nFactory, ProjectService projectService, AutomationConfigService configService, RuleSecretTransformer ruleSecretTransformer)
-
-
Method Details
-
getAllSecrets
Description copied from interface:RuleSecretServiceRetrieves all the rule secrets for a tenant- Specified by:
getAllSecretsin interfaceRuleSecretService- Parameters:
context- The database tenant context- Returns:
- the complete list or rule secrets for the tenant
-
getSecretById
Description copied from interface:RuleSecretServiceGets a single rule secret by id- Specified by:
getSecretByIdin interfaceRuleSecretService- Parameters:
context- The database tenant contextsecretId- The id of the secret- Returns:
- an optional of the secret
-
getSecretByKey
- Specified by:
getSecretByKeyin interfaceRuleSecretService
-
updateSecret
public io.atlassian.fugue.Either<ErrorCollection,RuleSecretBean> updateSecret(RemoteConnectUser remoteUser, TenantContext context, RuleSecretBean secret) Description copied from interface:RuleSecretServiceUpdates given secret if it passes validation- Specified by:
updateSecretin interfaceRuleSecretService- Parameters:
remoteUser- the user requesting the secretscontext- The database tenant contextsecret- The secret with the updates to apply- Returns:
- The updated secret or validation errors
-
createSecret
public io.atlassian.fugue.Either<ErrorCollection,RuleSecretBean> createSecret(RemoteConnectUser remoteUser, TenantContext context, RuleSecretBean secret) Description copied from interface:RuleSecretServiceCreates secret if it passes validation- Specified by:
createSecretin interfaceRuleSecretService- Parameters:
remoteUser- the user requesting the secretscontext- The database tenant contextsecret- The secret to create- Returns:
- The created secret or validation errors
-
createSecretAssignedToProject
public io.atlassian.fugue.Either<ErrorCollection,RuleSecretBean> createSecretAssignedToProject(RemoteConnectUser remoteUser, TenantContext context, RuleSecretBean secret, String projectId) Description copied from interface:RuleSecretServiceCreates secret if it passes validation and assigns it ONLY to the passed project, ignoring values in the bean- Specified by:
createSecretAssignedToProjectin interfaceRuleSecretService- Parameters:
remoteUser- the user requesting the secretscontext- The database tenant contextsecret- The secret to createprojectId- The project ID to assign secret to- Returns:
- The created secret or validation errors
-
deleteSecret
public ErrorCollection deleteSecret(RemoteConnectUser remoteUser, TenantContext context, Long secretId) Description copied from interface:RuleSecretServiceDeletes secret if it passes validation- Specified by:
deleteSecretin interfaceRuleSecretService- Parameters:
context- The database tenant contextsecretId- The id of secret to delete- Returns:
- ErrorCollection containing errors when the deletion fails, and empty if the deletion succeeded
-
getSecretsByProject
Description copied from interface:RuleSecretServiceRetrieves all secrets associated to the project and all global secrets.- Specified by:
getSecretsByProjectin interfaceRuleSecretService- Parameters:
context- The db tenant contextprojectId- The ID of a project to retrieve secrets for.- Returns:
- list of secrets with loaded projects.
-
getSecretUsageData
public io.atlassian.fugue.Either<ErrorCollection,RuleSecretUsageBean> getSecretUsageData(RemoteConnectUser remoteUser, TenantContext context, Long secretId) Description copied from interface:RuleSecretServiceGet secrets usage data, used to determine which projects can be removed from secret, or if the global secret can be restricted.- Specified by:
getSecretUsageDatain interfaceRuleSecretService- Parameters:
remoteUser- the user requesting the secretscontext- The db tenant contextsecretId- ID of the secret to retrieve usage data for- Returns:
- Secrets usage or errors if the secret doesn't exist
-
deleteAssociatedRuleSecrets
Description copied from interface:RuleSecretServiceDeletes secret association to the project, or the whole secret if assigned only to this project- Specified by:
deleteAssociatedRuleSecretsin interfaceRuleSecretService- Parameters:
context- The db tenant contextprojectId- The ID of a project to delete associated secrets for.
-
createUniquelyNamedGlobalSecret
public RuleSecretBean createUniquelyNamedGlobalSecret(TenantContext tenant, String prefix, String value) Description copied from interface:RuleSecretServiceGenerates a secret with UUID based key with optional prefix, can be used e.g. in component transformation- Specified by:
createUniquelyNamedGlobalSecretin interfaceRuleSecretService
-
createExposedSecret
Description copied from interface:RuleSecretServiceGenerates exposed secret where key = value- Specified by:
createExposedSecretin interfaceRuleSecretService
-