Add vCenter Server

This API adds one or more vCenter Servers to vCenter Chargeback Manager. To do this, the vCenter Server must be accessible over the network.

Syntax

The syntax for calling this API is:

POST <Base_URL>/vCenterServer

A sample API call is as follows:

POST https://123.123.123.123/vCenter-CB/api/vCenterServer

User Privilege

You must have the Super User role or Administrator role.

Request Body Parameters

The request XML for this API can include the parameters described in the following table.

XPath

Type

Min Occurs

Max Occurs

Description

VCenterServers/VCenterServer

 

1

1

The vCenter Server element

VCenterServers/VCenterServer/Url

xs:string

1

1

FQDN or IP address and port number of the vCenter Server

VCenterServers/VCenterServer/Name

xs:string

1

1

Short display name for the vCenter Server

VCenterServers/VCenterServer/Description

xs:string

0

1

A description of the vCenter Server

VCenterServers/VCenterServer/UserName

xs:string

1

1

User name to access the vCenter Server

VCenterServers/VCenterServer/Password

xs:string

1

1

Password for the user name entered

VCenterServers/VCenterServer/PluginRegistered

xs:boolean

1

1

Whether to register vCenter Chargeback Manager as a vSphere Client plug-in. The value can be true or false.
Specify true if you want to register vCenter Chargeback Manager as a plug-in in vSphere Client. Each time you log in to this vCenter Server using the vSphere Client, the vCenter Chargeback Manager plug-in is available on vSphere Client. You can access the vCenter Chargeback Manager from vSphere Client.

VCenterServers/VCenterServer/StatsSync

xs:boolean

0

1

Whether to replicate statistics from the vCenter Server database to the vCenter Chargeback Manager database. Select this option if you want the resource usage statistics from the vCenter Server database to be replicated in the vCenter Chargeback Manager database.

VCenterServers/VCenterServer/DataSourceType/@id

xs:integer

1

1

Integer to specify the database type for the vCenter Server database. The database type can be either SQL Server (default) or Oracle. An ID value of 1 means SQL Server and 2 means Oracle.

VCenterServers/VCenterServer/DataSourceUrl

xs:string

1

1

URL of the system on which the vCenter Chargeback Manager database is installed along with either the port at which the database listener service is running or the vCenter Chargeback Manager database instance name.

For Oracle database, the database URL can be in one of the following formats:

<IP Address>:<TNS Listener Port>
<Host Name>:<TNS Listener Port>

For SQL Server, the database URL can be in one of the following formats:

<IP Address>\<Database Instance Name>
<Host Name>\<Database Instance Name>

You can also specify a well formed JDBC URL that starts with 'jdbc' and contains the database name. If the vCenter Server database is on an Oracle RAC environment, then you must provide a JDBC URL for the database.

VCenterServers/VCenterServer/DataSourceName

xs:string

1

1

Name of the vCenter Server database. For example, vim_vcdb, which is the default name given by vCenter Server. If the vCenter Server database is an Oracle database, you can specify its service name. For example, vcdb_ora.

The DataSourceName is ignored if you specify a JDBC URL for DataSourceUrl.

VCenterServers/VCenterServer/DataSourceAuthType/@id

xs:integer

0

1

Integer to select authentication type for the vCenter Server database. For SQL Server, you can use Windows authentication or SQL authentication (credential-based authentication). ID value of 1 means SQL authentication (credential-based authentication) and ID value of 2 indicates Windows authentication.

VCenterServers/VCenterServer/DataSourceUserName

xs:string

0

1

A database user name to access the vCenter Server database. Ensure that this is not the same user that vCenter Server uses to connect to the vCenter Server database.

If you have selected Windows authentication, then provide a domain user name to access the vCenter Server database. The domain user name must be of the form user@domain.com or domain\user. If you do not specify a domain user name, then vCenter Chargeback Manager uses the details of the domain user who started the current session of the vCenter Chargeback Manager service to access the vCenter Server database.

VCenterServers/VCenterServer/DataSourcePassword

xs:string

0

1

Password for the database user name entered.

VCenterServers/VCenterServer/ForceUpdate

xs:boolean

0

1

Whether to force data source updates.

A sample request XML is provided here.

API Response

If the request succeeds, the API returns XML with details of the new vCenter Server.

XPath

Type

Min Occurs

Max Occurs

Description

VCenterServers/VCenterServer

 

1

1

This is the vCenter Server element

VCenterServers/VCenterServer/@id

xs:int

1

1

The vCenter Server identifier. This ID will be the same as the vCenterServer Id specified in the API URL.

VCenterServers/VCenterServer/Url

xs:string

1

1

URL with IP address (or host name) and port number of the vCenter Server

VCenterServers/VCenterServer/LastSynchronizationTime

xs:long

1

1

Long integer identifying the time of last synchronization. A value of 0 indicates that the vCenter Server is not synchronized with the vCenter Chargeback Manager.

VCenterServers/VCenterServer/Name

xs:string

1

1

Short name for the vCenter Server

VCenterServers/VCenterServer/Description

xs:string

0

1

A description of the vCenter Server

VCenterServers/VCenterServer/UserName

xs:string

1

1

Login name of the user with which the vCenter Server is added to vCenter Chargeback Manager.

VCenterServers/VCenterServer/PluginRegistered

xs:boolean

1

1

Whether the vCenter Chargeback Manager is registered as a plugin to this vCenter Server

VCenterServers/VCenterServer/StatsSync

xs:boolean

1

1

Whether statistics from the vCenter Server database are replicated in the vCenter Chargeback Manager database

VCenterServers/VCenterServer/DataSourceUrl

xs:string

1

1

URL with IP address (or host name) of the vCenter Server database

VCenterServers/VCenterServer/DataSourceName

xs:string

1

1

Name of the vCenter Server database

VCenterServers/VCenterServer/DataSourceUserName

xs:string

1

1

Login name of the user to authenticate with the vCenter Server database

VCenterServers/VCenterServer/DataSourceAuthType/@id

xs:integer

1

1

ID of the authorization type of the vCenter Server database

VCenterServers/VCenterServer/DataSourceAuthType/Name

xs:string

1

1

Name of the authorization type of the vCenter Server database

VCenterServers/VCenterServer/DataSourceType/@id

xs:integer

1

1

ID of the datasource type of the vCenter Server

VCenterServers/VCenterServer/DataSourceType/Name

xs:string

1

1

Name of the datasource type of the vCenter Server

VCenterServers/VCenterServer/Version

xs:string

1

1

Version of the vCenter Server

A sample response is provided here.

Error Response

The following table explains the possible error codes.

Error code

Description

VCENTER_COMMON_ERR_INVALID_DATA_LENGTH

Returned if:

  • vCenter Server/Data Source URL exceeds the permissible limit of 255 characters or
  • vCenter Server/Data Source Password exceeds the limit of 1024 characters.

VCB_ERR_VC_EXISTS

Returned if the same vCenter Server exists

VCB_ERR_INVALID_VC_DISPLAY_NAME

Returned if a vCenter Server with the same display name exists or if the display name exceeds 255 characters.

VCB_ERR_VC_CONN

Failed to connect to vCenter Server

VCB_ERR_INVALID_VC_DESCRIPTION

Returned if the vCenter Server description exceeds 512 characters.

VCB_ERR_INVALID_VC_USER_NAME

Returned if the vCenter Server user name exceeds 255 characters.

VCB_ERR_INVALID_DATA_SOURCE_NAME

Returned if the vCenter Server datasource name exceeds 128 characters.

VCB_ERR_INVALID_DATA_SOURCE_USER_NAME

Returned if the vCenter Server datasource user name exceeds 255 characters.

VCENTER_COMMON_ERR_DAS_DB_CONN

Failed to connect to the vCenter Server database

VCB_ERR_INVALID_DB_TYPE

Returned if the data source type is invalid

VCB_ERR_INVALID_VC_VIEW_TYPE

Returned if the vCenter Server view type is invalid

VCB_ERR_INVALID_AUTH_TYPE

Returned if the Authentication type is invalid

VCB_ERR_UNTRUSTED_SSL_CERTIFICATE

Returned if the SSL certificate is untrusted.