latitude-api 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.yardopts +10 -0
- data/LICENSE.txt +21 -0
- data/README.md +283 -0
- data/Rakefile +13 -0
- data/lib/latitude/api/api_object.rb +105 -0
- data/lib/latitude/api/api_resource.rb +260 -0
- data/lib/latitude/api/attributes.rb +64 -0
- data/lib/latitude/api/client.rb +80 -0
- data/lib/latitude/api/configuration.rb +88 -0
- data/lib/latitude/api/errors.rb +134 -0
- data/lib/latitude/api/json_api.rb +40 -0
- data/lib/latitude/api/list_object.rb +129 -0
- data/lib/latitude/api/objects.rb +216 -0
- data/lib/latitude/api/operations/action.rb +41 -0
- data/lib/latitude/api/operations/create.rb +22 -0
- data/lib/latitude/api/operations/delete.rb +22 -0
- data/lib/latitude/api/operations/list.rb +54 -0
- data/lib/latitude/api/operations/nested.rb +53 -0
- data/lib/latitude/api/operations/retrieve.rb +22 -0
- data/lib/latitude/api/operations/update.rb +22 -0
- data/lib/latitude/api/request_executor.rb +217 -0
- data/lib/latitude/api/request_options.rb +86 -0
- data/lib/latitude/api/request_params.rb +70 -0
- data/lib/latitude/api/resources/api_key.rb +61 -0
- data/lib/latitude/api/resources/billing_usage.rb +51 -0
- data/lib/latitude/api/resources/elastic_ip.rb +96 -0
- data/lib/latitude/api/resources/event.rb +55 -0
- data/lib/latitude/api/resources/firewall.rb +129 -0
- data/lib/latitude/api/resources/ip.rb +110 -0
- data/lib/latitude/api/resources/kubernetes_cluster.rb +184 -0
- data/lib/latitude/api/resources/plan.rb +658 -0
- data/lib/latitude/api/resources/project.rb +179 -0
- data/lib/latitude/api/resources/region.rb +41 -0
- data/lib/latitude/api/resources/role.rb +20 -0
- data/lib/latitude/api/resources/server.rb +251 -0
- data/lib/latitude/api/resources/ssh_key.rb +44 -0
- data/lib/latitude/api/resources/storage_filesystem.rb +36 -0
- data/lib/latitude/api/resources/storage_object.rb +85 -0
- data/lib/latitude/api/resources/storage_volume.rb +64 -0
- data/lib/latitude/api/resources/tag.rb +34 -0
- data/lib/latitude/api/resources/team.rb +169 -0
- data/lib/latitude/api/resources/traffic.rb +215 -0
- data/lib/latitude/api/resources/user_data.rb +38 -0
- data/lib/latitude/api/resources/user_profile.rb +51 -0
- data/lib/latitude/api/resources/user_team.rb +90 -0
- data/lib/latitude/api/resources/virtual_machine.rb +146 -0
- data/lib/latitude/api/resources/virtual_network.rb +162 -0
- data/lib/latitude/api/resources/vpn_session.rb +80 -0
- data/lib/latitude/api/singleton_api_resource.rb +22 -0
- data/lib/latitude/api/util.rb +64 -0
- data/lib/latitude/api/version.rb +7 -0
- data/lib/latitude/api.rb +147 -0
- data/lib/latitude/metadata/errors.rb +18 -0
- data/lib/latitude/metadata/session.rb +109 -0
- data/lib/latitude/metadata.rb +43 -0
- data/lib/latitude.rb +4 -0
- metadata +132 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Latitude
|
|
4
|
+
module API
|
|
5
|
+
module Resources
|
|
6
|
+
module Storage
|
|
7
|
+
# @!attribute [rw] name
|
|
8
|
+
# @return [String]
|
|
9
|
+
# @!attribute [rw] size_in_gb
|
|
10
|
+
# @return [Integer]
|
|
11
|
+
# @!attribute [r] created_at
|
|
12
|
+
# @return [Time]
|
|
13
|
+
# @!attribute [rw] namespace_id
|
|
14
|
+
# @return [String]
|
|
15
|
+
# @!attribute [rw] connector_id
|
|
16
|
+
# @return [String]
|
|
17
|
+
# @!attribute [rw] initiators
|
|
18
|
+
# @return [Array<Initiator>]
|
|
19
|
+
# @!attribute [rw] project
|
|
20
|
+
# @return [Latitude::API::Objects::Project]
|
|
21
|
+
# @!attribute [rw] team
|
|
22
|
+
# @return [Latitude::API::Objects::Team]
|
|
23
|
+
class Volume < APIResource
|
|
24
|
+
# @!attribute [r] nqn
|
|
25
|
+
# @return [String]
|
|
26
|
+
class Initiator < APIObject
|
|
27
|
+
attribute :nqn, :string, read_only: true
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
attribute :name, :string
|
|
31
|
+
attribute :size_in_gb, :integer
|
|
32
|
+
attribute :created_at, :time, read_only: true
|
|
33
|
+
attribute :namespace_id, :string
|
|
34
|
+
attribute :connector_id, :string
|
|
35
|
+
attribute :initiators, [Initiator]
|
|
36
|
+
attribute :project, Objects::Project
|
|
37
|
+
attribute :team, Objects::Team
|
|
38
|
+
|
|
39
|
+
resource_type "volumes"
|
|
40
|
+
resource_path "/storage/volumes"
|
|
41
|
+
id_prefix "vol_"
|
|
42
|
+
|
|
43
|
+
extend Operations::List
|
|
44
|
+
extend Operations::Create
|
|
45
|
+
extend Operations::Retrieve
|
|
46
|
+
extend Operations::Delete
|
|
47
|
+
|
|
48
|
+
class << self
|
|
49
|
+
def mount(id, server_id: nil, opts: {})
|
|
50
|
+
attrs = { server_id: server_id }.compact
|
|
51
|
+
body = JSONAPI.encode(type: "volumes", attributes: attrs)
|
|
52
|
+
parsed = execute_request(method: :post, path: "#{instance_url(id)}/mount", body: body, opts: opts)
|
|
53
|
+
parsed
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def mount(server_id: nil, opts: {})
|
|
58
|
+
self.class.mount(id, server_id: server_id, opts: opts)
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Latitude
|
|
4
|
+
module API
|
|
5
|
+
module Resources
|
|
6
|
+
# @!attribute [rw] name
|
|
7
|
+
# @return [String]
|
|
8
|
+
# @!attribute [rw] slug
|
|
9
|
+
# @return [String]
|
|
10
|
+
# @!attribute [rw] description
|
|
11
|
+
# @return [String]
|
|
12
|
+
# @!attribute [rw] color
|
|
13
|
+
# @return [String]
|
|
14
|
+
# @!attribute [rw] team
|
|
15
|
+
# @return [Latitude::API::Objects::Team]
|
|
16
|
+
class Tag < APIResource
|
|
17
|
+
attribute :name, :string
|
|
18
|
+
attribute :slug, :string
|
|
19
|
+
attribute :description, :string
|
|
20
|
+
attribute :color, :string
|
|
21
|
+
attribute :team, Objects::Team
|
|
22
|
+
|
|
23
|
+
resource_type "tags"
|
|
24
|
+
resource_path "/tags"
|
|
25
|
+
id_prefix "tag_"
|
|
26
|
+
|
|
27
|
+
extend Operations::List
|
|
28
|
+
extend Operations::Create
|
|
29
|
+
extend Operations::Update
|
|
30
|
+
extend Operations::Delete
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Latitude
|
|
4
|
+
module API
|
|
5
|
+
module Resources
|
|
6
|
+
# @!attribute [rw] name
|
|
7
|
+
# @return [String]
|
|
8
|
+
# @!attribute [rw] slug
|
|
9
|
+
# @return [String]
|
|
10
|
+
# @!attribute [rw] address
|
|
11
|
+
# @return [String]
|
|
12
|
+
# @!attribute [rw] currency
|
|
13
|
+
# @return [String]
|
|
14
|
+
# @!attribute [rw] enforce_mfa
|
|
15
|
+
# @return [Boolean]
|
|
16
|
+
# @!attribute [rw] referred_code
|
|
17
|
+
# @return [String]
|
|
18
|
+
# @!attribute [r] created_at
|
|
19
|
+
# @return [Time]
|
|
20
|
+
# @!attribute [r] updated_at
|
|
21
|
+
# @return [Time]
|
|
22
|
+
# @!attribute [rw] status
|
|
23
|
+
# @return [String]
|
|
24
|
+
# @!attribute [rw] users
|
|
25
|
+
# @return [Array<User>]
|
|
26
|
+
# @!attribute [rw] projects
|
|
27
|
+
# @return [Array]
|
|
28
|
+
# @!attribute [rw] owner
|
|
29
|
+
# @return [Latitude::API::Objects::User]
|
|
30
|
+
# @!attribute [rw] billing
|
|
31
|
+
# @return [Latitude::API::Objects::Billing]
|
|
32
|
+
# @!attribute [rw] feature_flags
|
|
33
|
+
# @return [Array]
|
|
34
|
+
# @!attribute [rw] limits
|
|
35
|
+
# @return [Latitude::API::Objects::Limits]
|
|
36
|
+
# @!attribute [rw] token
|
|
37
|
+
# @return [String]
|
|
38
|
+
# @!attribute [rw] customer_billing_id
|
|
39
|
+
# @return [String]
|
|
40
|
+
class Team < APIResource
|
|
41
|
+
# @!attribute [r] id
|
|
42
|
+
# @return [String]
|
|
43
|
+
# @!attribute [r] first_name
|
|
44
|
+
# @return [String]
|
|
45
|
+
# @!attribute [r] last_name
|
|
46
|
+
# @return [String]
|
|
47
|
+
# @!attribute [r] email
|
|
48
|
+
# @return [String]
|
|
49
|
+
# @!attribute [r] created_at
|
|
50
|
+
# @return [Time]
|
|
51
|
+
# @!attribute [r] updated_at
|
|
52
|
+
# @return [Time]
|
|
53
|
+
# @!attribute [r] role
|
|
54
|
+
# @return [Latitude::API::Objects::Role]
|
|
55
|
+
class User < APIObject
|
|
56
|
+
attribute :id, :string, read_only: true
|
|
57
|
+
attribute :first_name, :string, read_only: true
|
|
58
|
+
attribute :last_name, :string, read_only: true
|
|
59
|
+
attribute :email, :string, read_only: true
|
|
60
|
+
attribute :created_at, :time, read_only: true
|
|
61
|
+
attribute :updated_at, :time, read_only: true
|
|
62
|
+
attribute :role, Objects::Role, read_only: true
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
attribute :name, :string
|
|
66
|
+
attribute :slug, :string
|
|
67
|
+
attribute :address, :string
|
|
68
|
+
attribute :currency, :string
|
|
69
|
+
attribute :enforce_mfa, :boolean
|
|
70
|
+
attribute :referred_code, :string
|
|
71
|
+
attribute :created_at, :time, read_only: true
|
|
72
|
+
attribute :updated_at, :time, read_only: true
|
|
73
|
+
attribute :status, :string
|
|
74
|
+
attribute :users, [User]
|
|
75
|
+
attribute :projects, :array
|
|
76
|
+
attribute :owner, Objects::User
|
|
77
|
+
attribute :billing, Objects::Billing
|
|
78
|
+
attribute :feature_flags, :array
|
|
79
|
+
attribute :limits, Objects::Limits
|
|
80
|
+
attribute :token, :string
|
|
81
|
+
attribute :customer_billing_id, :string
|
|
82
|
+
|
|
83
|
+
resource_type "teams"
|
|
84
|
+
resource_path "/team"
|
|
85
|
+
id_prefix "team_"
|
|
86
|
+
|
|
87
|
+
extend Operations::Create
|
|
88
|
+
extend Operations::Update
|
|
89
|
+
|
|
90
|
+
class << self
|
|
91
|
+
def retrieve(opts = {})
|
|
92
|
+
parsed = execute_request(method: :get, path: resource_path, opts: opts)
|
|
93
|
+
construct_from(parsed, opts: opts)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def members
|
|
97
|
+
Member
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# @!attribute [rw] first_name
|
|
102
|
+
|
|
103
|
+
# @return [String]
|
|
104
|
+
|
|
105
|
+
# @!attribute [rw] last_name
|
|
106
|
+
|
|
107
|
+
# @return [String]
|
|
108
|
+
|
|
109
|
+
# @!attribute [rw] email
|
|
110
|
+
|
|
111
|
+
# @return [String]
|
|
112
|
+
|
|
113
|
+
# @!attribute [rw] mfa_enabled
|
|
114
|
+
|
|
115
|
+
# @return [Boolean]
|
|
116
|
+
|
|
117
|
+
# @!attribute [r] created_at
|
|
118
|
+
|
|
119
|
+
# @return [Time]
|
|
120
|
+
|
|
121
|
+
# @!attribute [r] updated_at
|
|
122
|
+
|
|
123
|
+
# @return [Time]
|
|
124
|
+
|
|
125
|
+
# @!attribute [rw] last_login_at
|
|
126
|
+
|
|
127
|
+
# @return [Time]
|
|
128
|
+
|
|
129
|
+
# @!attribute [rw] role
|
|
130
|
+
|
|
131
|
+
# @return [Latitude::API::Objects::Role]
|
|
132
|
+
|
|
133
|
+
class Member < APIResource
|
|
134
|
+
|
|
135
|
+
attribute :first_name, :string
|
|
136
|
+
|
|
137
|
+
attribute :last_name, :string
|
|
138
|
+
|
|
139
|
+
attribute :email, :string
|
|
140
|
+
|
|
141
|
+
attribute :mfa_enabled, :boolean
|
|
142
|
+
|
|
143
|
+
attribute :created_at, :time, read_only: true
|
|
144
|
+
|
|
145
|
+
attribute :updated_at, :time, read_only: true
|
|
146
|
+
|
|
147
|
+
attribute :last_login_at, :time
|
|
148
|
+
|
|
149
|
+
attribute :role, Objects::Role
|
|
150
|
+
|
|
151
|
+
resource_type "memberships"
|
|
152
|
+
resource_path "/team/members"
|
|
153
|
+
id_prefix "user_"
|
|
154
|
+
|
|
155
|
+
extend Operations::List
|
|
156
|
+
extend Operations::Delete
|
|
157
|
+
|
|
158
|
+
class << self
|
|
159
|
+
def create(params = {}, opts = {})
|
|
160
|
+
body = JSONAPI.encode(type: "teams", attributes: params)
|
|
161
|
+
parsed = execute_request(method: :post, path: resource_path, body: body, opts: opts)
|
|
162
|
+
construct_from(parsed, opts: opts)
|
|
163
|
+
end
|
|
164
|
+
end
|
|
165
|
+
end
|
|
166
|
+
end
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
end
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Latitude
|
|
4
|
+
module API
|
|
5
|
+
module Resources
|
|
6
|
+
# @!attribute [rw] from_date
|
|
7
|
+
# @return [Integer]
|
|
8
|
+
# @!attribute [rw] to_date
|
|
9
|
+
# @return [Integer]
|
|
10
|
+
# @!attribute [rw] total_inbound_gb
|
|
11
|
+
# @return [Integer]
|
|
12
|
+
# @!attribute [rw] total_outbound_gb
|
|
13
|
+
# @return [Integer]
|
|
14
|
+
# @!attribute [rw] total_inbound_95th_percentile_mbps
|
|
15
|
+
# @return [Float]
|
|
16
|
+
# @!attribute [rw] total_outbound_95th_percentile_mbps
|
|
17
|
+
# @return [Float]
|
|
18
|
+
# @!attribute [rw] regions
|
|
19
|
+
# @return [Array<Region>]
|
|
20
|
+
class Traffic < SingletonAPIResource
|
|
21
|
+
# @!attribute [r] date
|
|
22
|
+
# @return [Time]
|
|
23
|
+
# @!attribute [r] inbound_gb
|
|
24
|
+
# @return [Integer]
|
|
25
|
+
# @!attribute [r] outbound_gb
|
|
26
|
+
# @return [Integer]
|
|
27
|
+
# @!attribute [r] avg_outbound_speed_mbps
|
|
28
|
+
# @return [Float]
|
|
29
|
+
# @!attribute [r] avg_inbound_speed_mbps
|
|
30
|
+
# @return [Float]
|
|
31
|
+
class Data < APIObject
|
|
32
|
+
attribute :date, :time, read_only: true
|
|
33
|
+
attribute :inbound_gb, :integer, read_only: true
|
|
34
|
+
attribute :outbound_gb, :integer, read_only: true
|
|
35
|
+
attribute :avg_outbound_speed_mbps, :float, read_only: true
|
|
36
|
+
attribute :avg_inbound_speed_mbps, :float, read_only: true
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# @!attribute [r] region_slug
|
|
40
|
+
# @return [String]
|
|
41
|
+
# @!attribute [r] total_inbound_gb
|
|
42
|
+
# @return [Integer]
|
|
43
|
+
# @!attribute [r] total_outbound_gb
|
|
44
|
+
# @return [Integer]
|
|
45
|
+
# @!attribute [r] total_inbound_95th_percentile_mbps
|
|
46
|
+
# @return [Float]
|
|
47
|
+
# @!attribute [r] total_outbound_95th_percentile_mbps
|
|
48
|
+
# @return [Float]
|
|
49
|
+
# @!attribute [r] data
|
|
50
|
+
# @return [Array<Data>]
|
|
51
|
+
class Region < APIObject
|
|
52
|
+
attribute :region_slug, :string, read_only: true
|
|
53
|
+
attribute :total_inbound_gb, :integer, read_only: true
|
|
54
|
+
attribute :total_outbound_gb, :integer, read_only: true
|
|
55
|
+
attribute :total_inbound_95th_percentile_mbps, :float, read_only: true
|
|
56
|
+
attribute :total_outbound_95th_percentile_mbps, :float, read_only: true
|
|
57
|
+
attribute :data, [Data], read_only: true
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
attribute :from_date, :integer
|
|
61
|
+
attribute :to_date, :integer
|
|
62
|
+
attribute :total_inbound_gb, :integer
|
|
63
|
+
attribute :total_outbound_gb, :integer
|
|
64
|
+
attribute :total_inbound_95th_percentile_mbps, :float
|
|
65
|
+
attribute :total_outbound_95th_percentile_mbps, :float
|
|
66
|
+
attribute :regions, [Region]
|
|
67
|
+
|
|
68
|
+
resource_type "traffic"
|
|
69
|
+
resource_path "/traffic"
|
|
70
|
+
|
|
71
|
+
class << self
|
|
72
|
+
def retrieve(params = {}, opts = {})
|
|
73
|
+
query = RequestParams.encode(params)
|
|
74
|
+
parsed = execute_request(method: :get, path: resource_path, query: query, opts: opts)
|
|
75
|
+
construct_from(parsed, opts: opts)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def quota(opts = {})
|
|
79
|
+
parsed = execute_request(method: :get, path: "#{resource_path}/quota", opts: opts)
|
|
80
|
+
Quota.construct_from(parsed, opts: opts)
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# @!attribute [rw] quota_per_project
|
|
85
|
+
|
|
86
|
+
# @return [Array<QuotaPerProject>]
|
|
87
|
+
|
|
88
|
+
class Quota < SingletonAPIResource
|
|
89
|
+
|
|
90
|
+
# @!attribute [r] granted
|
|
91
|
+
|
|
92
|
+
# @return [Integer]
|
|
93
|
+
|
|
94
|
+
# @!attribute [r] additional
|
|
95
|
+
|
|
96
|
+
# @return [Integer]
|
|
97
|
+
|
|
98
|
+
# @!attribute [r] total
|
|
99
|
+
|
|
100
|
+
# @return [Integer]
|
|
101
|
+
|
|
102
|
+
class QuotaInTb < APIObject
|
|
103
|
+
|
|
104
|
+
attribute :granted, :integer, read_only: true
|
|
105
|
+
|
|
106
|
+
attribute :additional, :integer, read_only: true
|
|
107
|
+
|
|
108
|
+
attribute :total, :integer, read_only: true
|
|
109
|
+
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
# @!attribute [r] granted
|
|
114
|
+
|
|
115
|
+
# @return [Integer]
|
|
116
|
+
|
|
117
|
+
# @!attribute [r] additional
|
|
118
|
+
|
|
119
|
+
# @return [Integer]
|
|
120
|
+
|
|
121
|
+
# @!attribute [r] total
|
|
122
|
+
|
|
123
|
+
# @return [Integer]
|
|
124
|
+
|
|
125
|
+
class QuotaInMbp < APIObject
|
|
126
|
+
|
|
127
|
+
attribute :granted, :integer, read_only: true
|
|
128
|
+
|
|
129
|
+
attribute :additional, :integer, read_only: true
|
|
130
|
+
|
|
131
|
+
attribute :total, :integer, read_only: true
|
|
132
|
+
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
# @!attribute [r] region_id
|
|
137
|
+
|
|
138
|
+
# @return [String]
|
|
139
|
+
|
|
140
|
+
# @!attribute [r] price
|
|
141
|
+
|
|
142
|
+
# @return [Integer]
|
|
143
|
+
|
|
144
|
+
# @!attribute [r] region_slug
|
|
145
|
+
|
|
146
|
+
# @return [String]
|
|
147
|
+
|
|
148
|
+
# @!attribute [r] quota_in_tb
|
|
149
|
+
|
|
150
|
+
# @return [QuotaInTb]
|
|
151
|
+
|
|
152
|
+
# @!attribute [r] quota_in_mbps
|
|
153
|
+
|
|
154
|
+
# @return [QuotaInMbp]
|
|
155
|
+
|
|
156
|
+
class QuotaPerRegion < APIObject
|
|
157
|
+
|
|
158
|
+
attribute :region_id, :string, read_only: true
|
|
159
|
+
|
|
160
|
+
attribute :price, :integer, read_only: true
|
|
161
|
+
|
|
162
|
+
attribute :region_slug, :string, read_only: true
|
|
163
|
+
|
|
164
|
+
attribute :quota_in_tb, QuotaInTb, read_only: true
|
|
165
|
+
|
|
166
|
+
attribute :quota_in_mbps, QuotaInMbp, read_only: true
|
|
167
|
+
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
# @!attribute [r] project_id
|
|
172
|
+
|
|
173
|
+
# @return [String]
|
|
174
|
+
|
|
175
|
+
# @!attribute [r] project_slug
|
|
176
|
+
|
|
177
|
+
# @return [String]
|
|
178
|
+
|
|
179
|
+
# @!attribute [r] billing_method
|
|
180
|
+
|
|
181
|
+
# @return [String]
|
|
182
|
+
|
|
183
|
+
# @!attribute [r] quota_per_region
|
|
184
|
+
|
|
185
|
+
# @return [Array<QuotaPerRegion>]
|
|
186
|
+
|
|
187
|
+
class QuotaPerProject < APIObject
|
|
188
|
+
|
|
189
|
+
attribute :project_id, :string, read_only: true
|
|
190
|
+
|
|
191
|
+
attribute :project_slug, :string, read_only: true
|
|
192
|
+
|
|
193
|
+
attribute :billing_method, :string, read_only: true
|
|
194
|
+
|
|
195
|
+
attribute :quota_per_region, [QuotaPerRegion], read_only: true
|
|
196
|
+
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
attribute :quota_per_project, [QuotaPerProject]
|
|
201
|
+
|
|
202
|
+
resource_type "traffic_quota"
|
|
203
|
+
resource_path "/traffic/quota"
|
|
204
|
+
|
|
205
|
+
class << self
|
|
206
|
+
def retrieve(opts = {})
|
|
207
|
+
parsed = execute_request(method: :get, path: resource_path, opts: opts)
|
|
208
|
+
construct_from(parsed, opts: opts)
|
|
209
|
+
end
|
|
210
|
+
end
|
|
211
|
+
end
|
|
212
|
+
end
|
|
213
|
+
end
|
|
214
|
+
end
|
|
215
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Latitude
|
|
4
|
+
module API
|
|
5
|
+
module Resources
|
|
6
|
+
# @!attribute [rw] description
|
|
7
|
+
# @return [String]
|
|
8
|
+
# @!attribute [rw] content
|
|
9
|
+
# @return [String]
|
|
10
|
+
# @!attribute [r] created_at
|
|
11
|
+
# @return [Time]
|
|
12
|
+
# @!attribute [r] updated_at
|
|
13
|
+
# @return [Time]
|
|
14
|
+
# @!attribute [rw] decoded_content
|
|
15
|
+
# @return [String]
|
|
16
|
+
# @!attribute [rw] project
|
|
17
|
+
# @return [Latitude::API::Objects::Project]
|
|
18
|
+
class UserData < APIResource
|
|
19
|
+
attribute :description, :string
|
|
20
|
+
attribute :content, :string
|
|
21
|
+
attribute :created_at, :time, read_only: true
|
|
22
|
+
attribute :updated_at, :time, read_only: true
|
|
23
|
+
attribute :decoded_content, :string
|
|
24
|
+
attribute :project, Objects::Project
|
|
25
|
+
|
|
26
|
+
resource_type "user_data"
|
|
27
|
+
resource_path "/user_data"
|
|
28
|
+
id_prefix "ud_"
|
|
29
|
+
|
|
30
|
+
extend Operations::List
|
|
31
|
+
extend Operations::Create
|
|
32
|
+
extend Operations::Retrieve
|
|
33
|
+
extend Operations::Update
|
|
34
|
+
extend Operations::Delete
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Latitude
|
|
4
|
+
module API
|
|
5
|
+
module Resources
|
|
6
|
+
# @!attribute [rw] first_name
|
|
7
|
+
# @return [String]
|
|
8
|
+
# @!attribute [rw] last_name
|
|
9
|
+
# @return [String]
|
|
10
|
+
# @!attribute [rw] email
|
|
11
|
+
# @return [String]
|
|
12
|
+
# @!attribute [rw] mfa_enabled
|
|
13
|
+
# @return [Boolean]
|
|
14
|
+
# @!attribute [r] created_at
|
|
15
|
+
# @return [Time]
|
|
16
|
+
# @!attribute [r] updated_at
|
|
17
|
+
# @return [Time]
|
|
18
|
+
# @!attribute [rw] last_login_at
|
|
19
|
+
# @return [Time]
|
|
20
|
+
# @!attribute [rw] role
|
|
21
|
+
# @return [Latitude::API::Objects::Role]
|
|
22
|
+
class UserProfile < SingletonAPIResource
|
|
23
|
+
attribute :first_name, :string
|
|
24
|
+
attribute :last_name, :string
|
|
25
|
+
attribute :email, :string
|
|
26
|
+
attribute :mfa_enabled, :boolean
|
|
27
|
+
attribute :created_at, :time, read_only: true
|
|
28
|
+
attribute :updated_at, :time, read_only: true
|
|
29
|
+
attribute :last_login_at, :time
|
|
30
|
+
attribute :role, Objects::Role
|
|
31
|
+
|
|
32
|
+
resource_type "users"
|
|
33
|
+
resource_path "/user/profile"
|
|
34
|
+
|
|
35
|
+
class << self
|
|
36
|
+
def retrieve(opts = {})
|
|
37
|
+
parsed = execute_request(method: :get, path: resource_path, opts: opts)
|
|
38
|
+
construct_from(parsed, opts: opts)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def update(id, params = {}, opts = {})
|
|
42
|
+
body = JSONAPI.encode(type: resource_type, id: id, attributes: params)
|
|
43
|
+
parsed = execute_request(method: :patch, path: "#{resource_path}/#{URI.encode_www_form_component(id)}",
|
|
44
|
+
body: body, opts: opts)
|
|
45
|
+
construct_from(parsed, opts: opts)
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Latitude
|
|
4
|
+
module API
|
|
5
|
+
module Resources
|
|
6
|
+
# @!attribute [rw] name
|
|
7
|
+
# @return [String]
|
|
8
|
+
# @!attribute [rw] slug
|
|
9
|
+
# @return [String]
|
|
10
|
+
# @!attribute [rw] address
|
|
11
|
+
# @return [String]
|
|
12
|
+
# @!attribute [rw] currency
|
|
13
|
+
# @return [String]
|
|
14
|
+
# @!attribute [rw] enforce_mfa
|
|
15
|
+
# @return [Boolean]
|
|
16
|
+
# @!attribute [rw] referred_code
|
|
17
|
+
# @return [String]
|
|
18
|
+
# @!attribute [r] created_at
|
|
19
|
+
# @return [Time]
|
|
20
|
+
# @!attribute [r] updated_at
|
|
21
|
+
# @return [Time]
|
|
22
|
+
# @!attribute [rw] status
|
|
23
|
+
# @return [String]
|
|
24
|
+
# @!attribute [rw] users
|
|
25
|
+
# @return [Array<User>]
|
|
26
|
+
# @!attribute [rw] projects
|
|
27
|
+
# @return [Array]
|
|
28
|
+
# @!attribute [rw] owner
|
|
29
|
+
# @return [Latitude::API::Objects::User]
|
|
30
|
+
# @!attribute [rw] billing
|
|
31
|
+
# @return [Latitude::API::Objects::Billing]
|
|
32
|
+
# @!attribute [rw] feature_flags
|
|
33
|
+
# @return [Array]
|
|
34
|
+
# @!attribute [rw] limits
|
|
35
|
+
# @return [Latitude::API::Objects::Limits]
|
|
36
|
+
# @!attribute [rw] token
|
|
37
|
+
# @return [String]
|
|
38
|
+
# @!attribute [rw] customer_billing_id
|
|
39
|
+
# @return [String]
|
|
40
|
+
class UserTeam < APIResource
|
|
41
|
+
# @!attribute [r] id
|
|
42
|
+
# @return [String]
|
|
43
|
+
# @!attribute [r] first_name
|
|
44
|
+
# @return [String]
|
|
45
|
+
# @!attribute [r] last_name
|
|
46
|
+
# @return [String]
|
|
47
|
+
# @!attribute [r] email
|
|
48
|
+
# @return [String]
|
|
49
|
+
# @!attribute [r] created_at
|
|
50
|
+
# @return [Time]
|
|
51
|
+
# @!attribute [r] updated_at
|
|
52
|
+
# @return [Time]
|
|
53
|
+
# @!attribute [r] role
|
|
54
|
+
# @return [Latitude::API::Objects::Role]
|
|
55
|
+
class User < APIObject
|
|
56
|
+
attribute :id, :string, read_only: true
|
|
57
|
+
attribute :first_name, :string, read_only: true
|
|
58
|
+
attribute :last_name, :string, read_only: true
|
|
59
|
+
attribute :email, :string, read_only: true
|
|
60
|
+
attribute :created_at, :time, read_only: true
|
|
61
|
+
attribute :updated_at, :time, read_only: true
|
|
62
|
+
attribute :role, Objects::Role, read_only: true
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
attribute :name, :string
|
|
66
|
+
attribute :slug, :string
|
|
67
|
+
attribute :address, :string
|
|
68
|
+
attribute :currency, :string
|
|
69
|
+
attribute :enforce_mfa, :boolean
|
|
70
|
+
attribute :referred_code, :string
|
|
71
|
+
attribute :created_at, :time, read_only: true
|
|
72
|
+
attribute :updated_at, :time, read_only: true
|
|
73
|
+
attribute :status, :string
|
|
74
|
+
attribute :users, [User]
|
|
75
|
+
attribute :projects, :array
|
|
76
|
+
attribute :owner, Objects::User
|
|
77
|
+
attribute :billing, Objects::Billing
|
|
78
|
+
attribute :feature_flags, :array
|
|
79
|
+
attribute :limits, Objects::Limits
|
|
80
|
+
attribute :token, :string
|
|
81
|
+
attribute :customer_billing_id, :string
|
|
82
|
+
|
|
83
|
+
resource_type "teams"
|
|
84
|
+
resource_path "/user/teams"
|
|
85
|
+
|
|
86
|
+
extend Operations::List
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|