Skip to content

Commit

Permalink
Merge pull request #112 from movableink/nbogetic/sc-89400/toggle-auto…
Browse files Browse the repository at this point in the history
…scaling-lambda-failover

[sc-89400] Allow toggling the autoscaling lambda
  • Loading branch information
nikolabogetic authored Sep 7, 2023
2 parents f882b2a + d94504d commit 45b73d4
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 2 deletions.
6 changes: 5 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
MovableInkAWS (2.8.5)
MovableInkAWS (2.8.6)
aws-sdk-athena (~> 1)
aws-sdk-autoscaling (~> 1)
aws-sdk-cloudwatch (~> 1)
Expand All @@ -10,6 +10,7 @@ PATH
aws-sdk-eks (~> 1)
aws-sdk-elasticache (~> 1)
aws-sdk-iam (~> 1)
aws-sdk-lambda (~> 1)
aws-sdk-rds (~> 1)
aws-sdk-route53 (~> 1)
aws-sdk-s3 (~> 1)
Expand Down Expand Up @@ -55,6 +56,9 @@ GEM
aws-sdk-kms (1.62.0)
aws-sdk-core (~> 3, >= 3.165.0)
aws-sigv4 (~> 1.1)
aws-sdk-lambda (1.96.0)
aws-sdk-core (~> 3, >= 3.165.0)
aws-sigv4 (~> 1.1)
aws-sdk-rds (1.171.0)
aws-sdk-core (~> 3, >= 3.165.0)
aws-sigv4 (~> 1.1)
Expand Down
1 change: 1 addition & 0 deletions MovableInkAWS.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Gem::Specification.new do |s|
s.add_runtime_dependency 'aws-sdk-eks', '~> 1'
s.add_runtime_dependency 'aws-sdk-elasticache', '~> 1'
s.add_runtime_dependency 'aws-sdk-iam', '~> 1'
s.add_runtime_dependency 'aws-sdk-lambda', '~> 1'
s.add_runtime_dependency 'aws-sdk-rds', '~> 1'
s.add_runtime_dependency 'aws-sdk-route53', '~> 1'
s.add_runtime_dependency 'aws-sdk-s3', '~> 1'
Expand Down
2 changes: 2 additions & 0 deletions lib/movable_ink/aws.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
require_relative 'aws/eks'
require_relative 'aws/elasticache'
require_relative 'aws/api_gateway'
require_relative 'aws/lambda'
require_relative 'consul/consul'
require 'aws-sdk-cloudwatch'

Expand All @@ -28,6 +29,7 @@ class AWS
include ApiGateway
include EKS
include IAM
include Lambda

class << self
def regions
Expand Down
35 changes: 35 additions & 0 deletions lib/movable_ink/aws/lambda.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
require 'aws-sdk-lambda'

module MovableInk
class AWS
module Lambda
def lambda(region: 'us-east-1')
@lambda_client ||= {}
@lambda_client[region] ||= Aws::Lambda::Client.new(region: region)
end

def disable_autoscaling_lambda(function_name)
lambda.update_function_configuration({
function_name: function_name,
environment: {
variables: {
"DRY_RUN" => "true",
}
}
})
end

def enable_autoscaling_lambda(function_name)
lambda.update_function_configuration({
function_name: function_name,
environment: {
variables: {
"DRY_RUN" => "false",
}
}
})
end

end
end
end
2 changes: 1 addition & 1 deletion lib/movable_ink/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module MovableInk
class AWS
VERSION = '2.8.5'
VERSION = '2.8.6'
end
end

0 comments on commit 45b73d4

Please sign in to comment.