Skip to content

Commit 61201a7

Browse files
authored
sc-35229: Aptible Managed AI (#207)
* sc-35229: Aptible Managed AI * sc-35229: managed ai includes gateway_url in responses * sc-35229: user and actor for revoke and create
1 parent d05d7ad commit 61201a7

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

lib/aptible/api/account.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ module Api
55
class Account < Resource
66
belongs_to :stack
77

8+
has_many :ai_tokens
89
has_many :apps
910
has_many :backups
1011
has_many :certificates

lib/aptible/api/ai_token.rb

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
module Aptible
2+
module Api
3+
class AiToken < Resource
4+
belongs_to :account
5+
6+
field :id
7+
field :name
8+
field :created_at
9+
field :updated_at
10+
field :expires_at
11+
field :last_used_at
12+
field :revoked_at
13+
field :gateway_url
14+
# User (on whose behalf) details
15+
field :created_by_user_id
16+
field :created_by_user_name
17+
field :created_by_user_email
18+
# Actor (who performed) details
19+
field :created_by_actor_id
20+
field :created_by_actor_name
21+
field :created_by_actor_email
22+
# Revoked by user details
23+
field :revoked_by_user_id
24+
field :revoked_by_user_name
25+
field :revoked_by_user_email
26+
# Revoked by actor details
27+
field :revoked_by_actor_id
28+
field :revoked_by_actor_name
29+
field :revoked_by_actor_email
30+
31+
# Note: The 'token' field from API response is accessible via
32+
# attributes['token'] to avoid conflict with aptible-resource's
33+
# internal token handling (used for auth bearer token)
34+
def api_key
35+
attributes['token']
36+
end
37+
end
38+
end
39+
end

lib/aptible/api/resource.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ def root_url
1515
end
1616

1717
require 'aptible/api/account'
18+
require 'aptible/api/ai_token'
1819
require 'aptible/api/ami'
1920
require 'aptible/api/ami_release'
2021
require 'aptible/api/app'

0 commit comments

Comments
 (0)