source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | rlister/stax | https://github.com/rlister/stax | lib/stax/cfer.rb | Ruby | mit | 19 | master | 1,817 | require 'cfer'
## TODO: remove these hacks once merged and released in upstream cfer
## see cfer PRs: #52, #54
module Cfer::Core::Functions
def get_azs(region = '')
{"Fn::GetAZs" => region}
end
def cidr(ip_block, count, size_mask)
{"Fn::Cidr" => [ip_block, count, size_mask]}
end
def import_value(va... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/base.rb | Ruby | mit | 19 | master | 4,260 | require 'thor'
require 'stax/aws/sts'
require 'aws-sdk-ssm'
## clean exit on ctrl-c for all methods
trap('SIGINT', 'EXIT')
module Stax
class Base < Thor
no_commands do
def app_name
@_app_name ||= options[:app].empty? ? nil : cfn_safe(options[:app])
end
def branch_name
@_branc... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/docker.rb | Ruby | mit | 19 | master | 2,077 | require 'stax/aws/ecr'
module Stax
class Docker < Base
no_commands do
## default to ECR registry for this account
def docker_registry
@_docker_registry ||= "#{aws_account_id}.dkr.ecr.#{aws_region}.amazonaws.com"
end
## name the docker repo after the git repo
def docker_rep... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/stack/parameters.rb | Ruby | mit | 19 | master | 524 | module Stax
class Stack < Base
no_commands do
def stack_parameters
@_stack_parameters ||= Aws::Cfn.parameters(stack_name)
end
def stack_parameter(key)
stack_parameters.find do |p|
p.parameter_key == key.to_s
end&.parameter_value
end
end
desc 'pa... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/stack/crud.rb | Ruby | mit | 19 | master | 9,246 | module Stax
class Stack < Base
no_commands do
## by default we pass names of imported stacks;
## you are encouraged to override or extend this method
def cfn_parameters
stack_imports.each_with_object({}) do |i, h|
h[i.to_sym] = stack(i).stack_name
end
end
... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/stack/drift.rb | Ruby | mit | 19 | master | 1,685 | module Stax
class Stack < Base
COLORS = {
IN_SYNC: :green,
MODIFIED: :red,
DELETED: :red,
ADD: :green,
REMOVE: :red,
}
no_commands do
## start a drift detection job and wait for it to complete
def run_drift_detection
debug("Running drift detectio... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/stack/changeset.rb | Ruby | mit | 19 | master | 4,901 | module Stax
class Stack < Base
no_commands do
## set this in stack to force changesets on update
def stack_force_changeset
false
end
## can be anything unique
def change_set_name
stack_name + '-' + Time.now.strftime('%Y%m%d%H%M%S')
end
## create a chan... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/stack/resources.rb | Ruby | mit | 19 | master | 990 | module Stax
class Stack < Base
no_commands do
def stack_resources
@_stack_resources ||= Aws::Cfn.resources(stack_name)
end
def stack_resources_by_type(type)
stack_resources.select do |r|
r.resource_type == type
end
end
end
desc 'resources', 'lis... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/stack/exports.rb | Ruby | mit | 19 | master | 1,105 | module Stax
class Stack < Base
no_commands do
def import_stacks
@_import_stacks ||= Aws::Cfn.exports(stack_name).map do |e|
Aws::Cfn.imports(e.export_name)
end.flatten.uniq
end
def update_warn_imports
unless import_stacks.empty?
warn("You may also ne... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/stack/outputs.rb | Ruby | mit | 19 | master | 540 | module Stax
class Stack < Base
no_commands do
def stack_outputs
@_stack_outputs ||= Aws::Cfn.outputs(stack_name)
end
def stack_output(key)
stack_outputs.fetch(key.to_s, nil)
end
end
desc 'outputs', 'show stack outputs'
def outputs(key = nil)
if key
... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/stack/template.rb | Ruby | mit | 19 | master | 1,581 | module Stax
class Stack < Base
no_commands do
## location of templates relative to Staxfile
def cfn_template_dir
'cf'
end
## template filename without extension
def cfn_template_stub
@_cfn_template_stub ||= File.join(cfn_template_dir, "#{class_name}")
end
... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/stack/cfn.rb | Ruby | mit | 19 | master | 2,323 | module Stax
class Stack < Base
no_commands do
def event_fields(e)
[e.timestamp, color(e.resource_status, Aws::Cfn::COLORS), e.resource_type, e.logical_resource_id, e.resource_status_reason]
end
def print_events(events)
events.reverse.each do |e|
puts "%s %-44s %-40... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/aws/codepipeline.rb | Ruby | mit | 19 | master | 1,116 | require 'aws-sdk-codepipeline'
module Stax
module Aws
class Codepipeline < Sdk
class << self
def client
@_client ||= ::Aws::CodePipeline::Client.new
end
def stages(name)
client.get_pipeline(name: name).pipeline.stages
end
def executions(name, ... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/aws/s3.rb | Ruby | mit | 19 | master | 1,237 | require 'aws-sdk-s3'
module Stax
module Aws
class S3 < Sdk
class << self
def client
@_client ||= ::Aws::S3::Client.new
end
def list_buckets
client.list_buckets.buckets
end
def bucket_tags(bucket)
client.get_bucket_tagging(bucket: buc... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/aws/cloudfront.rb | Ruby | mit | 19 | master | 599 | require 'aws-sdk-cloudfront'
module Stax
module Aws
class Cloudfront < Sdk
class << self
def client
@_client ||= ::Aws::CloudFront::Client.new
end
def distribution(id)
client.get_distribution(id: id).distribution
end
def invalidations(id)
... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/aws/dms.rb | Ruby | mit | 19 | master | 887 | require 'aws-sdk-databasemigrationservice'
module Stax
module Aws
class Dms < Sdk
class << self
def client
@_client ||= ::Aws::DatabaseMigrationService::Client.new
end
def endpoints(opt)
client.describe_endpoints(opt).map(&:endpoints).flatten
end
... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/aws/iam.rb | Ruby | mit | 19 | master | 284 | require 'aws-sdk-iam'
module Stax
module Aws
class Iam < Sdk
class << self
def client
@_client ||= ::Aws::IAM::Client.new
end
def aliases
client.list_account_aliases.account_aliases
end
end
end
end
end |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/aws/elb.rb | Ruby | mit | 19 | master | 664 | require 'aws-sdk-elasticloadbalancing'
module Stax
module Aws
class Elb < Sdk
COLORS = {
InService: :green,
OutOfService: :red,
}
class << self
def client
@_client ||= ::Aws::ElasticLoadBalancing::Client.new
end
def describe(elb_names)
... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/aws/logs.rb | Ruby | mit | 19 | master | 605 | require 'aws-sdk-cloudwatchlogs'
module Stax
module Aws
class Logs < Sdk
class << self
def client
@_client ||= ::Aws::CloudWatchLogs::Client.new
end
def groups(prefix = nil)
paginate(:log_groups) do |token|
client.describe_log_groups(log_group_name... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/aws/ecs.rb | Ruby | mit | 19 | master | 1,636 | require 'aws-sdk-ecs'
module Stax
module Aws
class Ecs < Sdk
class << self
def client
@_client ||= ::Aws::ECS::Client.new
end
def clusters(names)
client.describe_clusters(clusters: Array(names)).clusters
end
def services(cluster, services)
... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/aws/alb.rb | Ruby | mit | 19 | master | 710 | require 'aws-sdk-elasticloadbalancingv2'
module Stax
module Aws
class Alb < Sdk
class << self
def client
@_client ||= ::Aws::ElasticLoadBalancingV2::Client.new
end
def describe(alb_arns)
client.describe_load_balancers(load_balancer_arns: alb_arns).load_balance... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/aws/emr.rb | Ruby | mit | 19 | master | 597 | require 'aws-sdk-emr'
module Stax
module Aws
class Emr < Sdk
class << self
def client
@_client ||= ::Aws::EMR::Client.new
end
def describe(id)
client.describe_cluster(cluster_id: id).cluster
end
def groups(id)
## TODO paginate me
... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/aws/ecr.rb | Ruby | mit | 19 | master | 1,004 | require 'aws-sdk-ecr'
require 'base64'
module Stax
module Aws
class Ecr < Sdk
class << self
def client
@_client ||= ::Aws::ECR::Client.new
end
def auth
client.get_authorization_token.authorization_data
end
def repositories(opt = {})
... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/aws/lambda.rb | Ruby | mit | 19 | master | 705 | require 'aws-sdk-lambda'
module Stax
module Aws
class Lambda < Sdk
class << self
def client
@_client ||= ::Aws::Lambda::Client.new
end
def list
paginate(:functions) do |marker|
client.list_functions(marker: marker)
end
end
... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/aws/sdk.rb | Ruby | mit | 19 | master | 514 | module Stax
module Aws
class Sdk
RETRY_LIMIT = ENV['STAX_RETRY_LIMIT'] || 100
## universal paginator for aws-sdk calls
def self.paginate(thing)
token = nil
things = []
loop do
resp = yield(token)
things += resp.send(thing)
## some apis use ... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/aws/sts.rb | Ruby | mit | 19 | master | 434 | require 'aws-sdk-core'
module Stax
module Aws
class Sts < Sdk
class << self
def client
@_client ||= ::Aws::STS::Client.new
end
def id
@_id ||= client.get_caller_identity
end
def account_id
id.account
end
def user_id
... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/aws/ssm.rb | Ruby | mit | 19 | master | 1,086 | require 'aws-sdk-ssm'
module Stax
module Aws
class Ssm < Sdk
class << self
def client
@_client ||= ::Aws::SSM::Client.new
end
def instances(stack)
client.describe_instance_information(filters: [{key: 'tag:aws:cloudformation:stack-name', values: [stack]}]).inst... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/aws/firehose.rb | Ruby | mit | 19 | master | 350 | require 'aws-sdk-firehose'
module Stax
module Aws
class Firehose < Sdk
class << self
def client
@_client ||= ::Aws::Firehose::Client.new
end
def describe(name)
client.describe_delivery_stream(delivery_stream_name: name).delivery_stream_description
end
... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/aws/keypair.rb | Ruby | mit | 19 | master | 485 | require 'aws-sdk-ec2'
module Stax
module Aws
class Keypair < Sdk
class << self
def client
@_client ||= ::Aws::EC2::Client.new
end
def describe(names = nil)
client.describe_key_pairs(key_names: names).key_pairs
end
def create(name)
cl... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/aws/route53.rb | Ruby | mit | 19 | master | 1,283 | require 'aws-sdk-route53'
module Stax
module Aws
class Route53 < Sdk
class << self
def client
@_client ||= ::Aws::Route53::Client.new
end
## list all zones
def zones
client.list_hosted_zones.hosted_zones
end
## list limited number of z... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/aws/rds.rb | Ruby | mit | 19 | master | 528 | require 'aws-sdk-rds'
module Stax
module Aws
class Rds < Sdk
class << self
def client
@_client ||= ::Aws::RDS::Client.new
end
def clusters(opt)
client.describe_db_clusters(opt)&.db_clusters
end
def instances(opt)
client.describe_db_i... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/aws/kms.rb | Ruby | mit | 19 | master | 290 | require 'aws-sdk-kms'
module Stax
module Aws
class Kms < Sdk
class << self
def client
@_client ||= ::Aws::KMS::Client.new
end
def describe(id)
client.describe_key(key_id: id).key_metadata
end
end
end
end
end |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/aws/codebuild.rb | Ruby | mit | 19 | master | 1,238 | require 'aws-sdk-codebuild'
module Stax
module Aws
class Codebuild < Sdk
class << self
def client
@_client ||= ::Aws::CodeBuild::Client.new
end
def projects(names)
client.batch_get_projects(names: names).projects
end
## returns ids of num most... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/aws/sg.rb | Ruby | mit | 19 | master | 1,966 | require 'aws-sdk-ec2'
module Stax
module Aws
class Sg < Sdk
class << self
def client
@_client ||= ::Aws::EC2::Client.new
end
def describe(ids)
client.describe_security_groups(group_ids: Array(ids)).security_groups
end
def authorize(id, cidr, p... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/aws/acm.rb | Ruby | mit | 19 | master | 309 | require 'aws-sdk-acm'
module Stax
module Aws
class Acm < Sdk
class << self
def client
@_client ||= ::Aws::ACM::Client.new
end
def describe(arn)
client.describe_certificate(certificate_arn: arn)&.certificate
end
end
end
end
end |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/aws/asg.rb | Ruby | mit | 19 | master | 1,107 | require 'aws-sdk-autoscaling'
module Stax
module Aws
class Asg < Sdk
class << self
def client
@_client ||= ::Aws::AutoScaling::Client.new
end
def describe(names)
paginate(:auto_scaling_groups) do |token|
client.describe_auto_scaling_groups(auto_sca... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/aws/sqs.rb | Ruby | mit | 19 | master | 602 | require 'aws-sdk-sqs'
module Stax
module Aws
class Sqs < Sdk
class << self
def client
@_client ||= ::Aws::SQS::Client.new
end
def get(url, attributes = :All)
client.get_queue_attributes(queue_url: url, attribute_names: Array(attributes)).attributes
end... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/aws/dynamodb.rb | Ruby | mit | 19 | master | 2,962 | require 'aws-sdk-dynamodb'
require 'json'
module Stax
module Aws
class DynamoDB < Sdk
class << self
def client
@_client ||= ::Aws::DynamoDB::Client.new
end
def table(name)
client.describe_table(table_name: name).table
end
def global_table(name... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/aws/cfn.rb | Ruby | mit | 19 | master | 5,003 | module Stax
module Aws
class Cfn < Sdk
## stack statuses that are not DELETE_COMPLETE
STATUSES = %i[
CREATE_IN_PROGRESS CREATE_FAILED CREATE_COMPLETE
ROLLBACK_IN_PROGRESS ROLLBACK_FAILED ROLLBACK_COMPLETE
DELETE_IN_PROGRESS DELETE_FAILED
IMPORT_IN_PROGRESS IMPORT_COMPL... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/aws/apigw.rb | Ruby | mit | 19 | master | 742 | require 'aws-sdk-apigateway'
module Stax
module Aws
class APIGateway < Sdk
class << self
def client
@_client ||= ::Aws::APIGateway::Client.new
end
def api(id)
client.get_rest_api(rest_api_id: id)
end
def stages(id, deployment = nil)
... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/aws/secrets_manager.rb | Ruby | mit | 19 | master | 445 | require 'aws-sdk-secretsmanager'
module Stax
module Aws
class SecretsManager < Sdk
class << self
def client
@_client ||= ::Aws::SecretsManager::Client.new
end
def list
client.list_secrets.map(&:secret_list).flatten
end
def get(id, version = :A... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/aws/ec2.rb | Ruby | mit | 19 | master | 760 | require 'aws-sdk-ec2'
module Stax
module Aws
class Ec2 < Sdk
class << self
def client
@_client ||= ::Aws::EC2::Client.new
end
## return instances tagged by stack with name
def instances(name)
filter = {name: 'tag:aws:cloudformation:stack-name', values:... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/cli/new.rb | Ruby | mit | 19 | master | 222 | module Stax
class Cli < Base
desc 'new DIR', 'create new stax project in dir'
def new(dir)
Stax::Generators.load_builtin_generators
Stax::Generators::NewGenerator.start(Array(dir))
end
end
end |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/cli/ls.rb | Ruby | mit | 19 | master | 1,464 | module Stax
class Cli < Base
no_commands do
## fields to show in output
def ls_stack_fields(s)
[ s.stack_name, s.creation_time, color(s.stack_status, Aws::Cfn::COLORS) ]
end
## list stacks from Staxfile in given order
def ls_staxfile_stacks
print_table Stax.stack_li... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/cli/generate.rb | Ruby | mit | 19 | master | 549 | require 'stax/generators'
module Stax
class Cli < Base
desc 'generate NAME [ARGS]', 'run code generators'
def generate(name = nil, *args)
Stax::Generators.load_builtin_generators
Stax::Generators.load_local_generators
if name.nil?
Stax::Generators::Base.subclasses.each do |g|
... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/cli/crud.rb | Ruby | mit | 19 | master | 1,796 | module Stax
class Cli < Base
no_commands do
## create order: default to stacks from Staxfile, override if needed
## delete will be this, in reverse order
def stack_order
Stax.stack_list
end
def stack_objects
stack_order.map(&method(:stack))
end
end
de... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/cli/info.rb | Ruby | mit | 19 | master | 455 | module Stax
class Stack < Base
# no_commands do
# def self.info(cmds)
# puts "info: #{cmds}"
# end
# end
desc 'info', 'service-specific info'
def info
## get mixins in the order we declared them
self.class.subcommands.reverse.each do |cmd|
begin
invo... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/mixin/dynamodb.rb | Ruby | mit | 19 | master | 3,961 | require 'yaml'
require 'stax/aws/dynamodb'
require_relative 'dynamodb/throughput'
require_relative 'dynamodb/backup'
require_relative 'dynamodb/local'
module Stax
module DynamoDB
def self.included(thor)
thor.desc('dynamodb COMMAND', 'Dynamo subcommands')
thor.subcommand(:dynamodb, Cmd::DynamoDB)
... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/mixin/ssm.rb | Ruby | mit | 19 | master | 4,126 | require 'yaml'
require 'stax/aws/ssm'
module Stax
module Ssm
def self.included(thor)
thor.desc(:ssm, 'SSM subcommands')
thor.subcommand(:ssm, Cmd::Ssm)
end
def ssm_parameter_path
@_ssm_parameter_path ||= prepend('/', [app_name, branch_name, class_name].join('/'))
end
def ssm_... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/mixin/s3.rb | Ruby | mit | 19 | master | 4,264 | require 'stax/aws/s3'
module Stax
module S3
def self.included(thor)
thor.desc(:s3, 'S3 subcommands')
thor.subcommand(:s3, Cmd::S3)
end
end
module Cmd
class S3 < SubCommand
stax_info :ls
no_commands do
def stack_s3_buckets
Aws::Cfn.resources_by_type(my.stack... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/mixin/keypair.rb | Ruby | mit | 19 | master | 1,100 | require 'stax/aws/keypair'
module Stax
module Keypair
def self.included(thor)
thor.desc(:keypair, 'Keypair subcommands')
thor.subcommand(:keypair, Cmd::Keypair)
end
def keypair_create
Aws::Keypair.create(stack_name).key_material
rescue ::Aws::EC2::Errors::InvalidKeyPairDuplicate =>... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/mixin/rds.rb | Ruby | mit | 19 | master | 16,355 | require 'stax/aws/rds'
module Stax
module Rds
def self.included(thor)
thor.desc('rds COMMAND', 'RDS subcommands')
thor.subcommand(:rds, Cmd::Rds)
end
end
module Cmd
class Rds < SubCommand
stax_info :clusters, :instances, :endpoints
COLORS = {
available: :green,
... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/mixin/acm.rb | Ruby | mit | 19 | master | 2,784 | require 'stax/aws/acm'
module Stax
module Acm
def self.included(thor)
thor.desc('acm COMMAND', 'ACM subcommands')
thor.subcommand(:acm, Cmd::Acm)
end
end
module Cmd
class Acm < SubCommand
COLORS = {
SUCCESS: :green,
PENDING_VALIDATION: :yellow,
}
... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/mixin/kms.rb | Ruby | mit | 19 | master | 613 | require 'stax/aws/kms'
module Stax
module Kms
def self.included(thor)
thor.desc(:kms, 'KMS subcommands')
thor.subcommand(:kms, Cmd::Kms)
end
end
module Cmd
class Kms < SubCommand
no_commands do
def stack_kms_keys
Aws::Cfn.resources_by_type(my.stack_name, 'AWS::KM... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/mixin/codebuild.rb | Ruby | mit | 19 | master | 5,232 | require 'stax/aws/codebuild'
module Stax
module Codebuild
def self.included(thor)
thor.desc(:codebuild, 'Codebuild subcommands')
thor.subcommand(:codebuild, Cmd::Codebuild)
end
def stack_projects
@_stack_projects ||= Aws::Cfn.resources_by_type(stack_name, 'AWS::CodeBuild::Project')
... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/mixin/asg.rb | Ruby | mit | 19 | master | 4,403 | require 'stax/aws/asg'
module Stax
module Asg
def self.included(thor)
thor.desc(:asg, 'ASG subcommands')
thor.subcommand(:asg, Cmd::Asg)
end
end
module Cmd
class Asg < SubCommand
stax_info :status
COLORS = {
## lifecycle states
Pending: :yellow, InService: :g... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/mixin/sqs.rb | Ruby | mit | 19 | master | 1,176 | require 'stax/aws/sqs'
module Stax
module Sqs
def self.included(thor)
thor.desc(:sqs, 'SQS subcommands')
thor.subcommand(:sqs, Cmd::Sqs)
end
end
module Cmd
class Sqs < SubCommand
no_commands do
def stack_sqs_queues
Aws::Cfn.resources_by_type(my.stack_name, 'AWS::... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/mixin/firehose.rb | Ruby | mit | 19 | master | 796 | require 'stax/aws/firehose'
module Stax
module Firehose
def self.included(thor)
thor.desc(:firehose, 'Firehose subcommands')
thor.subcommand(:firehose, Cmd::Firehose)
def stack_firehoses
Aws::Cfn.resources_by_type(stack_name, 'AWS::KinesisFirehose::DeliveryStream')
end
end
... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/mixin/codepipeline.rb | Ruby | mit | 19 | master | 8,907 | require 'stax/aws/codepipeline'
module Stax
module Codepipeline
def self.included(thor)
thor.desc(:codepipeline, 'Codepipeline subcommands')
thor.subcommand(:codepipeline, Cmd::Codepipeline)
end
def stack_pipelines
@_stack_pipelines ||= Aws::Cfn.resources_by_type(stack_name, 'AWS::Code... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/mixin/ssh.rb | Ruby | mit | 19 | master | 1,232 | ## include this mixin in stack classes that need ssh to instances
## and consider defining methods: ssh_options, before_ssh, after_ssh
require 'stax/aws/ec2'
module Stax
module Ssh
def self.included(thor)
## stack class can define this
# def ssh_options
# {
# StrictHostKeyChecking:... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/mixin/ec2.rb | Ruby | mit | 19 | master | 979 | require 'stax/aws/ec2'
module Stax
module Ec2
def self.included(thor)
thor.desc(:ec2, 'EC2 subcommands')
thor.subcommand(:ec2, Cmd::Ec2)
end
end
module Cmd
class Ec2 < SubCommand
stax_info :ls
COLORS = {
## instances
running: :green,
stopped: :y... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/mixin/apigw.rb | Ruby | mit | 19 | master | 1,949 | require 'stax/aws/apigw'
module Stax
module Apigw
def self.included(thor)
thor.desc(:apigw, 'API Gateway subcommands')
thor.subcommand(:apigw, Cmd::Apigw)
end
end
module Cmd
class Apigw < SubCommand
stax_info :endpoints, :resources
no_commands do
def stack_apis
... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/mixin/lambda.rb | Ruby | mit | 19 | master | 3,458 | require 'open-uri'
require 'yaml'
require 'base64'
require 'stax/aws/lambda'
module Stax
module Lambda
def self.included(thor)
thor.desc('lambda COMMAND', 'Lambda subcommands')
thor.subcommand(:lambda, Cmd::Lambda)
end
end
module Cmd
class Lambda < SubCommand
stax_info :ls
n... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/mixin/secrets_manager.rb | Ruby | mit | 19 | master | 974 | require 'stax/aws/secrets_manager'
module Stax
module SecretsManager
def self.included(thor)
thor.desc('sm COMMAND', 'SecretsManager subcommands')
thor.subcommand(:sm, Cmd::SecretsManager)
end
## monkey-patch in your application as needed
def secrets_manager_prefix
@_secrets_manage... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/mixin/sg.rb | Ruby | mit | 19 | master | 3,029 | require 'stax/aws/sg'
require 'open-uri'
module Stax
module Sg
def self.included(thor)
thor.desc(:sg, 'Security group subcommands')
thor.subcommand(:sg, Cmd::Sg)
end
## look up my local public IP
def get_my_ip
URI.parse('http://v4.ident.me/').read + '/32'
end
def sg_author... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/mixin/dms.rb | Ruby | mit | 19 | master | 5,087 | require 'stax/aws/dms'
module Stax
module Dms
def self.included(thor)
thor.desc('dms COMMAND', 'DMS subcommands')
thor.subcommand(:dms, Cmd::Dms)
end
def stack_dms_endpoints
@_stack_dms_endpoints ||= Aws::Cfn.resources_by_type(stack_name, 'AWS::DMS::Endpoint')
end
def stack_dm... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/mixin/ecs.rb | Ruby | mit | 19 | master | 9,289 | require 'stax/aws/ecs'
require_relative 'ecs/deploy'
module Stax
module Ecs
def self.included(thor)
thor.desc('ecs COMMAND', 'ECS subcommands')
thor.subcommand(:ecs, Cmd::Ecs)
end
def ecs_clusters
@_ecs_clusters ||= Aws::Cfn.resources_by_type(stack_name, 'AWS::ECS::Cluster')
end
... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/mixin/elb.rb | Ruby | mit | 19 | master | 1,027 | require 'stax/aws/elb'
module Stax
module Elb
def self.included(thor)
thor.desc(:elb, 'ELB subcommands')
thor.subcommand(:elb, Cmd::Elb)
end
end
module Cmd
class Elb < SubCommand
stax_info :status
COLORS = {
InService: :green,
OutOfService: :red,
}
... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/mixin/ecr.rb | Ruby | mit | 19 | master | 1,984 | require 'base64'
require 'stax/aws/ecr'
module Stax
module Ecr
def self.included(thor)
thor.desc(:ecr, 'ECR subcommands')
thor.subcommand(:ecr, Cmd::Ecr)
end
def ecr_registry
@_ecr_registry ||= "#{aws_account_id}.dkr.ecr.#{aws_region}.amazonaws.com"
end
def ecr_repositories
... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/mixin/alb.rb | Ruby | mit | 19 | master | 1,217 | require 'stax/aws/alb'
module Stax
module Alb
def self.included(thor)
thor.desc('alb COMMAND', 'ALB subcommands')
thor.subcommand(:alb, Cmd::Alb)
end
end
module Cmd
class Alb < SubCommand
stax_info :status
COLORS = {
healthy: :green,
unhealthy: :red,
... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/mixin/emr.rb | Ruby | mit | 19 | master | 2,089 | require 'stax/aws/emr'
require 'yaml'
module Stax
module Emr
def self.included(thor)
thor.desc(:emr, 'Emr subcommands')
thor.subcommand(:emr, Cmd::Emr)
end
end
module Cmd
class Emr < SubCommand
COLORS = {
RUNNING: :green,
WAITING: :gre... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/mixin/cloudfront.rb | Ruby | mit | 19 | master | 3,348 | require 'stax/aws/cloudfront'
module Stax
module Cloudfront
def self.included(thor)
thor.desc('cloudfront COMMAND', 'Cloudfront subcommands')
thor.subcommand(:cloudfront, Cmd::Cloudfront)
end
end
module Cmd
class Cloudfront < SubCommand
stax_info :ls
COLORS = {
Enabl... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/mixin/logs.rb | Ruby | mit | 19 | master | 7,454 | require 'stax/aws/logs'
module Stax
module Logs
def self.included(thor)
thor.desc('logs COMMAND', 'Logs subcommands')
thor.subcommand(:logs, Cmd::Logs)
end
def stack_log_groups
@_stack_log_groups ||= stack_resources_by_type('AWS::Logs::LogGroup')
end
end
module Cmd
class... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/mixin/dynamodb/local.rb | Ruby | mit | 19 | master | 3,341 | require 'json'
module Stax
module DynamoDB
## monkey-patch this method to apply any app-specific changes to payload
## args: logical_id, payload hash
## returns: new payload
def dynamo_local_payload_hacks(id, payload)
payload
end
end
module Cmd
class DynamoDB < SubCommand
... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/mixin/dynamodb/throughput.rb | Ruby | mit | 19 | master | 2,795 | module Stax
module Cmd
class DynamoDB < SubCommand
no_commands do
def print_throughput(ids)
output = [['NAME', 'INDEX NAME', 'READ CAPACITY', 'WRITE CAPACITY', 'DECREASES TODAY']]
stack_table_names(ids).each do |name|
table = Aws::DynamoDB.table(name)
t =... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/mixin/dynamodb/backup.rb | Ruby | mit | 19 | master | 1,376 | module Stax
module Cmd
class DynamoDB < SubCommand
no_commands do
def list_backups(name)
debug("Backups for #{name}")
print_table Aws::DynamoDB.list_backups(table_name: name).map { |b|
[b.backup_name, color(b.backup_status, COLORS), b.table_name, b.backup_creation_da... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/mixin/ecs/deploy.rb | Ruby | mit | 19 | master | 1,499 | module Stax
module Ecs
## convert to hash for registering new taskdef
def taskdef_to_hash(taskdef)
args = %i[family cpu memory requires_compatibilities task_role_arn execution_role_arn network_mode container_definitions volumes placement_constraints]
taskdef.to_hash.slice(*args)
end
def ... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/generators/base.rb | Ruby | mit | 19 | master | 708 | require 'thor/group'
module Stax
module Generators
class Base < Thor::Group
include Thor::Actions
protected
## show usage and exit
def usage!
self.class.help(self)
exit
end
def self.subclasses
ObjectSpace.each_object(singleton_class).map do |klass|
... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/generators/generator/generator_generator.rb | Ruby | mit | 19 | master | 952 | module Stax
module Generators
class GeneratorGenerator < Base
desc 'Create new generator with given name.'
source_root File.expand_path('templates', __dir__)
def check_args
usage! if args.size != 1
end
def create_generator_file
template('generator.rb.erb', File.joi... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/generators/new/new_generator.rb | Ruby | mit | 19 | master | 804 | module Stax
module Generators
class NewGenerator < Base
desc 'Create new stax project in give dir.'
source_root File.expand_path('templates', __dir__)
def check_args
usage! if args.size != 1
end
def create_stax_dir
empty_directory(args.first)
self.destinati... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/generators/new/templates/Gemfile | Ruby | mit | 19 | master | 426 | source 'https://rubygems.org'
gem 'stax'
# gem 'stax', git: 'https://github.com/rlister/stax'
gem 'stax-nag'
# gem 'stax-nag', git: 'https://github.com/rlister/stax-nag'
gem 'stax-examples'
# gem 'stax-examples', git: 'https://github.com/rlister/stax-examples'
## this is a hack until this fixed: https://github.com/... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/generators/new/templates/lib/stack.rb | Ruby | mit | 19 | master | 974 | ## Monkey-patches you may make to change stack behavior.
## Changing these here will affect all stacks.
## You may also define these per-stack in the sub-class for each stack in lib/stacks/.
module Stax
class Stack < Base
no_commands do
## your application name, will start all stack names
# def app... |
github | rlister/stax | https://github.com/rlister/stax | lib/stax/generators/stack/stack_generator.rb | Ruby | mit | 19 | master | 2,677 | ## generator to create the basic files for one or more new stacks:
## - add stack to Staxfile
## - subclass in lib/stack/
## - cfer/json/yaml template outline in cf/
module Stax
module Generators
class StackGenerator < Base
desc 'Create new stacks with given names.'
class_option :json, type: :... |
github | shlomoswidler/elb-sanity-test | https://github.com/shlomoswidler/elb-sanity-test | elb-sanity-test.rb | Ruby | apache-2.0 | 19 | master | 10,894 | #!/usr/bin/env ruby -w
#
# elb-sanity-test
class ElbHealthCheckTargetDescription
def initialize(health_check_target)
colon_pos = health_check_target.index(":")
@protocol = health_check_target[0,colon_pos].downcase.to_sym
stop_looking_pos=-1
@url = nil
if ["http", "https"].include?(@protocol)
... |
github | ryopeko/db_supplier | https://github.com/ryopeko/db_supplier | db_supplier.gemspec | Ruby | mit | 19 | master | 1,172 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
Gem::Specification.new do |spec|
spec.name = "db_supplier"
spec.version = '0.1.0'
spec.authors = ["ryopeko"]
spec.email = ["ryopeko@gmail.com"]
spec.summary = ... |
github | ryopeko/db_supplier | https://github.com/ryopeko/db_supplier | sample.rb | Ruby | mit | 19 | master | 466 | require 'db_supplier'
require 'active_record'
require 'pry'
DBSupplier::Migrator.configurations = {
schema_repository: 'ryopeko/demo_schema',
access_token: ENV['TOKEN'],
schema_files: {
external_database: ['DEMO/APPS/DEFAULT/latest.sql']
}
}
ActiveRecord::Base.configurations = {
'external_database' => {... |
github | ryopeko/db_supplier | https://github.com/ryopeko/db_supplier | spec/spec_helper.rb | Ruby | mit | 19 | master | 482 | require 'rspec/mocks/standalone'
require 'simplecov'
require 'tapp'
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
SimpleCov::Formatter::HTMLFormatter
]
SimpleCov.start do
add_filter 'spec'
end
RSpec.configure do |config|
config.filter_run :focus
config.run_all_when_everything_filtered = true
... |
github | ryopeko/db_supplier | https://github.com/ryopeko/db_supplier | spec/migrator_spec.rb | Ruby | mit | 19 | master | 3,352 | require 'spec_helper.rb'
require 'db_supplier/migrator'
require 'active_record'
require 'logger'
def migrate_class
DBSupplier::Migrator.dup
end
describe DBSupplier::Migrator do
describe ".client" do
context "when access_token is not present" do
it { expect { migrate_class.client }.to raise_error(Runtime... |
github | ryopeko/db_supplier | https://github.com/ryopeko/db_supplier | lib/db_supplier/migrator.rb | Ruby | mit | 19 | master | 2,859 | require 'logger'
require 'octokit'
require 'active_support/core_ext/hash'
require 'active_record'
module DBSupplier
class Migrator
class << self
def configurations
@configurations
end
def configurations=(config={})
@configurations = config
@schema_repository = config[:... |
github | ryopeko/db_supplier | https://github.com/ryopeko/db_supplier | lib/db_supplier/rails/tasks.rake | Ruby | mit | 19 | master | 790 | namespace :db do
namespace :supplier do
desc 'show migration target databases'
task defined: :environment do
raise "This task can be performed in non production." if Rails.env == 'production'
puts DBSupplier::Migrator.databases.join("\n")
end
desc 'Migrate database from DDL files of unman... |
github | NJayDevelopment/mongoid_forums | https://github.com/NJayDevelopment/mongoid_forums | Gemfile | Ruby | mit | 19 | master | 569 | source 'https://rubygems.org'
# Declare your gem's dependencies in mongoid_forums.gemspec.
# Bundler will treat runtime dependencies like base dependencies, and
# development dependencies will be added by default to the :development group.
gemspec
# Declare any dependencies that are still in development here instead ... |
github | NJayDevelopment/mongoid_forums | https://github.com/NJayDevelopment/mongoid_forums | Rakefile | Ruby | mit | 19 | master | 616 | begin
require 'bundler/setup'
rescue LoadError
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
end
require 'rdoc/task'
RDoc::Task.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'MongoidForums'
rdoc.options << '--line-numbers'
rdoc.rdoc_files.include('README.rdoc')... |
github | NJayDevelopment/mongoid_forums | https://github.com/NJayDevelopment/mongoid_forums | mongoid_forums.gemspec | Ruby | mit | 19 | master | 1,132 | $:.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version:
require "mongoid_forums/version"
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "mongoid-forums"
s.version = MongoidForums::VERSION
s.authors = ["skipperguy12"]
s.email = ... |
github | NJayDevelopment/mongoid_forums | https://github.com/NJayDevelopment/mongoid_forums | test/test_helper.rb | Ruby | mit | 19 | master | 582 | # Configure Rails Environment
ENV["RAILS_ENV"] = "test"
require File.expand_path("../../test/dummy/config/environment.rb", __FILE__)
require "rails/test_help"
# Filter out Minitest backtrace while allowing backtrace from other libraries
# to be shown.
Minitest.backtrace_filter = Minitest::BacktraceFilter.new
# Load... |
github | NJayDevelopment/mongoid_forums | https://github.com/NJayDevelopment/mongoid_forums | test/controllers/mongoid_forums/topics_controller_test.rb | Ruby | mit | 19 | master | 640 | require 'test_helper'
module MongoidForums
class TopicsControllerTest < ActionController::TestCase
test "should get show" do
get :show
assert_response :success
end
test "should get new" do
get :new
assert_response :success
end
test "should get create" do
get :creat... |
github | NJayDevelopment/mongoid_forums | https://github.com/NJayDevelopment/mongoid_forums | test/controllers/mongoid_forums/forums_controller_test.rb | Ruby | mit | 19 | master | 286 | require 'test_helper'
module MongoidForums
class ForumsControllerTest < ActionController::TestCase
test "should get index" do
get :index
assert_response :success
end
test "should get show" do
get :show
assert_response :success
end
end
end |
github | NJayDevelopment/mongoid_forums | https://github.com/NJayDevelopment/mongoid_forums | test/controllers/mongoid_forums/posts_controller_test.rb | Ruby | mit | 19 | master | 639 | require 'test_helper'
module MongoidForums
class PostsControllerTest < ActionController::TestCase
test "should get new" do
get :new
assert_response :success
end
test "should get create" do
get :create
assert_response :success
end
test "should get show" do
get :show... |
github | NJayDevelopment/mongoid_forums | https://github.com/NJayDevelopment/mongoid_forums | test/controllers/mongoid_forums/admin/categories_controller_test.rb | Ruby | mit | 19 | master | 565 | require 'test_helper'
module MongoidForums
class Admin::CategoriesControllerTest < ActionController::TestCase
test "should get new" do
get :new
assert_response :success
end
test "should get create" do
get :create
assert_response :success
end
test "should get edit" do
... |
github | NJayDevelopment/mongoid_forums | https://github.com/NJayDevelopment/mongoid_forums | test/controllers/mongoid_forums/admin/base_controller_test.rb | Ruby | mit | 19 | master | 205 | require 'test_helper'
module MongoidForums
class Admin::BaseControllerTest < ActionController::TestCase
test "should get index" do
get :index
assert_response :success
end
end
end |
github | NJayDevelopment/mongoid_forums | https://github.com/NJayDevelopment/mongoid_forums | test/controllers/mongoid_forums/admin/forums_controller_test.rb | Ruby | mit | 19 | master | 561 | require 'test_helper'
module MongoidForums
class Admin::ForumsControllerTest < ActionController::TestCase
test "should get new" do
get :new
assert_response :success
end
test "should get create" do
get :create
assert_response :success
end
test "should get edit" do
g... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.