Sdk vmware что это
The vsphere-automation-sdk-rest has been discontinued. This repo is a READ ONLY repo. Refer below links for REST API documentation and Postman samples.
VMware vSphere Automation SDK for REST
Table of Contents
The VMware vSphere Automation SDK for REST enables programmatic access to vSphere. The SDK includes Postman examples.
Supported vCenter Releases:
All samples support vCenter 6.7. Tagging samples also support vCenter 6.0.
The VMware vSphere Automation SDK for REST is intended for the following audiences:
- Developers looking for REST samples for the REST APIs
What’s in the SDK?
The VMware vSphere Automation SDK for REST provides a client SDK that contains samples that demonstrate how to use the vSphere Automation REST API and sample code. The following table contains a brief description of the contents of the vSphere Automation SDK for REST.
Directory structure (under VMware-vSphere-Automation-SDK-REST):
Directory | Contents |
---|---|
samples/postman | Postman samples that demonstrate how to construct REST API requests for Virtual Machine Operations. |
Developer Certificate of Origin
Before you start working with this project, 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.
The following information must be included in the README.md or in the sample docstring in case a README already exists in same folder.
- Author Name
- This can include full name, email address or other identifiable piece of information that would allow interested parties to contact author with questions.
- Date the sample was originally written
- What does the sample do?
The following information should be included when possible. Inclusion of information provides valuable information to consumers of the resource.
- vSphere version against which the sample was developed/tested
- SDK version against which the sample was developed/tested
- Additional Version information for any dependencies against which the sample was developed/tested
- Follow the GitHub process
- Please use one branch per sample or change-set
- Please use one commit and pull request per sample
- Please post the sample output along with the pull request
- If you include a license with your sample, use the project license
Ownership of any and all submitted samples are maintained by the submitter.
Any bugs or other issues should be filed within GitHub by way of the repository’s Issue Tracker.
Any community member can resolve issues within the repository, however only the board member can approve the update. Once approved, assuming the resolution involves a pull request, only a board member will be able to merge and close the request.
VMware Sample Exchange
Sample Exchange can be allowed to access your GitHub resources, by way of a linking process, where they can be indexed and searched by the community. There are VMware social media accounts which will advertise resources posted to the site and there's no additional accounts needed, as the VMware Sample Exchange uses MyVMware credentials.
Repository Administrator Resources
Board members are volunteers from the SDK community and VMware staff members, board members are not held responsible for any issues which may occur from running of samples from this repository.
- Ravi Chadalawada (VMware)
- J.R. Garcia (VMware)
Approval of Additions
Items added to the repository, including items from the Board members, require 2 votes from the board members before being added to the repository. The approving members will have ideally downloaded and tested the item. When two “Approved for Merge” comments are added from board members, the pull can then be committed to the repository.
About
REST (Postman and JavaScript) samples and API reference documentation for vSphere using the VMware REST API
If you are not a developer or programmer, the term API and SDK maybe foreign words to you. If you have heard of either of these words, often times they are miss-used or used interchangeably with one or another which can cause confusion. So what is an API and SDK?
Wikipedia’s defines an API as:
An application programming interface (API) is a source code based specification intended to be used as an interface by software components to communicate with each other. An API may include specifications for routines, data structures, object classes, and variables.Wikpedia’s defines an SDK as:
A software development kit (SDK or “devkit”) is typically a set of software development tools that allows for the creation of applications for a certain software package, software framework, hardware platform, computer system, video game console, operating system, or similar platform.Basically, an API provides an interface for users to access the underlying platform capabilities and features. An SDK may provide a set of tools, helper classes (e.g. additional code that simplifies the access of an API), specific language bindings and sample code to help users develop and use the API. In general, you could have a single API exposing a set of functionality and have multiple SDKs to access that API. An SDK may not always exists for an API, but it is helpful when one is provided.
Let’s take a look at an example using one of VMware’s common API and SDK, the vSphere API and vSphere SDK.
Hopefully this gave you a better understanding between an API and an SDK. In the next post, we will dive into an introduction of the vSphere API and the various components that make up the API. Stay tuned!
Get notification of new blog postings and more by following lamw on Twitter: @lamw
William Lam
William is Senior Staff Solution Architect in the VMware Cloud team within the Cloud Infrastructure Business Group (CIBG) at VMware. He primarily focus on Automation, Integration and Operation for the…
About
Python samples, language bindings, and API reference documentation for vSphere, VMC, and NSX-T using the VMware REST API
Используйте VMware VSphere WebService SDK для разработки (1) - Основная информация
В Интернете относительно мало представлений о VSphere WebService SDK (по крайней мере, я могу найти меньше информации), а официальный API также на английском языке, и нет никаких указаний, как его использовать. Недавно я познакомился с разработкой VSphere WebService SDK, и вначале меня это раздражало. Например, чтобы получить информацию об использовании процессора, согласно соглашению, API должен предоставлять интерфейс, аналогичный: long getCpuUsage (), но это определенно не так просто, но Я быстро понял закон. Я думаю, что необходимо поделиться тем, что я узнал, в надежде немного помочь читателям.
Я планирую использовать несколько статей, чтобы в основном описать, как использовать VSphere WebService SDK для мониторинга информации о ресурсах и сбора сигналов тревоги. Мониторинг мониторинга ресурсов в основном включает в себя: мониторинг информации виртуальной машины (виртуальной машины) (использование ЦП, скорость записи и чтения на диск, время запаздывания памяти, отброшенная передача по сети и ожидание полученных датаграмм) , Мониторинг хоста (HostSystem), мониторинг информации кластера (Cluster, Compute Resource) .Также собираются алармы для этих основных объектов.
Что касается установки программного обеспечения, такого как настройка vSphere и установка vSphere Client, пропустите это. Я использую здесь версию VMware-vSphere-SDK-5.0.0-429209.
Эта статья в первую очередь объясняет некоторые базовые знания.
VMware vSphere поддерживает надежные, отказоустойчивые виртуализированные приложения, сети и системы хранения. vSphere предоставляет множество дополнительных компонентов и модулей, таких как VMware High Availability (HA) и VMware VMotion. VMware vSphere Web Services SDK предоставляет разработчикам веб-служб программный доступ к компонентам vSphere.
API vSphere реализован в форме веб-службы, не зависящей от языка.Клиентские приложения могут получать доступ к службам и компонентам в системах ESX / ESXi, VCenter и vSphere через удаленные вызовы.
Клиентская программа VMware vSphere основана на модели распределенной архитектуры асинхронной связи.Фундамент архитектуры основан на управляемом объекте на стороне сервера, ссылках на управляемые объекты на стороне клиента и объектах данных.
Managed Object: На сервере vSphere (система ESX / ESXi или vCenter Server) он представляет службы и компоненты vSphere. Услуги включают PropertyCollector, SearchIndex, PerformanceManager и ViewManager. Компоненты включают объекты инвентаризации, такие как VirtualMachine, Datastore и Folder.
Managed Object refereneces: Это клиентское приложение, управляемое на стороне сервера.Клиентское приложение использует объекты ManagedObjectReference для отправки запросов на сервер. ManagedObjectReferences уникальны и эффективно действуют в течение жизненного цикла объекта. Существующее приложение и объект в списке, удаленный из-за истекших сеансов или перезапуска сервера, по-прежнему будут существовать. Если вы удалите объект, например виртуальную машину, а затем получите его, ссылка на него изменится.
Data objects: Содержит информацию об управляемых объектах, ваша клиентская программа отправляет объекты данных и получает объекты данных с сервером vSphere, различными стандартными и функциональными объектами, такими как VirtualMachineConfigSp и HostCapability.
Следующий рисунок Ясно объяснена связь между этими тремя объектами данных и vSphere Sever и клиентом.
Среди этих трех объектов данных MO представляет службы или компоненты на стороне сервера, и все они прямо или косвенно наследуются от абстрактного класса ManagedEntity. На следующей диаграмме классов показаны 7 наиболее важных типов MO в vSphere Infrastructure и их отношения наследования. Они представляют 7 компонентов или объектов в vSphere Infrastructure.
При использовании SDK для разработки собственной клиентской программы vSphere основная проблема заключается в том, как получить доступ к объектам в vSphere Inventory и просмотреть их. Ниже мы познакомимся с этим аспектом.
Введение в vSphere Inventory
Инвентаризация vSphere - это фактически центр обработки данных vSphere и его управляемые объекты. В инвентарь vSphere включены следующие три типа объектов:
Системы, управляемые в центре обработки данных, такие как Host, VirtualMachine, VirtualApp и т. Д.
Компоненты с определенными функциями, например ComputeResource, DataStore, Network и т. Д.
Отвечая за организацию классифицированных компонентов, они отвечают за организацию объектов в центре обработки данных в соответствии с иерархическими отношениями для формирования древовидной структуры, такой как Folder и DataCenter.
Структура инвентаризации сервера ESX / ESXi и vCenter аналогична, за исключением того, что количество объектов на сервере ESX ограничено.Например, в инвентаризации сервера ESX может быть только один объект Host. Следующие две картинки Структура инвентаризации сервера ESX, vCenter, приведена соответственно.
Структура инвентаря vCenter
Приведенная выше диаграмма взаимосвязей очень важна.Для получения ключевой информации в системе сначала найдите связанные объекты ManagedObjectReference на основе этой диаграммы, а затем просмотрите дерево свойств этого объекта. Например, найдите информацию об объекте DataCenter:
Вышеупомянутый метод getDatacenterTraversalSpec () - это код пути обхода Datacenter, а затем метод getDatacenterByName (String datacenterName) может пройти в соответствии с полученным путем обхода и получить соответствующий объект Datacenter.
Код пути обхода для Datacenter относительно прост, в то время как код пути обхода для VirtualMachine или кластера (ComputeResource) относительно сложен, и мы перечислим их один за другим позже.
Структура инвентаризации сервера ESX
Если вы хотите получить доступ к объекту в vCenter или сервере ESX или вызвать его методы, вы должны сначала найти этот объект в соответствии с его положением в инвентаризации. Как видно из приведенного выше рисунка, объект ServiceInstance находится в корне дерева структуры инвентаризации, поэтому для обхода всего инвентаря или поиска объекта в инвентаре необходимо сначала начать с ServiceInstance. Самым важным свойством в классе ServiceInstance (свойство, которое можно понимать как переменную-член класса) является контент, который указывает на экземпляр типа данных (объект данных) ServiceContent. Класс ServiceContent содержит множество важных атрибутов и ссылок на службы экземпляра службы vSphere, таких как корневая папка всей инвентаризации, диспетчер сеансов, сборщик свойств (используемый для поиска и перемещения объектов), EventManager, TaskManager и т. Д. На следующей диаграмме классов показаны некоторые свойства ServiceInstance и ServiceContent.
ServiceInstance и ServiceContent
Вышеуказанную информацию можно найти в Интернете, в демонстрационном примере API или сценария использования, который поставляется с vSphere SDK. Я просто выберу несколько важных концептуальных заявлений, а затем в основном объясню, как реализовать мониторинг состояния частного облака в реальном времени с помощью кодирования, например, индикаторов производительности, таких как использование ЦП виртуальной машины.
Ниже перечислены некоторые из основных кодов клавиш (их можно найти в Найдите соответствующий код в демонстрации, поставляемой с vSphere sdk. ), включая такие операции, как аутентификация, подключение и отключение.
Таким образом, соответствующее соединение может быть выполнено через соответствующую информацию о соединении (имя пользователя, пароль, URL-адрес).
Из-за нехватки места следующий контент будет последовательно представлен в последующих статьях.
VMware vSphere Automation SDK for Java
Table of Contents
This document describes the vSphere Automation Java SDK samples that use the vSphere Automation java client library. Additionally, some of the samples demonstrate the combined use of the vSphere Automation and vSphere Web Service APIs. The samples have been developed to work with JDK 1.8.
Supported OnPrem vCenter Releases:
vCenter 6.5, 6.7, 6.7U1, 6.7U2, 6.7U3, 7.0, 7.0U1, 7.0U2, 7.0U2mp1, 7.0U3
Please refer to the notes in each sample for detailed compatibility information.
Supported NSX-T Releases
Latest VMware Cloud on AWS Release:
Quick Start Guide
This document will walk you through getting up and running with the Java SDK Samples. Prior to running the samples you will need to setup a vCenter test environment and install maven, the following steps will take you through this process. Before you can run the SDK samples we'll need to walk you through the following steps:
- Setting up maven
- Setting up a vSphere test environment
Setting up maven
The SDK requires maven to build the samples.
Setting up a vSphere Test Environment
NOTE: The samples are intended to be run against a freshly installed non-Production vSphere setup as the scripts may make changes to the test environment and in some cases can destroy items when needed.
To run the samples a vSphere test environment is required with the following minimum configuration
- 1 vCenter Server
- 2 ESX hosts
- 1 NFS Datastore with at least 3GB of free capacity
Apart from the above, each individual sample may require additional setup. Please refer to the sample parameters for more information on that.
Building the Samples
In the root directory of your folder after cloning the repository, run the below maven commands -
Running the Samples
When running the samples, parameters can be provided either on the command line, in a configuration file (using the --config-file parameter), or a combination of both. The parameter values specified on the command line will override those specified in the configuration file. When using a configuration file, each required parameter for the sample must be specified either in the configuration file or as a command line parameter. Each parameter specified in the configuration file should be in the "key=value" format. For example:
Note: Please specify the fully qualified “hostname” of the server for running the samples to avoid hostname verification errors.
Use a command like the following to display usage information for a particular sample.
Use a command like the following to run a sample using only command line parameters:
Use a command like the following to run a sample using only a configuration file:
Use the following command to run the sample using a combination of configuration file and command line parameters:
Importing the samples to eclipse
To generate the eclipse project files for the samples run the below command
Once generated, follow below steps to import the project to eclipse:
- Go to File -> Import.
- Select Existing Projects into Workspace.
- Select the root directory as the directory where the samples are located.
- Click Finish
Adding a new sample
Once the eclipse project is imported, follow below steps to add a new sample using the sample template:
- Right click on the project and select New -> Package. Specify a package name in the wizard and click Finish.
- Right click on the newly created package and click Import -> General -> File System. In the dialog box, click "Browse" and select the "sample-template" folder in the root directory.
- Select the "SampleClass" in the dialog box and click finish.
This will import a basic sample class to your package, which you can then customize according to your needs.
VMware vSphere Automation SDK for Python
Table of Contents
This document describes the vSphere Automation Python SDK samples that use the vSphere Automation python client library. Additionally, some of the samples demonstrate the combined use of the vSphere Automation and vSphere APIs. To support this combined use, the vSphere Automation Python SDK samples require the vSphere Management SDK packages (pyVmomi) to be installed on the client. The samples have been developed to work with python 2.7.x and 3.3+
Supported OnPrem vCenter Releases
vCenter 6.5, 6.7, 7.0, 7.0U1, 7.0U2 and 7.0U2 mp1, 7.0U3, 7.0.3.2 Certain APIs and samples that are introduced in 6.5 release, such as vCenter, Virtual Machine and Appliance Management. Please refer to the notes in each sample for detailed compatibility information.
Supported NSX-T Releases
NSX-T 2.2, 2.3, 3.0 and VMC 1.7, 1.8, 1.9, 1.10, 1.11, 1.12, 1.14, 1.15, 1.16, 1.17, 1.18
Latest VMware Cloud on AWS Release:
Quick Start Guide
Prepare a Python Development Environment
We recommend you to install latest Python and pip on your system.
A Python virtual environment is also highly recommended.
Installing Required Python Packages
Be sure to upgrade to the latest pip and setuptools.
NOTE: The SDK also requires OpenSSL 1.0.1+ if you want to connect to vSphere 6.5+ in order to support TLS1.1 & 1.2
Connect to a vCenter Server
Output in a Python Interpreter:
NOTE: If you are using Bash, be sure to use single quote for username and password to preserve the values. If you use double quote, you will have to escape special characters, such as "$". See Bash manual
Connect to VMware Cloud on AWS
Output in a Python Interpreter:
Run SDK Samples
In this section we will walk you through the steps to run the sample code for vSphere and VMware Cloud on AWS APIs.
First, set PYTHONPATH to use SDK helper methods
Run VMware Cloud on AWS Samples
Run vSphere Samples
A vSphere test environment is required with the following configuration:
- 1 vCenter Server
- 2 ESX hosts
- 1 NFS Datastore with at least 3GB of free capacity
Note Please have the details of these available but do not have any configuration pre-created on vCenter server or ESXi Hosts, for example there should be no existing datacenters, clusters or attached hosts on the vCenter server.
Running the SDK Sample Setup Script
Before executing the samples we'll need to setup the vSphere test environment using one of the sample scripts (samples/vsphere/vcenter/setup/main.py). The script will perform the following:
- Create 2 test Datacenters
- Create a test Cluster
- Create Test Folders for VM Storage
- Attach the hosts
- Create a Distributed Switch
- Create a Distributed Portgroup
- Attach the NFS datastore (if Selected) to the hosts
- Copy the Photon OS ISO image downloaded from VMware's bintray server to the datastore
- Create directories to add sample ports
First, edit settings in samples/vsphere/vcenter/setup/testbed.py and replace everything in < >brackets with your environment information. Leave the rest of the settings in this file at their default values.
At this point, we're ready to run the setup script:
After completion you will see from the output and also the vSphere Client that the environment has now been fully setup and is ready to easily run further samples.
To view other available command-line options:
Run the vAPI vCenter sample suite:
Run a specific sample in a standalone mode:
vSphere API Documentation
VMware Cloud on AWS API Documentation
NSX API Documentation
Common issues you may run into while installing the sdk and running samples are listed here
Repository Administrator Resources
Board members are volunteers from the SDK community and VMware staff members, board members are not held responsible for any issues which may occur from running of samples from this repository.
- Ankit Agrawal (VMware)
- Martin Tsvetanov (VMware)
- Shweta Purohit (VMware)
- Vandit Mehta (VMware)
Читайте также: