Interface PlanConfigImportService

  • All Known Implementing Classes:
    PlanConfigImportServiceImpl

    @ExperimentalApi
    public interface PlanConfigImportService
    Service to import plan configurations from human readable format.
    Since:
    5.15
    • Method Detail

      • convertYamlToPlan

        @NotNull
        @NotNull com.atlassian.bamboo.specs.api.model.plan.PlanProperties convertYamlToPlan​(@NotNull
                                                                                            @NotNull String yaml)
                                                                                     throws com.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException,
                                                                                            YamlValidationException
        Converts data from a YAML document to top level plan properties.
        Parameters:
        yaml - YAML String containing definition of top level plan
        Returns:
        top level plan properties
        Throws:
        YamlValidationException - if the format of the YAML file is invalid
        com.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException
      • validatePlanProperties

        void validatePlanProperties​(@NotNull
                                    @NotNull com.atlassian.bamboo.specs.api.model.plan.PlanProperties planProperties,
                                    @NotNull
                                    @NotNull RssPermissions rssPermissions)
                             throws com.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException,
                                    YamlValidationException,
                                    RssPermissionException
        This method performs validation of YAML types and of the properties without Bamboo context (e.g. no database integrity is verified).
        Parameters:
        planProperties - top level plan properties
        rssPermissions - projects which can allowed for modification
        Throws:
        YamlValidationException - if the format of the YAML file is invalid
        com.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException - if the imported properties were not valid
        RssPermissionException - if RSS is missing access to projects/repositories
      • validatePlanBranchProperties

        void validatePlanBranchProperties​(@NotNull
                                          @NotNull com.atlassian.bamboo.specs.api.model.plan.PlanProperties planProperties,
                                          @NotNull
                                          @NotNull RssPermissions rssPermissions,
                                          @NotNull
                                          @NotNull VcsBranch importedBranch)
                                   throws com.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException,
                                          YamlValidationException,
                                          RssPermissionException
        This method performs validation of YAML types and of the properties without Bamboo context (e.g. no database integrity is verified).
        Parameters:
        planProperties - plan branch properties
        rssPermissions - projects which can allowed for modification
        importedBranch - imported vcs branch
        Throws:
        YamlValidationException - if the format of the YAML file is invalid
        com.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException - if the imported properties were not valid
        RssPermissionException - if RSS is missing access to projects/repositories
      • importPlan

        @NotNull
        @NotNull PlanConfigImportService.ImportResult importPlan​(@NotNull
                                                                 @NotNull com.atlassian.bamboo.specs.api.model.plan.PlanProperties planProperties,
                                                                 @Nullable
                                                                 @Nullable com.atlassian.user.User userForCreation,
                                                                 @NotNull
                                                                 @NotNull RssPermissions rssPermissions)
        Validates exported top level plan properties within Bamboo context (e.g. verifying database integrity), then imports the data into the database.
        Parameters:
        planProperties - top level plan properties to import
        userForCreation - user invoking the import
        rssPermissions - projects which can allowed for modification; since 6.2
        Returns:
        saved top level plan entity and flag indicating if the plan is new
        Throws:
        com.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException - if data validation fails
        RssPermissionException - if rss doesn't have access to dependant project
        UnauthorisedException - if any other type of permission is missing
      • importPlan

        @NotNull
        @NotNull PlanConfigImportService.ImportResult importPlan​(@NotNull
                                                                 @NotNull com.atlassian.bamboo.specs.api.model.plan.PlanProperties planProperties,
                                                                 @Nullable
                                                                 @Nullable com.atlassian.user.User userForCreation,
                                                                 @NotNull
                                                                 @NotNull RssPermissions rssPermissions,
                                                                 boolean deferEvents,
                                                                 boolean noChangesInProperties)
                                                          throws com.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException,
                                                                 UnauthorisedException,
                                                                 RssPermissionException
        Validates exported top level plan properties within Bamboo context (e.g. verifying database integrity), then imports the data into the database.
        Parameters:
        planProperties - top level plan properties to import
        userForCreation - user invoking the import
        rssPermissions - projects which can allowed for modification; since 6.2
        deferEvents - when set to true, the import routine will not send creation events nor initialise plan triggers
        Returns:
        saved top level plan entity and flag indicating if the plan is new
        Throws:
        com.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException - if data validation fails
        RssPermissionException - if rss doesn't have access to dependant project
        UnauthorisedException - if any other type of permission is missing
      • sendEventsAndScheduleTriggersIfRequired

        void sendEventsAndScheduleTriggersIfRequired​(@NotNull
                                                     @NotNull PlanConfigImportService.ImportResult importResult)
        Sends events related to plan creation or update and initialises triggers.
        Parameters:
        importResult -
      • sendEventsAndScheduleTriggersForBranchIfRequired

        void sendEventsAndScheduleTriggersForBranchIfRequired​(@NotNull
                                                              @NotNull PlanConfigImportService.ImportResult importResult,
                                                              @Nullable
                                                              @Nullable com.atlassian.user.User user)
        Sends events related to branch creation or update and initialises triggers.
      • importPlanBranch

        @NotNull
        @NotNull PlanConfigImportService.ImportResult importPlanBranch​(@NotNull
                                                                       @NotNull com.atlassian.bamboo.specs.api.model.plan.PlanProperties planProperties,
                                                                       @NotNull
                                                                       @NotNull VcsBranch vcsBranch,
                                                                       @Nullable
                                                                       @Nullable com.atlassian.user.User user,
                                                                       @NotNull
                                                                       @NotNull RssPermissions rssPermissions)
        Import plan branch using specs.
      • updatePlanBranch

        @NotNull
        @NotNull PlanConfigImportService.ImportResult updatePlanBranch​(@NotNull
                                                                       @NotNull com.atlassian.bamboo.specs.api.model.plan.PlanProperties planProperties,
                                                                       @NotNull
                                                                       @NotNull VcsBranch vcsBranch,
                                                                       @Nullable
                                                                       @Nullable com.atlassian.user.User user,
                                                                       @NotNull
                                                                       @NotNull RssPermissions rssPermissions,
                                                                       @NotNull
                                                                       @NotNull DivergentBranchDataBean branchDataBean,
                                                                       boolean deferEvents,
                                                                       boolean noChangesInProperties)
        Update plan branch using specs. It is expected that plan branch already exists. (fails if it doesn't)
      • switchToLightweightBranch

        @NotNull
        @NotNull PlanConfigImportService.ImportResult switchToLightweightBranch​(@NotNull
                                                                                @NotNull PlanKey planBranchKey)
        Convert a divergent branch to a lightweight branch.
        Parameters:
        planBranchKey -