Class ReleasesRequestBuilder

java.lang.Object
org.azd.abstractions.BaseRequestBuilder
org.azd.release.releases.ReleasesRequestBuilder

public class ReleasesRequestBuilder extends BaseRequestBuilder
Provides functionality to work with Release releases Api.
  • Constructor Details

    • ReleasesRequestBuilder

      public ReleasesRequestBuilder(String organizationUrl, AccessTokenCredential accessTokenCredential)
      Instantiates a new RequestBuilder instance and sets the default values.
      Parameters:
      organizationUrl - Represents organization location request url.
      accessTokenCredential - Access token credential object.
  • Method Details

    • environment

      public ReleaseEnvironmentRequestBuilder environment()
      Provides functionality to work with Release environment API.
      Returns:
      ReleaseEnvironmentRequestBuilder ReleaseEnvironmentRequestBuilder
    • logs

      Provides functionality to work with Release logs API.
      Returns:
      ReleaseLogsRequestBuilder ReleaseLogsRequestBuilder
    • taskLog

      public ReleaseTaskLogRequestBuilder taskLog()
      Provides functionality to work with Release Task log API.
      Returns:
      ReleaseTaskLogRequestBuilder ReleaseTaskLogRequestBuilder
    • createAsync

      public CompletableFuture<Release> createAsync(ReleaseStartMetadata releaseStartMetadata) throws AzDException
      Create a release.



      Example:

      
               var releaseMetadata = new ReleaseStartMetadata();
               var artifacts = new ArtifactMetadata();
      
               var buildVersion = new BuildVersion();
               buildVersion.setId("1234"); // Build Id
               buildVersion.setName("Demo-Pipeline-CI"); // Build pipeline name
      
               artifacts.setAlias("_Demo-Pipeline-CI"); // Artifact alias name; This can be retrieved from release pipeline.
               artifacts.setInstanceReference(buildVersion);
      
               releaseMetadata.setDefinitionId(2); // Release pipeline Id.
               releaseMetadata.setDescription("Sample release");
               releaseMetadata.setArtifacts(List.of(artifacts));
               releaseMetadata.setIsDraft(false);
               releaseMetadata.setReason(ReleaseReason.NONE);
       
      Parameters:
      releaseStartMetadata - Release start metadata to create the release.
      Returns:
      Release object Release
      Throws:
      AzDException - Default Api exception handler.
    • deleteAsync

      public CompletableFuture<Void> deleteAsync(int releaseId) throws AzDException
      Delete a Release
      Parameters:
      releaseId - pass the release id
      Throws:
      AzDException - Default Api Exception handler.
    • getAsync

      public CompletableFuture<Release> getAsync(int releaseId) throws AzDException
      Get a Release
      Parameters:
      releaseId - pass the release id
      Returns:
      Release Release
      Throws:
      AzDException - Default Api Exception handler.
    • getAsync

      public CompletableFuture<Release> getAsync(int releaseId, Consumer<ReleasesRequestBuilder.RequestConfiguration> requestConfiguration) throws AzDException
      Get a Release
      Parameters:
      releaseId - pass the release id
      requestConfiguration - Represents the query parameters.
      Returns:
      Release Release
      Throws:
      AzDException - Default Api Exception handler.
    • getRevisionAsync

      public CompletableFuture<String> getRevisionAsync(int releaseId, int definitionSnapshotRevision) throws AzDException
      Get release for a given revision number.
      Parameters:
      releaseId - Id of the release.
      definitionSnapshotRevision - Definition snapshot revision number.
      Returns:
      Release revision.
      Throws:
      AzDException - Default Api Exception handler.
    • listAsync

      public CompletableFuture<Releases> listAsync() throws AzDException
      Get a list of releases
      Returns:
      Releases Releases
      Throws:
      AzDException - Default Api Exception handler.
    • listAsync

      Get a list of releases
      Parameters:
      requestConfiguration - Represents the query parameters
      Returns:
      Releases Releases
      Throws:
      AzDException - Default Api Exception handler.
    • updateAsync

      public CompletableFuture<Release> updateAsync(int releaseId, Release release) throws AzDException
      Update a complete release object.
      Parameters:
      releaseId - Id of the release to update.
      release - Release object to update
      Returns:
      a release object Release
      Throws:
      AzDException - Default Api Exception handler.
    • updateResourceAsync

      public CompletableFuture<Release> updateResourceAsync(int releaseId, ReleaseUpdateMetadata releaseUpdateMetadata) throws AzDException
      Update a complete release object.
      Parameters:
      releaseId - Id of the release to update.
      releaseUpdateMetadata - Release metadata object to update
      Returns:
      a release object Release
      Throws:
      AzDException - Default Api Exception handler.
    • create

      public Release create(ReleaseStartMetadata releaseStartMetadata) throws AzDException
      Create a release.



      Example:

      
               var releaseMetadata = new ReleaseStartMetadata();
               var artifacts = new ArtifactMetadata();
      
               var buildVersion = new BuildVersion();
               buildVersion.setId("1234"); // Build Id
               buildVersion.setName("Demo-Pipeline-CI"); // Build pipeline name
      
               artifacts.setAlias("_Demo-Pipeline-CI"); // Artifact alias name; This can be retrieved from release pipeline.
               artifacts.setInstanceReference(buildVersion);
      
               releaseMetadata.setDefinitionId(2); // Release pipeline Id.
               releaseMetadata.setDescription("Sample release");
               releaseMetadata.setArtifacts(List.of(artifacts));
               releaseMetadata.setIsDraft(false);
               releaseMetadata.setReason(ReleaseReason.NONE);
       
      Parameters:
      releaseStartMetadata - Release start metadata to create the release.
      Returns:
      Release object Release
      Throws:
      AzDException - Default Api exception handler.
    • delete

      public Void delete(int releaseId) throws AzDException
      Delete a Release
      Parameters:
      releaseId - pass the release id
      Throws:
      AzDException - Default Api Exception handler.
    • get

      public Release get(int releaseId) throws AzDException
      Get a Release
      Parameters:
      releaseId - pass the release id
      Returns:
      Release Release
      Throws:
      AzDException - Default Api Exception handler.
    • get

      public Release get(int releaseId, Consumer<ReleasesRequestBuilder.RequestConfiguration> requestConfiguration) throws AzDException
      Get a Release
      Parameters:
      releaseId - pass the release id
      requestConfiguration - Represents the query parameters.
      Returns:
      Release Release
      Throws:
      AzDException - Default Api Exception handler.
    • getRevision

      public String getRevision(int releaseId, int definitionSnapshotRevision) throws AzDException
      Get release for a given revision number.
      Parameters:
      releaseId - Id of the release.
      definitionSnapshotRevision - Definition snapshot revision number.
      Returns:
      Release revision.
      Throws:
      AzDException - Default Api Exception handler.
    • list

      public Releases list() throws AzDException
      Get a list of releases
      Returns:
      Releases Releases
      Throws:
      AzDException - Default Api Exception handler.
    • list

      Get a list of releases
      Parameters:
      requestConfiguration - Represents the query parameters
      Returns:
      Releases Releases
      Throws:
      AzDException - Default Api Exception handler.
    • update

      public Release update(int releaseId, Release release) throws AzDException
      Update a complete release object.
      Parameters:
      releaseId - Id of the release to update.
      release - Release object to update
      Returns:
      a release object Release
      Throws:
      AzDException - Default Api Exception handler.
    • updateResource

      public Release updateResource(int releaseId, ReleaseUpdateMetadata releaseUpdateMetadata) throws AzDException
      Update a complete release object.
      Parameters:
      releaseId - Id of the release to update.
      releaseUpdateMetadata - Release metadata object to update
      Returns:
      a release object Release
      Throws:
      AzDException - Default Api Exception handler.