VSphereAutomation::CIS::SessionApi
All URIs are relative to https://<vcenter>/rest
Method | HTTP request | Description |
---|---|---|
create | POST /com/vmware/cis/session | Creates a session with the API. This is the equivalent of login. This operation exchanges user credentials supplied in the security context for a session identifier that is to be used for authenticating subsequent calls. To authenticate subsequent calls clients are expected to include the session key. |
delete | DELETE /com/vmware/cis/session | Terminates the validity of a session token. This is the equivalent of log out. A session identifier is expected as part of the request. |
get | POST /com/vmware/cis/session?~action=get | Returns information about the current session. This operation expects a valid session identifier to be supplied. A side effect of invoking this operation may be a change to the session's last accessed time to the current time if this is supported by the session implementation. Invoking any other operation in the API will also update the session's last accessed time. This API is meant to serve the needs of various front end projects that may want to display the name of the user. Examples of this include various web based user interfaces and logging facilities. |
create
CisSessionCreateResult create(vmware_use_header_authn)
Creates a session with the API. This is the equivalent of login. This operation exchanges user credentials supplied in the security context for a session identifier that is to be used for authenticating subsequent calls. To authenticate subsequent calls clients are expected to include the session key.
Example
# load the gem
require 'vsphere-automation-cis'
# setup authorization
VSphereAutomation::Configuration.new.tap do |config|
# Configure HTTP basic authorization: basic_auth
config.username = 'YOUR USERNAME'
config.password = 'YOUR PASSWORD'
end
api_instance = VSphereAutomation::CIS::SessionApi.new
vmware_use_header_authn = 'vmware_use_header_authn_example' # String | Custom header to protect against CSRF attacks in browser based clients
begin
#Creates a session with the API. This is the equivalent of login. This operation exchanges user credentials supplied in the security context for a session identifier that is to be used for authenticating subsequent calls. To authenticate subsequent calls clients are expected to include the session key.
result = api_instance.create(vmware_use_header_authn)
p result
rescue VSphereAutomation::ApiError => e
puts "Exception when calling SessionApi->create: #{e}"
end
Parameters
Name | Type | Description | Notes |
---|---|---|---|
vmware_use_header_authn | String | Custom header to protect against CSRF attacks in browser based clients |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
delete
delete
Terminates the validity of a session token. This is the equivalent of log out. A session identifier is expected as part of the request.
Example
# load the gem
require 'vsphere-automation-cis'
# setup authorization
VSphereAutomation::Configuration.new.tap do |config|
# Configure API key authorization: api_key
config.api_key['vmware-api-session-id'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['vmware-api-session-id'] = 'Bearer'
end
api_instance = VSphereAutomation::CIS::SessionApi.new
begin
#Terminates the validity of a session token. This is the equivalent of log out. A session identifier is expected as part of the request.
api_instance.delete
rescue VSphereAutomation::ApiError => e
puts "Exception when calling SessionApi->delete: #{e}"
end
Parameters
This endpoint does not need any parameter.
Return type
nil (empty response body)
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
get
CisSessionResult get
Returns information about the current session. This operation expects a valid session identifier to be supplied. A side effect of invoking this operation may be a change to the session's last accessed time to the current time if this is supported by the session implementation. Invoking any other operation in the API will also update the session's last accessed time. This API is meant to serve the needs of various front end projects that may want to display the name of the user. Examples of this include various web based user interfaces and logging facilities.
Example
# load the gem
require 'vsphere-automation-cis'
# setup authorization
VSphereAutomation::Configuration.new.tap do |config|
# Configure API key authorization: api_key
config.api_key['vmware-api-session-id'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['vmware-api-session-id'] = 'Bearer'
end
api_instance = VSphereAutomation::CIS::SessionApi.new
begin
#Returns information about the current session. This operation expects a valid session identifier to be supplied. A side effect of invoking this operation may be a change to the session's last accessed time to the current time if this is supported by the session implementation. Invoking any other operation in the API will also update the session's last accessed time. This API is meant to serve the needs of various front end projects that may want to display the name of the user. Examples of this include various web based user interfaces and logging facilities.
result = api_instance.get
p result
rescue VSphereAutomation::ApiError => e
puts "Exception when calling SessionApi->get: #{e}"
end
Parameters
This endpoint does not need any parameter.
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json