droplet_kit 3.20.0 → 3.22.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.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +77 -0
  3. data/lib/droplet_kit/client.rb +6 -1
  4. data/lib/droplet_kit/mappings/app_mapping.rb +121 -0
  5. data/lib/droplet_kit/mappings/app_spec_mapping.rb +549 -0
  6. data/lib/droplet_kit/mappings/database_connection_pool_mapping.rb +4 -4
  7. data/lib/droplet_kit/mappings/database_kafka_config_mapping.rb +56 -0
  8. data/lib/droplet_kit/mappings/database_metrics_credentials_mapping.rb +15 -0
  9. data/lib/droplet_kit/mappings/database_mongo_config_mapping.rb +22 -0
  10. data/lib/droplet_kit/mappings/database_mysql_config_mapping.rb +50 -0
  11. data/lib/droplet_kit/mappings/database_opensearch_config_mapping.rb +55 -0
  12. data/lib/droplet_kit/mappings/database_postgres_config_mapping.rb +97 -0
  13. data/lib/droplet_kit/mappings/database_redis_config_mapping.rb +28 -0
  14. data/lib/droplet_kit/mappings/deployment_mapping.rb +136 -0
  15. data/lib/droplet_kit/mappings/one_click_kubernetes_mapping.rb +16 -0
  16. data/lib/droplet_kit/mappings/one_click_mapping.rb +17 -0
  17. data/lib/droplet_kit/mappings/reserved_ipv6_mapping.rb +17 -0
  18. data/lib/droplet_kit/mappings/vpc_peering_mapping.rb +29 -0
  19. data/lib/droplet_kit/models/app.rb +70 -0
  20. data/lib/droplet_kit/models/app_spec.rb +290 -0
  21. data/lib/droplet_kit/models/database_kafka_config.rb +47 -0
  22. data/lib/droplet_kit/models/database_metrics_credentials.rb +8 -0
  23. data/lib/droplet_kit/models/database_mongo_config.rb +13 -0
  24. data/lib/droplet_kit/models/database_mysql_config.rb +41 -0
  25. data/lib/droplet_kit/models/database_opensearch_config.rb +46 -0
  26. data/lib/droplet_kit/models/database_postgres_config.rb +76 -0
  27. data/lib/droplet_kit/models/database_redis_config.rb +19 -0
  28. data/lib/droplet_kit/models/deployment.rb +73 -0
  29. data/lib/droplet_kit/models/one_click.rb +8 -0
  30. data/lib/droplet_kit/models/one_click_kubernetes.rb +8 -0
  31. data/lib/droplet_kit/models/reserved_ipv6.rb +19 -0
  32. data/lib/droplet_kit/models/vpc_peering.rb +11 -0
  33. data/lib/droplet_kit/resources/app_resource.rb +36 -0
  34. data/lib/droplet_kit/resources/database_resource.rb +36 -0
  35. data/lib/droplet_kit/resources/droplet_action_resource.rb +1 -1
  36. data/lib/droplet_kit/resources/one_click_resource.rb +23 -0
  37. data/lib/droplet_kit/resources/reserved_ipv6_action_resource.rb +20 -0
  38. data/lib/droplet_kit/resources/reserved_ipv6_resource.rb +33 -0
  39. data/lib/droplet_kit/resources/vpc_peering_resource.rb +43 -0
  40. data/lib/droplet_kit/version.rb +1 -1
  41. data/lib/droplet_kit.rb +137 -0
  42. metadata +52 -5
