Skip to content

Commit

Permalink
Merge branch 'main' into add-one-clicks-resource
Browse files Browse the repository at this point in the history
  • Loading branch information
caiohsramos authored Oct 8, 2024
2 parents 4a0cb92 + 37a3b1d commit 7c7fdce
Show file tree
Hide file tree
Showing 23 changed files with 917 additions and 10 deletions.
20 changes: 10 additions & 10 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Lint/UnderscorePrefixedVariableName:
Exclude:
- 'spec/lib/droplet_kit/client_spec.rb'

# Offense count: 37
# Offense count: 38
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AutoCorrect, IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
Lint/UnusedBlockArgument:
Expand All @@ -51,16 +51,16 @@ Lint/Void:
Metrics/AbcSize:
Max: 184

# Offense count: 16
# Offense count: 24
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode.
# AllowedMethods: refine
Metrics/BlockLength:
Max: 138
Max: 158

# Offense count: 1
# Configuration parameters: CountComments, CountAsOne.
Metrics/ClassLength:
Max: 144
Max: 164

# Offense count: 6
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
Expand All @@ -70,7 +70,7 @@ Metrics/MethodLength:
# Offense count: 1
# Configuration parameters: CountComments, CountAsOne.
Metrics/ModuleLength:
Max: 174
Max: 183

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
Expand All @@ -90,7 +90,7 @@ Naming/VariableNumber:
- 'spec/lib/droplet_kit/resources/firewall_resource_spec.rb'
- 'spec/lib/droplet_kit/resources/load_balancer_resource_spec.rb'

# Offense count: 34
# Offense count: 46
# Configuration parameters: Prefixes, AllowedPatterns.
# Prefixes: when, with, without
RSpec/ContextWording:
Expand All @@ -110,7 +110,7 @@ RSpec/ContextWording:
- 'spec/lib/droplet_kit/resources/vpc_resource_spec.rb'
- 'spec/support/resource_context.rb'

# Offense count: 124
# Offense count: 130
# Configuration parameters: CountAsOne.
RSpec/ExampleLength:
Max: 43
Expand All @@ -125,7 +125,7 @@ RSpec/LeakyConstantDeclaration:
Exclude:
- 'spec/lib/droplet_kit/client_spec.rb'

# Offense count: 125
# Offense count: 129
RSpec/MultipleExpectations:
Max: 30

Expand All @@ -145,7 +145,7 @@ RSpec/NestedGroups:
RSpec/SpecFilePathFormat:
Enabled: false

# Offense count: 175
# Offense count: 186
# Configuration parameters: AllowedConstants.
Style/Documentation:
Enabled: false
Expand Down Expand Up @@ -174,7 +174,7 @@ Style/SymbolProc:
- 'lib/droplet_kit/resources/one_click_resource.rb'
- 'lib/tasks/resource_doc.rake'

# Offense count: 93
# Offense count: 106
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
# URISchemes: http, https
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,18 @@ Actions supported:
* `client.databases.get_sql_mode(id: 'id')`
* `client.databases.get_metrics_credentials`
* `client.databases.update_metrics_credentials(database_metrics_credentials)`
* `client.databases.get_mongo_config(id: 'id')`
* `client.databases.get_postgres_config(id: 'id')`
* `client.databases.get_mysql_config(id: 'id')`
* `client.databases.get_redis_config(id: 'id')`
* `client.databases.get_kafka_config(id: 'id')`
* `client.databases.get_opensearch_config(id: 'id')`
* `client.databases.update_mongo_config(mongo_config, id: 'id')`
* `client.databases.update_postgres_config(postgres_config, id: 'id')`
* `client.databases.update_mysql_config(mysql_config, id: 'id')`
* `client.databases.update_redis_config(redis_config, id: 'id')`
* `client.databases.update_kafka_config(kafka_config, id: 'id')`
* `client.databases.update_opensearch_config(opensearch_config, id: 'id')`

## Droplet resource

