Interface CreateReferenceBuilder


  • public interface CreateReferenceBuilder
    Request builder for "create reference".

    Examples for creating the reference.

    1. Create a Tag called 'release' from the 'dev' branch at hash 'c26ce632cea616aabbbda2e1cfa82070514eb8b773fb035eaf668e2f0be8f10d'.

    
     CreateReferenceBuilder builder = ..;
     builder
     .sourceRefName("dev")
     .reference(Tag.of("release","c26ce632cea616aabbbda2e1cfa82070514eb8b773fb035eaf668e2f0be8f10d"))
     .create();
     

    2. Create a Branch called 'test' from the 'dev' branch at hash 'c26ce632cea616aabbbda2e1cfa82070514eb8b773fb035eaf668e2f0be8f10d'.

    
     CreateReferenceBuilder builder = ..;
     builder
     .sourceRefName("dev")
     .reference(Branch.of("test","c26ce632cea616aabbbda2e1cfa82070514eb8b773fb035eaf668e2f0be8f10d"))
     .create();
     

    3. Create a Branch called 'test' from the default branch NessieApiV1.getDefaultBranch() at hash 'c26ce632cea616aabbbda2e1cfa82070514eb8b773fb035eaf668e2f0be8f10d'.

    
     CreateReferenceBuilder builder = ..;
     builder
     .reference(Branch.of("test","c26ce632cea616aabbbda2e1cfa82070514eb8b773fb035eaf668e2f0be8f10d"))
     .create();
     

    4. Create a Branch called 'test' pointing at the beginning of time (without any commits).

    
     CreateReferenceBuilder builder = ..;
     builder
     .reference(Branch.of("test",null))
     .create();
     
    Since:
    NessieApiV1
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      org.projectnessie.model.Reference create()  
      CreateReferenceBuilder reference​(@Valid @NotNull org.projectnessie.model.Reference reference)
      Sets the name and hash of the reference-to-be-created.
      CreateReferenceBuilder sourceRefName​(@Pattern(regexp="^[A-Za-z](((?![.][.])[A-Za-z0-9./_-])*[A-Za-z0-9_-])?$",message="Reference name must start with a letter, followed by letters, digits, one of the ./_- characters, not end with a slash or dot, not contain \'..\'") java.lang.String sourceRefName)
      Sets the name of the reference that contains the hash of the reference-to-be-created.
    • Method Detail

      • sourceRefName

        CreateReferenceBuilder sourceRefName​(@Pattern(regexp="^[A-Za-z](((?![.][.])[A-Za-z0-9./_-])*[A-Za-z0-9_-])?$",message="Reference name must start with a letter, followed by letters, digits, one of the ./_- characters, not end with a slash or dot, not contain \'..\'")
                                             @Pattern(regexp="^[A-Za-z](((?![.][.])[A-Za-z0-9./_-])*[A-Za-z0-9_-])?$",message="Reference name must start with a letter, followed by letters, digits, one of the ./_- characters, not end with a slash or dot, not contain \'..\'") java.lang.String sourceRefName)
        Sets the name of the reference that contains the hash of the reference-to-be-created.

        If not explicitly set, the default branch NessieApiV1.getDefaultBranch() will be used as the source reference name.

        The name and hash of the reference to be created is set via reference(Reference).

        Parameters:
        sourceRefName - is the name of the reference that contains the hash of the reference-to-be-created.
      • reference

        CreateReferenceBuilder reference​(@Valid @NotNull
                                         @Valid @NotNull org.projectnessie.model.Reference reference)
        Sets the name and hash of the reference-to-be-created.

        For creating a Tag, hash cannot be null.

        For creating a Branch, If the hash is not specified, hash will be set to reference the beginning of time (aka NO_ANCESTOR hash).

        If the hash is specified, it should be on the sourceRefName(String)

        Parameters:
        reference - is Branch or Tag defining the name and hash for the new reference-to-be-created.
      • create

        org.projectnessie.model.Reference create()
                                          throws org.projectnessie.error.NessieNotFoundException,
                                                 org.projectnessie.error.NessieConflictException
        Throws:
        org.projectnessie.error.NessieNotFoundException
        org.projectnessie.error.NessieConflictException