net.nemerosa.ontrack.extension.bitbucket.cloud.property.BitbucketCloudProjectConfigurationPropertyMutationProvider.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ontrack-extension-bitbucket-cloud Show documentation
Show all versions of ontrack-extension-bitbucket-cloud Show documentation
Ontrack module: ontrack-extension-bitbucket-cloud
package net.nemerosa.ontrack.extension.bitbucket.cloud.property
import graphql.schema.GraphQLInputObjectField
import net.nemerosa.ontrack.extension.bitbucket.cloud.configuration.BitbucketCloudConfigurationService
import net.nemerosa.ontrack.graphql.schema.*
import net.nemerosa.ontrack.model.structure.ProjectEntity
import net.nemerosa.ontrack.model.structure.PropertyType
import org.springframework.stereotype.Component
import kotlin.reflect.KClass
@Component
class BitbucketCloudProjectConfigurationPropertyMutationProvider(
private val bitbucketCloudConfigurationService: BitbucketCloudConfigurationService
) :
PropertyMutationProvider {
override val propertyType: KClass> =
BitbucketCloudProjectConfigurationPropertyType::class
override val mutationNameFragment: String = "BitbucketCloudConfiguration"
override val inputFields: List = listOf(
requiredStringInputField("configuration", "Name of the Bitbucket Cloud configuration to use"),
requiredStringInputField("repository", "Bitbucket Cloud repository to use, in the form of `workspace/name`"),
optionalIntInputField(
"indexationInterval",
"Interval (in minutes) between each indexation of the repository by Ontrack"
),
optionalStringInputField(
"issueServiceConfigurationIdentifier",
"Issue identifier to use, for example jira//name where name is the name of the JIRA configuration in Ontrack."
)
)
override fun readInput(entity: ProjectEntity, input: MutationInput) = BitbucketCloudProjectConfigurationProperty(
configuration = bitbucketCloudConfigurationService.getConfiguration(input.getRequiredInput("configuration")),
repository = input.getRequiredInput("repository"),
indexationInterval = input.getInput("indexationInterval") ?: 0,
issueServiceConfigurationIdentifier = input.getInput("issueServiceConfigurationIdentifier")
)
}