Expand Down
14 changes: 14 additions & 0 deletions lib/droplet_kit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ module DropletKit
autoload :DatabaseMaintenanceWindow, 'droplet_kit/models/database_maintenance_window'
autoload :DatabaseReplica, 'droplet_kit/models/database_replica'
autoload :DatabaseSQLMode, 'droplet_kit/models/database_sql_mode'
autoload :DatabaseMongoConfig, 'droplet_kit/models/database_mongo_config'
autoload :DatabaseKafkaConfig, 'droplet_kit/models/database_kafka_config'
autoload :DatabaseMysqlConfig, 'droplet_kit/models/database_mysql_config'
autoload :DatabasePostgresTimescaledbConfig, 'droplet_kit/models/database_postgres_config'
autoload :DatabasePostgresPgbouncerConfig, 'droplet_kit/models/database_postgres_config'
autoload :DatabasePostgresConfig, 'droplet_kit/models/database_postgres_config'
autoload :DatabaseRedisConfig, 'droplet_kit/models/database_redis_config'
autoload :DatabaseOpensearchConfig, 'droplet_kit/models/database_opensearch_config'
autoload :DatabaseUser, 'droplet_kit/models/database_user'
autoload :DatabaseUserResetAuth, 'droplet_kit/models/database_user_reset_auth'
autoload :DatabaseUserMySQLSettings, 'droplet_kit/models/database_user_mysql_settings'
Expand Down Expand Up @@ -154,6 +162,12 @@ module DropletKit
autoload :DatabaseMaintenanceWindowMapping, 'droplet_kit/mappings/database_maintenance_window_mapping'
autoload :DatabaseReplicaMapping, 'droplet_kit/mappings/database_replica_mapping'
autoload :DatabaseSQLModeMapping, 'droplet_kit/mappings/database_sql_mode_mapping'
autoload :DatabaseMongoConfigMapping, 'droplet_kit/mappings/database_mongo_config_mapping'
autoload :DatabaseKafkaConfigMapping, 'droplet_kit/mappings/database_kafka_config_mapping'
autoload :DatabaseMysqlConfigMapping, 'droplet_kit/mappings/database_mysql_config_mapping'
autoload :DatabasePostgresConfigMapping, 'droplet_kit/mappings/database_postgres_config_mapping'
autoload :DatabaseRedisConfigMapping, 'droplet_kit/mappings/database_redis_config_mapping'
autoload :DatabaseOpensearchConfigMapping, 'droplet_kit/mappings/database_opensearch_config_mapping'
autoload :DatabaseUserMapping, 'droplet_kit/mappings/database_user_mapping'
autoload :DatabaseUserResetAuthMapping, 'droplet_kit/mappings/database_user_reset_auth_mapping'
autoload :DatabaseMetricsCredentialsMapping, 'droplet_kit/mappings/database_metrics_credentials_mapping'
Expand Down
56 changes: 56 additions & 0 deletions lib/droplet_kit/mappings/database_kafka_config_mapping.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# frozen_string_literal: true

module DropletKit
class DatabaseKafkaConfigMapping
include Kartograph::DSL

kartograph do
mapping DatabaseKafkaConfig
root_key singular: 'config', scopes: %i[read update]

scoped :read, :update do
%i[compression_type
group_initial_rebalance_delay_ms
group_min_session_timeout_ms
group_max_session_timeout_ms
connections_max_idle_ms
max_incremental_fetch_session_cache_slots
message_max_bytes
offsets_retention_minutes
log_cleaner_delete_retention_ms
log_cleaner_min_cleanable_ratio
log_cleaner_max_compaction_lag_ms
log_cleaner_min_compaction_lag_ms
log_cleanup_policy
log_flush_interval_messages
log_flush_interval_ms
log_index_interval_bytes
log_index_size_max_bytes
log_message_downconversion_enable
log_message_timestamp_type
log_message_timestamp_difference_max_ms
log_preallocate
log_retention_bytes
log_retention_hours
log_retention_ms
log_roll_jitter_ms
log_roll_ms
log_segment_bytes
log_segment_delete_delay_ms
auto_create_topics_enable
min_insync_replicas
num_partitions
default_replication_factor
replica_fetch_max_bytes
replica_fetch_response_max_bytes
max_connections_per_ip
producer_purgatory_purge_interval_requests
socket_request_max_bytes
transaction_state_log_segment_bytes
transaction_remove_expired_transaction_cleanup_interval_ms].each do |key|
property(key)
end
end
end
end
end
22 changes: 22 additions & 0 deletions lib/droplet_kit/mappings/database_mongo_config_mapping.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# frozen_string_literal: true

