Class ReleaseApi

All Implemented Interfaces:
ReleaseDetails

public class ReleaseApi extends AzDAsyncApi<ReleaseApi> implements ReleaseDetails
Release Api to manage releases service
  • Constructor Details

    • ReleaseApi

      public ReleaseApi(Connection connection)
      Pass the connection object to work with Release Api
      Parameters:
      connection - Connection object
  • Method Details

    • createRelease

      public Release createRelease(int releaseDefinitionId, String description, String artifactAlias, String artifactId, String artifactName, boolean isDraft) throws AzDException
      Create a release.
      Specified by:
      createRelease in interface ReleaseDetails
      Parameters:
      releaseDefinitionId - pass definition Id to create a release.
      description - pass description to create a release.
      artifactAlias - build pipeline alias name. Run getBuilds() from BuildApi to get the build alias name and build number.
      artifactId - pass the build id.
      artifactName - pass the build pipeline name
      isDraft - creates the release as draft if set to false
      Returns:
      Release Release
      Throws:
      AzDException - Default Api Exception handler.
    • getRelease

      public Release getRelease(int releaseId) throws AzDException
      Get a Release
      Specified by:
      getRelease in interface ReleaseDetails
      Parameters:
      releaseId - pass the release id
      Returns:
      Release Release
      Throws:
      AzDException - Default Api Exception handler.
    • getRelease

      public Release getRelease(int releaseId, SingleReleaseExpands expand) throws AzDException
      Gets a Release
      Specified by:
      getRelease in interface ReleaseDetails
      Parameters:
      releaseId - pass the release id
      expand - field to expand in the result. SingleReleaseExpands
      Returns:
      Release Release
      Throws:
      AzDException - Default Api Exception handler.
    • getRelease

      public Release getRelease(int releaseId, SingleReleaseExpands expand, ReleaseApprovalFilters approvalFilters, String[] propertyFilters, int topGateRecords) throws AzDException
      Gets a Release
      Specified by:
      getRelease in interface ReleaseDetails
      Parameters:
      releaseId - pass the release id
      expand - field to expand in the result. SingleReleaseExpands
      approvalFilters - A filter which would allow fetching approval steps selectively based on whether it is automated, or manual. This would also decide whether we should fetch pre and post approval snapshots. Assumes All by default
      propertyFilters - A comma-delimited list of extended properties to be retrieved. If set, the returned Release will contain values for the specified property Ids (if they exist). If not set, properties will not be included.
      topGateRecords - Number of release gate records to get. Default is 5.
      Returns:
      Release Release
      Throws:
      AzDException - Default Api Exception handler.
    • getReleaseEnvironment

      public ReleaseEnvironment getReleaseEnvironment(int releaseId, int environmentId) throws AzDException
      Get a release environment.
      Specified by:
      getReleaseEnvironment in interface ReleaseDetails
      Parameters:
      releaseId - pass the release id
      environmentId - Id of the release environment.
      Returns:
      Release Environment ReleaseEnvironment
      Throws:
      AzDException - Default Api Exception handler.
    • getReleaseEnvironment

      public ReleaseEnvironment getReleaseEnvironment(int releaseId, int environmentId, SingleReleaseExpands expand) throws AzDException
      Get a release environment.
      Specified by:
      getReleaseEnvironment in interface ReleaseDetails
      Parameters:
      releaseId - pass the release id
      environmentId - Id of the release environment.
      expand - Release expands SingleReleaseExpands
      Returns:
      Release Environment ReleaseEnvironment
      Throws:
      AzDException - Default Api Exception handler.
    • getReleases

      public Releases getReleases() throws AzDException
      Get a list of releases
      Specified by:
      getReleases in interface ReleaseDetails
      Returns:
      Releases Releases
      Throws:
      AzDException - Default Api Exception handler.
    • getReleases

      public Releases getReleases(ReleaseExpands expand) throws AzDException
      Get a list of releases
      Specified by:
      getReleases in interface ReleaseDetails
      Parameters:
      expand - The property that should be expanded in the list of releases. ReleaseExpands
      Returns:
      Releases Releases
      Throws:
      AzDException - Default Api Exception handler.
    • getReleases

      public Releases getReleases(int definitionId) throws AzDException
      Get a list of releases
      Specified by:
      getReleases in interface ReleaseDetails
      Parameters:
      definitionId - pass the release definition id
      Returns:
      Releases Releases
      Throws:
      AzDException - Default Api Exception handler.
    • getReleases

      public Releases getReleases(ReleaseExpands expand, int top) throws AzDException
      Get a list of releases
      Specified by:
      getReleases in interface ReleaseDetails
      Parameters:
      expand - The property that should be expanded in the list of releases. ReleaseExpands
      top - Number of releases to get. Default is 50.
      Returns:
      Releases Releases
      Throws:
      AzDException - Default Api Exception handler.
    • getReleases

      public Releases getReleases(String[] releaseIdFilter) throws AzDException
      Get a list of releases
      Specified by:
      getReleases in interface ReleaseDetails
      Parameters:
      releaseIdFilter - A comma-delimited list of releases Ids. Only releases with these Ids will be returned.
      Returns:
      Releases Releases
      Throws:
      AzDException - Default Api Exception handler.
    • getReleases

      public Releases getReleases(ReleaseExpands expand, String artifactVersionId) throws AzDException
      Get a list of releases
      Specified by:
      getReleases in interface ReleaseDetails
      Parameters:
      expand - The property that should be expanded in the list of releases. ReleaseExpands
      artifactVersionId - Releases with given artifactVersionId will be returned. E.g. in case of Build artifactType, it is buildId.
      Returns:
      Releases Releases
      Throws:
      AzDException - Default Api Exception handler.
    • getReleases

      public Releases getReleases(ReleaseExpands expand, int top, String artifactTypeId, String artifactVersionId, int continuationToken, String createdBy, int definitionEnvironmentId, int definitionId, int environmentStatusFilter, boolean isDeleted, String maxCreatedTime, String minCreatedTime, String path, String[] propertyFilters, ReleaseQueryOrder queryOrder, String[] releaseIdFilter, String searchText, String sourceBranchFilter, String sourceId, ReleaseStatus statusFilter, String[] tagFilter) throws AzDException
      Get a list of releases
      Specified by:
      getReleases in interface ReleaseDetails
      Parameters:
      expand - The property that should be expanded in the list of releases. ReleaseExpands
      top - Number of releases to get. Default is 50.
      artifactTypeId - Releases with given artifactTypeId will be returned. Values can be Build, Jenkins, GitHub, Nuget, Team Build (external), ExternalTFSBuild, Git, TFVC, ExternalTfsXamlBuild.
      artifactVersionId - Releases with given artifactVersionId will be returned. E.g. in case of Build artifactType, it is buildId.
      continuationToken - Gets the releases after the continuation token provided.
      createdBy - Releases created by this user.
      definitionEnvironmentId - pass the release definition environment id
      definitionId - Releases from this release definition Id.
      environmentStatusFilter - environment status filter
      isDeleted - Gets the soft deleted releases, if true.
      maxCreatedTime - Releases that were created before this time.
      minCreatedTime - Releases that were created after this time.
      path - Releases under this folder path will be returned
      propertyFilters - A comma-delimited list of extended properties to be retrieved. If set, the returned Releases will contain values for the specified property Ids (if they exist). If not set, properties will not be included. Note that this will not filter out any Release from results irrespective of whether it has property set or not.
      queryOrder - Gets the results in the defined order of created date for releases. Default is descending.
      releaseIdFilter - A comma-delimited list of releases Ids. Only releases with these Ids will be returned.
      searchText - Releases with names containing searchText.
      sourceBranchFilter - Releases with given sourceBranchFilter will be returned.
      sourceId - Unique identifier of the artifact used. e.g. For build it would be {projectGuid}:{BuildDefinitionId}, for Jenkins it would be {JenkinsConnectionId}:{JenkinsDefinitionId}, for TfsOnPrem it would be {TfsOnPremConnectionId}:{ProjectName}:{TfsOnPremDefinitionId}. For third-party artifacts e.g. TeamCity, BitBucket you may refer 'uniqueSourceIdentifier' inside vss-extension.json https://github.com/Microsoft/vsts-rm-extensions/blob/master/Extensions.
      statusFilter - Releases that have the status from ReleaseStatus.
      tagFilter - A comma-delimited list of tags. Only releases with these tags will be returned.
      Returns:
      Releases Releases
      Throws:
      AzDException - Default Api Exception handler.
    • createReleaseDefinition

      public ReleaseDefinition createReleaseDefinition(String releaseDefinitionParameters) throws AzDException
      Create a release definition
      Specified by:
      createReleaseDefinition in interface ReleaseDetails
      Parameters:
      releaseDefinitionParameters - Pass the release definition parameter as string. It is easy to export json result from an existing pipeline and edit it.
      Returns:
      ReleaseDefinition ReleaseDefinition
      Throws:
      AzDException - Default Api Exception handler.
    • deleteReleaseDefinition

      public Void deleteReleaseDefinition(int definitionId) throws AzDException
      Delete a release definition.
      Specified by:
      deleteReleaseDefinition in interface ReleaseDetails
      Parameters:
      definitionId - Id of the release definition/pipeline.
      Throws:
      AzDException - Default Api Exception handler.
    • deleteReleaseDefinition

      public Void deleteReleaseDefinition(int definitionId, String comment, boolean forceDelete) throws AzDException
      Delete a release definition.
      Specified by:
      deleteReleaseDefinition in interface ReleaseDetails
      Parameters:
      definitionId - Id of the release definition/pipeline.
      comment - Comment for deleting a release definition.
      forceDelete - 'true' to automatically cancel any in-progress release deployments and proceed with release definition deletion . Default is 'false'.
      Throws:
      AzDException - Default Api Exception handler.
    • getReleaseDefinition

      public ReleaseDefinition getReleaseDefinition(int definitionId) throws AzDException
      Get a release definition.
      Specified by:
      getReleaseDefinition in interface ReleaseDetails
      Parameters:
      definitionId - Id of the release definition/pipeline.
      Returns:
      ReleaseDefinition ReleaseDefinition
      Throws:
      AzDException - Default Api Exception handler.
    • getReleaseDefinitionHistory

      public ReleaseDefinitionRevisions getReleaseDefinitionHistory(int definitionId) throws AzDException
      Get revision history for a release definition
      Specified by:
      getReleaseDefinitionHistory in interface ReleaseDetails
      Parameters:
      definitionId - Id of the release definition/pipeline.
      Returns:
      ReleaseDefinitionRevisions ReleaseDefinitionRevisions
      Throws:
      AzDException - Default Api Exception handler.
    • getReleaseDefinitions

      public ReleaseDefinitions getReleaseDefinitions() throws AzDException
      Get a list of release definitions.
      Specified by:
      getReleaseDefinitions in interface ReleaseDetails
      Returns:
      ReleaseDefinitions ReleaseDefinitions
      Throws:
      AzDException - Default Api Exception handler.
    • getReleaseDefinitions

      public ReleaseDefinitions getReleaseDefinitions(ReleaseDefinitionExpands expands) throws AzDException
      Get a list of release definitions.
      Specified by:
      getReleaseDefinitions in interface ReleaseDetails
      Parameters:
      expands - The properties that should be expanded in the list of Release definitions. ReleaseDefinitionExpands
      Returns:
      ReleaseDefinition Object ReleaseDefinition
      Throws:
      AzDException - Default Api Exception handler.
    • getReleaseDefinitions

      public ReleaseDefinitions getReleaseDefinitions(int top) throws AzDException
      Get a list of release definitions.
      Specified by:
      getReleaseDefinitions in interface ReleaseDetails
      Parameters:
      top - Number of release definitions to get.
      Returns:
      ReleaseDefinition Object ReleaseDefinition
      Throws:
      AzDException - Default Api Exception handler.
    • getReleaseDefinitions

      public ReleaseDefinitions getReleaseDefinitions(String artifactSourceId) throws AzDException
      Get a list of release definitions.
      Specified by:
      getReleaseDefinitions in interface ReleaseDetails
      Parameters:
      artifactSourceId - Release definitions with given artifactSourceId will be returned. e.g. For build it would be {projectGuid}:{BuildDefinitionId}, for Jenkins it would be {JenkinsConnectionId}:{JenkinsDefinitionId}, for TfsOnPrem it would be {TfsOnPremConnectionId}:{ProjectName}:{TfsOnPremDefinitionId}. For third-party artifacts e.g. TeamCity, BitBucket you may refer 'uniqueSourceIdentifier' inside vss-extension.json at https://github.com/Microsoft/vsts-rm-extensions/blob/master/Extensions.
      Returns:
      ReleaseDefinition Object ReleaseDefinition
      Throws:
      AzDException - Default Api Exception handler.
    • getReleaseDefinitions

      public ReleaseDefinitions getReleaseDefinitions(int[] definitionIdFilter) throws AzDException
      Get a list of release definitions.
      Specified by:
      getReleaseDefinitions in interface ReleaseDetails
      Parameters:
      definitionIdFilter - A comma-delimited list of release definitions to retrieve.
      Returns:
      ReleaseDefinition Object ReleaseDefinition
      Throws:
      AzDException - Default Api Exception handler.
    • getReleaseDefinitions

      public ReleaseDefinitions getReleaseDefinitions(ReleaseDefinitionExpands expands, int top, String artifactSourceId, String artifactType, String continuationToken, int[] definitionIdFilter, boolean isDeleted, boolean isExactNameMatch, String path, String[] propertyFilters, ReleaseDefinitionQueryOrder queryOrder, String searchText, boolean searchTextContainsFolderName, String[] tagFilter) throws AzDException
      Get a list of release definitions.
      Specified by:
      getReleaseDefinitions in interface ReleaseDetails
      Parameters:
      expands - The properties that should be expanded in the list of Release definitions.
      top - Number of release definitions to get.
      artifactSourceId - Release definitions with given artifactSourceId will be returned. e.g. For build it would be {projectGuid}:{BuildDefinitionId}, for Jenkins it would be {JenkinsConnectionId}:{JenkinsDefinitionId}, for TfsOnPrem it would be {TfsOnPremConnectionId}:{ProjectName}:{TfsOnPremDefinitionId}. For third-party artifacts e.g. TeamCity, BitBucket you may refer 'uniqueSourceIdentifier' inside vss-extension.json at https://github.com/Microsoft/vsts-rm-extensions/blob/master/Extensions.
      artifactType - Release definitions with given artifactType will be returned. Values can be Build, Jenkins, GitHub, Nuget, Team Build (external), ExternalTFSBuild, Git, TFVC, ExternalTfsXamlBuild.
      continuationToken - Gets the release definitions after the continuation token provided.
      definitionIdFilter - A comma-delimited list of release definitions to retrieve.
      isDeleted - 'true' to get release definitions that has been deleted. Default is 'false'
      isExactNameMatch - 'true'to gets the release definitions with exact match as specified in searchText. Default is 'false'.
      path - Gets the release definitions under the specified path.
      propertyFilters - A comma-delimited list of extended properties to be retrieved. If set, the returned Release Definitions will contain values for the specified property Ids (if they exist). If not set, properties will not be included. Note that this will not filter out any Release Definition from results irrespective of whether it has property set or not.
      queryOrder - Gets the results in the defined order. Default is 'IdAscending'.
      searchText - Get release definitions with names containing searchText.
      searchTextContainsFolderName - 'true' to get the release definitions under the folder with name as specified in searchText. Default is 'false'.
      tagFilter - A comma-delimited list of tags. Only release definitions with these tags will be returned.
      Returns:
      ReleaseDefinition Object ReleaseDefinition
      Throws:
      AzDException - Default Api Exception handler.
    • updateReleaseDefinition

      public ReleaseDefinition updateReleaseDefinition(ReleaseDefinition releaseDefinition) throws AzDException
      Update a release definition.
      Specified by:
      updateReleaseDefinition in interface ReleaseDetails
      Parameters:
      releaseDefinition - Pass the release definition ReleaseDefinition object. You can get it by running either getReleaseDefinitions() or getReleaseDefinition(int definitionId)
      Returns:
      a ReleaseDefinition ReleaseDefinition object.
      Throws:
      AzDException - Default Api exception handler.
    • deleteRelease

      public Void deleteRelease(int releaseId) throws AzDException
      Delete a release using release id.
      Specified by:
      deleteRelease in interface ReleaseDetails
      Parameters:
      releaseId - Release id to delete
      Throws:
      AzDException - Default Api Exception handler.
    • updateRelease

      public Release updateRelease(int releaseId, Release release) throws AzDException
      Update a complete release object.
      Specified by:
      updateRelease in interface ReleaseDetails
      Parameters:
      releaseId - Id of the release to update.
      release - Release object to update
      Returns:
      a release object Release
      Throws:
      AzDException - Default Api Exception handler.
    • updateReleaseEnvironment

      public ReleaseEnvironment updateReleaseEnvironment(int releaseId, int environmentId, String comment, String scheduledDeploymentTime, ReleaseEnvironmentStatus status, VariableGroupMap variables) throws AzDException
      Update the status of a release environment.
      Specified by:
      updateReleaseEnvironment in interface ReleaseDetails
      Parameters:
      releaseId - Id of the release to update.
      environmentId - Id of the stage or environment to update.
      comment - Gets or sets comment.
      scheduledDeploymentTime - Gets or sets scheduled deployment time.
      status - Gets or sets status of environment.
      variables - Sets list of environment variables to be overridden at deployment time.
      Returns:
      ReleaseEnvironment object ReleaseEnvironment
      Throws:
      AzDException - Default Api Exception handler.
    • updateReleaseResource

      public Release updateReleaseResource(int releaseId, String comment, boolean keepForever, String[] manualEnvironments, ReleaseStatus status, String name) throws AzDException
      Update few properties of a release.
      Specified by:
      updateReleaseResource in interface ReleaseDetails
      Parameters:
      releaseId - Id of the release to update.
      comment - Sets comment for release.
      keepForever - Set 'true' to exclude the release from retention policies.
      manualEnvironments - Sets list of manual environments.
      status - Sets status of the release.
      name - Sets name of the release.
      Returns:
      A release object Release
      Throws:
      AzDException - Default Api Exception handler.
    • queueRelease

      public ReleaseEnvironment queueRelease(int releaseId, String environmentName) throws AzDException
      Queue a release pipeline with release id and environment or stage name.
      Specified by:
      queueRelease in interface ReleaseDetails
      Parameters:
      releaseId - Id of the release
      environmentName - Stage name or environment name
      Returns:
      Release Environment object ReleaseEnvironment
      Throws:
      AzDException - Default Api Exception handler.
    • abandonRelease

      public Release abandonRelease(int releaseId) throws AzDException
      Abandon a release.
      Specified by:
      abandonRelease in interface ReleaseDetails
      Parameters:
      releaseId - Id of the release
      Returns:
      A release object Release
      Throws:
      AzDException - Default Api Exception handler.
    • getReleaseApprovals

      public ReleaseApprovals getReleaseApprovals() throws AzDException
      Get a list of approvals
      Specified by:
      getReleaseApprovals in interface ReleaseDetails
      Returns:
      List of release approvals ReleaseApprovals
      Throws:
      AzDException - Default Api Exception handler.
    • getReleaseApprovals

      public ReleaseApprovals getReleaseApprovals(int[] releaseIdsFilter) throws AzDException
      Get a list of approvals
      Specified by:
      getReleaseApprovals in interface ReleaseDetails
      Parameters:
      releaseIdsFilter - array of release ids to filter the approvals
      Returns:
      List of release approvals ReleaseApprovals
      Throws:
      AzDException - Default Api Exception handler.
    • getReleaseApprovals

      public ReleaseApprovals getReleaseApprovals(String assignedToFilter, int continuationToken, boolean includeMyGroupApprovals, ReleaseQueryOrder queryOrder, int[] releaseIdsFilter, ReleaseApprovalStatus statusFilter, int top, ReleaseApprovalType typeFilter) throws AzDException
      Get a list of approvals
      Specified by:
      getReleaseApprovals in interface ReleaseDetails
      Parameters:
      assignedToFilter - Approvals assigned to this user.
      continuationToken - Gets the approvals after the continuation token provided.
      includeMyGroupApprovals - 'true' to include my group approvals. Default is 'false'.
      queryOrder - Gets the results in the defined order of created approvals. Default is 'descending'.
      releaseIdsFilter - Approvals for release id(s) mentioned in the filter. Multiple releases can be mentioned by separating them with ',' e.g. releaseIdsFilter=1,2,3,4.
      statusFilter - Approvals with this status. Default is 'pending'.
      top - Number of approvals to get. Default is 50.
      typeFilter - Approval with this type.
      Returns:
      List of release approvals ReleaseApprovals
      Throws:
      AzDException - Default Api Exception handler.
    • updateApproval

      public ReleaseApproval updateApproval(int approvalId, ReleaseApprovalStatus status, String comments) throws AzDException
      Update status of an approval
      Specified by:
      updateApproval in interface ReleaseDetails
      Parameters:
      approvalId - Id of the approval.
      status - Gets or sets the status of the approval.
      comments - Gets or sets comments for approval.
      Returns:
      release approval object ReleaseApproval
      Throws:
      AzDException - Default Api Exception handler.
    • getManualIntervention

      public ManualIntervention getManualIntervention(int releaseId, int manualInterventionId) throws AzDException
      Get manual intervention for a given release and manual intervention id.
      Specified by:
      getManualIntervention in interface ReleaseDetails
      Parameters:
      releaseId - Id of the manual intervention.
      manualInterventionId - Id of the release.
      Returns:
      manual intervention object ManualIntervention
      Throws:
      AzDException - Default Api Exception handler.
    • getManualInterventions

      public ManualInterventions getManualInterventions(int releaseId) throws AzDException
      List all manual interventions for a given release.
      Specified by:
      getManualInterventions in interface ReleaseDetails
      Parameters:
      releaseId - Id of the release.
      Returns:
      list of manual intervention object ManualInterventions
      Throws:
      AzDException - Default Api Exception handler.
    • updateManualIntervention

      public ManualIntervention updateManualIntervention(int releaseId, int manualInterventionId, String comment, ManualInterventionStatus status) throws AzDException
      Update manual intervention.
      Specified by:
      updateManualIntervention in interface ReleaseDetails
      Parameters:
      releaseId - Id of the release.
      manualInterventionId - Id of the manual intervention.
      comment - Sets the comment for manual intervention update.
      status - Sets the status of the manual intervention.
      Returns:
      manual intervention object ManualIntervention
      Throws:
      AzDException - Default Api Exception handler.