class IBM::CloudSDK
Holds the SDK pieces.
Attributes
connection[R]
logger[R]
token[R]
Public Class Methods
new(api_key, logger: nil)
click to toggle source
# File lib/ibm/cloud_sdk.rb, line 12 def initialize(api_key, logger: nil) @logger = logger || Logger.new($stdout, level: :warn) @connection = IBM::Cloud::SDKHTTP::HTTPConnection.new(@logger) @token = IBM::Cloud::SDKHTTP::IAMToken.new(api_key, @connection, logger: @logger) end
Public Instance Methods
add_proxy(uri)
click to toggle source
Add a proxy to the configuration. @param uri [URI::Generic] A URI object with proxy configuration.
# File lib/ibm/cloud_sdk.rb, line 22 def add_proxy(uri) raise "URI #{uri} is not set properly. Requires a full url, and optional user & password" if uri.relative? path = "#{uri.scheme}://#{uri.hostname}" @connection.class.http_proxy(path, uri.port, uri.user, uri.password) end
vpc(region = 'us-east')
click to toggle source
Get an instance of the VPC API. @param region [String] The region to use for the VPC connection.
# File lib/ibm/cloud_sdk.rb, line 35 def vpc(region = 'us-east') @vpc ||= IBM::Cloud::SDK::Vpc.new(region, @connection, @token, logger: @logger) end