class LambdaWrap::AwsService

Super Abstract Class for all AWS services and their calls. @abstract @since 1.0

Public Instance Methods

delete(client, region = 'AWS_REGION') click to toggle source
# File lib/lambda_wrap/aws_service.rb, line 24
def delete(client, region = 'AWS_REGION')
  @client = client
  @region = region
  client_guard
end
deploy(environment, client, region = 'AWS_REGION') click to toggle source
# File lib/lambda_wrap/aws_service.rb, line 6
def deploy(environment, client, region = 'AWS_REGION')
  unless environment.is_a?(LambdaWrap::Environment)
    raise ArgumentError, 'Must pass a LambdaWrap::Environment class.'
  end
  @client = client
  @region = region
  client_guard
end
teardown(environment, client, region = 'AWS_REGION') click to toggle source
# File lib/lambda_wrap/aws_service.rb, line 15
def teardown(environment, client, region = 'AWS_REGION')
  unless environment.is_a?(LambdaWrap::Environment)
    raise ArgumentError, 'Must pass a LambdaWrap::Environment class.'
  end
  @client = client
  @region = region
  client_guard
end

Private Instance Methods

client_guard() click to toggle source
# File lib/lambda_wrap/aws_service.rb, line 32
def client_guard
  unless @client.class == Aws::Lambda::Client || @client.class == Aws::DynamoDB::Client ||
         @client.class == Aws::APIGateway::Client
    raise ArgumentError, 'AWS client not initialized.'
  end
  raise ArgumentError, 'Invalid region' if @region.empty? || !Aws.partition('aws').region(@region)
end