This example is based on the code in the connection_workflow.rb sample file. The source file is located in the following vCloud Suite SDK for Ruby directory: client/samples/lib/sample/workflow/connection_workflow.rb.
This example uses the steps that are described in the Create a vCloud Suite Session with a SAML Token procedure.
# 1 - Create a stub configuration. $my_stub_config = VAPI::Bindings::VapiConfig.new($my_vapi_url) # 2 - Create a SAML token security context. saml_token_context = VAPI::Security.create_saml_bearer_security_context($my_saml_token.to_s) # 3 - Apply the token security context to the stub configuration. $my_stub_config.set_security_context(saml_token_context) # 4 - Create a session stub, using the token security context. $my_vapi_stub = Com::Vmware::Cis::Session.new($my_stub_config) # 5 - Use the create() operation to create an authenticated session. session_id = $my_vapi_stub.create() # 6 - Create a session security context and set the stub configuration # to use the session ID. session_id_context = VAPI::Security.create_session_security_context(session_id) $my_stub_config.set_security_context(session_id_context) # 7 - Create a new session stub, using the session security context. $my_vapi_stub = Com::Vmware::Cis::Session.new($my_stub_config)