Coder Social home page Coder Social logo

vmware-samples / site-recovery-manager-rest-api-examples Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 1.0 139 KB

Site Recovery Manager and vSphere Replication REST API was released in 8.6 and 8.7 of the product. We would like to create a codespace in VMware github to provide examples of the main use cases which our customers have difficulties with. These examples will be code snippets (or the whole request) of working REST API requests.

License: BSD 2-Clause "Simplified" License

Java 72.05% PowerShell 27.95%

site-recovery-manager-rest-api-examples's Introduction

site-recovery-manager-rest-api-examples

Examples (code snippets) of working REST API requests.

1. Prerequisites

REST API gateway Open API spec file in one of the formats - .json or .yaml

REST API client generator.

Online option - https://editor.swagger.io/

Maven option:

swagger-codegen-maven-plugin

<plugin>
   <groupId>io.swagger.codegen.v3</groupId>
   <artifactId>swagger-codegen-maven-plugin</artifactId>
   <version>3.0.32</version>
   <dependencies>
      <dependency>
         <groupId>com.github.jknack</groupId>
         <artifactId>handlebars</artifactId>
         <version>4.3.0</version>
      </dependency>
   </dependencies>
   <executions>
      <execution>
         <phase>generate-sources</phase>
         <goals>
            <goal>generate</goal>
         </goals>
         <configuration>
            <inputSpec>${swagger.definitions.url}</inputSpec>
            <language>java</language>
            <output>${swagger.output.dir}</output>
            <generateSupportingFiles>true</generateSupportingFiles>
            <generateApiTests>false</generateApiTests>
            <generateApiDocumentation>false</generateApiDocumentation>
            <generateModelTests>false</generateModelTests>
            <generateModelDocumentation>false</generateModelDocumentation>
            <environmentVariables>
               <io.swagger.v3.parser.util.RemoteUrl.trustAll>true</io.swagger.v3.parser.util.RemoteUrl.trustAll>
            </environmentVariables>
            <configOptions>
               <dateLibrary>legacy</dateLibrary>
               <useRuntimeException>true</useRuntimeException>
               <hideGenerationTimestamp>true</hideGenerationTimestamp>
            </configOptions>
         </configuration>
      </execution>
   </executions>
</plugin>

Other options are also available.

Project build tools - Maven, Gradle, etc.

2. Project Setup Steps

Generate REST API gateway client.

Build REST API gateway generated client.

Create your project and introduce dependency on REST API gateway client built in the previous step.

Write your code to start calling REST API gateway endpoints.

First start with login request in order to obtain REST API gateway session token. This needs Basic Authentication with user and password credentials for the local SRM/HMS site. Add the obtained session token to the header, with key "x-dr-session", of every future REST API request.

Call get all pairings request. This is a preliminary step before calling remote login request.

Call remote login request in order to authenticate to the SRM/HMS remote site. This needs Basic Authentication with user and password credentials for the remote SRM/HMS site.

Now logged in at the local and remote site, any request of your interest can be made.

With project build tool of your choice build your project.

Contributing

The site-recovery-manager-rest-api-examples project team welcomes contributions from the community. Before you start working with site-recovery-manager-rest-api-examples, please read our Developer Certificate of Origin. All contributions to this repository must be signed as described on that page. Your signature certifies that you wrote the patch or have the right to pass it on as an open-source patch. For more detailed information, refer to CONTRIBUTING_DCO.md.

License

BSD-2

site-recovery-manager-rest-api-examples's People

Contributors

epetkovvmware avatar fmanning07 avatar sstych avatar vmwghbot avatar ybarova avatar zivanov123 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

jaychinut

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.