All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.nemerosa.ontrack.extension.bitbucket.cloud.property.BitbucketCloudProjectConfigurationPropertyMutationProvider.kt Maven / Gradle / Ivy

There is a newer version: 4.4.5
Show newest version
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")
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy