Interface EnvironmentRequirementService

  • All Known Implementing Classes:
    EnvironmentRequirementServiceImpl

    @ExperimentalApi
    public interface EnvironmentRequirementService
    Service to provide actions on Environment Requirements
    Since:
    v5.13
    • Method Detail

      • getRequirementsForEnvironment

        @NotNull
        @NotNull List<? extends ImmutableRequirement> getRequirementsForEnvironment​(long environmentId)
                                                                             throws WebValidationException
        Get all requirements for environment.
        Parameters:
        environmentId - of environment
        Returns:
        RequirementSet for environment
        Throws:
        WebValidationException - if environmentId invalid
      • getRequirementForEnvironment

        @NotNull
        @NotNull ImmutableRequirement getRequirementForEnvironment​(long environmentId,
                                                                   long requirementId)
        Get a single requirement for a environment.
        Parameters:
        environmentId - of environment
        requirementId - of requirement
        Returns:
        requirement
        Throws:
        NotFoundException - if environmentId is invalid or requirement doesn't exist
      • addRequirement

        @NotNull
        @NotNull ImmutableRequirement addRequirement​(long environmentId,
                                                     @NotNull
                                                     @NotNull String key,
                                                     @NotNull
                                                     ImmutableRequirement.MatchType matchType,
                                                     @Nullable
                                                     @Nullable String matchValue)
                                              throws WebValidationException
        Add new requirement to an environment.
        Parameters:
        environmentId - of environment
        key - of requirement to match with the capability
        matchType - e.g. exists, regex match, equals
        matchValue - for regex and equals the value the requirement should match
        Returns:
        created requirement
        Throws:
        WebValidationException - for any data related error.
      • updateRequirement

        @NotNull
        @NotNull ImmutableRequirement updateRequirement​(long environmentId,
                                                        long requirementId,
                                                        @NotNull
                                                        @NotNull String key,
                                                        @NotNull
                                                        ImmutableRequirement.MatchType matchType,
                                                        @Nullable
                                                        @Nullable String matchValue)
                                                 throws WebValidationException
        Update an existing requirement.
        Parameters:
        environmentId - of environment
        requirementId - if of the requirement being updated
        key - of requirement to match with the capability
        matchType - e.g. exists, regex match, equals
        matchValue - for regex and equals the value the requirement should match
        Returns:
        updated requirement
        Throws:
        WebValidationException - for any data related error.
      • removeRequirement

        void removeRequirement​(long environmentId,
                               long requirementId)
                        throws WebValidationException
        Remove a specific requirement
        Parameters:
        environmentId - of environment
        requirementId - of requirement to remove
        Throws:
        WebValidationException - if requirement is not allowed to be removed
      • getExecutableAgentMatrixForEnvironment

        @NotNull
        @NotNull ExecutableAgentsMatrix getExecutableAgentMatrixForEnvironment​(long environmentId)
        Retrieve all executable agents for a particular environment. Includes all disabled and offline agents/images.
        Parameters:
        environmentId - of environment
        Returns:
        executableAgentMatrix (requirements to matching agents and images)
        Throws:
        WebValidationException
      • getExecutableAgentMatrixForEnvironment

        @NotNull
        @NotNull ExecutableAgentsMatrix getExecutableAgentMatrixForEnvironment​(@NotNull
                                                                               @NotNull InternalEnvironment environment)
        Retrieve all executable agents for a particular environment. Includes all disabled and offline agents/images.
        Parameters:
        environment - environment
        Returns:
        executableAgentMatrix (requirements to matching agents and images)
      • renameRequirement

        void renameRequirement​(CapabilityType capabilityType,
                               String oldCapabilityKey,
                               String newCapabilityLabel,
                               boolean override)
        Updates capability key across all environments.
        Parameters:
        capabilityType - capability type
        oldCapabilityKey - previous capability key, for example system.builder.mvn.Maven 3
        newCapabilityLabel - new capability label, for example Maven 3 updated
        override - existing values in case of conflict. If there is a conflict when entity already has capability with new label this flag indicates if it should be overridden or not.