Class: PlatformServiceController

Inherits:
Object
  • Object
show all
Defined in:
/build/mts/release/bora-4571906/vcsuite-sdks/ruby/samples/lib/sample/framework/platform_service_controller.rb

Overview

Manages services on the Platform Service Controller (PSC) node (e.g. lookup service, SSO etc.)

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (PlatformServiceController) initialize(sample)

Constructs a new instance.

Parameters:

  • sample (SampleBase)

    the associated sample, which provides access to the configuration properties of the sample



26
27
28
# File '/build/mts/release/bora-4571906/vcsuite-sdks/ruby/samples/lib/sample/framework/platform_service_controller.rb', line 26

def initialize(sample)
    @sample = sample
end

Instance Attribute Details

- (Object) bearer_token (readonly)

Returns the value of attribute bearer_token



21
22
23
# File '/build/mts/release/bora-4571906/vcsuite-sdks/ruby/samples/lib/sample/framework/platform_service_controller.rb', line 21

def bearer_token
  @bearer_token
end

- (Object) bearer_token_context (readonly)

Returns the value of attribute bearer_token_context



21
22
23
# File '/build/mts/release/bora-4571906/vcsuite-sdks/ruby/samples/lib/sample/framework/platform_service_controller.rb', line 21

def bearer_token_context
  @bearer_token_context
end

- (Object) lookup_service_helper (readonly)

Returns the value of attribute lookup_service_helper



20
21
22
# File '/build/mts/release/bora-4571906/vcsuite-sdks/ruby/samples/lib/sample/framework/platform_service_controller.rb', line 20

def lookup_service_helper
  @lookup_service_helper
end

- (Object) sample (readonly)

Returns the value of attribute sample



20
21
22
# File '/build/mts/release/bora-4571906/vcsuite-sdks/ruby/samples/lib/sample/framework/platform_service_controller.rb', line 20

def sample
  @sample
end

- (Object) sts_url (readonly)

Returns the value of attribute sts_url



21
22
23
# File '/build/mts/release/bora-4571906/vcsuite-sdks/ruby/samples/lib/sample/framework/platform_service_controller.rb', line 21

def sts_url
  @sts_url
end

Instance Method Details

- (Object) login

Finds the SSO URL from the lookup service and retrieves the SAML token from STS URL



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File '/build/mts/release/bora-4571906/vcsuite-sdks/ruby/samples/lib/sample/framework/platform_service_controller.rb', line 31

def 
    @lookup_service_helper = LookupServiceHelper.new(sample)
    Sample.log.info "Connecting to lookup service: #{lookup_service_helper.soap_url}"
    lookup_service_helper.connect()

    @sts_url = lookup_service_helper.find_sso_url()
    raise 'sts_url not found' if sts_url.nil?

    Sample.log.info "Retrieving a SAML bearer token from STS: #{sts_url}"
    sso = SSO::Connection.new(sts_url)
    sso.(sample.sso_username, sample.sso_password)
    @bearer_token = sso.request_bearer_token()
    @bearer_token_context =
        VAPI::Security.create_saml_bearer_security_context(bearer_token.to_s)
end