Class: IBM::Cloud::SDK::IAM
- Inherits:
-
BaseService
- Object
- BaseService
- IBM::Cloud::SDK::IAM
- Includes:
- Logging
- Defined in:
- lib/ibm/cloud/sdk/iam.rb,
lib/ibm/cloud/sdk/iam/token.rb
Defined Under Namespace
Classes: Token
Instance Method Summary collapse
- #endpoint ⇒ Object
- #get_identity_token ⇒ Object
-
#initialize(api_key) ⇒ IAM
constructor
A new instance of IAM.
Methods included from Logging
Methods inherited from BaseService
#delete, endpoint, #get, #post
Constructor Details
#initialize(api_key) ⇒ IAM
Returns a new instance of IAM.
13 14 15 16 |
# File 'lib/ibm/cloud/sdk/iam.rb', line 13 def initialize(api_key) @api_key = api_key RestClient.log = logger end |
Instance Method Details
#endpoint ⇒ Object
9 10 11 |
# File 'lib/ibm/cloud/sdk/iam.rb', line 9 def endpoint "https://iam.cloud.ibm.com".freeze end |
#get_identity_token ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/ibm/cloud/sdk/iam.rb', line 18 def get_identity_token payload = { :grant_type => "urn:ibm:params:oauth:grant-type:apikey", :apikey => api_key } result = post("identity/token", payload) require "ibm/cloud/sdk/iam/token" Token.new(*result.values_at("token_type", "access_token")) end |