@@ -0,0 +1,290 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DropletKit
4
+ class AppDomainSpec < BaseModel
5
+ attribute :domain
6
+ attribute :type
7
+ attribute :wildcard
8
+ attribute :zone
9
+ attribute :minimum_tls_version
10
+ end
11
+
12
+ class AppGitSourceSpec < BaseModel
13
+ attribute :branch
14
+ attribute :repo_clone_url
15
+ end
16
+
17
+ class AppGitHubSourceSpec < BaseModel
18
+ attribute :branch
19
+ attribute :deploy_on_push
20
+ attribute :repo
21
+ end
22
+
23
+ class AppGitLabSourceSpec < BaseModel
24
+ attribute :branch
25
+ attribute :deploy_on_push
26
+ attribute :repo
27
+ end
28
+
29
+ class AppImageDeployOnPush < BaseModel
30
+ attribute :enabled
31
+ end
32
+
33
+ class AppImageSourceSpec < BaseModel
34
+ attribute :registry
35
+ attribute :registry_type
36
+ attribute :registry_credentials
37
+ attribute :repository
38
+ attribute :tag
39
+ attribute :digest
40
+ attribute :deploy_on_push, AppImageDeployOnPush
41
+ end
42
+
43
+ class AppVariableDefinition < BaseModel
44
+ attribute :key
45
+ attribute :scope
46
+ attribute :type
47
+ attribute :value
48
+ end
49
+
50
+ class AppLogDestinationSpecPapertrail < BaseModel
51
+ attribute :endpoint
52
+ end
53
+
54
+ class AppLogDestinationSpecDatadog < BaseModel
55
+ attribute :endpoint
56
+ attribute :api_key
57
+ end
58
+
59
+ class AppLogDestinationSpecLogtail < BaseModel
60
+ attribute :token
61
+ end
62
+
63
+ class OpenSearchBasicAuth < BaseModel
64
+ attribute :username
65
+ attribute :password
66
+ end
67
+
68
+ class AppLogDestinationSpecOpenSearch < BaseModel
69
+ attribute :endpoint
70
+ attribute :basic_auth, OpenSearchBasicAuth
71
+ attribute :index_name
72
+ attribute :cluster_name
73
+ end
74
+
75
+ class AppLogDestinationSpec < BaseModel
76
+ attribute :name
77
+ attribute :papertrail, AppLogDestinationSpecPapertrail
78
+ attribute :datadog, AppLogDestinationSpecDatadog
79
+ attribute :logtail, AppLogDestinationSpecLogtail
80
+ attribute :open_search, AppLogDestinationSpecOpenSearch
81
+ end
82
+
83
+ class AppAutoscalingSpecMetricCPU < BaseModel
84
+ attribute :percent
85
+ end
86
+
87
+ class AppAutoscalingSpecMetrics < BaseModel
88
+ attribute :cpu, AppAutoscalingSpecMetricCPU
89
+ end
90
+
91
+ class AppAutoscalingSpec < BaseModel
92
+ attribute :min_instance_count
93
+ attribute :max_instance_count
94
+ attribute :metrics, AppAutoscalingSpecMetrics
95
+ end
96
+
97
+ class AppServiceSpecHealthCheck < BaseModel
98
+ attribute :failure_threshold
99
+ attribute :port
100
+ attribute :http_path
101
+ attribute :initial_delay_seconds
102
+ attribute :period_seconds
103
+ attribute :success_threshold
104
+ attribute :timeout_seconds
105
+ end
106
+
107
+ class AppServiceSpecTermination < BaseModel
108
+ attribute :drain_seconds
109
+ attribute :grace_period_seconds
110
+ end
111
+
112
+ class AppServiceSpec < BaseModel
113
+ attribute :name
114
+ attribute :git, AppGitSourceSpec
115
+ attribute :github, AppGitHubSourceSpec
116
+ attribute :gitlab, AppGitLabSourceSpec
117
+ attribute :image, AppImageSourceSpec
118
+ attribute :dockerfile_path
119
+ attribute :build_command
120
+ attribute :run_command
121
+ attribute :source_dir
122
+ attribute :envs, [AppVariableDefinition]
123
+ attribute :environment_slug
124
+ attribute :log_destinations, [AppLogDestinationSpec]
125
+ attribute :instance_count
126
+ attribute :instance_size_slug
127
+ attribute :autoscaling, AppAutoscalingSpec
128
+ attribute :health_check, AppServiceSpecHealthCheck
129
+ attribute :http_port
130
+ attribute :internal_ports
131
+ attribute :termination, AppServiceSpecTermination
132
+ end
133
+
134
+ class AppStaticSiteSpec < BaseModel
135
+ attribute :name
136
+ attribute :git, AppGitSourceSpec
137
+ attribute :github, AppGitHubSourceSpec
138
+ attribute :gitlab, AppGitLabSourceSpec
139
+ attribute :image, AppImageSourceSpec
140
+ attribute :dockerfile_path
141
+ attribute :build_command
142
+ attribute :run_command
143
+ attribute :source_dir
144
+ attribute :envs, [AppVariableDefinition]
145
+ attribute :environment_slug
146
+ attribute :log_destinations, [AppLogDestinationSpec]
147
+ attribute :index_document
148
+ attribute :error_document
149
+ attribute :catchall_document
150
+ attribute :output_dir
151
+ end
152
+
153
+ class AppJobSpecTermination < BaseModel
154
+ attribute :grace_period_seconds
155
+ end
156
+
157
+ class AppJobSpec < BaseModel
158
+ attribute :name
159
+ attribute :git, AppGitSourceSpec
160
+ attribute :github, AppGitHubSourceSpec
161
+ attribute :gitlab, AppGitLabSourceSpec
162
+ attribute :image, AppImageSourceSpec
163
+ attribute :dockerfile_path
164
+ attribute :build_command
165
+ attribute :run_command
166
+ attribute :source_dir
167
+ attribute :envs, [AppVariableDefinition]
168
+ attribute :environment_slug
169
+ attribute :log_destinations, [AppLogDestinationSpec]
170
+ attribute :instance_count
171
+ attribute :instance_size_slug
172
+ attribute :autoscaling, AppAutoscalingSpec
173
+ attribute :kind
174
+ attribute :termination, AppJobSpecTermination
175
+ end
176
+
177
+ class AppWorkerSpecTermination < BaseModel
178
+ attribute :grace_period_seconds
179
+ end
180
+
181
+ class AppWorkerSpec < BaseModel
182
+ attribute :name
183
+ attribute :git, AppGitSourceSpec
184
+ attribute :github, AppGitHubSourceSpec
185
+ attribute :gitlab, AppGitLabSourceSpec
186
+ attribute :image, AppImageSourceSpec
187
+ attribute :dockerfile_path
188
+ attribute :build_command
189
+ attribute :run_command
190
+ attribute :source_dir
191
+ attribute :envs, [AppVariableDefinition]
192
+ attribute :environment_slug
193
+ attribute :log_destinations, [AppLogDestinationSpec]
194
+ attribute :instance_count
195
+ attribute :instance_size_slug
196
+ attribute :autoscaling, AppAutoscalingSpec
197
+ attribute :termination, AppWorkerSpecTermination
198
+ end
199
+
200
+ class AppAlertSpec < BaseModel
201
+ attribute :rule
202
+ attribute :disabled
203
+ attribute :operator
204
+ attribute :value
205
+ attribute :window
206
+ end
207
+
208
+ class AppFunctionSpec < BaseModel
209
+ attribute :name
210
+ attribute :source_dir
211
+ attribute :alerts, [AppAlertSpec]
212
+ attribute :envs, [AppVariableDefinition]
213
+ attribute :log_destinations, [AppLogDestinationSpec]
214
+ end
215
+
216
+ class AppDatabaseSpec < BaseModel
217
+ attribute :cluster_name
218
+ attribute :db_name
219
+ attribute :db_user
220
+ attribute :engine
221
+ attribute :name
222
+ attribute :production
223
+ attribute :version
224
+ end
225
+
226
+ class AppIngressSpecRuleStringMatch < BaseModel
227
+ attribute :prefix
228
+ end
229
+
230
+ class AppIngressSpecRuleMatch < BaseModel
231
+ attribute :path, AppIngressSpecRuleStringMatch
232
+ end
233
+
234
+ class AppStringMatch < BaseModel
235
+ attribute :exact
236
+ attribute :regex
237
+ end
238
+
239
+ class AppCorsPolicy < BaseModel
240
+ attribute :allow_origins, [AppStringMatch]
241
+ attribute :allow_methods
242
+ attribute :allow_headers
243
+ attribute :expose_headers
244
+ attribute :max_age
245
+ attribute :allow_credentials
246
+ end
247
+
248
+ class AppIngressSpecRuleRoutingComponent < BaseModel
249
+ attribute :name
250
+ attribute :preserve_path_prefix
251
+ attribute :rewrite
252
+ end
253
+
254
+ class AppIngressSpecRuleRoutingRedirect < BaseModel
255
+ attribute :uri
256
+ attribute :authority
257
+ attribute :port
258
+ attribute :scheme
259
+ attribute :redirect_code
260
+ end
261
+
262
+ class AppIngressSpecRule < BaseModel
263
+ attribute :match, AppIngressSpecRuleMatch
264
+ attribute :cors, AppCorsPolicy
265
+ attribute :component, AppIngressSpecRuleRoutingComponent
266
+ attribute :redirect, AppIngressSpecRuleRoutingRedirect
267
+ end
268
+
269
+ class AppIngressSpec < BaseModel
270
+ attribute :rules, [AppIngressSpecRule]
271
+ end
272
+
273
+ class AppEgressSpec < BaseModel
274
+ attribute :type
275
+ end
276
+
277
+ class AppSpec < BaseModel
278
+ attribute :name
279
+ attribute :region
280
+ attribute :domains, [AppDomainSpec]
281
+ attribute :services, [AppServiceSpec]
282
+ attribute :static_sites, [AppStaticSiteSpec]
283
+ attribute :jobs, [AppJobSpec]
284
+ attribute :workers, [AppWorkerSpec]
285
+ attribute :functions, [AppFunctionSpec]
286
+ attribute :databases, [AppDatabaseSpec]
287
+ attribute :ingress, AppIngressSpec
288
+ attribute :egress, AppEgressSpec
289
+ end
290
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DropletKit
4
+ class DatabaseKafkaConfig < BaseModel
5
+ %i[compression_type
6
+ group_initial_rebalance_delay_ms
7
+ group_min_session_timeout_ms
8
+ group_max_session_timeout_ms
9
+ connections_max_idle_ms
10
+ max_incremental_fetch_session_cache_slots
11
+ message_max_bytes
12
+ offsets_retention_minutes
13
+ log_cleaner_delete_retention_ms
14
+ log_cleaner_min_cleanable_ratio
15
+ log_cleaner_max_compaction_lag_ms
16
+ log_cleaner_min_compaction_lag_ms
17
+ log_cleanup_policy
18
+ log_flush_interval_messages
19
+ log_flush_interval_ms
20
+ log_index_interval_bytes
21
+ log_index_size_max_bytes
22
+ log_message_downconversion_enable
23
+ log_message_timestamp_type
24
+ log_message_timestamp_difference_max_ms
25
+ log_preallocate
26
+ log_retention_bytes
27
+ log_retention_hours
28
+ log_retention_ms
29
+ log_roll_jitter_ms
30
+ log_roll_ms
31
+ log_segment_bytes
32
+ log_segment_delete_delay_ms
33
+ auto_create_topics_enable
34
+ min_insync_replicas
35
+ num_partitions
36
+ default_replication_factor
37
+ replica_fetch_max_bytes
38
+ replica_fetch_response_max_bytes
39
+ max_connections_per_ip
40
+ producer_purgatory_purge_interval_requests
41
+ socket_request_max_bytes
42
+ transaction_state_log_segment_bytes
43
+ transaction_remove_expired_transaction_cleanup_interval_ms].each do |key|
44
+ attribute(key)
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DropletKit
4
+ class DatabaseMetricsCredentials < BaseModel
5
+ attribute :basic_auth_username
6
+ attribute :basic_auth_password
7
+ end
8
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DropletKit
4
+ class DatabaseMongoConfig < BaseModel
5
+ %i[default_read_concern
6
+ default_write_concern
7
+ transaction_lifetime_limit_seconds
8
+ slow_op_threshold_ms
9
+ verbosity].each do |key|
10
+ attribute(key)
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DropletKit
4
+ class DatabaseMysqlConfig < BaseModel
5
+ %i[backup_hour
6
+ backup_minute
7
+ sql_mode
8
+ connect_timeout
9
+ default_time_zone
10
+ group_concat_max_len
11
+ information_schema_stats_expiry
12
+ innodb_ft_min_token_size
13
+ innodb_ft_server_stopword_table
14
+ innodb_lock_wait_timeout
15
+ innodb_log_buffer_size
16
+ innodb_online_alter_log_max_size
17
+ innodb_print_all_deadlocks
18
+ innodb_rollback_on_timeout
19
+ interactive_timeout
20
+ internal_tmp_mem_storage_engine
21
+ net_read_timeout
22
+ net_write_timeout
23
+ sql_require_primary_key
24
+ wait_timeout
25
+ max_allowed_packet
26
+ max_heap_table_size
27
+ sort_buffer_size
28
+ tmp_table_size
29
+ slow_query_log
30
+ long_query_time
31
+ binlog_retention_period
32
+ innodb_change_buffer_max_size
33
+ innodb_flush_neighbors
34
+ innodb_read_io_threads
35
+ innodb_write_io_threads
36
+ innodb_thread_concurrency
37
+ net_buffer_length].each do |key|
38
+ attribute(key)
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DropletKit
4
+ class DatabaseOpensearchConfig < BaseModel
5
+ %i[http_max_content_length_bytes
6
+ http_max_header_size_bytes
7
+ http_max_initial_line_length_bytes
8
+ indices_query_bool_max_clause_count
9
+ indices_fielddata_cache_size_percentage
10
+ indices_memory_index_buffer_size_percentage
11
+ indices_memory_min_index_buffer_size_mb
12
+ indices_memory_max_index_buffer_size_mb
13
+ indices_queries_cache_size_percentage
14
+ indices_recovery_max_mb_per_sec
15
+ indices_recovery_max_concurrent_file_chunks
16
+ thread_pool_search_size
17
+ thread_pool_search_throttled_size
18
+ thread_pool_get_size
19
+ thread_pool_analyze_size
20
+ thread_pool_write_size
21
+ thread_pool_force_merge_size
22
+ thread_pool_search_queue_size
23
+ thread_pool_search_throttled_queue_size
24
+ thread_pool_get_queue_size
25
+ thread_pool_analyze_queue_size
26
+ thread_pool_write_queue_size
27
+ ism_enabled
28
+ ism_history_enabled
29
+ ism_history_max_age_hours
30
+ ism_history_max_docs
31
+ ism_history_rollover_check_period_hours
32
+ ism_history_rollover_retention_period_days
33
+ search_max_buckets
34
+ action_auto_create_index_enabled
35
+ enable_security_audit
36
+ action_destructive_requires_name
37
+ cluster_max_shards_per_node
38
+ override_main_response_version
39
+ script_max_compilations_rate
40
+ cluster_routing_allocation_node_concurrent_recoveries
41
+ reindex_remote_whitelist
42
+ plugins_alerting_filter_by_backend_roles_enabled].each do |key|
43
+ attribute(key)
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,76 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DropletKit
4
+ class DatabasePostgresTimescaledbConfig < BaseModel
5
+ attribute :max_background_workers
6
+ end
7
+
8
+ class DatabasePostgresPgbouncerConfig < BaseModel
9
+ attribute :server_reset_query_always
10
+ attribute :ignore_startup_parameters
11
+ attribute :min_pool_size
12
+ attribute :server_lifetime
13
+ attribute :server_idle_timeout
14
+ attribute :autodb_pool_size
15
+ attribute :autodb_pool_mode
16
+ attribute :autodb_max_db_connections
17
+ attribute :autodb_idle_timeout
18
+ end
19
+
20
+ class DatabasePostgresConfig < BaseModel
21
+ %i[autovacuum_freeze_max_age
22
+ autovacuum_max_workers
23
+ autovacuum_naptime
24
+ autovacuum_vacuum_threshold
25
+ autovacuum_analyze_threshold
26
+ autovacuum_vacuum_scale_factor
27
+ autovacuum_analyze_scale_factor
28
+ autovacuum_vacuum_cost_delay
29
+ autovacuum_vacuum_cost_limit
30
+ bgwriter_delay
31
+ bgwriter_flush_after
32
+ bgwriter_lru_maxpages
33
+ bgwriter_lru_multiplier
34
+ deadlock_timeout
35
+ default_toast_compression
36
+ idle_in_transaction_session_timeout
37
+ jit
38
+ log_autovacuum_min_duration
39
+ log_error_verbosity
40
+ log_line_prefix
41
+ log_min_duration_statement
42
+ max_files_per_process
43
+ max_prepared_transactions
44
+ max_pred_locks_per_transaction
45
+ max_locks_per_transaction
46
+ max_stack_depth
47
+ max_standby_archive_delay
48
+ max_standby_streaming_delay
49
+ max_replication_slots
50
+ max_logical_replication_workers
51
+ max_parallel_workers
52
+ max_parallel_workers_per_gather
53
+ max_worker_processes
54
+ pg_partman_bgw_role
55
+ pg_partman_bgw_interval
56
+ pg_stat_statements_track
57
+ temp_file_limit
58
+ timezone
59
+ track_activity_query_size
60
+ track_commit_timestamp
61
+ track_functions
62
+ track_io_timing
63
+ max_wal_senders
64
+ wal_sender_timeout
65
+ wal_writer_delay
66
+ shared_buffers_percentage
67
+ backup_hour
68
+ backup_minute
69
+ work_mem].each do |key|
70
+ attribute(key)
71
+ end
72
+
73
+ attribute :timescaledb, DatabasePostgresTimescaledbConfig
74
+ attribute :pgbouncer, DatabasePostgresPgbouncerConfig
75
+ end
76
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DropletKit
4
+ class DatabaseRedisConfig < BaseModel
5
+ %i[redis_maxmemory_policy
6
+ redis_pubsub_client_output_buffer_limit
7
+ redis_number_of_databases
8
+ redis_io_threads
9
+ redis_lfu_log_factor
10
+ redis_lfu_decay_time
11
+ redis_ssl
12
+ redis_timeout
13
+ redis_notify_keyspace_events
14
+ redis_persistence
15
+ redis_acl_channels_default].each do |key|
16
+ attribute(key)
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,73 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DropletKit
4
+ class DeploymentJob < BaseModel
5
+ attribute :name
6
+ attribute :source_commit_hash
7
+ end
8
+
9
+ class DeploymentFunction < BaseModel
10
+ attribute :name
11
+ attribute :source_commit_hash
12
+ attribute :namespace
13
+ end
14
+
15
+ class DeploymentProgressStepReason < BaseModel
16
+ attribute :code
17
+ attribute :message
18
+ end
19
+
20
+ class DeploymentProgressStep < BaseModel
21
+ attribute :component_name
22
+ attribute :ended_at
23
+ attribute :message_base
24
+ attribute :name
25
+ attribute :reason, DeploymentProgressStepReason
26
+ attribute :started_at
27
+ attribute :status
28
+ attribute :steps
29
+ end
30
+
31
+ class DeploymentProgress < BaseModel
32
+ attribute :error_steps
33
+ attribute :pending_steps
34
+ attribute :running_steps
35
+ attribute :steps, [DeploymentProgressStep]
36
+ attribute :success_steps
37
+ attribute :summary_steps, [DeploymentProgressStep]
38
+ attribute :total_steps
39
+ end
40
+
41
+ class DeploymentService < BaseModel
42
+ attribute :name
43
+ attribute :source_commit_hash
44
+ end
45
+
46
+ class DeploymentStaticSite < BaseModel
47
+ attribute :name
48
+ attribute :source_commit_hash
49
+ end
50
+
51
+ class DeploymentWorker < BaseModel
52
+ attribute :name
53
+ attribute :source_commit_hash
54
+ end
55
+
56
+ class Deployment < BaseModel
57
+ attribute :cause
58
+ attribute :cloned_from
59
+ attribute :created_at
60
+ attribute :id
61
+ attribute :jobs, [DeploymentJob]
62
+ attribute :functions, [DeploymentFunction]
63
+ attribute :phase
64
+ attribute :phase_last_updated_at
65
+ attribute :progress, DeploymentProgress
66
+ attribute :services, [DeploymentService]
67
+ attribute :spec, AppSpec
68
+ attribute :static_sites, [DeploymentStaticSite]
69
+ attribute :tier_slug
70
+ attribute :updated_at
71
+ attribute :workers, [DeploymentWorker]
72
+ end
73
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DropletKit
4
+ class OneClick < BaseModel
5
+ attribute :slug
6
+ attribute :type
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DropletKit
4
+ class OneClickKubernetes < BaseModel
5
+ attribute :addon_slugs
6
+ attribute :cluster_uuid
7
+ end
8
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DropletKit
4
+ class ReservedIpv6 < BaseModel
5
+ attribute :ip
6
+ attribute :droplet
7
+ attribute :reserved_at
8
+ # Used for creates
9
+ attribute :region_slug
10
+
11
+ def identifier
12
+ ip
13
+ end
14
+
15
+ def self.from_identifier(identifier)
16
+ new(ip: identifier)
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DropletKit
4
+ class VPCPeering < BaseModel
5
+ attribute :id
6
+ attribute :name
7
+ attribute :vpc_ids
8
+ attribute :created_at
9
+ attribute :status
10
+ end
11
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DropletKit
4
+ class AppResource < ResourceKit::Resource
5
+ include ErrorHandlingResourcable
6
+
7
+ resources do
8
+ action :all, 'GET /v2/apps' do
9
+ query_keys :per_page, :page, :with_projects
10
+ handler(200) { |response| AppMapping.extract_collection(response.body, :read) }
11
+ end
12
+
13
+ action :find, 'GET /v2/apps/:id' do
14
+ handler(200) { |response| AppMapping.extract_single(response.body, :read) }
15
+ end
16
+
17
+ action :create, 'POST /v2/apps' do
18
+ body { |app| AppMapping.representation_for(:create, app) }
19
+ handler(200) { |response| AppMapping.extract_single(response.body, :read) }
20
+ end
21
+
22
+ action :update, 'PUT /v2/apps/:id' do
23
+ body { |app| AppMapping.representation_for(:update, app) }
24
+ handler(200) { |response| AppMapping.extract_single(response.body, :read) }
25
+ end
26
+
27
+ action :delete, 'DELETE /v2/apps/:id' do
28
+ handler(200) { |response| response.body }
29
+ end
30
+ end
31
+
32
+ def all(*args)
33
+ PaginatedResource.new(action(:all), self, *args)
34
+ end
35
+ end
36
+ end