create_protect_stage

def create_protect_stage(
        project_id: Optional[Union[str, UUID4]] = None,
        project_name: Optional[str] = None,
        name: Optional[str] = None,
        stage_type: StageType = StageType.local,
        pause: bool = False,
        prioritized_rulesets: Optional[Sequence[Ruleset]] = None,
        description: Optional[str] = None) -> Optional[StageDB]
Creates a new stage. Arguments:
  • project_id: The ID of the project.
  • project_name: Name of the project. If project_id is not provided, this will be used to look up the project.
  • name: Name of the stage. Defaults to a generated name.
  • stage_type: Type of the stage.
  • pause: Whether the stage should be created in a paused state.
  • prioritized_rulesets: List of rulesets for the stage.
  • description: Description for the stage.
Returns: The newly created Stage.

get_protect_stage

def get_protect_stage(project_id: Optional[Union[str, UUID4]] = None,
                      project_name: Optional[str] = None,
                      stage_id: Optional[Union[str, UUID4]] = None,
                      stage_name: Optional[str] = None) -> Optional[StageDB]
Retrieves a stage by its ID or name, within a given project. Arguments:
  • project_id: ID of the project.
  • project_name: Name of the project. If project_id is not provided, this will be used to look up the project.
  • stage_id: ID of the stage to retrieve.
  • stage_name: Name of the stage to retrieve. If stage_id is not provided, this will be used (in conjunction with project ID/name).
Returns: The fetched Stage.

update_protect_stage

def update_protect_stage(
    project_id: Optional[Union[str, UUID4]] = None,
    project_name: Optional[str] = None,
    stage_id: Optional[Union[str, UUID4]] = None,
    stage_name: Optional[str] = None,
    prioritized_rulesets: Optional[Sequence[Ruleset]] = None
) -> Optional[StageDB]
Updates a stage’s rulesets, creating a new version. Arguments:
  • project_id: ID of the project.
  • project_name: Name of the project. If project_id is not provided, this will be used to look up the project.
  • stage_id: ID of the stage to update.
  • stage_name: Name of the stage to update. If stage_id is not provided, this will be used (in conjunction with project ID/name).
  • prioritized_rulesets: New list of prioritized rulesets for the stage. If None, effectively clears existing rulesets.
Returns: The updated Stage.

pause_protect_stage

def pause_protect_stage(project_id: Optional[Union[str, UUID4]] = None,
                        project_name: Optional[str] = None,
                        stage_id: Optional[Union[str, UUID4]] = None,
                        stage_name: Optional[str] = None) -> Optional[StageDB]
Pauses the specified stage. Pauses a stage using either its ID or name within the context of a project. Arguments:
  • project_id: ID of the project containing the stage.
  • project_name: Name of the project containing the stage. (Used if project_id is not provided).
  • stage_id: ID of the stage to pause.
  • stage_name: Name of the stage to pause. (Used if stage_id is not provided).
Returns: The Stage with its updated pause state.

resume_protect_stage

def resume_protect_stage(
        project_id: Optional[Union[str, UUID4]] = None,
        project_name: Optional[str] = None,
        stage_id: Optional[Union[str, UUID4]] = None,
        stage_name: Optional[str] = None) -> Optional[StageDB]
Resumes a previously paused stage. Resumes a stage using either its ID or name within the context of a project. Arguments:
  • project_id: ID of the project containing the stage.
  • project_name: Name of the project containing the stage. (Used if project_id is not provided).
  • stage_id: ID of the stage to resume.
  • stage_name: Name of the stage to resume. (Used if stage_id is not provided).
Returns: The Stage with its updated pause state.