module DropletKit
class DatabaseMongoConfigMapping
include Kartograph::DSL

kartograph do
mapping DatabaseMongoConfig
root_key singular: 'config', scopes: %i[read update]

scoped :read, :update do
%i[default_read_concern
default_write_concern
transaction_lifetime_limit_seconds
slow_op_threshold_ms
verbosity].each do |key|
property(key)
end
end
end
end
end
50 changes: 50 additions & 0 deletions lib/droplet_kit/mappings/database_mysql_config_mapping.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# frozen_string_literal: true

module DropletKit
class DatabaseMysqlConfigMapping
include Kartograph::DSL

kartograph do
mapping DatabaseMysqlConfig
root_key singular: 'config', scopes: %i[read update]

scoped :read, :update do
%i[backup_hour
backup_minute
sql_mode
connect_timeout
default_time_zone
group_concat_max_len
information_schema_stats_expiry
innodb_ft_min_token_size
innodb_ft_server_stopword_table
innodb_lock_wait_timeout
innodb_log_buffer_size
innodb_online_alter_log_max_size
innodb_print_all_deadlocks
innodb_rollback_on_timeout
interactive_timeout
internal_tmp_mem_storage_engine
net_read_timeout
net_write_timeout
sql_require_primary_key
wait_timeout
max_allowed_packet
max_heap_table_size
sort_buffer_size
tmp_table_size
slow_query_log
long_query_time
binlog_retention_period
innodb_change_buffer_max_size
innodb_flush_neighbors
innodb_read_io_threads
innodb_write_io_threads
innodb_thread_concurrency
net_buffer_length].each do |key|
property(key)
end
end
end
end
end
55 changes: 55 additions & 0 deletions lib/droplet_kit/mappings/database_opensearch_config_mapping.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# frozen_string_literal: true

module DropletKit
class DatabaseOpensearchConfigMapping
include Kartograph::DSL

kartograph do
mapping DatabaseOpensearchConfig
root_key singular: 'config', scopes: %i[read update]

scoped :read, :update do
%i[http_max_content_length_bytes
http_max_header_size_bytes
http_max_initial_line_length_bytes
indices_query_bool_max_clause_count
indices_fielddata_cache_size_percentage
indices_memory_index_buffer_size_percentage
indices_memory_min_index_buffer_size_mb
indices_memory_max_index_buffer_size_mb
indices_queries_cache_size_percentage
indices_recovery_max_mb_per_sec
indices_recovery_max_concurrent_file_chunks
thread_pool_search_size
thread_pool_search_throttled_size
thread_pool_get_size
thread_pool_analyze_size
thread_pool_write_size
thread_pool_force_merge_size
thread_pool_search_queue_size
thread_pool_search_throttled_queue_size
thread_pool_get_queue_size
thread_pool_analyze_queue_size
thread_pool_write_queue_size
ism_enabled
ism_history_enabled
ism_history_max_age_hours
ism_history_max_docs
ism_history_rollover_check_period_hours
ism_history_rollover_retention_period_days
search_max_buckets
action_auto_create_index_enabled
enable_security_audit
action_destructive_requires_name
cluster_max_shards_per_node
override_main_response_version
script_max_compilations_rate
cluster_routing_allocation_node_concurrent_recoveries
reindex_remote_whitelist
plugins_alerting_filter_by_backend_roles_enabled].each do |key|
property(key)
end
end
end
end
end
Loading

0 comments on commit 7c7fdce

Please sign in to comment.