Git Product home page Git Product logo

azure-devops-java-sdk's Introduction

azure-devops-java-sdk

Build Status License: MIT Documentation Status Maven Central

azd library helps to manage Azure DevOps REST API with ease. This provides functionality to the significant services in Azure DevOps and manage in granular level.

The extension method .createAsync() is available for all the Apis in the sdk and returns a CompletableFuture object on the method that is called.

You can view the blog post for details about the library.

Documentation

Getting Started

To download the library and use it in your project, just add below in your pom.xml file.

<dependency>
  <groupId>io.github.hkarthik7</groupId>
  <artifactId>azd</artifactId>
  <version>5.0.5</version>
</dependency>

Java docs

<dependency>
    <groupId>io.github.hkarthik7</groupId>
    <artifactId>azd</artifactId>
    <version>5.0.5</version>
    <classifier>javadoc</classifier>
</dependency>

Source jar

<dependency>
    <groupId>io.github.hkarthik7</groupId>
    <artifactId>azd</artifactId>
    <version>5.0.5</version>
    <classifier>sources</classifier>
</dependency>
  • Get the list of projects for your organisation
public class Main {
    public static void main(String[] args) {
        String organisation = "myOrganisationName";
        String personalAccessToken = "accessToken";

        // Connect Azure DevOps API with organisation name and personal access token.
        var webApi = new AzDClientApi(organisation, personalAccessToken);

        // call the respective API with created webApi client connection object;
        var core = webApi.getCoreApi();
        try {
            // get the list of projects
            core.getProjects();
            
            // Get the list of projects asynchronously
            // This returns a CompletableFuture<List<Project>>
            var future = core.createAsync(core.getProjects().getProjects());

            System.out.println("Do something here...");

            var projects = future.join(); // Get the results
            
            projects.stream()
                    .map(Project::getName)
                    .forEach(System.out::println);
            
            // create a new project
            core.createProject("my-new-project", "Finance management");
            
            // create a team in the project
            core.createTeam("my-new-project", "my-new-team");
        
            // list all the teams
            core.getTeams();
        } catch (AzDException e1) {
            e1.printStackTrace();
        }
    }

}
  • Easily clone a build pipeline
public class Main {
    public static void main(String[] args) {
        String organisation = "myOrganisationName";
        String personalAccessToken = "accessToken";
        String projectName = "myProject";

        // Connect Azure DevOps API with organisation name and personal access token.
        var webApi = new AzDClientApi(organisation, projectName, personalAccessToken);

        // call the respective API with created webApi client connection object;
        var build = webApi.getBuildApi();
        try {
            // Clone an existing pipeline with the pipeline name
            String ciName = "DeployTo-WebApp-CI";
            String ciCloneName = "DeployTo-WebApp-CI-Copy";
            
            build.cloneBuildDefinition(ciName, ciCloneName);
            
        } catch (AzDException e1) {
            e1.printStackTrace();
        }
    }

}

Release Notes

Dependencies

NAME VERSION
com.fasterxml.jackson.core v2.13.3

Build Locally

You are going to need JDK version 11 or above and can be downloaded from here. Download Maven from the official website. Once it is installed add JAVA_HOME to the path as Maven is going to need it. You can check if Maven is installed correctly by running mvn -v.

Once you have installed JDK and Maven you can then,

Clone the repository and navigate to root of the folder where pom.xml is placed.

  • Run mvn clean to clean the target folder if any exists
  • Update _unitTest.json with your organisation name, project name and personal access token.
  • Run mvn test to run unit tests
  • Run mvn package to install the dependencies and create the resultant .jar file.

License

This project is licensed under MIT

Contributors

See Contribution Guidelines

azure-devops-java-sdk's People

Contributors

filterer avatar gabechan avatar hkarthik7 avatar jfbaraton avatar nbihan-mediware avatar shblue21 avatar stil4m avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.