def add_to_channel(env, blueprint_name, id, channel)
      raise "'env' must be a String or an Environment." \
        unless env.is_a?(String) || env.is_a?(Environments::Environment)
      raise "'blueprint_name' must be a String." unless blueprint_name.is_a?(String)
      raise "'id' must be a Fixnum." unless id.is_a?(Fixnum)
      raise "'channel' must be a String or Symbol." \
        unless channel.is_a?(String) || channel.is_a?(Symbol)

      if env.is_a?(String)
        env = environment(env)
      end

      raise "channel '#{channel}' does not exist in environment '#{env.name}'." \
        unless env.channels.key?(channel.to_s) || channel.to_sym == :latest

      credentials = Amigrind::Config.aws_credentials(env)

      amigrind_client = Amigrind::Core::Client.new(env.aws.region, credentials)
      ec2 = Aws::EC2::Client.new(region: env.aws.region, credentials: credentials)

      image = amigrind_client.get_image_by_id(name: blueprint_name, id: id)

      tag_key = Amigrind::Core::AMIGRIND_CHANNEL_TAG % { channel_name: channel }

      info_log "setting '#{tag_key}' on image #{image.id}..."
      ec2.create_tags(
        resources: [ image.id ],
        tags: [
          {
            key: tag_key,
            value: '1'
          }
        ]
      )
    end
def add_to_channel(env, blueprint_name, id, channel)
      raise "'env' must be a String or an Environment." \
        unless env.is_a?(String) || env.is_a?(Environments::Environment)
      raise "'blueprint_name' must be a String." unless blueprint_name.is_a?(String)
      raise "'id' must be a Fixnum." unless id.is_a?(Fixnum)
      raise "'channel' must be a String or Symbol." \
        unless channel.is_a?(String) || channel.is_a?(Symbol)

      if env.is_a?(String)
        env = environment(env)
      end

      raise "channel '#{channel}' does not exist in environment '#{env.name}'." \
        unless env.channels.key?(channel.to_s) || channel.to_sym == :latest

      credentials = Amigrind::Config.aws_credentials(env)

      amigrind_client = Amigrind::Core::Client.new(env.aws.region, credentials)
      ec2 = Aws::EC2::Client.new(region: env.aws.region, credentials: credentials)

      image = amigrind_client.get_image_by_id(name: blueprint_name, id: id)

      tag_key = Amigrind::Core::AMIGRIND_CHANNEL_TAG % { channel_name: channel }

      info_log "setting '#{tag_key}' on image #{image.id}..."
      ec2.create_tags(
        resources: [ image.id ],
        tags: [
          {
            key: tag_key,
            value: '1'
          }
        ]
      )
    end
TODO: refactor these client-y things.