class ZAWS::External::AWSCLI::Commands::EC2::CreateTags

Public Class Methods

new(shellout=nil, awscli=nil) click to toggle source
# File lib/zaws/external/awscli/commands/ec2/create_tags.rb, line 7
def initialize(shellout=nil, awscli=nil)
  @shellout=shellout
  @awscli=awscli
  clear_settings
  self
end

Public Instance Methods

aws() click to toggle source
# File lib/zaws/external/awscli/commands/ec2/create_tags.rb, line 14
def aws
  @aws ||= ZAWS::External::AWSCLI::Commands::AWS.new(self)
  @aws
end
clear_settings() click to toggle source
# File lib/zaws/external/awscli/commands/ec2/create_tags.rb, line 19
def clear_settings
  @resource=nil
  @tags=nil
  @aws=nil
end
execute(instanceid, region, tag_key, tag_value, textout=nil, verbose=nil) click to toggle source
# File lib/zaws/external/awscli/commands/ec2/create_tags.rb, line 42
def execute(instanceid, region, tag_key, tag_value, textout=nil, verbose=nil)
  comline="aws --output json --region #{region} ec2 create-tags --resources #{instanceid} --tags \"Key=#{tag_key},Value=#{tag_value}\""
  @shellout.cli(comline, verbose)
end
get_command() click to toggle source
# File lib/zaws/external/awscli/commands/ec2/create_tags.rb, line 35
def get_command
  command = "ec2 create-tags"
  command = "#{command} --resources #{@resource}" if @resource
  command = "#{command} --tags \"Key=#{@tags[0]['Key']},Value=#{@tags[0]['Value']}\" " if @tags
  return command
end
resource(resource) click to toggle source
# File lib/zaws/external/awscli/commands/ec2/create_tags.rb, line 25
def resource(resource)
  @resource=resource
  self
end
tags(tags) click to toggle source
# File lib/zaws/external/awscli/commands/ec2/create_tags.rb, line 30
def tags(tags)
  @tags=tags.get_tags_array
  self
end