Giter Club home page Giter Club logo

vrealize-pysdk's Introduction

vrealize-automation

This repository stores tools and and an SDK for VMware's vRealize Automation. Most of these are my first attempts at building something useful in python so expect bugs.

Overview

A basic vRealize automation wrapper API called vralib. I'm sure someone somewhere will want to change this over time and that's fine.

The library has few dependencies; you pretty much just need requests and the python standard library to get started.

  • requirements.txt - Library requirements for the vRA SDK. Should just need requests.

Sample Scripts

In the 'tool-samples' directory you'll find a series of helpful but simples tools that leverage this API to give you an idea of usage.

  • get-catalog.py - Returns a prettytable formatted list of catalog names and IDs. The IDs can be used to request resources
  • get-items.py - A script to pull a list of provisioned items.

Setup

Right now you'll just need the Python Requests library.

pip install requests

Import the library:

import vralib

Usage

Log into the vRA instance

Use the vralib.Session.login() method to log into the vRealize automation server by creating an object with the .login @classmethod:

vra = vralib.Session.login(username, password, cloudurl, tenant, ssl_verify=False)

Variables are defined as:

  • username - a string containing the username that's logging into the environment. Typically it's user@domain
  • password - a string containing the password for the specified user.
  • cloudurl - a string that contains the FQDN or IP address of the vrealize automation server. Don't include the https bit. The library will sort out specific URLs for you
  • tenant - an optional string that contains the tenant you want to log into. If you leave this blank it will log into the default tenant
  • ssl_verify - a boolean value that can be used to disable SSL verification. Helpful for when you don't have signed/trusted certificates (like a development environment)

Getting data from the API

Once logged in you can access various methods through the object. For example to retrieve all of the available catalog items:

catalog = vra.get_catalogitem_byname(name)

Most returns are going to be python dictionaries.

Contributions welcome!

vrealize-pysdk's People

Contributors

codyde avatar mpuckett159 avatar russellpope avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

vrealize-pysdk's Issues

incorrect connection URL to vrops API

I don't know which version of vRealize you using, but I get 404 error on 'https://' + cloudurl + '/identity/api/tokens'. So I add some IF to your code (classes.py) from 115 line:

            if str(r).find('404') != -1:
                r = requests.post(
                    url='https://' + cloudurl + '/suite-api/api/auth/token/acquire',
                    headers={'Content-type': 'Application/json',
                             'Accept': 'Application/json'},
                    verify=ssl_verify,
                    data=json.dumps({
                        "tenant": tenant,
                        "username": username,
                        "password": password
                    })
                )

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.